-
Notifications
You must be signed in to change notification settings - Fork 245
fix: Fail fast when executor ahead #2966
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
Conversation
|
The latest Buf updates on your PR. Results from workflow CI / buf-check (pull_request).
|
|
Claude finished @alpe's task in 2m 6s —— View job Comprehensive Code ReviewI've completed a thorough review of this PR, which changes the behavior when the execution layer is ahead of the target height from a warning to a fail-fast error. This is a critical correctness improvement for maintaining state consistency. SummaryOverall Assessment: ✅ Approved with Suggestions This PR correctly enforces state consistency by failing fast when the execution layer is ahead of the target height. The change is well-tested and properly documented. I've identified one actionable improvement around error handling patterns and several observations about the broader system design. 1. Code Quality & Architecture ✅Strengths:
Observations:
2. Error Handling & Resilience
|
Summary of ChangesHello @alpe, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refines the synchronization logic within the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request correctly changes the behavior to fail fast when the execution layer is ahead of the target height, which is a crucial improvement for maintaining state consistency. The implementation is clear and the accompanying test validates the new error condition. I've added one suggestion to further improve the error handling by using a structured error type, which would make the API more robust and easier for callers to handle this specific failure case.
I am having trouble creating individual review comments. Click here to see my feedback.
block/internal/common/replay.go (77-78)
Returning a generic error from fmt.Errorf makes it difficult for callers to handle this specific error condition programmatically. It's a best practice in Go to use a structured error or a sentinel error for such cases.
Consider defining a custom error type. This allows callers to use errors.As() for type-safe error handling and would also enable more precise testing in TestReplayer_SyncToHeight_ExecutorAhead by asserting the specific error type and its fields.
For example, you could define and use a custom error like this:
// ExecutorAheadError is returned when the execution layer is ahead of the target height.
type ExecutorAheadError struct {
ExecHeight uint64
TargetHeight uint64
}
func (e *ExecutorAheadError) Error() string {
return fmt.Sprintf("execution layer height (%d) ahead of target height (%d): manually rollback execution layer to height %d",
e.ExecHeight, e.TargetHeight, e.TargetHeight)
}
// Then, in SyncToHeight, you would return:
return &ExecutorAheadError{ExecHeight: execHeight, TargetHeight: targetHeight}
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2966 +/- ##
==========================================
- Coverage 57.88% 57.75% -0.14%
==========================================
Files 97 97
Lines 9306 9303 -3
==========================================
- Hits 5387 5373 -14
- Misses 3315 3326 +11
Partials 604 604
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
julienrbrt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK. We need to fix the EVM rollback command in a follow up.
I'll log an issue.
Ensure consistent state.
Reverts part of 9d4c64c#diff-c3cd6bebbc2af5fea33694c828f08dedbebb4e613f93ecf587e74bc56f9b76b6R78