Skip to content

Commit ceff551

Browse files
using expect
1 parent 6c2a728 commit ceff551

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

crates/contract/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1674,7 +1674,7 @@ impl MpcContract {
16741674
let max_reconstruction_threshold =
16751675
max_reconstruction_threshold(running_state.domains.domains());
16761676
if let Err(err) = ThresholdParameters::validate_governance_against_reconstruction(
1677-
remaining as u64,
1677+
u64::try_from(remaining).expect("participant count fits in u64"),
16781678
current_params.threshold(),
16791679
max_reconstruction_threshold,
16801680
) {
@@ -1695,7 +1695,8 @@ impl MpcContract {
16951695
//let n_participants_new = new_participants.len();
16961696
//let new_threshold = (3 * n_participants_new + 4) / 5; // minimum 60%
16971697
//let new_threshold = new_threshold.max(2); // but also minimum 2
1698-
let new_threshold = current_params.threshold().value() as usize;
1698+
let new_threshold = usize::try_from(current_params.threshold().value())
1699+
.expect("threshold value fits in usize");
16991700

17001701
let threshold_parameters = ThresholdParameters::new(
17011702
participants_with_valid_attestation,

0 commit comments

Comments
 (0)