Skip to content

Commit

Permalink
EPM and staking events improvement (paritytech#13035)
Browse files Browse the repository at this point in the history
* EPM and staking events improvement

* Uses RawOrigin in ElectionCompute event

* Refactors new phase events to PhaseTransition event

* PhaseTransitioned and remove RawOrigin from event

* Adds helpers for epm phase transition and staking force new

* addresses review comments

* nit: removes unecessary clone

* fixes benchmarks

Co-authored-by: parity-processbot <>
  • Loading branch information
gpestana authored and ltfschoen committed Feb 22, 2023
1 parent c697b8f commit baa04d8
Show file tree
Hide file tree
Showing 7 changed files with 369 additions and 124 deletions.
7 changes: 4 additions & 3 deletions frame/election-provider-multi-phase/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ frame_benchmarking::benchmarks! {
assert!(<MultiPhase<T>>::snapshot().is_none());
assert!(<MultiPhase<T>>::current_phase().is_off());
}: {
<MultiPhase<T>>::on_initialize_open_signed();
<MultiPhase<T>>::phase_transition(Phase::Signed);
} verify {
assert!(<MultiPhase<T>>::snapshot().is_none());
assert!(<MultiPhase<T>>::current_phase().is_signed());
Expand All @@ -210,7 +210,8 @@ frame_benchmarking::benchmarks! {
assert!(<MultiPhase<T>>::snapshot().is_none());
assert!(<MultiPhase<T>>::current_phase().is_off());
}: {
<MultiPhase<T>>::on_initialize_open_unsigned(true, 1u32.into())
let now = frame_system::Pallet::<T>::block_number();
<MultiPhase<T>>::phase_transition(Phase::Unsigned((true, now)));
} verify {
assert!(<MultiPhase<T>>::snapshot().is_none());
assert!(<MultiPhase<T>>::current_phase().is_unsigned());
Expand Down Expand Up @@ -318,7 +319,7 @@ frame_benchmarking::benchmarks! {
submit {
// the queue is full and the solution is only better than the worse.
<MultiPhase<T>>::create_snapshot().map_err(<&str>::from)?;
MultiPhase::<T>::on_initialize_open_signed();
<MultiPhase<T>>::phase_transition(Phase::Signed);
<Round<T>>::put(1);

let mut signed_submissions = SignedSubmissions::<T>::get();
Expand Down
Loading

0 comments on commit baa04d8

Please sign in to comment.