Skip to content

fix: Don't update state if we failed to execute sufficient transactions#21443

Merged
PhilWindle merged 5 commits intomerge-train/spartanfrom
pw/fix-valid-tx-count
Mar 16, 2026
Merged

fix: Don't update state if we failed to execute sufficient transactions#21443
PhilWindle merged 5 commits intomerge-train/spartanfrom
pw/fix-valid-tx-count

Conversation

@PhilWindle
Copy link
Collaborator

@PhilWindle PhilWindle commented Mar 12, 2026

This PR fixes a bug in block building. Reproduction was as follows:

  1. Sequencer would fail to process sufficient transactions in the first block of the checkpoint (e.g. timeout).
  2. CheckpointBuilder.buildBlock() would update the state regardless.
  3. CheckpointProposalJob.buildSingleBlock() would detect an insufficient number of transactions and discard the block, leaving the state invalid for further block building.

This PR moves the detection of sufficient transaction count into CheckpointBuilder.buildBlock() so the state is left unmodified. It also introduces an additional fork checkpoint and reverts all changes made for blocks that are discarded.

@PhilWindle
Copy link
Collaborator Author

Looking further into this. It may not be the complete fix.

@PhilWindle PhilWindle reopened this Mar 12, 2026
@PhilWindle PhilWindle added ci-full Run all master checks. backport-to-v4-next and removed ci-full Run all master checks. labels Mar 12, 2026
@PhilWindle PhilWindle enabled auto-merge March 16, 2026 11:19
spalladino added a commit that referenced this pull request Mar 16, 2026
Temporarily skips the `acir_tests/browser-test-app` browser prove tests
(`verify_honk_proof` and `a_1_mul`) which are failing with "Failed to
fetch" errors in CI, blocking the v4 merge train.

This unblocks #21595 and transitively #21592 and #21443.

ClaudeBox log: https://claudebox.work/s/8663550bd346778b?run=1

---------

Co-authored-by: Santiago Palladino <santiago@aztec-labs.com>
@PhilWindle PhilWindle merged commit 31c3b73 into merge-train/spartan Mar 16, 2026
11 checks passed
@PhilWindle PhilWindle deleted the pw/fix-valid-tx-count branch March 16, 2026 15:38
@AztecBot
Copy link
Collaborator

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

PhilWindle added a commit that referenced this pull request Mar 16, 2026
…ficient transactions (v4) (#21610)

## Summary

Backport of #21443
to v4.

This PR fixes a bug in block building where the sequencer would update
state even when it failed to execute sufficient transactions. The fix:
- Replaces `NoValidTxsError` with `InsufficientValidTxsError` (includes
`processedCount` and `minRequired`)
- Moves the minimum valid tx check into `CheckpointBuilder.buildBlock()`
so state is not updated for blocks that will be discarded
- Introduces a `ForkCheckpoint` wrapper to revert world state changes on
failure
- Passes `minValidTxs` from `CheckpointProposalJob` into the builder

## Cherry-pick conflicts

The second commit (`3ccb6868a8 — Use an additional world state fork
checkpoint`) conflicted in `checkpoint_builder.ts` because the first
commit had already restructured the code into the
try/catch/ForkCheckpoint pattern. The conflict was just duplicate
leftover code that needed to be removed.

## Build fix

On v4, `LightweightCheckpointBuilder.addBlock()` returns
`Promise<L2Block>` directly, while on `next` it returns `Promise<{
block: L2Block, timings: ... }>`. Adjusted the destructuring
accordingly.

## Commit structure
1. **Cherry-pick**: `Don't update state if we failed to execute
sufficient transactions` (clean)
2. **Cherry-pick with conflicts**: `Use an additional world state fork
checkpoint when building blocks`
3. **Conflict resolution**: Remove duplicate code block left by conflict
4. **Cherry-pick**: `Comment` (clean)
5. **Build fix**: Adapt to v4 API (`addBlock` returns `L2Block`
directly)

ClaudeBox log: https://claudebox.work/s/a4bb51a881c56125?run=1
github-merge-queue bot pushed a commit that referenced this pull request Mar 16, 2026
BEGIN_COMMIT_OVERRIDE
feat: add ETHEREUM_HTTP_TIMEOUT_MS env var for viem HTTP transport
(#20919)
fix(archiver): filter tagged log queries by block number (#21388)
fix(node): handle slot zero in getL2ToL1Messages (#21386)
feat(sequencer): redistribute checkpoint budget evenly across remaining
blocks (#21378)
fix: fall back to package.json for CLI version detection (#21382)
chore: Removed multiplier config (#21412)
chore: Removed default snapshot url config (#21413)
chore: Read tx filestores from network config (#21416)
fix(node): check world state against requested block hash (#21385)
feat(p2p): use l2 priority fee only for tx priority (#21420)
feat(p2p): reject and evict txs with insufficient max fee per gas
(#21281)
revert "feat(p2p): reject and evict txs with insufficient max fee per
gas (#21281)" (#21432)
chore: Reduce log spam (#21436)
fix(tx): reject txs with invalid setup when unprotecting (#21224)
fix: orchestrator enqueue yield (#21286)
chore(builder): check archive tree next leaf index during block building
(#21457)
fix: scenario deployment (#21428)
chore: add claude skill to read network-logs (#21495)
chore: update claude network-logs skill (#21523)
feat(rpc): add package version to RPC response headers (#21526)
chore(prover): silence "epoch to prove" debug logs (#21527)
chore(sequencer): do not log blob data (#21530)
fix: dependabot alerts (#21531)
docs(p2p): nicer READMEs (#21456)
fix(archiver): guard getL1ToL2Messages against incomplete message sync
(#21494)
fix(sequencer): await syncing proposed block to archiver (#21554)
feat(ethereum): check VK tree root and protocol contracts hash in rollup
compatibility (#21537)
fix: marking peer as dumb on failed responses (#21316)
fix(kv-store): make LMDB clear and drop operations atomic across
sub-databases (#21539)
feat(world-state): add blockHash verification to syncImmediate (#21556)
chore(monitor): print out l2 fees components (#21559)
chore: rm faucet (#21538)
chore: remove old merkle trees (#21577)
feat: Implement commit all and revert all for world state checkpoints
(#21532)
chore: skip flaky browser acir tests in CI (#21596)
fix: Better detection for epoch prune (#21478)
chore: logging (#21604)
fix: Don't update state if we failed to execute sufficient transactions
(#21443)
END_COMMIT_OVERRIDE
alexghr pushed a commit that referenced this pull request Mar 17, 2026
BEGIN_COMMIT_OVERRIDE
fix(aztec-nr): return Option from decode functions and fix event
commitment capacity (backport #21264) (#21360)
fix: backport #21271 — handle bad note lengths on
compute_note_hash_and_nullifier (#21364)
fix: not reusing tags of partially reverted txs (#20817)
chore: revert accidental backport of #20817 (#21583)
feat: Implement commit all and revert all for world state checkpoints
(#21532)
cherry-pick: fix: dependabot alerts (#21531)
fix: dependabot alerts (backport #21531 to v4) (#21592)
fix: backport #21443 — Don't update state if we failed to execute
sufficient transactions (v4) (#21610)
chore: Fix msgpack serialisation (#21612)
END_COMMIT_OVERRIDE

---------

Co-authored-by: Jan Beneš <janbenes1234@gmail.com>
Co-authored-by: PhilWindle <60546371+PhilWindle@users.noreply.github.com>
Co-authored-by: Phil Windle <philip.windle@gmail.com>
Co-authored-by: Santiago Palladino <santiago@aztecprotocol.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: ludamad <adam.domurad@gmail.com>
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