Open
Conversation
…#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
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
…ing blocks (with conflicts)
…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.
#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>
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
## Summary PR #21597 increased the finalized block lookback from `epochDuration*2` to `epochDuration*2*4`, which caused the finalized block number to jump backwards past blocks already pruned from world-state. The native `advance_finalized_block` then failed trying to read pruned block data, crashing the block stream with: ``` Error: Unable to advance finalized block: 15370. Failed to read block data. Tree name: NullifierTree ``` Two fixes: - **TypeScript** (`server_world_state_synchronizer.ts`): Clamp the finalized block number to `oldestHistoricalBlock` before calling `setFinalized`, so we never request a pruned block. - **C++** (`cached_content_addressed_tree_store.hpp`): Reorder checks in `advance_finalized_block` to check the no-op condition (`finalizedBlockHeight >= blockNumber`) before attempting `read_block_data`. This makes the native layer resilient to stale finalized block numbers. Full analysis: https://gist.github.com/AztecBot/6221fb074ed7bbd8a753ec3602133b42 ClaudeBox log: https://claudebox.work/s/8e97449f22ba9343?run=1
…21656) ## Summary Follow-up to #21643. The clamping fix avoided the `setFinalized` error, but the method continued into the pruning logic where `removeHistoricalBlocks` failed with: ``` Unable to remove historical blocks to block number 15812, blocks not found. Current oldest block: 15812 ``` Two changes: - When the finalized block is older than `oldestHistoricalBlock`, return early instead of clamping and continuing. There's nothing useful to do — world-state is already finalized past this point. - Guard `removeHistoricalBlocks` against being called with a block `<= oldestHistoricalBlock`, which the C++ layer rejects. The C++ reorder fix from #21643 is preserved. ClaudeBox log: https://claudebox.work/s/8e97449f22ba9343?run=4
## Summary Demotes the "Finalized block X is older than oldest available block Y. Skipping." log from `warn` to `trace`. This message fires on every block stream tick while the finalized block is behind the oldest available, filling up operator logs on deployed networks. ClaudeBox log: https://claudebox.work/s/8e97449f22ba9343?run=6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)
fix(p2p): fall back to maxTxsPerCheckpoint for per-block tx validation (#21605)
chore: merge v4 into backport-to-v4-staging (#21618)
fix(revert): avm sim uses event loop again (#21138) (#21630)
fix(e2e): remove historic/finalized block checks from epochs_multiple test (#21642)
fix: clamp finalized block to oldest available in world-state (#21643)
fix: skip handleChainFinalized when block is behind oldest available (#21656)
chore: demote finalized block skip log to trace (#21661)
END_COMMIT_OVERRIDE