Skip to content

Commit e72e801

Browse files
expect
1 parent ceff551 commit e72e801

1 file changed

Lines changed: 5 additions & 12 deletions

File tree

crates/contract/src/state/running.rs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use super::initializing::InitializingContractState;
22
use super::key_event::KeyEvent;
33
use super::resharing::ResharingContractState;
4-
use crate::errors::{ConversionError, DomainError, Error, InvalidParameters, VoteError};
4+
use crate::errors::{DomainError, Error, InvalidParameters, VoteError};
55
use crate::primitives::{
66
domain::{
77
AddDomainsVotes, DomainRegistry, max_reconstruction_threshold, validate_domain_purpose,
@@ -150,11 +150,8 @@ impl RunningContractState {
150150

151151
// Validate effective per-domain thresholds (updates override, absent
152152
// domains keep theirs) against the proposed participant count.
153-
let new_num_participants = u64::try_from(proposal.participants().len()).map_err(|e| {
154-
ConversionError::DataConversion {
155-
reason: format!("participant count does not fit in u64: {e}"),
156-
}
157-
})?;
153+
let new_num_participants = u64::try_from(proposal.participants().len())
154+
.expect("participant count fits in u64");
158155
let threshold_updates = proposal.per_domain_thresholds();
159156
// Reject unknown domain IDs: the loop below iterates existing domains, so
160157
// an unknown ID would otherwise be silently ignored here (it's caught at
@@ -221,12 +218,8 @@ impl RunningContractState {
221218
if domains.is_empty() {
222219
return Err(DomainError::AddDomainsMustAddAtLeastOneDomain.into());
223220
}
224-
let num_participants =
225-
u64::try_from(self.parameters.participants().len()).map_err(|e| {
226-
ConversionError::DataConversion {
227-
reason: format!("participant count does not fit in u64: {e}"),
228-
}
229-
})?;
221+
let num_participants = u64::try_from(self.parameters.participants().len())
222+
.expect("participant count fits in u64");
230223
for domain in &domains {
231224
validate_domain_purpose(domain)?;
232225
validate_domain_threshold(domain, num_participants)?;

0 commit comments

Comments
 (0)