mirror of
https://git.ghostchain.io/proxmio/ghost-node.git
synced 2025-12-27 11:19:57 +00:00
auto nullification during finalization and appropriate tests
Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
This commit is contained in:
@@ -798,7 +798,6 @@ fn bridged_inlation_reward_works() {
|
||||
let total_staked_not_ideal: u128 = 68;
|
||||
let total_issuance: u128 = 100;
|
||||
|
||||
|
||||
assert_eq!(BridgedInflationCurve::<RewardCurve, Test>::era_payout(
|
||||
total_staked_ideal * 1_000,
|
||||
total_issuance * 1_000,
|
||||
@@ -913,3 +912,26 @@ fn bridged_inlation_reward_works() {
|
||||
1, total_issuance * 1_000_000_000_000_000_000_000_000 + amount, 0), (0, 0));
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bridged_inflation_era_payout_triggers_need_of_nullification() {
|
||||
ExtBuilder::build()
|
||||
.execute_with(|| {
|
||||
let chain_id: u32 = 1;
|
||||
let amount: u128 = 1337 * 1_000_000_000;
|
||||
let commission: u128 = amount / 100; // 1% commission
|
||||
let total_staked_ideal: u128 = 69;
|
||||
let total_issuance: u128 = 100;
|
||||
|
||||
assert_ok!(GhostNetworks::accumulate_commission(&commission));
|
||||
assert_ok!(GhostNetworks::increase_gatekeeper_amount(&chain_id, &amount));
|
||||
assert_eq!(NullifyNeeded::<Test>::get(), false);
|
||||
assert_eq!(BridgedInflationCurve::<RewardCurve, Test>::era_payout(
|
||||
total_staked_ideal * 1_000,
|
||||
total_issuance * 1_000 + amount,
|
||||
0), (commission, 0));
|
||||
assert_eq!(NullifyNeeded::<Test>::get(), true);
|
||||
GhostNetworks::on_finalize(69);
|
||||
assert_eq!(NullifyNeeded::<Test>::get(), false);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user