mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 05:51:02 +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:
@@ -302,6 +302,13 @@ impl<T: Config> Pallet<T> {
|
||||
Self::start_era(start_session);
|
||||
}
|
||||
}
|
||||
|
||||
// disable all offending validators that have been disabled for the whole era
|
||||
for (index, disabled) in <OffendingValidators<T>>::get() {
|
||||
if disabled {
|
||||
T::SessionInterface::disable_validator(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// End a session potentially ending an era.
|
||||
@@ -374,6 +381,9 @@ impl<T: Config> Pallet<T> {
|
||||
// Set ending era reward.
|
||||
<ErasValidatorReward<T>>::insert(&active_era.index, validator_payout);
|
||||
T::RewardRemainder::on_unbalanced(T::Currency::issue(rest));
|
||||
|
||||
// Clear offending validators.
|
||||
<OffendingValidators<T>>::kill();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user