Add some important events to batch & staking to ensure ease of analysis (#9462)

* Add some important events to batch & staking to ensure ease of analysis

* Update frame/staking/src/pallet/mod.rs

Co-authored-by: Zeke Mostov <32168567+emostov@users.noreply.github.com>

* Update lib.rs

* fix test

Co-authored-by: Zeke Mostov <32168567+emostov@users.noreply.github.com>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
Gavin Wood
2021-07-29 22:02:28 +02:00
committed by GitHub
parent 060d564fc3
commit 8a44bec2dc
7 changed files with 30 additions and 16 deletions
+5 -5
View File
@@ -257,7 +257,7 @@ fn rewards_should_work() {
);
assert_eq!(
*mock::staking_events().last().unwrap(),
Event::EraPayout(0, total_payout_0, maximum_payout - total_payout_0)
Event::EraPaid(0, total_payout_0, maximum_payout - total_payout_0)
);
mock::make_all_reward_payment(0);
@@ -295,7 +295,7 @@ fn rewards_should_work() {
);
assert_eq!(
*mock::staking_events().last().unwrap(),
Event::EraPayout(1, total_payout_1, maximum_payout - total_payout_1)
Event::EraPaid(1, total_payout_1, maximum_payout - total_payout_1)
);
mock::make_all_reward_payment(1);
@@ -3942,7 +3942,7 @@ mod election_data_provider {
run_to_block(20);
assert_eq!(Staking::next_election_prediction(System::block_number()), 45);
assert_eq!(staking_events().len(), 1);
assert_eq!(*staking_events().last().unwrap(), Event::StakingElection);
assert_eq!(*staking_events().last().unwrap(), Event::StakersElected);
for b in 21..45 {
run_to_block(b);
@@ -3953,7 +3953,7 @@ mod election_data_provider {
run_to_block(45);
assert_eq!(Staking::next_election_prediction(System::block_number()), 70);
assert_eq!(staking_events().len(), 3);
assert_eq!(*staking_events().last().unwrap(), Event::StakingElection);
assert_eq!(*staking_events().last().unwrap(), Event::StakersElected);
Staking::force_no_eras(Origin::root()).unwrap();
assert_eq!(Staking::next_election_prediction(System::block_number()), u64::MAX);
@@ -3976,7 +3976,7 @@ mod election_data_provider {
run_to_block(55);
assert_eq!(Staking::next_election_prediction(System::block_number()), 55 + 25);
assert_eq!(staking_events().len(), 6);
assert_eq!(*staking_events().last().unwrap(), Event::StakingElection);
assert_eq!(*staking_events().last().unwrap(), Event::StakersElected);
// The new era has been planned, forcing is changed from `ForceNew` to `NotForcing`.
assert_eq!(ForceEra::<Test>::get(), Forcing::NotForcing);
})