mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 05:51:02 +00:00
Filter votes from disabled validators in BackedCandidates in process_inherent_data (#2889)
Backport of https://github.com/paritytech/polkadot-sdk/pull/1863 to master Extend candidate sanitation in paras_inherent by removing backing votes from disabled validators. Check https://github.com/paritytech/polkadot-sdk/issues/1592 for more details. This change is related to the disabling strategy implementation (https://github.com/paritytech/polkadot-sdk/pull/2226). --------- Co-authored-by: ordian <noreply@reusable.software> Co-authored-by: ordian <write@reusable.software> Co-authored-by: Maciej <maciej.zyszkiewicz@parity.io>
This commit is contained in:
committed by
GitHub
parent
f574868822
commit
f8954093b4
@@ -96,6 +96,10 @@ impl DisabledValidators for MockDisabledValidators {
|
||||
fn is_disabled(index: AuthorityIndex) -> bool {
|
||||
DisabledValidatorTestValue::get().binary_search(&index).is_ok()
|
||||
}
|
||||
|
||||
fn disabled_validators() -> Vec<u32> {
|
||||
DisabledValidatorTestValue::get()
|
||||
}
|
||||
}
|
||||
|
||||
impl pallet_aura::Config for Test {
|
||||
|
||||
@@ -99,7 +99,9 @@ impl pallet_balances::Config for Runtime {
|
||||
type RuntimeFreezeReason = RuntimeFreezeReason;
|
||||
}
|
||||
|
||||
impl shared::Config for Runtime {}
|
||||
impl shared::Config for Runtime {
|
||||
type DisabledValidators = ();
|
||||
}
|
||||
|
||||
impl configuration::Config for Runtime {
|
||||
type WeightInfo = configuration::TestWeightInfo;
|
||||
|
||||
@@ -918,6 +918,10 @@ impl<T: Config> frame_support::traits::DisabledValidators for Pallet<T> {
|
||||
fn is_disabled(index: u32) -> bool {
|
||||
<Pallet<T>>::disabled_validators().binary_search(&index).is_ok()
|
||||
}
|
||||
|
||||
fn disabled_validators() -> Vec<u32> {
|
||||
<Pallet<T>>::disabled_validators()
|
||||
}
|
||||
}
|
||||
|
||||
/// Wraps the author-scraping logic for consensus engines that can recover
|
||||
|
||||
@@ -251,10 +251,17 @@ pub trait ValidatorRegistration<ValidatorId> {
|
||||
pub trait DisabledValidators {
|
||||
/// Returns true if the given validator is disabled.
|
||||
fn is_disabled(index: u32) -> bool;
|
||||
|
||||
/// Returns all disabled validators
|
||||
fn disabled_validators() -> Vec<u32>;
|
||||
}
|
||||
|
||||
impl DisabledValidators for () {
|
||||
fn is_disabled(_index: u32) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn disabled_validators() -> Vec<u32> {
|
||||
vec![]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user