Skip to content

Commit 70fca02

Browse files
stronger typing
1 parent 63d1658 commit 70fca02

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

crates/contract/src/state/running.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,9 @@ pub mod running_tests {
271271
use crate::primitives::domain::AddDomainsVotes;
272272
use crate::primitives::test_utils::{NUM_PROTOCOLS, gen_proposed_threshold_params};
273273
use crate::primitives::threshold_votes::GovernanceThresholdParametersVotes;
274-
use crate::primitives::thresholds::ProposedGovernanceThresholdParameters;
274+
use crate::primitives::thresholds::{
275+
GovernanceThreshold, ProposedGovernanceThresholdParameters,
276+
};
275277
use crate::state::key_event::tests::Environment;
276278
use crate::state::test_utils::{
277279
gen_running_state, gen_running_state_with_params, gen_valid_params_proposal,
@@ -290,7 +292,7 @@ pub mod running_tests {
290292
fn setup_with_params(
291293
num_domains: usize,
292294
num_participants: usize,
293-
governance_threshold: u64,
295+
governance_threshold: impl Into<GovernanceThreshold>,
294296
) -> (RunningContractState, Environment) {
295297
with_first_participant_signer(gen_running_state_with_params(
296298
num_domains,

crates/contract/src/state/test_utils.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ pub fn gen_running_state(num_domains: usize) -> RunningContractState {
9999
gen_running_state_with_params(
100100
num_domains,
101101
parameters.participants().len(),
102-
parameters.threshold().value(),
102+
parameters.threshold(),
103103
)
104104
}
105105

@@ -108,11 +108,11 @@ pub fn gen_running_state(num_domains: usize) -> RunningContractState {
108108
pub fn gen_running_state_with_params(
109109
num_domains: usize,
110110
num_participants: usize,
111-
governance_threshold: u64,
111+
governance_threshold: impl Into<GovernanceThreshold>,
112112
) -> RunningContractState {
113113
let threshold_parameters = GovernanceThresholdParameters::new(
114114
gen_participants(num_participants),
115-
GovernanceThreshold::new(governance_threshold),
115+
governance_threshold.into(),
116116
)
117117
.expect("valid threshold parameters");
118118

0 commit comments

Comments
 (0)