From cc141105bb8182cc84afd63d3aca815fa4db293e Mon Sep 17 00:00:00 2001 From: Uncle Stinky Date: Sat, 8 Nov 2025 13:38:15 +0300 Subject: [PATCH] propagate disabled authorities to upcoming sessions in era Signed-off-by: Uncle Stinky --- pallets/slow-clap/Cargo.toml | 2 +- pallets/slow-clap/src/lib.rs | 13 +++++++++++-- pallets/slow-clap/src/mock.rs | 1 + 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/pallets/slow-clap/Cargo.toml b/pallets/slow-clap/Cargo.toml index 0bb443e..446e1e9 100644 --- a/pallets/slow-clap/Cargo.toml +++ b/pallets/slow-clap/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ghost-slow-clap" -version = "0.3.47" +version = "0.3.48" description = "Applause protocol for the EVM bridge" license.workspace = true authors.workspace = true diff --git a/pallets/slow-clap/src/lib.rs b/pallets/slow-clap/src/lib.rs index 71cb56d..678e70a 100644 --- a/pallets/slow-clap/src/lib.rs +++ b/pallets/slow-clap/src/lib.rs @@ -10,7 +10,7 @@ use frame_support::{ traits::{ tokens::fungible::{Inspect, Mutate}, EstimateNextSessionRotation, Get, OneSessionHandler, ValidatorSet, - ValidatorSetWithIdentification, + ValidatorSetWithIdentification, DisabledValidators, }, WeakBoundedVec, }; @@ -199,6 +199,7 @@ pub mod pallet { IdentificationTuple, ThrottlingOffence>, >; + type DisabledValidators: DisabledValidators; #[pallet::constant] type MaxAuthorities: Get; @@ -1104,7 +1105,15 @@ impl Pallet { Validators::::insert(&session_index, bounded_validators); Authorities::::set(&session_index, bounded_authorities); - ClapsInSession::::set(&session_index, Default::default()); + + let mut disabled_validators: BTreeMap = Default::default(); + for disabled_index in T::DisabledValidators::disabled_validators().iter() { + let _ = disabled_validators.insert(*disabled_index, SessionAuthorityInfo { + claps: 0u32, + disabled: true, + }); + } + ClapsInSession::::set(&session_index, disabled_validators); } fn clear_history(target_session_index: &SessionIndex) { diff --git a/pallets/slow-clap/src/mock.rs b/pallets/slow-clap/src/mock.rs index 706b4dd..0df7757 100644 --- a/pallets/slow-clap/src/mock.rs +++ b/pallets/slow-clap/src/mock.rs @@ -206,6 +206,7 @@ impl Config for Runtime { type NetworkDataHandler = Networks; type BlockNumberProvider = System; type ReportUnresponsiveness = OffenceHandler; + type DisabledValidators = Session; type MaxAuthorities = ConstU32<5>; type ApplauseThreshold = ConstU32<50>;