Skip to content

fix(e2e): set anvilSlotsInAnEpoch in slashing tests#21869

Merged
spalladino merged 1 commit intomerge-train/spartanfrom
palla/fix-sentinel-finalization-race
Mar 26, 2026
Merged

fix(e2e): set anvilSlotsInAnEpoch in slashing tests#21869
spalladino merged 1 commit intomerge-train/spartanfrom
palla/fix-sentinel-finalization-race

Conversation

@spalladino
Copy link
Copy Markdown
Contributor

@spalladino spalladino commented Mar 20, 2026

With the default slotsInAnEpoch=1, anvil finalizes blocks almost immediately (finalized = latest - 2). This causes the P2P client to prune its attestation pool before the sentinel gets a chance to read it, leading to false attestation-missed flakes in sentinel and slashing tests. Bumps to 4 so finalization doesn't race ahead of sentinel processing.

🤖 Generated with Claude Code

With the default slotsInAnEpoch=1, anvil reports finalized = latest - 2,
causing L1 finalization to race ahead of L2 checkpoint processing. The P2P
client prunes its attestation pool on finalization, which can delete
attestations for a slot before the sentinel has a chance to read them,
leading to false attestation-missed reports.

Setting anvilSlotsInAnEpoch=4 (finalized = latest - 8) gives the sentinel
enough time to query the P2P pool before it is pruned.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@spalladino spalladino changed the title fix(e2e): set anvilSlotsInAnEpoch in slashing/sentinel tests fix(e2e): set anvilSlotsInAnEpoch in slashing tests Mar 20, 2026
@spalladino spalladino added ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure backport-to-v4-next labels Mar 20, 2026
@spalladino spalladino enabled auto-merge (squash) March 20, 2026 20:56
Base automatically changed from merge-train/spartan to next March 20, 2026 22:34
@spalladino spalladino changed the base branch from next to merge-train/spartan March 25, 2026 13:23
@spalladino spalladino merged commit 5319cf3 into merge-train/spartan Mar 26, 2026
37 of 41 checks passed
@spalladino spalladino deleted the palla/fix-sentinel-finalization-race branch March 26, 2026 09:35
@AztecBot
Copy link
Copy Markdown
Collaborator

❌ Failed to cherry-pick to v4-next due to conflicts. (🤖) View backport run.

AztecBot pushed a commit that referenced this pull request Mar 26, 2026
spalladino added a commit that referenced this pull request Mar 27, 2026
spalladino added a commit that referenced this pull request Mar 27, 2026
Resolves conflicts from cherry-picking PRs #21829, #21853, #21869, #22023.

