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
2020-08-03 15:26:09 +02:00
committed by GitHub
parent dd6ef0a3a5
commit 1a84ad87c0
+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.
///