Skip to content

fix(test): use checkpointed chain tip for e2e_p2p PXEs to avoid reorg race#22685

Merged
PhilWindle merged 1 commit intonextfrom
claudebox/66ccc62a64c65de9-4
Apr 23, 2026
Merged

fix(test): use checkpointed chain tip for e2e_p2p PXEs to avoid reorg race#22685
PhilWindle merged 1 commit intonextfrom
claudebox/66ccc62a64c65de9-4

Conversation

@AztecBot
Copy link
Copy Markdown
Collaborator

Summary

Sets syncChainTip: 'checkpointed' on the PXE instances used by submitTransactions / prepareTransactions in e2e_p2p/shared.ts and the cross-chain bridge PXE in e2e_p2p/add_rollup.test.ts. This matches the config already used by the main P2PNetworkTest PXE and makes the remaining test-local PXEs immune to the archiver's "slot ended without being checkpointed" prune.

Why

e2e_p2p/rediscovery.test.ts flaked on next with:

Simulation error: Block 0x0c2ddd9f9956e0a925118cb2e74f7b1243e5fa88996ad7923836d6a8d3f05b05 not found in the node. This might indicate a reorg has occurred.
    at SchnorrAccount.sync_state
    at AztecNodeService.getPrivateLogsByTags
    at ContractSyncService.ensureContractSynced
    at PXE.#executePrivate

CI log: http://ci.aztec-labs.com/90332e178cf20a05

Mechanism:

  1. The PXE's anchorBlockStore advances on every new proposed block (default syncChainTip: 'proposed'). Each #executePrivate / #executeUtility call captures the current anchor and passes the block hash down into getPrivateLogsByTags(referenceBlock).
  2. In this run, the slot-97 checkpoint-propose tx missed its only mineable L1 block (block 23) by ~5 ms. Anvil's deterministic 4s block cadence means the next L1 block lands at slot 98 start, so pruneUncheckpointedBlocks correctly drops block 2 from the node's local chain.
  3. The in-flight PXE sync_state utility still holds block 2's hash as referenceBlock. getPrivateLogsByTags then throws Block <hash> not found in the node. This might indicate a reorg has occurred., which bubbles up and fails the test.

With syncChainTip: 'checkpointed', the PXE only advances its anchor on chain-checkpointed events, so an uncheckpointed-then-pruned block can never become the reference for a sync_state query.

The main test PXE in P2PNetworkTest.setup() is already configured this way (p2p_network.ts:364, added in #22399) — this PR extends the same setting to the transient PXEs that submitTransactions / prepareTransactions / the bridging helper spin up.

Notes

  • Purely test-side change; no product behavior modified.
  • Doesn't fix the underlying product fragility (PXE throws hard on any archiver reorg of its anchor). Long-term fix would be a typed BlockReorgedError from the node + retry with refreshed anchor in ContractSyncService. That's tracked separately.
  • e2e_p2p/*.test.ts is already covered by the e2e-p2p-epoch-flakes pattern in .test_patterns.yml, so this doesn't change CI pass/fail gating — it just reduces the flake rate.

Full analysis: https://gist.github.com/AztecBot/bd68e0650e379f9c3e4e62a91ff2da13

ClaudeBox log: https://claudebox.work/s/66ccc62a64c65de9?run=4

@AztecBot AztecBot added ci-draft Run CI on draft PRs. claudebox Owned by claudebox. it can push to this PR. labels Apr 21, 2026
@PhilWindle PhilWindle marked this pull request as ready for review April 21, 2026 11:01
@spalladino
Copy link
Copy Markdown
Contributor

Should we move it to the merge-train?

@PhilWindle PhilWindle added this pull request to the merge queue Apr 23, 2026
Merged via the queue into next with commit fd84d15 Apr 23, 2026
43 of 47 checks passed
@PhilWindle PhilWindle deleted the claudebox/66ccc62a64c65de9-4 branch April 23, 2026 11:43
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.

4 participants