fix: prune cache entries of repeat proposals that are not imported - #10083
Conversation
Performance Report✔️ no performance regression detected Full benchmark results
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## unstable #10083 +/- ##
=========================================
Coverage 52.77% 52.77%
=========================================
Files 848 848
Lines 58970 58970
Branches 4345 4345
=========================================
Hits 31122 31122
Misses 27791 27791
Partials 57 57 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9f460ffae1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
| chain.seenBlockInputCache.remove(blockRootHex); | ||
| if (isForkPostGloas(fork)) { | ||
| chain.seenPayloadEnvelopeInputCache.prune(blockRootHex); |
There was a problem hiding this comment.
naming here is a bit confusing
seenBlockInputCache.pruneremoves the entry + all ancestorsseenPayloadEnvelopeInputCache.pruneremoves only the entry, same asseenBlockInputCache.remove
| // both caches, keeping them consistent. | ||
| chain.seenBlockInputCache.prune(blockRootHex); | ||
| // both caches, keeping them consistent. The block may carry any parent root, so only its own entry is removed | ||
| chain.seenBlockInputCache.remove(blockRootHex); |
There was a problem hiding this comment.
current code seems like a bug, we don't wanna drop the whole ancestry, anyone can send us an invalid block that can trigger this (unless I am missing something obvious why we did this)
Every block that reaches gossip validation seeds a block input, and on gloas a payload envelope input, before the checks run, and IGNORE keeps those entries until finalization or size pruning. Since #9805 only the first signature-verified repeat proposal of a proposer is imported, so any further one holds its full block in memory for nothing, and a proposer can send as many of those as it likes. This drops the entries of a repeat proposal that is not imported, sync re-downloads the block if a child or an attestation ever references it. The comment on the import gate now says what it actually is, the two-root cap in the seen cache is what bounds full imports over gossip to one alternate.
The dropped entry is removed with the block input cache's single-entry
removerather thanprune, which follows the parent root and evicts every cached ancestor. A repeat proposal past the second one never had its signature verified, so withpruneany peer could name a cached block as parent and evict it together with its downloaded data. The gossip REJECT path had the same walk for blocks that fail signature or proposer checks and is switched toremoveas well.The payload envelope input cache named its single-entry eviction
prunetoo, which reads as if it walked ancestors like the block input cache's. It is renamed toremove, with its metric reason label, andpruneBelowParentstays the ancestor variant.