-
Notifications
You must be signed in to change notification settings - Fork 19
handle reset chains #229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
handle reset chains #229
Conversation
WalkthroughA validation check was introduced in the Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant Committer
Caller->>Committer: getBlockNumbersToCommit()
Committer->>Committer: Calculate blockCount
alt blockCount < 1
Committer-->>Caller: Return error and empty slice
else blockCount >= 1
Committer-->>Caller: Return block numbers to commit
end
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🔇 Additional comments (1)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
TL;DR
Added a check to prevent processing when the RPC has fewer blocks than have been committed.
What changed?
Added a validation check in the
getBlockNumbersToCommit
function that returns an error when the calculated block count is less than 1, which indicates that more blocks have been committed than are available in the RPC node - potentially signaling a chain reset.How to test?
Why make this change?
This change prevents the system from attempting to process an invalid range of blocks when a chain reset may have occurred. Without this check, the system might try to process a negative number of blocks, leading to unexpected behavior or crashes. This improves resilience against chain reorganizations or RPC node inconsistencies.
Summary by CodeRabbit