mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 10:31:04 +00:00
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:
@@ -19,7 +19,7 @@ use super::{Config, OffenceDetails, Perbill, SessionIndex};
|
||||
use frame_support::{
|
||||
generate_storage_alias, pallet_prelude::ValueQuery, traits::Get, weights::Weight,
|
||||
};
|
||||
use sp_staking::offence::OnOffenceHandler;
|
||||
use sp_staking::offence::{DisableStrategy, OnOffenceHandler};
|
||||
use sp_std::vec::Vec;
|
||||
|
||||
/// Type of data stored as a deferred offence
|
||||
@@ -41,7 +41,12 @@ pub fn remove_deferred_storage<T: Config>() -> Weight {
|
||||
let deferred = <DeferredOffences<T>>::take();
|
||||
log::info!(target: "runtime::offences", "have {} deferred offences, applying.", deferred.len());
|
||||
for (offences, perbill, session) in deferred.iter() {
|
||||
let consumed = T::OnOffenceHandler::on_offence(&offences, &perbill, *session);
|
||||
let consumed = T::OnOffenceHandler::on_offence(
|
||||
&offences,
|
||||
&perbill,
|
||||
*session,
|
||||
DisableStrategy::WhenSlashed,
|
||||
);
|
||||
weight = weight.saturating_add(consumed);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user