Skip to content

Fix xevm snapshot journal reverts#3414

Open
codchen wants to merge 2 commits into
mainfrom
tony/fix-xevm-snapshot-reverts
Open

Fix xevm snapshot journal reverts#3414
codchen wants to merge 2 commits into
mainfrom
tony/fix-xevm-snapshot-reverts

Conversation

@codchen
Copy link
Copy Markdown
Collaborator

@codchen codchen commented May 11, 2026

Summary

  • track prior code key existence and address mapping state for SetCode journal reverts
  • restore absent nonce/code keys precisely during snapshot rollback
  • keep same-value SetState writes flowing to the backing store while still deduping journal entries
  • add regression coverage for mapping cleanup, absent nonce, explicit empty code, CreateAccount nonce restoration, and no-op storage write-through

Tests

  • go test ./giga/deps/xevm/state

Note

Medium Risk
Touches EVM stateDB journaling and snapshot rollback semantics (code, nonce, address mappings), so subtle regressions could affect execution correctness, but changes are localized and covered by new regression tests.

Overview
Fixes snapshot rollback correctness in xevm/state by journaling key existence for code/nonce and restoring them precisely (including deleting keys when they were originally absent), rather than relying on zero/empty-value heuristics.

SetCode reverts now also restore/remove any address mapping and account side-effects that Keeper.SetCode may have created, including resetting the auth module’s global account number when a revert removes a newly-created account.

Adjusts SetState so same-value writes still pass through to the backing store while continuing to dedupe journal entries, and adds targeted tests for mapping cleanup, absent nonce/code preservation, CreateAccount revert behavior, and no-op storage write-through.

Reviewed by Cursor Bugbot for commit fb542d6. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 11, 2026

The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedMay 11, 2026, 9:29 AM

@codecov
Copy link
Copy Markdown

codecov Bot commented May 11, 2026

Codecov Report

❌ Patch coverage is 89.61039% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.25%. Comparing base (0543e0e) to head (fb542d6).

Files with missing lines Patch % Lines
giga/deps/xevm/state/journal.go 88.88% 3 Missing and 2 partials ⚠️
sei-cosmos/x/auth/keeper/keeper.go 66.66% 2 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3414      +/-   ##
==========================================
+ Coverage   59.24%   59.25%   +0.01%     
==========================================
  Files        2110     2110              
  Lines      174149   174210      +61     
==========================================
+ Hits       103175   103230      +55     
- Misses      62041    62044       +3     
- Partials     8933     8936       +3     
Flag Coverage Δ
sei-chain-pr 79.93% <89.61%> (?)
sei-db 70.41% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
giga/deps/xevm/state/code.go 86.95% <100.00%> (+8.38%) ⬆️
giga/deps/xevm/state/nonce.go 100.00% <100.00%> (ø)
giga/deps/xevm/state/state.go 98.71% <100.00%> (+0.05%) ⬆️
sei-cosmos/x/auth/keeper/keeper.go 81.52% <66.66%> (-1.62%) ⬇️
giga/deps/xevm/state/journal.go 89.90% <88.88%> (-1.88%) ⬇️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants