refactor(e2e): fast block build config in e2e tests#23340
Draft
spalladino wants to merge 14 commits into
Draft
Conversation
4af2626 to
db4ec58
Compare
…rp paths mine(), evmMine(), and mineEmptyBlock() now call syncDateProvider() after mining so TestDateProvider follows L1 time without callers needing to do it manually. Remove now-redundant dateProvider.setTime() calls from three e2e test sites.
…tcher markAsProven loop Adds CheckpointAutoProver, an event-driven helper that subscribes to the sequencer's checkpoint-published event, waits for the local archiver to promote the checkpoint (verified via getL2Tips + getBlocks), then calls rollupCheatCodes.markAsProven(checkpointNumber). Replaces the periodic polling loop in AnvilTestWatcher.
…tcher Stop starting AnvilTestWatcher in e2e tests. Anvil now runs in interval mining mode at ethereumSlotDuration after L1 deploy, so warpTimeIfNeeded and syncDateProviderToL1IfBehind are unnecessary. The markAsProven loop is replaced by CheckpointAutoProver when testOnlyAutoProveAfterPublish is true (default via FAST_E2E_SETUP_OPTS). AnvilTestWatcher class stays in the tree for the sandbox/local-network entrypoint. The opt-in automineL1Setup option is removed (three callers cleaned up).
Canary for the AnvilTestWatcher-removal work in this PR. Exercises: - chain advances under interval mining + pipelining - 20 sequential dependent txs land in distinct blocks - proven tip advances via CheckpointAutoProver Uses FAST_E2E_SETUP_OPTS, the new preset added in this PR.
Missed in batch 2 because of its third argument (syncChainTip: 'checkpointed').
… and migrate to FAST_E2E_SETUP_OPTS
9208a79 to
1e675e8
Compare
…TUP_OPTS Both already used PIPELINING_SETUP_OPTS. The plan flagged them as second-batch out of caution; verified neither has hand-rolled cc.eth.warp/dateProvider.setTime helpers that would conflict with the wave-1 cheat-code audit.
1e675e8 to
d9922ef
Compare
Replace the PR's bespoke `CheckpointAutoProver` (140 lines + unit tests) with the existing `EpochTestSettler`, which is already the sandbox's proven-tip advancement path (`local-network.ts:213`). `EpochTestSettler` polls `EpochMonitor` and, once an epoch is complete, inserts the epoch out-hash into the outbox and calls `RollupCheatCodes.markAsProven(lastCheckpoint)`. Reusing it kills three audit findings in one go (the dead-weight verify step, unhandled `markAsProven` rejections, and the misleading `trigger()` JSDoc) and as a bonus advances the L2→L1 outbox -- so a follow-up can drop `startProverNode: true` from tests that only spin up a simulated prover to push the outbox. The trade-off is epoch-granularity proven advancement instead of per-checkpoint. With `aztecEpochDuration` left at the 32-slot default, FAST e2e proven would only advance every 384s. Add `aztecEpochDuration: 4` to `FAST_E2E_SETUP_OPTS` (matching `e2e_simple` and `e2e_p2p/fee_asset_price_oracle_gossip`) so an epoch is 48s wall time, and bump the smoke test's proven-tip retry window to 150s for two epochs of slack.
EpochTestSettler runs once per completed epoch, so the proven-tip retry budgets up to two epochs (the worst case is the tx landing right after an epoch boundary, needing the full next epoch to complete).
Migrated tests using FAST_E2E_SETUP_OPTS (e2e_token_contract/*, e2e_nested_contract/*, e2e_fast_config) consistently failed in CI with "Transaction dropped by P2P node" because the slot-4 propose tx reverted on L1. Root cause: with aztecEpochDuration: 4, EpochTestSettler fires markAsProven at the end of epoch 0 (just after the slot-3 propose lands). The cheat code wraps its storage write in execWithPausedAnvil, which pauses anvil interval mining for the duration of the cheat-code RPC and shifts the L1 mining cadence on resume. The next propose, sent at the slot-4 wall-clock boundary, lands in an L1 block whose block.timestamp is still in slot 3, and propose's validateHeader reverts with HeaderLib__InvalidSlotNumber(3, 4) inside the multicall. The outer multicall tx succeeds, but the propose log is absent, so the sequencer treats the checkpoint as un-published, the pending chain is pruned, and the in-flight L2 tx is ejected from the P2P pool. Drop aztecEpochDuration: 4 from FAST_E2E_SETUP_OPTS and let it default to 32, so EpochTestSettler does not fire within the typical test window. The smoke test loses its proven-tip assertion (the same epoch-boundary collision); it still covers chain progression and single-block-per-slot batching.
Setup pace-locks to anvil's 12s wall-clock interval mining since the watcher's warpTimeIfNeeded loop is gone, and the default `aztecSlotDuration: 72` means each L2 slot now takes 72s of wall time. `account_init` deploys ~5 blocks during `beforeAll` (initial account, banana token, FPC class+instance, fund), which exceeds the 300s Jest hook budget. Switch to PIPELINING_SETUP_OPTS (12s/4s slots, pipelining, 30x fee padding, `startProverNode: true` preserved through the spread order in `FeesTest.setup`), matching the pattern `e2e_fees/gas_estimation.test.ts` already uses for the same reason. Manual `getPaddedMaxFeesPerGas` calls in the test bodies still use the 5x default padding; leaving as-is since the PR's failure is a timeout, not a fee-rejection.
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.
Motivation
AnvilTestWatcherpolls every 200ms and silently mutates global state from three differentRunningPromises — proving, dateProvider sync, and L1 time warping. The wiring difference between e2e and sandbox makes failures hard to diagnose. Concrete examples this work was motivated by:dateProvider-read race inSequencer.workwheretargetSlotcould compute toslot + 2becausesyncDateProviderToL1IfBehindwarped time between the two reads.e2e_pruned_blocksregressions wherefinalizedstalled at 0 becausemarkAsProvenand the archiver'sfinalizedtag advanced out of order.Deleting the watcher from e2e in favor of deterministic per-responsibility replacements gets us:
anvil_setIntervalMining), no surprise warps.EpochTestSettleradvances it; no async loop racing the archiver.dateProvidermutates only when a cheat code explicitly warps L1, atomically with the RPC.The
AnvilTestWatcherclass stays in the tree so the sandbox / local-network entrypoint can keep using it. This PR only changes the e2e fixture wiring.What's landed
Foundation
fix(ethereum): atomically sync TestDateProvider in cheat-code mine/warp paths—mine(),evmMine(),mineEmptyBlock()syncTestDateProviderafter the RPC. Removes redundant manualsetTimeat three e2e call sites.setNextBlockTimestampdeliberately remains un-synced (it schedules but doesn't mine; sync happens on the next mine).feat(e2e): add FAST_E2E_SETUP_OPTS preset— single-block fast-mode timing (3.75s execution budget per slot, 20s pipelined publishing deadline, 48s epoch). Plus astdlib/timetable/index.test.tsunit test that verifies the derived numbers.refactor(e2e): unconditional anvil interval mining + drop AnvilTestWatcher—fixtures/setup.tsintegration: dropautomineL1Setup, switch to unconditionalsetIntervalMining(ethereumSlotDuration)for anvil after L1 deploy, default-skipwatcher.start()for anvil chains (disableAnvilTestWatcher ?? isAnvilChain). Removes redundantsetIsMarkingAsProven(false)calls from 8 sites.refactor(e2e): use EpochTestSettler in place of CheckpointAutoProver— reuses the existing sandbox-path orchestrator (yarn-project/aztec/src/local-network/local-network.ts:213) instead of the bespoke per-checkpoint helper the PR originally added. Advances both the outbox hash and the proven tip once per completed epoch.test(e2e): add e2e_fast_config smoke test— canary exercising three invariants: (a) chain advances under interval mining + pipelining, (b) 20 sequential dependent txs land in distinct blocks (single-block mode keeps batching off), (c) proven tip advances within two epochs (EpochTestSettlerworks).Migrations (49 tests)
e2e_amm(separate commit because it had a thirdsetup()arg the batch-2 agent missed).TokenContractTest/NestedContractTest, which gained aopts?: Partial<SetupOptions>parameter (calleroptsfirst, fixture invariants likemetricsPort/fundSponsoredFPC/skipAccountDeploymentoverride; mirrors the existingFeesTest.setup(opts)pattern).e2e_2_pxesande2e_lending_contract(initially deferred per the design plan, then re-verified safe).Held back from this PR
e2e_cheat_codes— exercisessetNextBlockTimestampandmine()directly. The cheat-code audit deliberately leftsetNextBlockTimestampun-synced; this test readsdateProvider.now()between schedule and mine, so it needs a hand-audit before migration.BlacklistTokenContractTest(7 suites) — huge time warps wedge the pipelined publisher, and they also hit a separateL1ToL2MessagesNotReadyErrorbug (see "Out of scope" below). Blocked on those source fixes.Explicitly out of scope (separate PRs)
These came up during the work and are tracked but not addressed here:
canProposeAtsimulation regression under pipelining. The simulation dropslastArchiveRootand the pending-tip slot override; a fix exists onorigin/sp/publisher-simulation-cleanupand needs forward-port tomerge-train/spartan. Blockse2e_contract_updates,composed/web3signer/e2e_multi_validator_node_key_store, and HA governance opt-in.AztecNodeService.simulatePublicCallsqueries unsealed checkpoint. WithinboxLag = 2, the simulator callsgetL1ToL2Messages(proposedCheckpoint + 1)on a checkpoint that hasn't been sealed yet, raisingL1ToL2MessagesNotReadyError. Pointer:yarn-project/aztec-node/src/aztec-node/server.ts:1519-1524. Preferred fix: a positivemessagesSealed(checkpoint)check on the message store, gating the next-checkpoint-message-append on it. Blocks 7 blacklist suites +e2e_bot+e2e_avm_simulator+e2e_fees/{private_payments,failures}.RunningPromisecycle inyarn-project/ethereum/src/publisher_manager.ts:84-89. Hypothesis: shared viem client between an in-flightmonitorTransactionand cycle-2'sgetSenderBalancehangs the loop. Blockse2e_publisher_funding_multi.Sequencer.invalidateInFlightCheckpointsBefore(slot)— needed if any test wants to do huge L1 warps that would orphan an in-flight checkpoint. Currently the in-flight job is silently kept and times out.Status
Audited end-to-end by an LLM review pass + a
/codexround-2 review on the final state of the branch. No CI-blocking issues flagged. Mark non-draft to trigger e2e CI. Considerci-no-fail-fastfor the first run so all failures surface at once.