-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Dispute vote filtering for block authors #3498
Conversation
Co-authored-by: Andronik Ordian <write@reusable.software>
…ytech/polkadot into rh-filter-runtime-disputes
indices.sort(); | ||
indices.dedup(); | ||
|
||
// reverse order ensures correctness | ||
for index in indices.into_iter().rev() { | ||
// swap_remove guarantees linear complexity. | ||
statement_set.statements.swap_remove(index); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very elegant 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
credit to @ordian
runtime/parachains/src/disputes.rs
Outdated
let valid = match statement { | ||
DisputeStatement::Valid(_) => true, | ||
DisputeStatement::Invalid(_) => false, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: adding a fn is_...(&self) -> bool
would reduce the clutter a bit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very much appreciate the effort put into documenting the rationale of innocent looking code 👍
bot merge |
Waiting for commit status. |
Merge aborted: Checks failed for a4762ea |
(feel free to edit the audit label) bot merge |
* master: Reduce staking miner reward (companion `substrate/pull/9395`) (#3465) Parachains shared.rs to Frame V2 (#3425) Parachains hrmp.rs to Frame V2 (#3475) Migrate slots pallet to pallet attribute macro. (#3218) Improve test in bridge (#3507) parachain dmp.rs to Frame V2 (#3426) Parachains inclusion.rs to Frame V2 (#3440) Dispute coordinator - Recover disputes on startup (#3481) Use correct syntax for owning all files in a folder (#3510) Add wococo-local chain spec (#3509) Dispute vote filtering for block authors (#3498) Bump indexmap from 1.6.1 to 1.7.0 (#3497) Companion for substrate #9315 (#3477)
Closes #3472
When the node-side is authoring a block, it passes all votes from all disputes from recent sessions to an instance of the runtime as
InherentData
. TheProvideInherent
implementation for theParasInherent
here invokes the filtering function, which is intended to detect duplicates and spam and so on.This pull request actually provides the implementation of that filtering logic, to be used to create
ParasInherent
inherents that actually contain dispute votes so the chain can witness disputes.