Skip to content

Commit 34166f7

Browse files
committed
chore(fast-inbox): single canonical path for rollup sample-input regeneration (A-1435)
Make the prover-client regenerate_rollup_sample_inputs suite the sole owner of every block-root, block-merge, checkpoint, tx-merge, and root rollup Prover.toml, and stop the e2e full.test dump from writing the block-root and checkpoint samples it overlapped on. The two paths previously both wrote rollup-block-root-first, rollup-block-root-first-single-tx, rollup-checkpoint-root-single-block, rollup-checkpoint-merge, and rollup-root, so the committed fixtures drifted depending on which ran last. The e2e dump now regenerates only what needs real client-proved transactions the simulated orchestrator cannot produce: the private-kernel circuits and the transaction-base rollups. A dedicated three-tx scenario restores rollup-tx-merge coverage (dropped when orchestrator_single_checkpoint.test.ts was replaced), so the suite covers every rollup circuit at or above the transaction merge. Update the regen docs (barretenberg cpp CLAUDE.md, update-prover-toml and gate-counts skills) to the two-command split and drop the dead orchestrator_single_checkpoint references.
1 parent beda331 commit 34166f7

6 files changed

Lines changed: 77 additions & 64 deletions

File tree

barretenberg/.claude/skills/gate-counts/SKILL.md

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -209,41 +209,42 @@ Then retry `bb gates`.
209209
The committed `Prover.toml` files carry fake recursive proofs whose length is
210210
frozen at the value present when they were last generated. After a proof-length
211211
change they must be regenerated (or hacked — see below). Two commands cover all
212-
protocol circuits:
212+
protocol circuits, split by whether the sample needs a real client-proved
213+
transaction.
213214

214-
**Kernel circuits + most rollup circuits** (spins up an L1/anvil sandbox):
215+
**Block-root and above rollup circuits — prover-client suite** (simulated
216+
orchestrator, no L1 sandbox):
215217

216218
```bash
217-
AZTEC_GENERATE_TEST_DATA=1 FAKE_PROOFS=1 \
218-
yarn workspace @aztec/end-to-end test:e2e e2e_prover/full.test
219+
AZTEC_GENERATE_TEST_DATA=1 \
220+
yarn workspace @aztec/prover-client test regenerate_rollup_sample_inputs
219221
```
220222

221-
Regenerates `Prover.toml` for: `private-kernel-init` and its `private-kernel-init-N`
222-
variants, `private-kernel-inner` and its `private-kernel-inner-N` variants,
223-
`private-kernel-reset`, `private-kernel-reset-tail`,
224-
`private-kernel-reset-tail-to-public`, `rollup-tx-base-private`,
225-
`rollup-tx-base-public`, `rollup-block-root-first`,
226-
`rollup-block-root-first-single-tx`, `rollup-checkpoint-root-single-block`,
227-
`rollup-checkpoint-merge`, `rollup-root`.
223+
Regenerates `Prover.toml` for `rollup-block-root-first-empty-tx`,
224+
`rollup-block-root-first`, `rollup-block-root-first-single-tx`,
225+
`rollup-block-root`, `rollup-block-root-single-tx`, `rollup-block-merge`,
226+
`rollup-checkpoint-root`, `rollup-checkpoint-root-single-block`,
227+
`rollup-checkpoint-merge`, `rollup-tx-merge`, `rollup-root`.
228228

229-
**Rollup circuits NOT covered by `full.test`** (incl. `rollup-tx-merge`):
229+
**Private-kernel + transaction-base circuits — e2e prover full test** (spins up
230+
an L1/anvil sandbox):
230231

231232
```bash
232233
AZTEC_GENERATE_TEST_DATA=1 FAKE_PROOFS=1 \
233-
yarn workspace @aztec/prover-client test src/orchestrator/orchestrator_single_checkpoint.test.ts
234+
yarn workspace @aztec/end-to-end test:e2e e2e_prover/full.test
234235
```
235236

