Skip to content

Commit

Permalink
check the dkg size against the threshold if we timeout waiting for Dk…
Browse files Browse the repository at this point in the history
…gPublicShares
  • Loading branch information
xoloki committed Dec 20, 2023
1 parent bd99ddd commit 352f13b
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions src/state_machine/coordinator/fire.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,24 @@ impl<Aggregator: AggregatorTrait> Coordinator<Aggregator> {
if let Some(start) = self.dkg_public_start {
if let Some(timeout) = self.config.dkg_public_timeout {
if now.duration_since(start) > timeout {
error!("Timeout gathering DkgPublicShares for dkg round {} signing round {} iteration {}, unable to continue", self.current_dkg_id, self.current_sign_id, self.current_sign_iter_id);
let wait = self.dkg_wait_signer_ids.iter().copied().collect();
return Ok((
None,
Some(OperationResult::DkgError(DkgError::DkgPublicTimeout(wait))),
));
// check dkg_threshold to determine if we can continue
let dkg_size = self

Check failure on line 73 in src/state_machine/coordinator/fire.rs

View workflow job for this annotation

GitHub Actions / clippy

iterating on a map's values
.dkg_public_shares
.iter()
.map(|(_id, shares)| shares.comms.len() as u32)
.sum();
if self.config.dkg_threshold > dkg_size {
error!("Timeout gathering DkgPublicShares for dkg round {} signing round {} iteration {}, dkg_threshold not met ({}/{}), unable to continue", self.current_dkg_id, self.current_sign_id, self.current_sign_iter_id, dkg_size, self.config.dkg_threshold);
let wait = self.dkg_wait_signer_ids.iter().copied().collect();
return Ok((
None,
Some(OperationResult::DkgError(DkgError::DkgPublicTimeout(
wait,
))),
));
} else {
// we hit the timeout but met the threshold, continue
}
}
}
}
Expand Down

0 comments on commit 352f13b

Please sign in to comment.