Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inflation Test #183

Merged
merged 9 commits into from
Dec 30, 2019
Prev Previous commit
Next Next commit
update mock:current_total_payout_for_duration() payout_fraction to 50%
  • Loading branch information
readlnh committed Dec 27, 2019
commit cb20bdf7add57d7f9fbd7a8db45e91ffff5a06a7
1 change: 1 addition & 0 deletions srml/staking/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,7 @@ pub fn current_total_payout_for_duration(duration: u64) -> Balance {
duration.saturated_into::<Moment>(),
(Timestamp::now() - <mock::Test as Trait>::GenesisTime::get()).saturated_into::<Moment>(),
(<mock::Test as Trait>::Cap::get() - Ring::total_issuance()).saturated_into::<Balance>(),
Perbill::from_percent(50)
).0
}

Expand Down
12 changes: 6 additions & 6 deletions srml/staking/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4066,13 +4066,13 @@ fn test_payout() {
assert_ok!(Staking::set_payee(Origin::signed(10), RewardDestination::Controller));

let total_pay_out_now = current_total_payout_for_duration(180 * 1000);
assert_eq!(total_pay_out_now, 456240000000);
assert_eq!(total_pay_out_now, 456240000000 / 2);

// // for one year, Note: this test will take over 60s
// for i in 0..175320 {
// start_session(i);
// }
// assert_eq!(current_total_payout_for_duration(1000 * 3600 * 24 * 36525 / 100), 8 * 10_000_000 * COIN);
// for one year, Note: this test will take over 60s
for i in 0..175320 {
start_session(i);
}
assert_eq!(current_total_payout_for_duration(1000 * 3600 * 24 * 36525 / 100), 8 * 10_000_000 * COIN / 2);
});
}
// breakpoint test
Expand Down