Add integrity test for slash defer duration (#6782)

* Add integrity test for slash defer duration

* Wrap in externalities

* Update frame/staking/src/lib.rs
This commit is contained in:
Kian Paimani authored and GitHub committed 2020-08-03 13:26:09 +00:00
1 parent dd6ef0a3a5
commit 1a84ad87c0
1 file changed
+11
+11
View File
@@ -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.
///