Repository navigation
Conversation
Headers were validated only when a finished segment was stored, so a fork was detected and followed on headers nobody had checked. Validate every batch once in `handle_headers_pipeline`, against the stored block or the segment tip it extends, and ban the peer that sent an invalid one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Waiting for bot review — coderabbitai not yet. Wait for the missing reviews, or a writer can post |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 37 minutes. View limit details
Walkthrough
Merge Risk:
|
|
Bots are done — your move: post |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #1304 +/- ##
==========================================
+ Coverage 82.08% 82.15% +0.07%
==========================================
Files 290 290
Lines 76201 76310 +109
==========================================
+ Hits 62550 62694 +144
+ Misses 13651 13616 -35
|
|
Waiting for bot review — coderabbitai not yet. Wait for the missing reviews, or a writer can post |
Problem
Block headers were validated only when a finished segment was stored. A batch that did not match a segment reached
fork_heightunchecked, so a single header that did not even meet its ownbitscould make the client truncate everything above a stored block.Changes
handle_headers_pipelinevalidates every batch once, before routing it: continuity, PoW and DGW difficulty. An invalid batch bans its peer and returns the error.HeadersPipeline::segment_ancestors). Segments that are not stored yet keep their whole buffer, so nothing new is tracked.store_headersonly stores.A batch whose parent is neither stored nor a segment tip is not validated, as before nothing follows from it.
Tests
test_received_headers_are_validated: valid and invalid headers on the tip and on a fork. Invalid ones are not stored, raise noForkDetected, and ban the peer.test_segment_ancestors: checkpoint plus buffered headers, a segment above a checkpoint it does not start at, and an unknown hash.Issues
Closes #1193. Covers the block-header half of #1290 and the unvalidated fork of #1103, and stops an invalid batch from entering a segment (#1194). The rest of those stays open.
🤖 Generated with Claude Code
PR Hygiene ·
8030985/skip-botsproceeds without the ones not yet reported/self-revieweddash-spv(dash-spv/src/sync/block_headers/manager.rs,dash-spv/src/sync/block_headers/pipeline.rs,dash-spv/src/sync/block_headers/segment_state.rs) — QuantumExplorer or xdustinfaceWhen every merge requirement is met, the
PR Hygienecheck passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.Summary by CodeRabbit