mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-30 13:07:56 +00:00
Pass max-total to RewardRemainder on end_era (#5697)
* Pass max-total to RewardRemainder on end_era * add test and event * add doc Co-authored-by: thiolliere <gui.thiolliere@gmail.com>
This commit is contained in:
@@ -152,6 +152,7 @@ fn rewards_should_work() {
|
||||
// should check that:
|
||||
// * rewards get recorded per session
|
||||
// * rewards get paid per Era
|
||||
// * `RewardRemainder::on_unbalanced` is called
|
||||
// * Check that nominators are also rewarded
|
||||
ExtBuilder::default().nominate(true).build_and_execute(|| {
|
||||
let init_balance_10 = Balances::total_balance(&10);
|
||||
@@ -197,6 +198,8 @@ fn rewards_should_work() {
|
||||
start_session(3);
|
||||
|
||||
assert_eq!(Staking::active_era().unwrap().index, 1);
|
||||
assert_eq!(mock::REWARD_REMAINDER_UNBALANCED.with(|v| *v.borrow()), 7050);
|
||||
assert_eq!(*mock::staking_events().last().unwrap(), RawEvent::EraPayout(0, 2350, 7050));
|
||||
mock::make_all_reward_payment(0);
|
||||
|
||||
assert_eq_error_rate!(Balances::total_balance(&10), init_balance_10 + part_for_10 * total_payout_0*2/3, 2);
|
||||
@@ -220,6 +223,8 @@ fn rewards_should_work() {
|
||||
assert!(total_payout_1 > 10); // Test is meaningful if reward something
|
||||
|
||||
mock::start_era(2);
|
||||
assert_eq!(mock::REWARD_REMAINDER_UNBALANCED.with(|v| *v.borrow()), 7050*2);
|
||||
assert_eq!(*mock::staking_events().last().unwrap(), RawEvent::EraPayout(1, 2350, 7050));
|
||||
mock::make_all_reward_payment(1);
|
||||
|
||||
assert_eq_error_rate!(Balances::total_balance(&10), init_balance_10 + part_for_10 * (total_payout_0 * 2/3 + total_payout_1), 2);
|
||||
|
||||
Reference in New Issue
Block a user