Skip to content

chore: port-to-v6 rolling ports - #25597

Merged
IlyasRidhuan merged 4 commits into
v6from
cb/port-to-v6
Oct 8, 2026
Merged

IlyasRidhuan merged 4 commits into
v6from
cb/port-to-v6

Conversation

@AztecBot

@AztecBot AztecBot commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

Rolling integration PR carrying merged port-to-v6 PRs from next onto v6. One commit per source PR (plus a fix(port): commit after any conflicted pick).

Ported

  • #25596 chore: remove ledwards2225 from CODEOWNERS — clean pick
  • #25609 feat: update L1 gas constants for Glamsterdam — clean pick. It adds labs-patches/0011-… to v6's otherwise empty patch queue. The patch's pre-image blobs match v6's labs pin ee1312cf, so it applies there unchanged.
  • #25600 test(l1-contracts): measure BN254 proof-of-possession gas against the GSE cap — clean pick. The sources and fixtures it imports (BN254Lib.sol, Bn254LibWrapper.sol, BN254Fixtures.t.sol, bn254_constants.json) are identical on v6 and next.
  • #25619 fix(l1): escape hatch, staking flush and rollup registration payload fixes — clean pick. All 34 touched files match next byte-for-byte afterwards.

Created by claudebox · group: slackbot · Slack thread

@AztecBot AztecBot added ci-draft Run CI on draft PRs. ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure claudebox Owned by claudebox. it can push to this PR. labels Oct 5, 2026
AztecBot and others added 4 commits October 8, 2026 05:23
Removes `@ledwards2225` from every entry in `CODEOWNERS`, as requested
by Tom French.

The 12 affected entries cover `/barretenberg/`, the
`noir-protocol-circuits` paths (kernels, rollup, parity, blob), the
circuit JSON files, and `noir-contracts`. Each one still has at least
two owners afterward, so no path is left without an owner.

