Skip to content

chore: Accumulated backports to v4#21582

Merged
alexghr merged 21 commits intov4from
backport-to-v4-staging
Mar 17, 2026
Merged

chore: Accumulated backports to v4#21582
alexghr merged 21 commits intov4from
backport-to-v4-staging

Conversation

@AztecBot
Copy link
Collaborator

@AztecBot AztecBot commented Mar 16, 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

@AztecBot
Copy link
Collaborator Author

AztecBot commented Mar 16, 2026

Flakey Tests

🤖 says: This CI run detected 1 tests that failed, but were tolerated due to a .test_patterns.yml entry.

\033FLAKED\033 (8;;http://ci.aztec-labs.com/0b8b65ad6b0b00dd�0b8b65ad6b0b00dd8;;�):  yarn-project/end-to-end/scripts/run_test.sh simple src/e2e_epochs/epochs_invalidate_block.parallel.test.ts "proposer invalidates previous block with shuffled attestations" (188s) (code: 0) group:e2e-p2p-epoch-flakes

benesjan and others added 2 commits March 16, 2026 12:08
…#21532)

## Summary

- Adds depth-aware `commitAllCheckpointsTo(depth)` and
`revertAllCheckpointsTo(depth)` to the world state checkpoint system.
These revert/commit all checkpoints at or above the given depth
(inclusive), preserving any checkpoints created by callers below that
depth.
- `createCheckpoint()` now returns the depth of the newly created
checkpoint, threading it through the full C++ async callback chain
(cache → tree store → append-only tree → world state → NAPI →
TypeScript).
- `ForkCheckpoint` stores its depth and exposes `revertToCheckpoint()`
which encapsulates the revert-to-depth pattern, replacing the previous
`revertAllCheckpoints()` + `markCompleted()` two-step.
- The public processor uses `revertToCheckpoint()` on tx timeout/panic,
so per-tx reverts no longer destroy checkpoints created by callers
(e.g., `CheckpointBuilder`).

## Changes

**C++ (barretenberg)**
- `ContentAddressedCache`: `checkpoint()` returns depth, new
`commit_to_depth()`/`revert_to_depth()` methods
- `CachedContentAddressedTreeStore`: passes through depth-aware
operations
- `ContentAddressedAppendOnlyTree`: `CheckpointCallback` now receives
`TypedResponse<CheckpointResponse>` with depth
- `WorldState`: `checkpoint()` returns depth,
`commit_all_checkpoints_to`/`revert_all_checkpoints_to` take required
depth
- NAPI layer: new `ForkIdWithDepthRequest`/`CheckpointDepthResponse`
message types

**TypeScript**
- `MerkleTreeCheckpointOperations` interface: `createCheckpoint()`
returns `Promise<number>`, depth is required on
`commitAllCheckpointsTo`/`revertAllCheckpointsTo`
- `MerkleTreesFacade`: passes depth through native message channel
- `ForkCheckpoint`: stores depth, new `revertToCheckpoint()` method
- `PublicProcessor`: uses `checkpoint.revertToCheckpoint()` on error
paths

**Tests**
- C++ cache tests: depth return, `commit_to_depth`, `revert_to_depth`,
edge cases
- C++ append-only tree tests: depth return, commit/revert to depth
- TypeScript native world state tests: depth return, commit/revert to
depth, backward compat
- TypeScript fork checkpoint unit tests
- TypeScript public processor tests: verifies depth passed on revert

## Test plan

- C++ cache tests pass (`crypto_content_addressed_cache_tests`)
- C++ append-only tree tests pass
(`crypto_content_addressed_append_only_tree_tests`)
- TypeScript `native_world_state.test.ts` passes
- TypeScript `fork_checkpoint.test.ts` passes
- TypeScript `public_processor.test.ts` passes
- TypeScript `timeout_race.test.ts` passes
PhilWindle and others added 11 commits March 16, 2026 12:23
Cherry-pick of d11638d with conflicts (backport to v4).
Resolved lock file conflicts for backport to v4:
- Kept v4 specifiers while updating to new versions where applicable
- barretenberg/acir_tests, boxes, docs, playground: updated tar 7.4.3/7.5.1 -> 7.5.11
- barretenberg/ts: updated glob 10.4.5 -> 10.5.0
- barretenberg/docs: kept tar@6, updated tar@7 -> 7.5.11
- yarn-project: kept tar@6.2.1 (v4 uses tar@6, not tar@7)
- nodejs_module: kept v4 version (different lock format)
## Summary
Backport of #21531
to v4.

Updates vulnerable dependencies in lock files:
- **tar**: 7.4.3/7.5.1 → 7.5.11 (in acir_tests, boxes, docs, playground,
barretenberg/docs)
- **glob**: 10.4.5 → 10.5.0 (in barretenberg/ts)
- **barretenberg/ts/package-lock.json**: glob + lru-cache updates

Some files from the original PR were skipped because they don't apply to
v4:
- `yarn-project/yarn.lock`: v4 uses tar@6, not tar@7
- `nodejs_module/yarn.lock`: v4 uses different lock file format (yarn v1
vs berry)

## Cherry-pick conflicts
Lock file conflicts due to different base versions on v4. Resolved by
keeping v4 specifiers while updating to the patched versions.

ClaudeBox log: https://claudebox.work/s/c3fa261b77bf8f67?run=1
…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
This PR fixes an error in backporting.
@alexghr alexghr enabled auto-merge (squash) March 16, 2026 17:41
#21605)

## Motivation

When `VALIDATOR_MAX_TX_PER_BLOCK` is not set but
`VALIDATOR_MAX_TX_PER_CHECKPOINT` is, the gossip-level proposal
validator enforces no per-block transaction limit at all. A single block
can't have more transactions than the entire checkpoint allows, so the
checkpoint limit is a valid upper bound for per-block validation.

## Approach

Use `validateMaxTxsPerCheckpoint` as a fallback when
`validateMaxTxsPerBlock` is not set in the proposal validator
construction. This applies at both construction sites: the P2P libp2p
service (gossip validation) and the validator-client factory (block
proposal handler).

## Changes

- **p2p**: Added `validateMaxTxsPerCheckpoint` to `P2PConfig` interface
and config mappings (reads from `VALIDATOR_MAX_TX_PER_CHECKPOINT` env
var)
- **p2p (libp2p_service)**: Use `validateMaxTxsPerBlock ??
validateMaxTxsPerCheckpoint` when constructing proposal validators
- **validator-client (factory)**: Same fallback when constructing the
`BlockProposalValidator`

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
## Summary
- Fast-forward merge of 51 commits from `v4` into
`backport-to-v4-staging`
- No conflicts — clean fast-forward merge
- 214 files changed across archiver, p2p, sequencer, prover, stdlib,
spartan, and more

ClaudeBox log: https://claudebox.work/s/4542813f964f2419?run=1

Co-authored-by: Santiago Palladino <santiago@aztecprotocol.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@alexghr alexghr disabled auto-merge March 16, 2026 18:24
@alexghr alexghr enabled auto-merge (squash) March 16, 2026 18:24
@ludamad ludamad force-pushed the backport-to-v4-staging branch from d3d3ff8 to ecc6cdc Compare March 16, 2026 18:58
ludamad and others added 3 commits March 16, 2026 21:20
Reverts #21138 on v4. ThreadedAsyncOperation has a use-after-free that
causes SIGBUS on macOS and silent memory corruption on Linux. Restoring
AsyncOperation (libuv pool) with the original deadlock-prevention
semaphore (UV_THREADPOOL_SIZE / 2) until a proper fix lands on next
(#21625).

[Post
mortem](https://gist.github.com/ludamad/443afe321853389a08693c4ff73676f7)
… test (#21642)

## Summary

- Removes the historic/finalized block verification checks from
`epochs_multiple.test.ts`
- The finalization logic on v4 is incorrect: it subtracts a fixed number
of blocks (`epochDuration * 2`) instead of accounting for variable
blocks per slot (up to 4 per slot), causing test timeouts
- The correct finalization implementation exists on `next` in #21156 but
is non-trivial to backport to v4
- Keeps the proven sync check intact — only historic/finalized
assertions are removed

## Context

See discussion in Slack: the current `getFinalizedL2BlockNumber` uses
`provenBlockNumber - epochDuration * 2` which doesn't account for
variable blocks per slot. This causes the tx mempool to evict
transactions too aggressively and the test to time out waiting for
finalization.

## Test plan

- CI should pass — the test still verifies epoch proving and proven
block sync, just without the finalized block assertions

ClaudeBox log: https://claudebox.work/s/a5e9cea005ce4a5a?run=1
@alexghr alexghr merged commit df8c59a into v4 Mar 17, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants