Skip to content

Commit

Permalink
Inclusion pruning tweaks (#1550)
Browse files Browse the repository at this point in the history
In follow-up to #1518

Adding extra tests for inclusion pruning. Primarily focusing on various
cases surrounding candidates included in different forks (with different
relay parents).

All cases fall into a few buckets based on 3 degrees of freedom - number
of candidates, number of blocks (height), number of forks + extra case
for pruning multiple heights at once.

Added small tweak to the original pruning function to disregard stale
candidate duplicates which should keep the same behaviour.

---------

Co-authored-by: Tsvetomir Dimitrov <tsvetomir@parity.io>
  • Loading branch information
Overkillus and tdimitrov committed Sep 14, 2023
1 parent 49c4b20 commit 756347a
Show file tree
Hide file tree
Showing 2 changed files with 384 additions and 63 deletions.
8 changes: 3 additions & 5 deletions polkadot/node/core/dispute-coordinator/src/scraping/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,11 @@ impl Inclusions {
self.candidates_by_block_number = not_stale;

for candidate in stale.into_values().flatten() {
debug_assert!(self.inclusions_inner.get(&candidate).is_some());
match self.inclusions_inner.entry(candidate) {
Entry::Vacant(_) => {
gum::debug!(
target: LOG_TARGET,
"Inconsistency in `Inclusions` detected on pruning!"
);
// Rare case where same candidate was present on multiple heights, but all are
// pruned at the same time. This candidate was already pruned in the previous
// occurence so it is skipped now.
},
Entry::Occupied(mut e) => {
let mut blocks_including = std::mem::take(e.get_mut());
Expand Down
Loading

0 comments on commit 756347a

Please sign in to comment.