-
Notifications
You must be signed in to change notification settings - Fork 246
refactor(block)!: remove GetLastState from components #2923
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 @julienrbrt's task in 2m 9s —— View job Comprehensive Code ReviewI've reviewed this PR which removes the public ✅ SummaryThe PR correctly removes unused public API methods and simplifies the codebase. The refactoring is sound and improves the architecture. What Changed
🎯 Code Quality & Architecture✅ Strengths
📋 Observations
🔒 Concurrency & Thread Safety✅ Correct UsageThe
Note on the Removed FallbackThe gemini-code-assist bot flagged a variable shadowing bug in the fallback code (commit 60c6c0e), but this is moot since:
🧪 Testing✅ Test CoverageAll tests were properly updated:
The test changes confirm that:
🛡️ Error Handling & Resilience✅ Proper Initialization ContractThe removal of the store fallback strengthens the contract:
Both
🚨 Security & Safety✅ No Security Issues
📊 Performance✅ Minor Performance ImprovementRemoving defensive cloning in syncer's // OLD (unnecessary defensive copy)
stateCopy := *state
stateCopy.AppHash = bytes.Clone(state.AppHash)
stateCopy.LastHeaderHash = bytes.Clone(state.LastHeaderHash)
return stateCopy
// NEW (simple value copy, no extra allocations)
return *stateImpact: Eliminates 2 heap allocations per call. Since this is called frequently in the hot path ( 🎨 Code Style & Conventions✅ Follows Go Conventions
Minor Suggestion (Non-blocking)Consider adding a comment to // getLastState returns the current state.
// Returns an empty state if called before Start() initializes the component.
// getLastState should never directly mutate the returned state.
func (e *Executor) getLastState() types.State {🔍 VerificationI verified that:
✅ Final RecommendationAPPROVE - This is a clean refactoring that:
The PR correctly identifies that |
Summary of ChangesHello @julienrbrt, 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 refactors the state retrieval logic within the Highlights
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 aims to add a fallback to fetch state from the store in GetLastState if it's not present in memory. While the intention is good, the current implementation introduces a critical bug in both modified files. A variable shadowing issue will cause a nil pointer dereference, leading to a panic. I've added comments with suggested fixes to address this critical issue.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2923 +/- ##
==========================================
+ Coverage 63.61% 63.65% +0.03%
==========================================
Files 90 90
Lines 8584 8571 -13
==========================================
- Hits 5461 5456 -5
+ Misses 2540 2534 -6
+ Partials 583 581 -2
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:
|
* main: chore: execute goimports to format the code (#2924) refactor(block)!: remove GetLastState from components (#2923) feat(syncing): add grace period for missing force txs inclusion (#2915) chore: minor improvement for docs (#2918) feat: DA Client remove interface part 2, add client for celestia blob api (#2909) chore: update rust deps (#2917) feat(sequencers/based): add based batch time (#2911) build(deps): Bump golangci/golangci-lint-action from 9.1.0 to 9.2.0 (#2914) refactor(sequencers): implement batch position persistance (#2908)
Overview
If GetLastState() got somehow called on the component prior that it is started you could get an empty state.
First I thought let's fallback to the store 60c6c0e when empty. However when I checked the usage of GetLastState from the components I couldn't find anything.
I think deleting this public api makes more sense then.