Skip to content

Commit 9dc804b

Browse files
authored
fix(sequencer): use evmMine in automine auto-settle to avoid dropping test L1 txs (#24421)
The local-network `AutomineSequencer` auto-settle loop hangs a test's direct L1 tx (~180s viem `WaitForTransactionReceiptTimeoutError`), surfacing as the `e2e_token_bridge_tutorial` flake. ## Context After `markAsProven`, `runProve()` called `mineEmptyBlock()` purely to advance the L1 block hash so the archiver re-reads the proven tip. `mineEmptyBlock` drops and re-adds the anvil mempool non-atomically (snapshot → `anvil_dropAllTransactions` → mine → re-add snapshotted txs). A direct test L1 tx submitted in the snapshot→drop window is dropped and never re-added; with the sequencer otherwise idle it is never mined, so the caller hangs until viem times out. ## Approach Replace `mineEmptyBlock()` with `evmMine()` at that call site. `evm_mine` advances the block hash and includes whatever is pending, with no mempool drop and no automine toggle — so there is no race window. The call site only needs a new block hash, not an empty block. `mineEmptyBlock()` itself is unchanged: its other callers invoke it single-threaded with no concurrent external tx and some rely on the block being empty, and making it race-safe across independent RPC clients is out of scope.
1 parent d3e4633 commit 9dc804b

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

yarn-project/sequencer-client/src/sequencer/automine/automine_sequencer.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -715,9 +715,12 @@ export class AutomineSequencer {
715715
await rollupCheatCodes.markAsProven(target);
716716
// Settlement is a direct L1 storage write that mines no block, unlike a real epoch proof landing
717717
// on L1. The archiver's L1 sync short-circuits while the L1 block hash is unchanged, so it would
718-
// never re-read the proven tip until the next build/warp mines a block. Mine one empty L1 block so
719-
// the block hash advances, then force an immediate sync that observes the new proven checkpoint.
720-
await this.deps.ethCheatCodes.mineEmptyBlock();
718+
// never re-read the proven tip until the next build/warp mines a block. Mine one L1 block so the
719+
// block hash advances, then force an immediate sync that observes the new proven checkpoint. Use
720+
// evmMine (not mineEmptyBlock): mineEmptyBlock drops+re-adds the mempool non-atomically, which can
721+
// silently lose a test's concurrently-submitted direct L1 tx. evm_mine just includes whatever is
722+
// pending, which is fine here — we only need the block hash to advance.
723+
await this.deps.ethCheatCodes.evmMine();
721724
await this.deps.archiver.syncImmediate();
722725

723726
this.log.verbose(`Proved up to checkpoint ${target}`, { target, proven, startEpoch, endEpoch });

0 commit comments

Comments
 (0)