Skip to content

[codex] fix giga snapshot storage rollback#3536

Draft
codchen wants to merge 1 commit into
mainfrom
codex/fix-giga-sstore-snapshot-rollback
Draft

[codex] fix giga snapshot storage rollback#3536
codchen wants to merge 1 commit into
mainfrom
codex/fix-giga-sstore-snapshot-rollback

Conversation

@codchen
Copy link
Copy Markdown
Collaborator

@codchen codchen commented Jun 3, 2026

Summary

  • change Giga StateDB snapshots to use rollbackable CacheMultiStore layers instead of relying on value-writing store journal reverts
  • stop store-backed storage, code, nonce, balance, account clear, and mapping changes from being replayed during snapshot rollback
  • add regression coverage that verifies reverted storage writes, including same-value SSTOREs, do not flush dirty writes to the parent store

Root cause

Giga used a single transaction cache plus explicit journal entries to undo store-backed writes. The same-value SetState path intentionally wrote through without a storage journal entry, so a same-value SSTORE inside a reverted internal call could survive rollback as a dirty cache write. Value-writing rollback also left a dirty cache entry for non-noop storage changes, which can affect AppHash even when the visible EVM value is restored.

Impact

Reverted EVM snapshots now discard store writes by dropping the snapshot cache layer, matching the V2 rollback model. Persistent store changes only flush from surviving snapshot layers during Finalize, while the journal remains responsible for in-memory EVM state such as logs, refunds, transient storage, access lists, surplus, and account status markers.

Validation

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

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 3, 2026

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

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedJun 3, 2026, 2:29 AM

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 3, 2026

Codecov Report

❌ Patch coverage is 82.53968% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.26%. Comparing base (f8f1af1) to head (17a36da).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
giga/deps/xevm/state/journal.go 14.28% 6 Missing ⚠️
giga/deps/xevm/state/statedb.go 89.58% 4 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3536      +/-   ##
==========================================
- Coverage   59.12%   58.26%   -0.87%     
==========================================
  Files        2213     2140      -73     
  Lines      182774   174353    -8421     
==========================================
- Hits       108072   101587    -6485     
+ Misses      64985    63727    -1258     
+ Partials     9717     9039     -678     
Flag Coverage Δ
sei-chain-pr 75.62% <82.53%> (?)
sei-db 70.41% <ø> (ø)
sei-db-state-db ?

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

Files with missing lines Coverage Δ
giga/deps/xevm/state/balance.go 60.67% <ø> (-0.87%) ⬇️
giga/deps/xevm/state/code.go 76.92% <ø> (-10.04%) ⬇️
giga/deps/xevm/state/nonce.go 100.00% <ø> (ø)
giga/deps/xevm/state/state.go 98.42% <100.00%> (-0.30%) ⬇️
giga/deps/xevm/state/statedb.go 77.24% <89.58%> (-1.47%) ⬇️
giga/deps/xevm/state/journal.go 80.68% <14.28%> (-9.23%) ⬇️

... and 73 files 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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant