Offence implementations can disable offenders independently from slashing (#10201)

* Offence implementations can disable offenders independently from slashing

* Fix build on CI

* Run cargo fmt

* Fixes based on review comments

* Make parameter naming consistent

* Fix migration and some English

* Fix migration - again

* cargo fmt

* Cover 2 new cases with a test
This commit is contained in:
wigy
2021-11-17 15:11:02 +01:00
committed by GitHub
parent 186efbc2a5
commit 3f0f1aa6f7
8 changed files with 129 additions and 46 deletions
+3 -1
View File
@@ -36,7 +36,7 @@ use sp_runtime::{
Perbill,
};
use sp_staking::{
offence::{OffenceDetails, OnOffenceHandler},
offence::{DisableStrategy, OffenceDetails, OnOffenceHandler},
SessionIndex,
};
use sp_std::{collections::btree_map::BTreeMap, prelude::*};
@@ -1137,6 +1137,7 @@ where
>],
slash_fraction: &[Perbill],
slash_session: SessionIndex,
disable_strategy: DisableStrategy,
) -> Weight {
let reward_proportion = SlashRewardFraction::<T>::get();
let mut consumed_weight: Weight = 0;
@@ -1206,6 +1207,7 @@ where
window_start,
now: active_era,
reward_proportion,
disable_strategy,
});
if let Some(mut unapplied) = unapplied {