Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Add integrity test for slash defer duration (#6782)
Browse files Browse the repository at this point in the history
* Add integrity test for slash defer duration

* Wrap in externalities

* Update frame/staking/src/lib.rs
  • Loading branch information
kianenigma authored Aug 3, 2020
1 parent 2bd4f45 commit 2afbcf7
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions frame/staking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1459,6 +1459,17 @@ decl_module! {
// `on_finalize` weight is tracked in `on_initialize`
}

fn integrity_test() {
sp_io::TestExternalities::new_empty().execute_with(||
assert!(
T::SlashDeferDuration::get() < T::BondingDuration::get() || T::BondingDuration::get() == 0,
"As per documentation, slash defer duration ({}) should be less than bonding duration ({}).",
T::SlashDeferDuration::get(),
T::BondingDuration::get(),
)
);
}

/// Take the origin account as a stash and lock up `value` of its balance. `controller` will
/// be the account that controls it.
///
Expand Down

0 comments on commit 2afbcf7

Please sign in to comment.