Skip to content

chore: Accumulated backports to v4#21064

Merged
alexghr merged 19 commits intov4from
backport-to-v4-staging
Mar 5, 2026
Merged

chore: Accumulated backports to v4#21064
alexghr merged 19 commits intov4from
backport-to-v4-staging

Conversation

@AztecBot
Copy link
Collaborator

@AztecBot AztecBot commented Mar 3, 2026

BEGIN_COMMIT_OVERRIDE
chore: chonk proof compression poc (#20645)
feat: Update L1 to L2 message APIs (#20913)
fix: adapt chonk proof compression for v4 Translator layout (#21067)
fix: omit bigint priceBumpPercentage from IPC config in testbench worker (#21086)
feat: standby mode for prover broker (#21098)
fix(p2p): remove default block handler in favor of block handler (#21105)
chore: prepare barretenberg-rs for crates.io publishing (#20496)
feat: reenable function selectors + additional validation in public setup allowlist (backport #20909, #21122) (#21129)
chore: remove stale aes comments (#21133)
chore: remove auto-tag job (#21127)
feat: calldata length validation of public setup function allowlist (#21139)
feat: run AVM NAPI simulations on dedicated threads instead of libuv pool (#21138)
feat: Remove non-protocol contracts from public setup allowlist (#21154)
END_COMMIT_OVERRIDE

Adds Chonk proof compression logic that utilizes two things:
1. Suyash's proposed EC point compression: store (x, sign_bit) instead of (x, y); leverage curve equation to reconstruct y-coord
2. Store all fields as u256 / 32 bytes. (Similar effect to Snappy compression but seems to do slightly better)

Overall effect is that each single "component" of the proof is represented as 32 bytes. E.g. an Fq (naively 2 Frs) becomes one u256. A bn254 commitment (naively 2 Fqs = 4 Frs) becomes one u256 representing the x-coord.

High level stats:
| Metric            | Value                                    |
|-------------------|------------------------------------------|
| Original size     | 1,935 Fr elements = ~60 KB|
| Snappy compressed size   | ~47 KB                    |
| Compressed size   | ~35 KB                   |
| Compression ratio | 1.72x                                    |
| Compress time     | 0.64 ms                                  |
| Decompress time   | 3.5 ms                                   |
This PR fixes issue A-548 by replacing the block-based L1-to-L2 message readiness API with a checkpoint-based one. The core insight: messages are grouped by checkpoint number, not block number, so readiness should be checked against the checkpoint the node has synced to.

Key changes:

New API getCheckpointNumber() added to AztecNode, L2BlockSource, and archiver interfaces — returns the latest synced checkpoint number.

Renamed getL1ToL2MessageBlock → getL1ToL2MessageCheckpoint — now returns CheckpointNumber instead of BlockNumber, eliminating the deprecated BlockNumber.fromCheckpointNumber cast.

Simplified isL1ToL2MessageReady — removed the forPublicConsumption flag entirely. This now checks whether we have reached the first block in the message's inclusion checkpoint.

Updated all callers — bot factory, cross-chain bot, e2e tests, spartan setup, and epoch tests. Removed all A-548 workaround comments.

E2E test improvements — new helpers advanceCheckpoint and waitForBlockToCheckpoint for checkpoint-aware test flow. The drift test now mines checkpoints instead of blocks.
AztecBot and others added 2 commits March 3, 2026 13:27
Adapts `proof_compression.hpp` for v4's Translator proof layout, which
differs from `next` in three ways:

1. **Wire commitments**: v4 uses `(NUM_WITNESS_ENTITIES - 3 -
NUM_OP_QUEUE_WIRES)` as a single batch instead of separately listing
gemini masking poly, `NUM_COMMITMENTS_IN_PROOF` wires, and z_perm
2. **Sumcheck evaluations**: v4 sends all entity evaluations
(`NUM_ALL_ENTITIES`) instead of a subset (`NUM_SENT_EVALUATIONS`)
3. **Gemini P pos/neg**: v4 includes two extra Gemini interleaving
evaluations that were removed on `next`

The static_assert validates the walk produces exactly
`TranslatorFlavor::PROOF_LENGTH` Fr elements. Build verified locally —
`chonk_tests` compiles cleanly.

This unblocks backport PR
#21064.

ClaudeBox log: http://ci.aztec-labs.com/eb8ee3312bb1d8e2-2
@ludamad ludamad added ci-full Run all master checks. ci-merge-queue and removed ci-full Run all master checks. labels Mar 3, 2026
…ker (#21086)

Fixes `TypeError: Do not know how to serialize a BigInt` in
`p2p_client.proposal_tx_collector.bench.test.ts`.

`childProcess.send()` uses JSON serialization under the hood, which
cannot handle BigInt values. The recently added `priceBumpPercentage`
config field is a `bigint`, causing the worker fork to crash.

This omits `priceBumpPercentage` from the IPC config

ClaudeBox log: http://ci.aztec-labs.com/6d6b6eba6d0eecf1-1
## Summary

- Extracts the node's rollup standby logic into a shared module (`standby.ts`) so both the node and the prover broker can wait for a compatible L1 rollup before starting
- Adds standby mode to the prover broker startup — previously it would crash on `getL1Config()` if the canonical rollup was incompatible (e.g. during L1 contract upgrades)
- Reduces the standby poll interval from 600s to 60s and replaces the manual `while(true) + sleep` loop with `retryUntil` from `@aztec/foundation/retry` (both suggested as review feedback on #20937)

## Changes

**New: `aztec/src/cli/cmds/standby.ts`**
- `computeExpectedGenesisRoot(config, userLog)` — computes genesis archive root from test accounts, sponsored FPC, and prefund addresses
- `waitForCompatibleRollup(config, expectedGenesisRoot, port, userLog)` — checks L1 rollup genesis root, enters standby with a K8s health server if mismatch, polls every 60s via `retryUntil`

**Modified: `aztec/src/cli/cmds/start_node.ts`**
- Removed inline `waitForCompatibleRollup` function and genesis computation logic
- Now imports and calls the shared functions from `standby.ts`
- Cleaned up unused imports (`RegistryContract`, `RollupContract`, `sleep`, `Koa`, etc.)

**Modified: `aztec/src/cli/cmds/start_prover_broker.ts`**
- Added `computeExpectedGenesisRoot` + `waitForCompatibleRollup` calls before `getL1Config()`, matching the node's pattern

Fixes A-608
)

The default block handler was limited in that it failed to handle block proposals out of order, missed validations, missed proper timeouts, etc. It's not removed in favor of the full block proposal handler, which is installed if the validator client is not set.
## Summary
- Add `include` field to barretenberg-rs `Cargo.toml` so generated `api.rs` and `generated_types.rs` are packaged by `cargo publish`, even though they remain gitignored
- Add `release` function to `barretenberg/rust/bootstrap.sh` — sets crate version from `REF_NAME`, verifies generated files exist, and runs `cargo publish`
- Hook `barretenberg/rust` into the top-level release orchestrator (after `barretenberg/ts` which generates the Rust bindings)
- Add `publish = false` to the tests crate

## How it works
1. Generated files stay **gitignored** — not committed to the repo
2. The `include` field in `Cargo.toml` overrides `.gitignore` for `cargo publish`, so the files are packaged as long as they exist on disk
3. During a release, `barretenberg/ts` runs first (which calls `yarn generate`), then `barretenberg/rust` publishes
4. No separate workflow — follows the same unified release flow as npm packages

## Test plan
- [x] `cargo package --list --allow-dirty` confirms `src/api.rs` and `src/generated_types.rs` are included
- [x] `cargo publish --dry-run --allow-dirty --no-verify` succeeds
- [ ] Set `CARGO_REGISTRY_TOKEN` env var in release environment before first publish
…etup allowlist (backport #20909, #21122) (#21129)

Combined backport of
#20909 and
#21122 to v4.

#20909 re-enables function selector checking in the setup allowlist, and
#21122 (which depends on it) adds `onlySelf` and `rejectNullMsgSender`
validation flags.

Cherry-picked in order with conflict resolution for v4 compatibility.

ClaudeBox log: http://ci.aztec-labs.com/766112c90222bb64-2
…21139)

## Summary

- Add calldata length validation to the public setup function allowlist in `PhasesTxValidator`, preventing setup calls with malformed arguments from being accepted
- Extend `AllowedElement` with an optional `calldataLength` field and compute expected lengths dynamically from contract artifacts (`AuthRegistry`, `FeeJuice`, `Token`)
- Reject setup calls where calldata length doesn't match the expected length for the matched allowlist entry, returning a new `TX_ERROR_SETUP_WRONG_CALLDATA_LENGTH` error

## Details

Even when a setup function call matches the allowlist by address/class and selector, it can still revert if the arguments are malformed. Since Aztec's ABI has no variable-size inputs, validating that the calldata length matches the expected length for a given selector is sufficient to guarantee the arguments are deserializable.

**AllowedElement type** (`stdlib`): Added optional `calldataLength?: number` to both `AllowedInstanceFunction` and `AllowedClassFunction`, plus corresponding Zod schema updates.

**PhasesTxValidator** (`p2p`): After matching an entry by address or class+selector, checks `entry.calldataLength` against `publicCall.calldata.length` before proceeding to `onlySelf`/`rejectNullMsgSender` checks. When `calldataLength` is not set, any length is accepted (backwards compatible).

**Default allowlist** (`p2p`): Uses `getFunctionArtifactByName` + `countArgumentsSize` from `stdlib/abi` to compute expected calldata lengths from `AuthRegistryArtifact`, `FeeJuiceArtifact`, and `TokenContractArtifact`.

Fixes A-612
Resolve conflicts:
- Use v4's perBlockAllocationMultiplier naming (not gasPerBlockAllocationMultiplier)
- Keep backported txPublicSetupAllowListExtend rename
- Keep v4's validator-specific limits (validateMax* fields)
- Accept v4's deletion of proposal_validator test files
- Merge changelog and README sections from both sides
@AztecBot AztecBot added the claudebox Owned by claudebox. it can push to this PR. label Mar 5, 2026
@ludamad ludamad removed the claudebox Owned by claudebox. it can push to this PR. label Mar 5, 2026
…pool (#21138)

## Summary

AVM simulations previously used `Napi::AsyncWorker` which runs on the **libuv thread pool**. During simulation, C++ calls back to JS for contract data via `BlockingCall`, and those JS callbacks do async I/O (LMDB, WorldState) that also needs libuv threads. With all libuv threads occupied by sims, the callback I/O deadlocks.

This PR introduces `ThreadedAsyncOperation` which spawns a **dedicated `std::thread` per simulation** and signals completion back to the JS event loop via `ThreadSafeFunction`. This structurally prevents the deadlock — libuv threads are always available for callback I/O.

### Changes
- **`async_op.hpp`**: New `ThreadedAsyncOperation` class — spawns `std::thread`, uses TSFN for completion, self-destructs after resolving/rejecting the promise
- **`avm_simulate_napi.cpp`**: Both `simulate` and `simulateWithHintedDbs` now use `ThreadedAsyncOperation` instead of `AsyncOperation`
- **`native_module.ts`**: Deadlock-prevention semaphore removed. Optional resource-limit semaphore available via `MAX_CONCURRENT_AVM_SIMULATIONS` env var (default: unlimited)

### Why this helps multi-sequencer tests
Previously, running multiple sequencers in one process required careful tuning of `UV_THREADPOOL_SIZE` and concurrent sim limits to avoid deadlock. With this change, AVM sims don't touch the libuv pool at all, so any number of concurrent simulations can run without starving each other's callbacks.

ClaudeBox log: http://ci.aztec-labs.com/884501541464780d-1
## Summary

Removes non-protocol contracts (Token class-based entries) from the default public setup allowlist for alpha. Token class IDs change with aztec-nr releases, making the allowlist hard to maintain—and FPC-based fee payment with custom tokens won't be supported on mainnet alpha.

- **Removed Token entries from the default allowlist** (`allowed_public_setup.ts`): only protocol contracts (AuthRegistry, FeeJuice) remain in the hardcoded defaults
- **Extended `parseAllowList` to support validation flags**: new optional flags segment (`os`, `rn`, `cl=N`) so node operators who manually re-add entries get proper `onlySelf`, `rejectNullMsgSender`, and `calldataLength` validation
- **Updated e2e tests to manually extend the allowlist**: `FeesTest` and `ClientFlowsBenchmark` now compute Token allowlist entries and pass them via `txPublicSetupAllowListExtend`
- **Updated local network node** (`local-network.ts`): computes Token allowlist entries at startup so FPC-based fee payments continue to work in local development and CI
- **Deprecated `PublicFeePaymentMethod` and `PrivateFeePaymentMethod`** in aztec.js with `@deprecated` JSDoc tags
- **Added CLI wallet deprecation warnings** for `fpc-public` and `fpc-private` payment methods
- **Added warning comment to FPC Noir contract** clarifying it's a reference implementation that won't work on mainnet alpha
- **Updated v4 changelog** with the breaking change, new flag syntax documentation, and migration guidance

## Test plan

- [x] Unit tests: `p2p/src/config.test.ts` (11 tests including 4 new flag parsing tests)
- [x] Unit tests: `p2p/src/msg_validators/tx_validator/phases_validator.test.ts` (23 tests)
- [x] E2E tests: all 8 fee test suites (26 tests total) — public_payments, private_payments, failures, account_init, gas_estimation, sponsored_payments, fee_juice_payments, fee_settings
- [ ] E2E: `e2e_local_network_example.test.ts` (requires running local network — unchanged, validated via local-network.ts code review)
- [x] Alert `@AztecProtocol/devrel` to update docs

Fixes A-606
…20563) (#21110)

## Summary

Backport of #20563
to v4.

**Commit 1** — Cherry-pick of the original squash merge (authored by
@mverzilli), conflicts resolved by accepting the incoming version.

**Commit 2** — Fix commit adapting the cherry-pick for v4:
- Resolved `send()` return type destructuring in 11 files
- Wired `additionalScopes` in `base_wallet`, `interaction_options`, and
`wallet.ts` schemas
- Deleted modify/delete conflict files (`e2e_custom_message.test.ts`,
`e2e_pxe.test.ts`) not present on v4
- Kept v4's `AvmGadgetsTestContract` name in `n_tps_prove.test.ts`
- Added `GasFees` import for priority fee logic in
`e2e_block_building.test.ts`
- Updated bot factory for v4 PrivateToken deploy pattern

Closes F-322.

---------

Co-authored-by: Martin Verzilli <martin@aztec-labs.com>
@mverzilli mverzilli requested a review from a team as a code owner March 5, 2026 15:17
@alexghr alexghr enabled auto-merge (squash) March 5, 2026 16:22
@alexghr alexghr disabled auto-merge March 5, 2026 16:47
@alexghr alexghr enabled auto-merge (squash) March 5, 2026 17:01
Backport of #21155
to v4.

This PR applies configuration settings for Alpha — renaming
`SEQ_MAX_TX_PER_BLOCK` to `SEQ_MAX_TX_PER_CHECKPOINT` across environment
files, deploy scripts, and terraform config. Also updates alpha/mainnet
network defaults (enabling transactions, setting P2P pool count).

The only conflict was `spartan/environments/alpha-net.env` which was
deleted in v4, so that change was dropped.

ClaudeBox log: http://ci.aztec-labs.com/73fd5ca0474b3c34-1

Co-authored-by: PhilWindle <60546371+PhilWindle@users.noreply.github.com>
@AztecBot
Copy link
Collaborator Author

AztecBot commented Mar 5, 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/2b70e12ca4a31f8b�2b70e12ca4a31f8b8;;�):  yarn-project/end-to-end/scripts/run_test.sh simple src/e2e_epochs/epochs_l1_reorgs.parallel.test.ts "updates L1 to L2 messages changed due to an L1 reorg" (61s) (code: 0) group:e2e-p2p-epoch-flakes

@alexghr alexghr merged commit 77e5b3c into v4 Mar 5, 2026
9 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.

9 participants