|
1 | 1 | use super::initializing::InitializingContractState; |
2 | 2 | use super::key_event::KeyEvent; |
3 | 3 | use super::resharing::ResharingContractState; |
4 | | -use crate::errors::{ConversionError, DomainError, Error, InvalidParameters, VoteError}; |
| 4 | +use crate::errors::{DomainError, Error, InvalidParameters, VoteError}; |
5 | 5 | use crate::primitives::{ |
6 | 6 | domain::{ |
7 | 7 | AddDomainsVotes, DomainRegistry, max_reconstruction_threshold, validate_domain_purpose, |
@@ -150,11 +150,8 @@ impl RunningContractState { |
150 | 150 |
|
151 | 151 | // Validate effective per-domain thresholds (updates override, absent |
152 | 152 | // 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"); |
158 | 155 | let threshold_updates = proposal.per_domain_thresholds(); |
159 | 156 | // Reject unknown domain IDs: the loop below iterates existing domains, so |
160 | 157 | // an unknown ID would otherwise be silently ignored here (it's caught at |
@@ -221,12 +218,8 @@ impl RunningContractState { |
221 | 218 | if domains.is_empty() { |
222 | 219 | return Err(DomainError::AddDomainsMustAddAtLeastOneDomain.into()); |
223 | 220 | } |
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"); |
230 | 223 | for domain in &domains { |
231 | 224 | validate_domain_purpose(domain)?; |
232 | 225 | validate_domain_threshold(domain, num_participants)?; |
|
0 commit comments