Skip to content

Fix xevm snapshot journal reverts#3414

Open
codchen wants to merge 1 commit intomainfrom
tony/fix-xevm-snapshot-reverts
Open

Fix xevm snapshot journal reverts#3414
codchen wants to merge 1 commit intomainfrom
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 state snapshot/journaling and rollback semantics (code, nonce, address mappings), which is consensus-critical and easy to get subtly wrong despite added tests.

Overview
Fixes snapshot rollback correctness in xevm/state by journaling key existence (not just values) for code and nonce updates, and by capturing/restoring the Sei<->EVM address mapping state created implicitly by SetCode.

Rollback now uses shared restoreCode/restoreNonce helpers to precisely delete or recreate underlying KV entries (including code hash/size) and to clean up newly-created accounts/mappings. Separately, SetState continues to dedupe journal entries on no-op writes but still writes the value through to the backing store.

Adds regression tests covering mapping cleanup on code revert, preserving explicit empty code, reverting nonce back to “absent”, CreateAccount restoring absent nonce state, and verifying no-op SetState still performs a store write.

Reviewed by Cursor Bugbot for commit 5c4446e. 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, 4:03 AM

@codecov
Copy link
Copy Markdown

codecov Bot commented May 11, 2026

Codecov Report

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

Files with missing lines Patch % Lines
giga/deps/xevm/state/journal.go 88.09% 3 Missing and 2 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3414   +/-   ##
=======================================
  Coverage   59.24%   59.25%           
=======================================
  Files        2110     2110           
  Lines      174149   174198   +49     
=======================================
+ Hits       103175   103221   +46     
- Misses      62041    62042    +1     
- Partials     8933     8935    +2     
Flag Coverage Δ
sei-chain-pr 84.50% <92.30%> (?)
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%) ⬆️
giga/deps/xevm/state/journal.go 89.62% <88.09%> (-2.16%) ⬇️

... 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.

1 participant