Skip to content

feat: merge-train/spartan#21889

Merged
AztecBot merged 5 commits intonextfrom
merge-train/spartan
Mar 24, 2026
Merged

feat: merge-train/spartan#21889
AztecBot merged 5 commits intonextfrom
merge-train/spartan

Conversation

@AztecBot
Copy link
Copy Markdown
Collaborator

@AztecBot AztecBot commented Mar 23, 2026

BEGIN_COMMIT_OVERRIDE
chore: deflake n_tps benchmark for LOW_VALUE_TPS=2 (#21578)
fix(sequencer): use wall-clock timestamp for simulation when pipelining is disabled (#21888)
fix: disable caching of error responses (300-499) on R2 custom domain (#21939)
fix: add missing default cases in treeId switch statements (#21942)
END_COMMIT_OVERRIDE

## Summary

- **Restore the `LOW_VALUE_TPS=2` benchmark scenario** that was removed
in PR #19920 after repeated setup timeouts
- **Parallelize wallet creation** in `n_tps.test.ts` by switching from
`timesAsync` (sequential) to `timesParallel`, cutting setup time
proportionally to the number of wallets
- **Add retry logic with backoff** to `deployAccountWithDiagnostics`
that tracks pending transactions across retries, avoiding nullifier
conflicts when a previous tx is still in the mempool under chaos mesh
conditions
- **Set `SEQ_BUILD_CHECKPOINT_IF_EMPTY=true`** in the TPS scenario
environment so the chain keeps advancing during quiet periods
(setup/teardown)

## Details

### Root cause

With `LOW_VALUE_TPS=2`, the test needs 3 wallets (2 low + 1 high). Each
wallet deployment is an on-chain transaction that must be mined. Under
chaos mesh conditions (20% packet drop + latency), sequential deployment
of accounts frequently exceeds the test timeout.

### Changes

**`yarn-project/end-to-end/src/spartan/n_tps.test.ts`**
- Replace `timesAsync` with `timesParallel` for wallet creation — each
wallet gets an independent PXE/node client, so no shared state
- Add try/catch around `getBlockNumber` polling to avoid crashing on
transient RPC errors during setup

**`yarn-project/end-to-end/src/spartan/setup_test_wallets.ts`**
- Wrap the deploy-and-wait cycle in `retry()` with exponential backoff
(5 attempts, [1,2,4,8,16]s delays)
- Use a 600s per-attempt `waitForTx` timeout, with retries providing
cumulative wait of ~3000s
- Track `sentTxHash` across retries: on retry, check if the previous tx
was dropped before deciding to re-send. If the tx is still pending, wait
for it again instead of sending a duplicate (which would cause
`NULLIFIER_CONFLICT` under chaos mesh)
- Pre-check `getContract()` before each retry to skip re-deploy if a
previous attempt succeeded but `waitForTx` timed out
- Check `receipt.isDropped()` explicitly to clear the tracked tx and
trigger a fresh send

**`spartan/environments/tps-scenario.env`**
- Add `SEQ_BUILD_CHECKPOINT_IF_EMPTY=true` to match
`prove-n-tps-fake.env` — ensures empty checkpoint blocks are produced in
quiet slots, keeping the chain live

**`spartan/bootstrap.sh`**
- Re-add `2` to `low_value_tps_list` to restore the benchmark scenario

## Test plan

- CI should run the restored `low_0_1__high_2` TPS benchmark scenario
end-to-end
- Existing lower TPS scenarios (0.1, 0.2, 0.5, 1) should be unaffected
by the retry/parallel changes

Fixes A-492
…ng is disabled (#21888)

## Summary

Fixes next-net being stuck at block 1. Every checkpoint proposal fails
at the `eth_simulateV1` step with `"block timestamps must be in order"`.

## Root Cause

`validateCheckpointForSubmission` (changed in PR #21026) uses
`checkpoint.header.timestamp` as the simulation time override. This is
the **slot start time**, which works when pipelining is enabled
(targetSlot = currentSlot + 1, so the timestamp is ~48s in the future),
but fails when pipelining is disabled (targetSlot = currentSlot, so the
timestamp is the start of the current slot — always in the past by the
time the simulation runs after ~24s of building).

## Fix

Branch on pipelining: use `checkpoint.header.timestamp` when pipelining
is enabled (always in the future), use `getNextL1SlotTimestamp()`
(wall-clock-derived, always in the future) when pipelining is disabled.

```typescript
const ts = this.epochCache.isProposerPipeliningEnabled()
  ? checkpoint.header.timestamp
  : getNextL1SlotTimestamp(this.dateProvider.nowInSeconds(), l1Constants);
```

## Evidence

From next-net logs at slot 300:
- `blockOverrides.time` = `0x69c11a91` = `checkpoint.header.timestamp +
1` = slot start + 1
- L1 latest block ≈ 24s ahead of slot start (2 Sepolia blocks of build
time)
- Pipelining disabled: `"target slot 319 during wall-clock slot 319"`
- All 8 validators attest correctly, but no checkpoint lands on L1

Analysis:
https://gist.github.com/AztecBot/6774618b735f2dd32004254e5170fb70
Copy link
Copy Markdown
Collaborator

@ludamad ludamad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Auto-approved

@AztecBot AztecBot enabled auto-merge March 23, 2026 19:18
@AztecBot
Copy link
Copy Markdown
Collaborator Author

🤖 Auto-merge enabled after 4 hours of inactivity. This PR will be merged automatically once all checks pass.

AztecBot and others added 3 commits March 24, 2026 10:47
## Summary
- Adds missing `default:` cases to 3 switch statements on `treeId` in
`nodejs_module/world_state/world_state.cpp`
- Affected functions: `find_leaf_indices`, `find_sibling_paths`,
`append_leaves`
- Without these, unknown `treeId` values silently fell through instead
of throwing errors

Fixes A-858
@AztecBot AztecBot added this pull request to the merge queue Mar 24, 2026
Merged via the queue into next with commit b42c0ec Mar 24, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants