mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-11 22:21:07 +00:00
staking: only disable slashed validators and keep them disabled for whole era (#9448)
* session: remove disabled validators threshold logic * staking: add logic to track offending validators * staking: disable validators for the whole era * frame: fix tests * staking: add tests for disabling validators handling * staking: fix adding offending validator when already slashed in era * address review comments * session, staking: add comments about sorted vecs Co-authored-by: Andronik Ordian <write@reusable.software>
This commit is contained in:
@@ -926,8 +926,8 @@ impl<T: Config> OneSessionHandler<T::AccountId> for Pallet<T> {
|
||||
Self::enact_epoch_change(bounded_authorities, next_bounded_authorities)
|
||||
}
|
||||
|
||||
fn on_disabled(i: usize) {
|
||||
Self::deposit_consensus(ConsensusLog::OnDisabled(i as u32))
|
||||
fn on_disabled(i: u32) {
|
||||
Self::deposit_consensus(ConsensusLog::OnDisabled(i))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,6 @@ frame_support::construct_runtime!(
|
||||
|
||||
parameter_types! {
|
||||
pub const BlockHashCount: u64 = 250;
|
||||
pub const DisabledValidatorsThreshold: Perbill = Perbill::from_percent(16);
|
||||
pub BlockWeights: frame_system::limits::BlockWeights =
|
||||
frame_system::limits::BlockWeights::simple_max(1024);
|
||||
}
|
||||
@@ -122,7 +121,6 @@ impl pallet_session::Config for Test {
|
||||
type SessionManager = pallet_session::historical::NoteHistoricalRoot<Self, Staking>;
|
||||
type SessionHandler = <MockSessionKeys as OpaqueKeys>::KeyTypeIdProviders;
|
||||
type Keys = MockSessionKeys;
|
||||
type DisabledValidatorsThreshold = DisabledValidatorsThreshold;
|
||||
type WeightInfo = ();
|
||||
}
|
||||
|
||||
@@ -189,6 +187,7 @@ parameter_types! {
|
||||
pub const MaxNominatorRewardedPerValidator: u32 = 64;
|
||||
pub const ElectionLookahead: u64 = 0;
|
||||
pub const StakingUnsignedPriority: u64 = u64::MAX / 2;
|
||||
pub const OffendingValidatorsThreshold: Perbill = Perbill::from_percent(16);
|
||||
}
|
||||
|
||||
impl onchain::Config for Test {
|
||||
@@ -212,6 +211,7 @@ impl pallet_staking::Config for Test {
|
||||
type UnixTime = pallet_timestamp::Pallet<Test>;
|
||||
type EraPayout = pallet_staking::ConvertCurve<RewardCurve>;
|
||||
type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator;
|
||||
type OffendingValidatorsThreshold = OffendingValidatorsThreshold;
|
||||
type NextNewSession = Session;
|
||||
type ElectionProvider = onchain::OnChainSequentialPhragmen<Self>;
|
||||
type GenesisElectionProvider = Self::ElectionProvider;
|
||||
|
||||
Reference in New Issue
Block a user