---
*Created by
[claudebox](https://claudebox.work/v2/sessions/c853494dbde67212/jobs/1)
· group: `slackbot` · requested by Tom (@TomAFrench) · [Slack
thread](https://aztecfoundation.slack.com/archives/D0B586H14KG/p1791215548634289?thread_ts=1791215548.634289&cid=D0B586H14KG)*

(cherry picked from commit bb004df)
## What changed

`FeeLib.sol` prices the L1 work a sequencer and a prover must recover
with two constants. They were placeholders taken from a forge benchmark
run under `--evm-version amsterdam`. This PR replaces them with values
measured on Sepolia after Glamsterdam:

| Constant | Old | New |
|---|---|---|
| `L1_GAS_PER_CHECKPOINT_PROPOSED` | 500,000 | 520,000 |
| `L1_GAS_PER_EPOCH_VERIFIED` | 4,000,000 | 2,500,000 |

Sepolia measurements:

- **Propose** (through Multicall3 `aggregate3`): median 487k; ~514k per
checkpoint on average once the `setupEpoch` folded into each epoch's
first checkpoint is counted; the most expensive regular propose was
520k.
- **Epoch proof** (first proof submitted for an epoch): median 2.36M,
max 2.51M.

The governance proposal is at
AztecProtocol/governance#68.

## Mirrors updated

- `l1-contracts/test/fixtures/fee_data_points.json` is recomputed for
the new constants. Only the sequencer, prover and protocol fee
components change. The congestion multiplier and the L1 fee inputs stay
the same. The recompute script reproduces the current fixture exactly
with the old constants (0 of 672 points differ), so the only thing that
moves is the constants.
- `labs-patches/0011` makes the same change to the TypeScript port
(`yarn-project/stdlib/src/gas/fee_math.ts`), updates the constants table
in the stdlib gas README, and updates the epoch constant hardcoded in
the single-node `fees_test.ts` e2e. The patch stays in the series until
the aztec-node PR lands.

Nothing else in the tree mirrors these values: they are not in the
constants codegen, and no docs state them.

## Testing

- `forge test` in `l1-contracts` (excluding the verifier-dependent
scripts, `shouting.t.sol` and `UniswapPortalTest`): 1370 passed, 0
failed. The fee suites under `test/fees/` (43 tests) pass both before
and after the change.
- In aztec-node, `stdlib/src/gas` and `stdlib/src/tx`, the
sequencer-client `global_variable_builder` tests and the aztec-node
`next_block` tests all pass. `fee_predictor.test.ts` deploys the rollup
to anvil and checks the TypeScript predictions against
`getManaMinFeeAt`. It fails when only the TypeScript side is updated
(`625010100000 != 598135100000`). It passes once the L1 contracts carry
the new constants too.

(cherry picked from commit 828486f)
… GSE cap (#25600)

Measures BN254 proof-of-possession verification gas against the GSE cap,
and publishes a calibration fixture and a conservative cost model for
tooling that screens validator keys before registration.

## What

Under `test/shared/bn254-pop-gas/`:
- `PopGasBase.sol`: a counting copy of `hashToPoint` (checked against
`BN254Lib.g1ToDigestPoint` on every run). It measures in-wrapper gas and
binary-searches the minimum `{gas: g}` stipend.
- `BN254G2TestLib.sol`: test-only G2 scalar multiplication to build
`pk2`. Reproduces all 50 `pk2` values in `bn254_constants.json`.
- `PopGasVectors.t.sol` (runs in CI): every vector is a valid PoP whose
attempts, sqrt calls, rejections, root choice and digest match the
library; the corpus covers all branches; the recorded gas matches the
active EVM version; the model bounds every vector.
- `PopGasScan.t.sol` and `PopGasGenerate.t.sol`: opt-in (env-gated)
scanning and regeneration.
- `scripts/bn254_pop_gas_model.py`: runs forge per EVM version, fits the
model, and writes `test/fixtures/bn254_pop_gas_vectors.json`. The output
is deterministic.
- `README.md`: method, tables, commands and fixture format.

## Results

On this path, Osaka and the next fork (`amsterdam` in Foundry 1.8.4)
price identically. Modexp is 4,016 gas per sqrt call, versus 1,338 on
Prague.

Model (minimum stipend, fitted on 2,152 keys, max residual 8 gas):
`gas ≤ 132,694 + 515·attempts + 4,580·sqrtCalls + 0.096·attempts²`

| Cap | Honest keys over the cap |
|---|---|
| 250k | ~1 in 28,559 |
| 300k | ~1 in 2.48M |
| 500k | 9.6e-15 |
| 1M | 5.1e-33 |

`hashToPoint` is unbounded, so no finite worst case is claimed.

## Commands

```
cd l1-contracts
python3 scripts/bn254_pop_gas_model.py            # regenerate (Foundry 1.8.4 on PATH)
forge test --match-contract PopGasVectorsTest --evm-version {amsterdam,osaka,prague}
```

(cherry picked from commit 5727158)
…fixes (#25619)

Four L1 fixes, one commit each.

## Changes

- **fix(l1): bind rollup registration payload to its predecessor.**
`RegisterNewRollupVersionPayload` records the Registry's canonical
rollup at deployment as an immutable `PREDECESSOR`, and its first
action, `assertPredecessorIsCanonical()`, reverts unless that rollup is
still canonical. A registration payload therefore only executes as a
transition from the rollup that was canonical when it was deployed. The
constructor signature is unchanged. The scenario tests now import the
production payload instead of a test-only copy, which is removed.
- **fix(l1): do not designate a fully exited candidate as escape hatch
proposer.** `EscapeHatch.selectCandidates()` draws from the
candidate-set snapshot, but the drawn candidate may have since left the
set entirely. In that case the hatch is now left prepared without a
designated proposer, the same outcome as an empty snapshot.
- **fix(l1): sample escape hatch RANDAO after the candidate set
freeze.** The escape hatch now accounts for the rollup's own
`lagInEpochsForRandao` when it queries the sample seed, so the RANDAO
used for the draw is the one checkpointed in the seed epoch, after the
freeze, for any rollup lag. This adds `getRollupLagInEpochsForRandao()`
to `EscapeHatch`/`IEscapeHatch`, sets `AZTEC_LAG_IN_EPOCHS_FOR_RANDAO`
to 1 in `network-defaults.json`, and corrects the
`ValidatorSelectionLib` docs on the RANDAO lag.
- **fix(staking): require a per-deposit gas floor in flushEntryQueue.**
Before each `GSE.deposit`, `flushEntryQueue` requires enough gas for the
deposit (including the live proof-of-possession gas limit) plus the
refund path, and otherwise reverts with
`Staking__InsufficientFlushGas(required, available)`. The reserves are
sized for the Glamsterdam gas schedule. `DeployRollupLib` no longer
flushes inside the deploy broadcast. Instead, `forge_broadcast.js` runs
the new `FlushEntryQueue.s.sol` as a separate broadcast.

## Testing

- `forge fmt --check`, `forge build` and
`scripts/check_contract_sizes.sh` pass in `l1-contracts`.
- New and updated tests: `AddRollup.t.sol`,
`escape-hatch/unit/selectCandidates.t.sol` (run with rollup RANDAO lags
of 2 and 1), `escape-hatch/unit/getters.t.sol`,
`staking/flushGasFloor.t.sol`, `staking/tmnt221.t.sol`,
`staking/tmnt333.t.sol` and `governance/gse/gse/tmnt395.t.sol`.
- Full `forge test` passes. `FlushGasFloorMainnetFork.t.sol` skips
without `MAINNET_FORK_RPC`, and the measurement suites under
`test/staking/flush-gas-floor/` skip unless `FLUSH_GAS_FLOOR_MEASURE` is
set.

(cherry picked from commit 9f6ddc4)
@IlyasRidhuan
IlyasRidhuan enabled auto-merge (squash) October 8, 2026 05:36
@AztecBot

AztecBot commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author

Flakey Tests

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

\033FLAKED\033 (8;;http://ci.aztec-labs.com/fbac1d01375e0015�fbac1d01375e00158;;�): cd labs && export root= ci3= &&  yarn-project/end-to-end/scripts/run_test.sh simple src/multi-node/slashing/inactivity_slash_with_consecutive_epochs.test.ts (267s) (code: 0) group:e2e-p2p-epoch-flakes
\033FLAKED\033 (8;;http://ci.aztec-labs.com/1a38ef8903139e27�1a38ef8903139e278;;�): cd labs && export root= ci3= &&  yarn-project/end-to-end/scripts/run_test.sh simple src/multi-node/slashing/inactivity_slash.test.ts (379s) (code: 0) group:e2e-p2p-epoch-flakes

@IlyasRidhuan
IlyasRidhuan merged commit 345d3d7 into v6 Oct 8, 2026
8 checks passed
@IlyasRidhuan
IlyasRidhuan deleted the cb/port-to-v6 branch October 8, 2026 05:49
IlyasRidhuan pushed a commit that referenced this pull request Oct 8, 2026
…t to v6] (#25624)

Port of
[aztec-packages#25521](#25521)
to `v6`, on its own branch so that the rolling port PR
[aztec-packages#25597](#25597)
can merge without it (see *Testnet compatibility pins*). The two PRs
touch different files and apply in either order. Together, the labs
series is #25597's `0011` followed by `0012`–`0018` from this PR, and
that combination applies cleanly to v6's labs pin `ee1312cf`.

Three commits:

1. **Raw pick** of `a36ddcc1c4c`, with git's conflict markers, in the
three world-state and genesis paths that sit in different places on v6
and next.
2. **`fix(port):`**, which resolves those conflicts and regenerates the
labs patches `0012`–`0014` against v6's labs pin.
3. **`fix(port):`**, which adds `0018` to pin labs' testnet
compatibility test to the V3 roots.

## Foundation side

- `genesis_protocol_nullifiers.hpp` keeps v6's `bb::world_state` layout
and takes the new seed set. The only seed the V3 separator moves is
ContractInstanceRegistry's registration nullifier, `0x2c1eb0…` →
`0x16f917…`.
- `world_state.test.cpp` keeps asserting the `GENESIS_*` macros. On v6
those come from `aztec_constants.hpp`, generated from the in-tree
`constants.nr`.
- `regenerate_genesis_constants.sh` stays as v6 has it. The source
change's `genesis_*_root()` functions (and the `--check` hunk for them)
are there for next's wsdb package, which reads its constants from a
pinned foundation release.
- Everything else (AVM pil and C++, codegen selections, `constants.nr`,
`Prover.toml`s, L1 checkpoint fixtures) picks clean.

## Labs side (`labs-patches`)

v6's labs pin `ee1312cf` is 101 commits ahead of next's `54e3383c` and
has its own standard-contract pin, so next's `0012`–`0014` did not fit
it. Those three patches were regenerated on a full build of this tree:

- `0012`: the separator rename and the address vectors from next,
applied unchanged, plus the address tables the standard-contracts
generator derives from v6's pinned artifacts under V3.
- `0013`: the migration note, with v6's V2 → V3 table.
- `0014`: `noir-contracts/bootstrap.sh pin-standard-build` with V3, plus
the regenerated tables. The re-pin is intentional: HandshakeRegistry
compiles the separator in through `get_public_keys`, and V3 moves these
addresses regardless.
- `0015`–`0017` are byte-identical to next's.
- `0018`: the testnet compatibility pins (below).

| Contract | V2 (v6 today) | V3 (this PR) |
| --- | --- | --- |
| AuthRegistry | `0x2e05e8fb…f7c9` | `0x2ba87146…3a9c` |
| MultiCallEntrypoint | `0x09b93e8e…5137` | `0x265552a4…fcc2` |
| PublicChecks | `0x0468c918…dbbe` | `0x2cfebe97…d21a` |
| HandshakeRegistry | `0x24d2effa…0fc7` | `0x198aa5f2…6040` |

PublicChecks' V3 address matches next's exactly, because its V2 address
was the same on both lines. The other three differ from next because
v6's pinned artifacts differ. The re-pin also changes AuthRegistry's and
MultiCallEntrypoint's bytecode: aztec-nr has moved on since v6's pin was
cut, while nargo is the same build. PublicChecks' bytecode is unchanged.
The pinned artifacts do not compile in the `STANDARD_*_ADDRESS` stamps
(checked by recompiling with both stamp sets), so the pin and the
address tables agree.

## Testnet compatibility pins

`labs/yarn-project/aztec/src/testnet_compatibility.test.ts` pins the VK
tree root, the protocol-contracts hash and the genesis archive root, and
V3 moves all three. `0018` sets them to the values the V3 tree produces
on v6, as reported by the test in CI3 run
[37721289208](https://github.com/AztecProtocol/aztec-packages/actions/runs/37721289208):

| Pin | V2 | V3 |
| --- | --- | --- |
| VK tree root | `0x031139ab…f75d` | `0x13eeb174…9e02` |
| Protocol-contracts hash | `0x0030cdae…b378` | `0x0f54271c…54d7` |
| Genesis archive root | `0x2ef904bb…bfb6` | `0x29eb2c52…e5c4` |

Because of this, the v6 line is no longer compatible with the current
testnet deployment; that is the intended effect of shipping V3 on v6.

## Checks run locally

- Built with `make labs-yarn-project`, plus the labs `yarn-project`
build: no generator drift after regeneration.
- `labs-patches/bootstrap.sh check` passes. The series also applies
after #25597's `0011`.
- Jest:
- stdlib `derivation`, `contract_address` and `complete_address` (14/14)
  - `noir_test_gen` (6/6)
  - `standard_contract_data` drift (5/5)
  - `contract_instance_published_event` (1/1)
  - `key_store` (4/4)
  - PXE storage backwards compatibility (16/16)
- Noir:
  - aztec-nr `domain_separators_are_valid`
  - HandshakeRegistry `recipient_signature` (8/8)
- protocol `types` crate: `constants_tests` (4/4) and
`address::aztec_address` (9/9)
- C++: `world_state_tests` `GetInitialTreeInfoForAllTrees`.
- `regenerate_genesis_constants.sh --check`: up to date. Measured from
v6's own artifacts, the roots equal the `constants.nr` values.

Everything else is covered by CI3, which passes on `1e629c1`.

The next step after this lands on v6 and a V3 rc is published: upstream
`0012`–`0018` to aztec-node `main`, then bump and drain the queue as in
[aztec-packages#25594](#25594).

Refs #25521

---
*Created by
[claudebox](https://claudebox.work/v2/sessions/9666bbcd1ae659f5/jobs/8)
· group: `slackbot` · requested by Santiago Palladino · [Slack
thread](https://aztecprotocol.slack.com/archives/C0AGN2WT3CP/p1791216786568079?thread_ts=1791216786.568079&cid=C0AGN2WT3CP)*

---------

Co-authored-by: Michael Connor <mike@aztecprotocol.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-draft Run CI on draft PRs. ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure claudebox Owned by claudebox. it can push to this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants