Repository navigation
test(rollback): fork-mode regression tests for precompile-storage checkpoint integration (BOP-214) - #100
Merged
amiecorso merged 1 commit intoMay 29, 2026
Conversation
…ckpoint integration (BOP-214) Add three fork-mode regression tests verifying that mid-execution reverts in multi-write batch operations leave no orphan state. Tests: - batchMint with supply-cap-exceeded on element 1: element 0's balance + totalSupply writes are rolled back. - batchBurn with insufficient-balance on element 1: element 0's debit is rolled back. - createPolicyWithAccounts with oversized batch: nextCounter + predicted policy slot unchanged, predicted ID not reachable. Mock mode (revm-journaled storage) provides the rollback for free and confirms test setup. The actual signal is fork mode against the real Rust precompile, where any break in precompile-storage's JournaledState hookup would leave the earlier writes persisted. Companion to BOP-176 (Rust-side unit tests of the same crate in isolation). All three pass in mock mode (256 fuzz runs) and fork mode (10 fuzz runs against anvil + live Rust precompile).
amiecorso
deleted the
amiecorso/bop-214-base-std-fork-mode-regression-tests-for-precompile-storage
branch
May 29, 2026 18:42
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds three fork-mode regression tests verifying that mid-execution reverts in multi-write batch operations leave no orphan state.
test/unit/B20Security/batch/batchMint_rollback.t.solbatchMintsupplyCaptest/unit/B20Security/batch/batchBurn_rollback.t.solbatchBurntest/unit/PolicyRegistry/createPolicyWithAccounts_rollback.t.solcreatePolicyWithAccountsMAX_BATCH_SIZEEach test snapshots the relevant state (balances + totalSupply, or slot-level
nextCounter+ policy slot), triggers the revert, and asserts the post-revert state is byte-identical to pre-revert.Why
Closes BOP-214. Companion to BOP-176 (Rust-side unit tests of the
precompile-storagecheckpoint mechanism in isolation).Mock mode (revm-journaled storage) gives rollback for free — passing tests there mostly just confirms setup is correct and revm works. The signal is in fork mode, where the same tests exercise the real Rust precompile and verify that
precompile-storage'sJournaledStateintegration correctly rolls back partial writes on revert. A broken integration (writes that aren't journaled, checkpoints released early, future refactor that drops the hookup) would leave earlier writes persisted across the revert — this suite would catch it.The
createPolicyWithAccountstest is robust to either impl order:nextCounter+ writes the policy slot before the batch check (BOP-207 tracks the reorder), relying on revm's journal to roll back.Both reach the same end state (counter unchanged, predicted slot still zero); the test passes in both modes for different reasons today.
Verification
Mock mode:
Fork mode (against live Rust precompile via patched anvil):
Out of scope
Exhaustive coverage of every multi-write entrypoint — only enough to catch precompile-storage integration regressions. Comprehensive unit-level rollback coverage stays in BOP-176.