From f4ef8d85db309d25d1cfdb2c965aa28defba0136 Mon Sep 17 00:00:00 2001 From: yanganto Date: Wed, 8 Jan 2020 11:48:55 +0800 Subject: [PATCH] trival: rustfmt --- srml/staking/src/mock.rs | 8 ++++---- srml/staking/src/tests.rs | 19 ++++++------------- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/srml/staking/src/mock.rs b/srml/staking/src/mock.rs index d92efecbf..0245a5a39 100644 --- a/srml/staking/src/mock.rs +++ b/srml/staking/src/mock.rs @@ -480,14 +480,14 @@ pub fn start_era(era_index: EraIndex) { assert_eq!(Staking::current_era(), era_index); } - pub fn current_total_payout_for_duration(duration: u64) -> Balance { inflation::compute_total_payout::( - duration.saturated_into::(), + duration.saturated_into::(), (Timestamp::now() - ::GenesisTime::get()).saturated_into::(), (::Cap::get() - Ring::total_issuance()).saturated_into::(), - Perbill::from_percent(50) - ).0 + Perbill::from_percent(50), + ) + .0 } pub fn compute_power(ring_amount: u128, kton_amount: u128) -> Power { diff --git a/srml/staking/src/tests.rs b/srml/staking/src/tests.rs index fc42108a7..423d2b5cb 100644 --- a/srml/staking/src/tests.rs +++ b/srml/staking/src/tests.rs @@ -1502,7 +1502,7 @@ fn bond_extra_should_works() { active_kton: 0, deposit_items: vec![], ring_staking_lock: StakingLock { - staking_amount: 1000 + 100, + staking_amount: 1000 + 100, unbondings: vec![], }, kton_staking_lock: Default::default(), @@ -1533,7 +1533,7 @@ fn bond_extra_should_works() { active_kton: 0, deposit_items: vec![], ring_staking_lock: StakingLock { - staking_amount: 1000 + 100, + staking_amount: 1000 + 100, unbondings: vec![], }, kton_staking_lock: Default::default(), @@ -1548,7 +1548,6 @@ fn bond_extra_should_works() { others: vec![] } ); - }) } @@ -1589,7 +1588,6 @@ fn withdraw_unbonded_automatically_works() { },) ); - // Unbond almost all of the funds in stash. let until = >::now() + BondingDuration::get(); assert_eq!(until, 60); @@ -1605,10 +1603,7 @@ fn withdraw_unbonded_automatically_works() { deposit_items: vec![], ring_staking_lock: StakingLock { staking_amount: 100, - unbondings: vec![NormalLock { - amount: 900, - until: until, - }], + unbondings: vec![NormalLock { amount: 900, until }], }, kton_staking_lock: Default::default(), }) @@ -1620,7 +1615,6 @@ fn withdraw_unbonded_automatically_works() { "account liquidity restrictions prevent withdrawal", ); - Timestamp::set_timestamp(until); assert_err!( @@ -1631,7 +1625,6 @@ fn withdraw_unbonded_automatically_works() { assert_ok!(Ring::transfer(Origin::signed(11), 10, 900)); assert_eq!(Ring::free_balance(10), 900 + 1); assert_eq!(Ring::free_balance(11), 100); - }) } @@ -1708,7 +1701,7 @@ fn slot_stake_is_least_staked_validator_and_exposure_defines_maximum_punishment( deposit_items: vec![], ring_staking_lock: StakingLock { staking_amount: 69, - unbondings: vec![] + unbondings: vec![], }, kton_staking_lock: Default::default(), }, @@ -1732,7 +1725,7 @@ fn slot_stake_is_least_staked_validator_and_exposure_defines_maximum_punishment( // assert_eq!(_11_balance, compute_power(1000 + total_payout_0 / 2, 0) ); // -- slot stake should also be updated. - assert_eq!(Staking::slot_stake(), compute_power(69, 0)); + assert_eq!(Staking::slot_stake(), compute_power(69, 0)); check_exposure_all(); check_nominator_all(); @@ -2282,7 +2275,7 @@ fn offence_deselects_validator_when_slash_is_zero() { }); } -// Question: our slashing is performed according to the current balance, not the exposure, is this what we want? +// Question: our slashing is performed according to the current balance, not the exposure, is this what we want? #[test] fn slashing_performed_according_exposure() { // This test checks that slashing is performed according the exposure (or more precisely,