Skip to content

fix: prevent race in e2e_offchain_payment reorg test#22386

Draft
AztecBot wants to merge 1 commit intomerge-train/barretenbergfrom
claudebox/fix-mt-barretenberg-ci
Draft

fix: prevent race in e2e_offchain_payment reorg test#22386
AztecBot wants to merge 1 commit intomerge-train/barretenbergfrom
claudebox/fix-mt-barretenberg-ci

Conversation

@AztecBot
Copy link
Copy Markdown
Collaborator

@AztecBot AztecBot commented Apr 7, 2026

Summary

Fixes a consistent test failure in e2e_offchain_payment.test.ts ("reprocesses an offchain-delivered payment after an L1 reorg") that was blocking the merge-train/barretenberg CI.

Root cause: After forceReorg triggers an L1 reorg via cheatCodes.eth.reorg(1), Anvil immediately auto-mines the reverted transaction back into a new L1 block. The rollbackTo call resumes the archiver in its finally block, so the archiver can re-sync the re-mined checkpoint before the test checks rollback balances. When this happens, sync_state re-delivers offchain capsule messages (which persist across reorgs by design) and re-adds notes that were properly deleted by the PXE rollback, causing Alice's balance to be 60n instead of the expected 100n.

Fix: Disable L1 automine before triggering the reorg, then re-enable it after verifying rollback balances. This prevents the race without changing any production code.

Test plan

  • e2e_offchain_payment.test.ts passes consistently (3/3 targeted runs + 1 full suite run)

ClaudeBox log: https://claudebox.work/s/637a1c6a0c33aa91?run=1

Disable L1 automine before triggering the reorg so that Anvil does not
immediately re-mine the reverted checkpoint. Without this, the archiver
can re-sync the same block before the test checks rollback balances,
causing sync_state to re-deliver offchain capsule messages and re-add
notes that were properly deleted by the PXE rollback.
@AztecBot AztecBot added ci-draft Run CI on draft PRs. claudebox Owned by claudebox. it can push to this PR. labels Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-draft Run CI on draft PRs. claudebox Owned by claudebox. it can push to this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant