Refactor: Reorg detection with parent hash verification#338
Refactor: Reorg detection with parent hash verification#338yug49 wants to merge 4 commits intoOpenZeppelin:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors block reorg detection to use parent-hash verification against a rolling buffer of (block_number, block_hash) entries, aligning the implementation with the ring-buffer approach described in #214 (and superseding #224).
Changes:
- Replaced hash-existence RPC checks with parent-hash verification backed by a
BlockNumHashring buffer. - Added gap handling logic that fetches intermediate blocks to bridge non-sequential incoming blocks.
- Minor formatting adjustments to conditionals in stream handling code.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| src/event_scanner/block_range_handler.rs | Minor conditional formatting; no behavior change. |
| src/block_range_scanner/ring_buffer.rs | Refactors buffer to store BlockNumHash and adds lookup/truncation helpers + tests. |
| src/block_range_scanner/reorg_handler.rs | Rewrites reorg detection using parent-hash verification with buffer, including gap and deep-reorg handling. |
| src/block_range_scanner/common.rs | Minor conditional formatting; no behavior change. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Thanks @yug49 , we will review the PR over the next couple of days/weeks |
Resolves #214
Supersedes #224
Rewrites reorg detection from scratch based on the reviews and pseudocode in #224