236-
Regenerates `Prover.toml` for `rollup-tx-merge`, `rollup-block-root-first-empty-tx`,
237-
`rollup-block-root` (single-tx checkpoint test) and `rollup-block-root-single-tx`,
238-
`rollup-block-merge`, `rollup-checkpoint-root` (multi-block checkpoint test).
239-
240-
> **`rollup-tx-merge`'s `Prover.toml` is regenerated by the prover-client
241-
> command, NOT `full.test`** — it is commented out in `full.test`'s circuit
242-
> list. Use the prover-client command for the tx-merge circuit.
237+
Regenerates `Prover.toml` for: `private-kernel-init` and its `private-kernel-init-N`
238+
variants, `private-kernel-inner` and its `private-kernel-inner-N` variants,
239+
`private-kernel-reset-tail`, `private-kernel-reset-tail-to-public`,
240+
`rollup-tx-base-private`, `rollup-tx-base-public`. These need real client-proved
241+
transactions the simulated orchestrator cannot produce. (`private-kernel-reset`,
242+
the inner reset, is commented out and hand-maintained — not regenerated.)
243243

244244
The circuit lists live in the `updateProtocolCircuitSampleInputs(...)` loops in
245-
`yarn-project/end-to-end/src/e2e_prover/full.test.ts` and
246-
`yarn-project/prover-client/src/orchestrator/orchestrator_single_checkpoint.test.ts`;
245+
`yarn-project/end-to-end/src/single-node/prover/server/full.test.ts` and the
246+
`scenarios` array in
247+
`yarn-project/prover-client/src/test/regenerate_rollup_sample_inputs.test.ts`;
247248
re-read them if a circuit seems missing (entries get commented in/out).
248249

249250
### Build prerequisites for regeneration

barretenberg/.claude/skills/update-prover-toml/SKILL.md

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: update-prover-toml
3-
description: Regenerate the protocol-circuit sample Prover.toml files (the witnesses CI feeds to `nargo execute`). Covers which e2e test/commands regenerate which tomls, and the one exception — private-kernel-reset/Prover.toml (the inner reset) which is NOT generated by the test at all and is maintained entirely by hand. Use when a `nargo execute` CI check fails on a crates/*/Prover.toml, after changing protocol-circuit inputs/constants, or when asked to refresh/regenerate Prover.toml sample inputs.
3+
description: Regenerate the protocol-circuit sample Prover.toml files (the witnesses CI feeds to `nargo execute`). Covers which of the two commands regenerates which tomls — the prover-client `regenerate_rollup_sample_inputs` suite for the block-root and above rollup circuits, and the e2e prover full test for the private-kernel and transaction-base circuits — and the one exception, private-kernel-reset/Prover.toml (the inner reset), which is NOT generated by the test at all and is maintained entirely by hand. Use when a `nargo execute` CI check fails on a crates/*/Prover.toml, after changing protocol-circuit inputs/constants, or when asked to refresh/regenerate Prover.toml sample inputs.
44
---
55

