Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
simplified OCW tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gpestana committed Jul 17, 2023
1 parent bf03a72 commit 0d9d40d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
30 changes: 13 additions & 17 deletions frame/election-provider-multi-phase/test-staking-e2e/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,27 +105,23 @@ fn offchainify_works() {
roll_one(pool_state.clone(), false);
let current_phase = ElectionProviderMultiPhase::current_phase();

let result = match QueuedSolution::<Runtime>::get() {
Some(_solution) if !current_phase.is_unsigned() =>
Err("solution must be queued only in unsigned phase."),
None if current_phase.is_unsigned() =>
Err("solution must be queued during unsigned phase."),
_ => Ok(()),
};

assert_ok!(result);
assert!(
match QueuedSolution::<Runtime>::get() {
Some(_) => current_phase.is_unsigned(),
None => !current_phase.is_unsigned(),
},
"solution must be queued *only* in unsigned phase"
);
}

// test ocw solution queue if submission in unsigned phase is delayed.
for _ in 0..100 {
roll_one(pool_state.clone(), true);

let result = match QueuedSolution::<Runtime>::get() {
Some(_solution) =>
Err("solution must never be submitted since it has been delayed."),
_ => Ok(()),
};

assert_ok!(result);
assert_eq!(
QueuedSolution::<Runtime>::get(),
None,
"solution must never be submitted and stored since it is delayed"
);
}
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ parameter_types! {
pub static MinerMaxLength: u32 = 256;
pub static MinerMaxWeight: Weight = BlockWeights::get().max_block;
pub static TransactionPriority: transaction_validity::TransactionPriority = 1;
#[derive(Debug)]
pub static MaxWinners: u32 = 100;
pub static MaxVotesPerVoter: u32 = 16;
pub static MaxNominations: u32 = 16;
Expand Down

0 comments on commit 0d9d40d

Please sign in to comment.