forked from ghostchain/ghost-node
propagate disabled authorities to upcoming sessions in era
Signed-off-by: Uncle Stinky <uncle.stinky@ghostchain.io>
This commit is contained in:
parent
0e750c0261
commit
cc141105bb
@ -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
|
||||
|
||||
@ -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<Self>,
|
||||
ThrottlingOffence<IdentificationTuple<Self>>,
|
||||
>;
|
||||
type DisabledValidators: DisabledValidators;
|
||||
|
||||
#[pallet::constant]
|
||||
type MaxAuthorities: Get<u32>;
|
||||
@ -1104,7 +1105,15 @@ impl<T: Config> Pallet<T> {
|
||||
|
||||
Validators::<T>::insert(&session_index, bounded_validators);
|
||||
Authorities::<T>::set(&session_index, bounded_authorities);
|
||||
ClapsInSession::<T>::set(&session_index, Default::default());
|
||||
|
||||
let mut disabled_validators: BTreeMap<AuthIndex, SessionAuthorityInfo> = Default::default();
|
||||
for disabled_index in T::DisabledValidators::disabled_validators().iter() {
|
||||
let _ = disabled_validators.insert(*disabled_index, SessionAuthorityInfo {
|
||||
claps: 0u32,
|
||||
disabled: true,
|
||||
});
|
||||
}
|
||||
ClapsInSession::<T>::set(&session_index, disabled_validators);
|
||||
}
|
||||
|
||||
fn clear_history(target_session_index: &SessionIndex) {
|
||||
|
||||
@ -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>;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user