66
# Updating protocol-circuit Prover.toml files
@@ -21,11 +21,21 @@ The tomls are captured from a real end-to-end run, not written by hand (except t
2121

2222
## How regeneration works
2323

24-
`yarn-project/end-to-end/src/e2e_prover/full.test.ts` has a test "generates sample Prover.toml files if generate test data is on". During proving, circuit inputs are captured via `pushTestData`/`getTestData`; the test then calls `updateProtocolCircuitSampleInputs(circuitName, TOML.stringify(...))` (`yarn-project/foundation/src/testing/files/index.ts`), which writes `noir-projects/noir-protocol-circuits/crates/<circuitName>/Prover.toml`.
24+
Two commands cover the protocol-circuit tomls, split by whether the sample needs a real client-proved transaction. Both capture circuit inputs during proving via `pushTestData`/`getTestData` and write them with `updateProtocolCircuitSampleInputs(circuitName, TOML.stringify(...))` (`yarn-project/foundation/src/testing/files/index.ts`), which writes `noir-projects/noir-protocol-circuits/crates/<circuitName>/Prover.toml`.
2525

26-
The test early-returns unless **both** are true: `AZTEC_GENERATE_TEST_DATA=1` (enables `isGenerateTestDataEnabled()`) and fake proofs (`FAKE_PROOFS=1`, i.e. `REAL_PROOFS` is false).
26+
### Block-root and above rollup circuits — prover-client suite
2727

28-
### Command
28+
`yarn-project/prover-client/src/test/regenerate_rollup_sample_inputs.test.ts` drives representative epochs through the simulated orchestrator and dumps each rollup circuit's captured input. The whole suite is `describe.skip`ped unless `AZTEC_GENERATE_TEST_DATA=1`, and it needs no L1 sandbox.
29+
30+
```bash
31+
AZTEC_GENERATE_TEST_DATA=1 yarn workspace @aztec/prover-client test regenerate_rollup_sample_inputs
32+
```
33+
34+
Regenerates: `rollup-block-root-first-empty-tx`, `rollup-block-root-first`, `rollup-block-root-first-single-tx`, `rollup-block-root`, `rollup-block-root-single-tx`, `rollup-block-merge`, `rollup-checkpoint-root`, `rollup-checkpoint-root-single-block`, `rollup-checkpoint-merge`, `rollup-tx-merge`, `rollup-root`. The scenario list lives in the `scenarios` array in that test; each scenario's `dump` field names the tomls it owns.
35+
36+
### Private-kernel and transaction-base circuits — e2e prover full test
37+
38+
`full.test.ts` has a test "generates sample Prover.toml files if generate test data is on". It early-returns unless **both** `AZTEC_GENERATE_TEST_DATA=1` (enables `isGenerateTestDataEnabled()`) and fake proofs (`FAKE_PROOFS=1`, i.e. `REAL_PROOFS` is false) are set. These circuits need real client-proved transactions, which the simulated orchestrator suite above cannot produce.
2939

3040
From the repo root:
3141

@@ -35,25 +45,16 @@ AZTEC_GENERATE_TEST_DATA=1 FAKE_PROOFS=1 yarn-project/end-to-end/scripts/run_tes
3545

3646
(Equivalently, from `yarn-project/end-to-end`: `AZTEC_GENERATE_TEST_DATA=1 FAKE_PROOFS=1 yarn test:e2e e2e_prover/full.test`.) This is a full-stack run (L1 anvil + node + prover), ~15 min with fake proofs.
3747

38-
After it finishes, review and stage the changed tomls with `git diff noir-projects/noir-protocol-circuits/crates/*/Prover.toml`.
39-
40-
### Which tomls this regenerates
41-
42-
The circuit list lives in the `forEach(circuitName => ...)` loop in `full.test.ts`. Currently active (regenerated by the run above):
48+
Regenerates:
4349

4450
- `private-kernel-init`, `private-kernel-init-2``private-kernel-init-5`
4551
- `private-kernel-inner`, `private-kernel-inner-2``private-kernel-inner-5`
4652
- `private-kernel-reset-tail`, `private-kernel-reset-tail-to-public` (the terminal resets — these run as part of every tx's tail)
4753
- `rollup-tx-base-private`, `rollup-tx-base-public`
48-
- `rollup-block-root-first`, `rollup-block-root-first-single-tx`
49-
- `rollup-checkpoint-root-single-block`, `rollup-checkpoint-merge`
50-
- `rollup-root`
51-
52-
`private-kernel-reset` (the **inner** reset) is deliberately **commented out** of this list and is **not** generated by the test — see the exception below.
5354

54-
Other entries commented out (e.g. `rollup-tx-merge`, `rollup-block-root`, `rollup-block-merge`, `rollup-checkpoint-root`) are also not produced by this flow; the inline comment points to the orchestrator single-checkpoint test for those.
55+
The circuit list lives in the `forEach(circuitName => ...)` loop in `full.test.ts`. `private-kernel-reset` (the **inner** reset) is deliberately **commented out** of this list and is **not** generated by the test — see the exception below.
5556

56-
If you add a new circuit crate, add its name to that list so its toml gets generated.
57+
After either run, review and stage the changed tomls with `git diff noir-projects/noir-protocol-circuits/crates/*/Prover.toml`. If you add a new circuit crate, add its name to the appropriate list so its toml gets generated.
5758

5859
## ⚠️ Exception: `private-kernel-reset/Prover.toml` (inner reset) is NOT generated — hand-maintain it
5960

barretenberg/cpp/CLAUDE.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -136,21 +136,21 @@ If C++ static_asserts fail after your changes, update both the assert values AND
136136

137137
Proof-length-affecting changes (e.g. `CHONK_PROOF_LENGTH` bumps from MegaFlavor entity additions) make the committed `Prover.toml` fixtures stale. `nargo execute --program-dir <crate>` then fails with `Type Array { length: N, typ: Field } is expected to have length N but value Vec(...)`.
138138

139-
Regenerate via the e2e prover full test with fake proofs:
139+
Regeneration is split across two commands. The block-root, block-merge, checkpoint, tx-merge, and root rollup samples come from the prover-client suite, which drives the simulated orchestrator and needs no L1 sandbox:
140140

141141
```bash
142-
cd yarn-project
143-
AZTEC_GENERATE_TEST_DATA=1 FAKE_PROOFS=1 yarn workspace @aztec/end-to-end test e2e_prover/full.test
142+
AZTEC_GENERATE_TEST_DATA=1 yarn workspace @aztec/prover-client test regenerate_rollup_sample_inputs
144143
```
145144

146-
`FAKE_PROOFS=1` skips real proving — runs in ~2 min (orchestrator + witness generation only). Writes 12 `Prover.toml` files under `noir-projects/noir-protocol-circuits/crates/<circuit>/Prover.toml`.
147-
148-
For circuits not exercised by `full.test.ts` (`rollup-tx-merge`, `rollup-block-root`, `rollup-block-root-single-tx`, `rollup-block-merge`, `rollup-checkpoint-root`, `rollup-block-root-first-empty-tx`), additionally run:
145+
The private-kernel samples and the transaction-base rollup samples (`rollup-tx-base-private`, `rollup-tx-base-public`) need real client-proved transactions, so they come from the e2e prover full test with fake proofs:
149146

150147
```bash
151-
AZTEC_GENERATE_TEST_DATA=1 yarn workspace @aztec/prover-client test orchestrator_single_checkpoint
148+
cd yarn-project
149+
AZTEC_GENERATE_TEST_DATA=1 FAKE_PROOFS=1 yarn workspace @aztec/end-to-end test e2e_prover/full.test
152150
```
153151

152+
`FAKE_PROOFS=1` skips real proving. Both write into `noir-projects/noir-protocol-circuits/crates/<circuit>/Prover.toml`.
153+
154154
Verify with `nargo execute --program-dir noir-projects/noir-protocol-circuits/crates/<crate>` for any previously-failing crate; should print `Circuit witness successfully solved`.
155155

156156
## Verification Keys

yarn-project/end-to-end/src/single-node/prover/server/full.test.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,10 @@ describe('single-node/prover/full', () => {
321321
}),
322322
);
323323

324-
// For the commented out circuits, run the tests in orchestrator_single_checkpoint.test.ts to generate the sample inputs.
324+
// Regenerates the private-kernel Prover.toml sample inputs plus the transaction-base rollup
325+
// samples, which all need real client-proved transactions. The block-root, block-merge,
326+
// checkpoint, tx-merge, and root rollup Prover.tomls are regenerated instead by the prover-client
327+
// suite `regenerate_rollup_sample_inputs.test.ts`, so they are intentionally not written here.
325328
(
326329
[
327330
'private-kernel-init',
@@ -339,17 +342,6 @@ describe('single-node/prover/full', () => {
339342
'private-kernel-reset-tail-to-public',
340343
'rollup-tx-base-private',
341344
'rollup-tx-base-public',
342-
// 'rollup-tx-merge',
343-
'rollup-block-root-first',
344-
'rollup-block-root-first-single-tx',
345-
// 'rollup-block-root-first-empty-tx',
346-
// 'rollup-block-root',
347-
// 'rollup-block-root-single-tx',
348-
// 'rollup-block-merge',
349-
// 'rollup-checkpoint-root',
350-
'rollup-checkpoint-root-single-block',
351-
'rollup-checkpoint-merge',
352-
'rollup-root',
353345
] satisfies CircuitName[]
354346
).forEach(circuitName => {
355347
const data = getTestData(circuitName);

yarn-project/foundation/src/testing/files/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,10 @@ export function updateInlineTestData(targetFileFromRepoRoot: string, itemName: s
5151

5252
/**
5353
* Updates the sample Prover.toml files in noir-projects/noir-protocol-circuits/crates/.
54-
* @remarks Requires AZTEC_GENERATE_TEST_DATA=1 to be set
55-
* To re-gen, run 'AZTEC_GENERATE_TEST_DATA=1 FAKE_PROOFS=1 yarn test:e2e e2e_prover/full.test'
54+
* @remarks Requires AZTEC_GENERATE_TEST_DATA=1 to be set. The block-root, block-merge, checkpoint,
55+
* tx-merge, and root rollup samples are regenerated by the prover-client
56+
* `regenerate_rollup_sample_inputs.test.ts` suite; the private-kernel and transaction-base rollup
57+
* samples by the e2e 'AZTEC_GENERATE_TEST_DATA=1 FAKE_PROOFS=1 yarn test:e2e e2e_prover/full.test' dump.
5658
*/
5759
export function updateProtocolCircuitSampleInputs(circuitName: string, value: string) {
5860
const logger = createConsoleLogger('aztec:testing:test_data');

yarn-project/prover-client/src/test/regenerate_rollup_sample_inputs.test.ts

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,16 @@ import { ChonkCache } from '../orchestrator/chonk-cache.js';
1616
import { type CheckpointTopTreeData, TopTreeOrchestrator } from '../orchestrator/top-tree-orchestrator.js';
1717

1818
// Regenerates the committed `crates/rollup-*/Prover.toml` sample inputs that CI runs `nargo execute`
19-
// against. The rollup circuits push their serialized inputs via `pushTestData` whenever they run
20-
// through the prover, so driving representative epochs through the (simulated) orchestrator and then
21-
// dumping `getTestData(circuitName)` produces fresh, ABI-current fixtures. Run with:
19+
// against, for every rollup circuit at or above the transaction merge: the block-root variants, the
20+
// block-merge, both checkpoint roots, the checkpoint-merge, the tx-merge, and the root rollup. The
21+
// rollup circuits push their serialized inputs via `pushTestData` whenever they run through the
22+
// prover, so driving representative epochs through the (simulated) orchestrator and then dumping
23+
// `getTestData(circuitName)` produces fresh, ABI-current fixtures. Run with:
2224
// AZTEC_GENERATE_TEST_DATA=1 yarn workspace @aztec/prover-client test regenerate_rollup_sample_inputs
23-
// Without that flag the whole suite is skipped, so it is a no-op (no prover setup) in normal CI.
25+
// Without that flag the whole suite is skipped, so it is a no-op (no prover setup) in normal CI. The
26+
// `rollup-tx-base-private`/`rollup-tx-base-public` fixtures and the private-kernel fixtures depend on
27+
// real client-proved transactions the simulated orchestrator cannot produce, so those are regenerated
28+
// separately by the e2e `e2e_prover/full.test` dump instead.
2429
//
2530
// The scenarios are chosen to exercise each block-root variant the orchestrator selects (see
2631
// BlockProvingState#getBlockRootRollupTypeAndInputs): a first block with 0 txs, with >=2 txs, and
@@ -29,7 +34,10 @@ import { type CheckpointTopTreeData, TopTreeOrchestrator } from '../orchestrator
2934
// checkpoint epoch a checkpoint-merge; a merge node only exists above the tree root, so both merges
3035
// need three leaves — two would pair directly at the root. Single-block checkpoints feed the
3136
// checkpoint-root-single-block circuit and multi-block checkpoints the (two-input) checkpoint-root
32-
// circuit. Every scenario also produces the root rollup.
37+
// circuit. A block with three txs merges its transaction base proofs through the tx-merge circuit
38+
// before the (two-input) block root, whereas one- or two-tx blocks feed the block root directly, so a
39+
// dedicated three-tx scenario is what regenerates the tx-merge sample. Every scenario also produces
40+
// the root rollup.
3341
const describeOrSkip = isGenerateTestDataEnabled() ? describe : describe.skip;
3442

3543
describeOrSkip('prover/regenerate-rollup-sample-inputs', () => {
@@ -81,6 +89,15 @@ describeOrSkip('prover/regenerate-rollup-sample-inputs', () => {
8189
numL1ToL2Messages: withMessages,
8290
dump: ['rollup-block-root'],
8391
},
92+
// Three txs in a block force a tx-merge to pair the base proofs down to the two the block root
93+
// takes; one- or two-tx blocks feed the block root directly and never exercise tx-merge.
94+
{
95+
numCheckpoints: 1,
96+
numBlocksPerCheckpoint: 1,
97+
numTxsPerBlock: 3,
98+
numL1ToL2Messages: withMessages,
99+
dump: ['rollup-tx-merge'],
100+
},
84101
// The checkpoint-merge only appears with three checkpoints. Independently-built checkpoints do
85102
// not carry the inbox message state forward, so this scenario runs with no L1-to-L2 messages and
86103
// a zero previous rolling hash, matching the multi-checkpoint case in top-tree-orchestrator.test.

0 commit comments

Comments
 (0)