fix(supervisor): l1 reorg source rewinding#2726
Conversation
|
Claude finished @dhyaniarun1993's task —— View job PR Review: L1 Reorg Source RewindingComprehensive code review focusing on code quality, bugs, performance, security, and test coverage. Todo List:
Critical Issues Found🚨 Bug #1: Off-by-one Error in Rewind TargetFile: // return the previous source block as the rewind target since rewinding is inclusive
Ok(Some(prev_source))Issue: Returns 🚨 Bug #2: Potential Infinite LoopFile: Summary & Recommendations✅ Strengths
|
Codecov Report❌ Patch coverage is ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Claude finished @dhyaniarun1993's task —— View job PR Review: L1 Reorg Source RewindingComprehensive code review focusing on code quality, bugs, performance, security, and test coverage. Todo List:
Critical Issues Found🚨 Bug: Off-by-one Error in Rewind TargetFile: // return the previous source block as the rewind target since rewinding is inclusive
Ok(Some(prev_source))Issue: The logic is flawed. When Impact: This causes the system to rewind one block further than necessary, potentially losing valid data. Fix: Should return // Found canonical block - rewind to this block (inclusive)
Ok(Some(current_source))
|
There was a problem hiding this comment.
Pull Request Overview
This PR implements L1 reorg source rewinding functionality by adding a new rewind_to_source method to the storage layer. The change addresses issue #2725 by providing a more targeted rewinding mechanism that operates at the source block level rather than derived blocks.
- Adds
rewind_to_sourcemethod toStorageRewindertrait that rewinds to a specific source block and returns the derived block target - Implements the method in
DerivationProviderandChainDbwith proper log storage and safety head updates - Updates reorg task logic to use the new source-based rewinding approach instead of the previous derived block method
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/supervisor/storage/src/traits.rs | Adds new rewind_to_source method to StorageRewinder trait |
| crates/supervisor/storage/src/providers/derivation_provider.rs | Implements rewind_to_source with block traversal deletion and comprehensive tests |
| crates/supervisor/storage/src/metrics.rs | Adds metrics tracking for the new rewind operation |
| crates/supervisor/storage/src/chaindb.rs | Implements trait method with log rewinding and safety head updates |
| crates/supervisor/service/src/actors/processor.rs | Updates mock trait implementation for tests |
| crates/supervisor/core/src/reorg/task.rs | Refactors reorg logic to use source-based rewinding and fixes target selection |
| crates/supervisor/core/src/reorg/handler.rs | Changes warning to error log level for failed reorg tasks |
| crates/supervisor/core/src/chain_processor/handlers/safe_block.rs | Updates logging and adds mock trait method |
| crates/supervisor/core/src/chain_processor/handlers/invalidation.rs | Adds mock trait method for tests |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Closes #2725