Skip to content

Commit

Permalink
Fix hardcoded threshold amount (#1048)
Browse files Browse the repository at this point in the history
* Fix hardcoded threshold amount

* fmt

* lint
  • Loading branch information
JesseAbram authored Sep 12, 2024
1 parent 766e9b9 commit 815c356
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions crates/client/src/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,14 @@ pub async fn get_signers_from_chain(
.await?
.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;
let key_info_query = entropy::storage().parameters().signers_info();
let threshold = query_chain(api, rpc, key_info_query, None)
.await?
.ok_or_else(|| SubgroupGetError::ChainFetch("Failed to get signers info"))?
.threshold;

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

let block_hash = rpc.chain_get_block_hash(None).await?;
let mut handles = Vec::new();
Expand Down

0 comments on commit 815c356

Please sign in to comment.