Skip to content

Commit

Permalink
Sort signers from Staking Extension pallet when signing
Browse files Browse the repository at this point in the history
  • Loading branch information
HCastano committed Aug 14, 2024
1 parent 5a7757b commit bac4ea8
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions crates/client/src/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,18 @@ pub async fn get_signers_from_chain(
.ok_or_else(|| SubgroupGetError::ChainFetch("Get all validators error"))?
} else {
let all_validators_query = entropy::storage().session().validators();
let mut validators = query_chain(api, rpc, all_validators_query, None)
query_chain(api, rpc, all_validators_query, None)
.await?
.ok_or_else(|| SubgroupGetError::ChainFetch("Get all validators error"))?;

validators.sort();
validators
.ok_or_else(|| SubgroupGetError::ChainFetch("Get all validators error"))?
};

// TODO #898 For now we use a fix proportion of the number of validators as the threshold
let threshold = (validators.len() as f32 * 0.75) as usize;

// We sort the validators here to ensure that we have a consistent ordering that external
// clients (e.g the Entropy JS SDK) can rely on.
validators.sort();

// TODO #899 For now we just take the first t validators as the ones to perform signing
validators.truncate(threshold);

Expand Down

0 comments on commit bac4ea8

Please sign in to comment.