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
+2 -1
View File
@@ -36,7 +36,7 @@ use sp_runtime::{
Perbill,
};
use sp_staking::{
offence::{self, Kind, OffenceDetails},
offence::{self, DisableStrategy, Kind, OffenceDetails},
SessionIndex,
};
use std::cell::RefCell;
@@ -55,6 +55,7 @@ impl<Reporter, Offender> offence::OnOffenceHandler<Reporter, Offender, Weight>
_offenders: &[OffenceDetails<Reporter, Offender>],
slash_fraction: &[Perbill],
_offence_session: SessionIndex,
_disable_strategy: DisableStrategy,
) -> Weight {
ON_OFFENCE_PERBILL.with(|f| {
*f.borrow_mut() = slash_fraction.to_vec();