mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 19:21:13 +00:00
Issue 6274: keeping all backing votes in provisioner vote set (#6494)
* Fixing filter to keep all backing votes * Comment and implementers guide edit * Formatting * Using fallthrough * Fmt
This commit is contained in:
@@ -28,7 +28,7 @@ use polkadot_node_subsystem::{
|
||||
};
|
||||
use polkadot_primitives::v2::{
|
||||
supermajority_threshold, CandidateHash, DisputeState, DisputeStatement, DisputeStatementSet,
|
||||
Hash, MultiDisputeStatementSet, SessionIndex, ValidatorIndex,
|
||||
Hash, MultiDisputeStatementSet, SessionIndex, ValidDisputeStatementKind, ValidatorIndex,
|
||||
};
|
||||
use std::{
|
||||
collections::{BTreeMap, HashMap},
|
||||
@@ -364,10 +364,20 @@ fn is_vote_worth_to_keep(
|
||||
dispute_statement: DisputeStatement,
|
||||
onchain_state: &DisputeState,
|
||||
) -> bool {
|
||||
let offchain_vote = match dispute_statement {
|
||||
DisputeStatement::Valid(_) => true,
|
||||
DisputeStatement::Invalid(_) => false,
|
||||
let (offchain_vote, valid_kind) = match dispute_statement {
|
||||
DisputeStatement::Valid(kind) => (true, Some(kind)),
|
||||
DisputeStatement::Invalid(_) => (false, None),
|
||||
};
|
||||
// We want to keep all backing votes. This maximizes the number of backers
|
||||
// punished when misbehaving.
|
||||
if let Some(kind) = valid_kind {
|
||||
match kind {
|
||||
ValidDisputeStatementKind::BackingValid(_) |
|
||||
ValidDisputeStatementKind::BackingSeconded(_) => return true,
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
|
||||
let in_validators_for = onchain_state
|
||||
.validators_for
|
||||
.get(validator_index.0 as usize)
|
||||
|
||||
@@ -73,7 +73,7 @@ The end result of this process is a vector of `BackedCandidate`s, sorted in orde
|
||||
|
||||
This is the point at which the block author provides further votes to active disputes or initiates new disputes in the runtime state.
|
||||
|
||||
The block-authoring logic of the runtime has an extra step between handling the inherent-data and producing the actual inherent call, which we assume performs the work of filtering out disputes which are not relevant to the on-chain state.
|
||||
The block-authoring logic of the runtime has an extra step between handling the inherent-data and producing the actual inherent call, which we assume performs the work of filtering out disputes which are not relevant to the on-chain state. Backing votes are always kept in the dispute statement set. This ensures we punish the maximum number of misbehaving backers.
|
||||
|
||||
To select disputes:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user