diff --git a/crates/client/src/user.rs b/crates/client/src/user.rs index 679bfc2b3..457fd7899 100644 --- a/crates/client/src/user.rs +++ b/crates/client/src/user.rs @@ -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);