-
Notifications
You must be signed in to change notification settings - Fork 193
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
fix(evm): ensure stateDB is nil after tx execution #2173
Conversation
📝 WalkthroughWalkthroughThis pull request addresses state database management in the Nibiru EVM by introducing a consistent approach to clearing the Changes
Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (5)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (1)
🔇 Additional comments (9)
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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 (
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
CHANGELOG.md (1)
87-88
: Consider enhancing the changelog entry.While the entry correctly documents the change, it could be more informative by explaining why clearing the
StateDB
between calls is important (e.g., to prevent residual state from affecting subsequent transactions).Consider expanding the entry to:
-- [#2173](https://github.com/NibiruChain/nibiru/pull/2173) - fix(evm): clear `StateDB` between calls ++ [#2173](https://github.com/NibiruChain/nibiru/pull/2173) - fix(evm): clear `StateDB` between calls to prevent residual state from affecting subsequent transactions
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
CHANGELOG.md
(1 hunks)x/evm/keeper/funtoken_from_coin.go
(1 hunks)x/evm/keeper/funtoken_from_erc20.go
(1 hunks)x/evm/keeper/msg_server.go
(3 hunks)x/evm/precompile/funtoken.go
(0 hunks)x/evm/precompile/wasm.go
(0 hunks)
💤 Files with no reviewable changes (2)
- x/evm/precompile/funtoken.go
- x/evm/precompile/wasm.go
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: integration-tests
🔇 Additional comments (5)
x/evm/keeper/funtoken_from_erc20.go (1)
135-137
: LGTM! Good use of defer pattern.The deferred function ensures that
StateDB
is properly reset to nil after execution, regardless of the execution path. This is a robust way to handle cleanup.x/evm/keeper/msg_server.go (3)
63-65
: LGTM! Consistent state management.The deferred reset of
StateDB
ensures proper cleanup after Ethereum transaction execution.
548-554
: LGTM! Proper state cleanup.The pattern of checking for nil, initializing if needed, and deferring the reset is well implemented.
602-608
: LGTM! Consistent implementation.The same state management pattern is correctly applied here, maintaining consistency across the codebase.
x/evm/keeper/funtoken_from_coin.go (1)
101-103
: LGTM! Consistent with other changes.The deferred reset of
StateDB
follows the same pattern implemented across the codebase.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2173 +/- ##
==========================================
+ Coverage 64.88% 64.97% +0.08%
==========================================
Files 277 277
Lines 22301 22363 +62
==========================================
+ Hits 14471 14530 +59
+ Misses 6839 6838 -1
- Partials 991 995 +4
|
Purpose / Abstract
Use the
defer
pattern to ensure thatStateDB
is nil after tx execution, by coupling the nil-clearing operation next to StateDB creation.