Key resolutions:
- start_anvil.ts: take full rewrite from PR #21829 (spawn-based instead of @viem/anvil)
- sequencer-publisher.ts: use getNextL1SlotTimestamp with pipelining (PR #21853),
  getSimulationTimestamp for simulation timestamps (PR #22023),
  add aztecSlotDuration property
- setup.ts: add slotsInAnEpoch and dateProvider options
- slasher_config.test.ts: add anvilSlotsInAnEpoch option
- checkpoint_voter test: add epochCache mock methods
- Drop backupFailedTx calls (infrastructure not on this branch)
github-merge-queue Bot pushed a commit that referenced this pull request Mar 27, 2026
BEGIN_COMMIT_OVERRIDE
fix: only clear provenBlockNumber when it exceeds prune point (#21946)
chore: (A-779) load all accounts before calling
LogService.#getSecretsForSenders (#21923)
fix: align staging-public mana target with testnet/mainnet (#21983)
chore: (A-777) add warn logs for regressive path in block synchronizer
(#21925)
fix: fully validate txs retrieved from tx file store (#21988)
refactor: extract checkpoint proposal handling to ProposalHandler
(#21999)
fix: unbounded memory in calldataRetriever (#22004)
fix(p2p): check peer rate limit before global to prevent quota
starvation (#21997)
fix(p2p): evict expired failed-auth-handshake entries on heartbeat
(#21992)
chore: defensively handle skipPushProposedBlocksToArchiver (#22017)
chore: bump testnet prover resource profile to prod-hi-tps (#22019)
chore: (A-835) remove unused serializer (#22037)
fix(p2p): remove disconnected peers from scoring maps (#22009)
fix(e2e): set anvilSlotsInAnEpoch in slashing tests (#21869)
fix(ethereum): Audit fixes A-810, A-812 (nonce race, isEscapeHatchOpen
logging) (#21948)
chore: remove old TxPool implementation (#22028)
fix: Fix blob encoding when uploaded from proposals (#22045)
chore: Adds /cycle and /fix skills. Also configures linear mcp server
(#22043)
chore: remove validatorReexecute config option (#22024)
fix(sequencer): use last L1 slot of L2 slot as eth_simulateV1 timestamp
(#22023)
docs(simulator): clarify teardown gas billing is intentional (#22057)
chore: revert account loading optimization in log service (#22062)
fix: use DateProvider in PeerScoring (#22070)
fix(aztec.js): preserve extraHashedArgs in DeployMethod.with() (#22053)
fix(p2p): replace process.exit() with graceful shutdown in worker
cleanup (#22046)
chore: merge next (#22089)
fix(stdlib): correct NoteDao size (#22068)
feat: improve blob download from filestores (#22096)
fix: remove stale tx_pool v1 benchmark reference (#22104)
END_COMMIT_OVERRIDE
spalladino added a commit that referenced this pull request Mar 30, 2026
## Backport PRs to `backport-to-v4-next-staging`

Cherry-picked the following PRs (in order) on top of the branch,
committing each with conflicts unresolved:

1. **#21829** - `fix: sync dateProvider from anvil stdout on every mined
block`
2. **#21853** - `fix(sequencer): remove l1 block timestamp check`
3. **#21869** - `fix(e2e): set anvilSlotsInAnEpoch in slashing tests`
4. **#22023** - `fix(sequencer): use last L1 slot of L2 slot as
eth_simulateV1 timestamp`

### Conflict resolution

Added a single commit resolving all cherry-pick conflicts:

- **`yarn-project/ethereum/src/test/start_anvil.ts`**: Took the full
rewrite from PR #21829, replacing the `@viem/anvil`-based implementation
with a direct `child_process.spawn` approach. Updated
`start_anvil.test.ts` to import the new local `Anvil` type instead of
`@viem/anvil`.
- **`yarn-project/end-to-end/src/fixtures/setup.ts`**: Added
`slotsInAnEpoch` and `dateProvider` options to the `startAnvil` call.
-
**`yarn-project/end-to-end/src/e2e_sequencer/slasher_config.test.ts`**:
Added `anvilSlotsInAnEpoch: 4` option to the `setup` call.
-
**`yarn-project/sequencer-client/src/sequencer/checkpoint_voter.ha.integration.test.ts`**:
Added `epochCache.getSlotNow` and `epochCache.getL1Constants` mock
return values.
-
**`yarn-project/sequencer-client/src/publisher/sequencer-publisher.ts`**:
- `canProposeAt`: Replaced `getNextL1SlotTimestampWithL1Floor()` with
`getNextL1SlotTimestamp()` plus pipelining offset (PR #21853). Added
`pipelined?: boolean` to the opts type.
- `validateCheckpointForSubmission`: Changed return type to
`Promise<void>`, removed manual timestamp computation (PR #22023).
- `enqueueCastSignalHelper` / `simulateProposeTx`: Use
`getSimulationTimestamp()` for simulation timestamps, improved error
logging with `formatViemError` (PR #22023).
- Added `aztecSlotDuration` class property and wired it through the
config.
- Dropped `backupFailedTx` calls since the underlying `FailedL1Tx` /
`createL1TxFailedStore` infrastructure does not exist on this branch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-to-v4-next ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants