Skip to content

Commit 1fa89da

Browse files
authored
feat: gen public base prover.toml (#11757)
Hi AVM team - not sure if this is still helpful for you... To avoid you having to run a long e2e test and update a load of irrelevant files when you need to change the `Prover.toml`s, I added a small test in `prover-client`. This only updates public base. Just run: ``` AZTEC_GENERATE_TEST_DATA=1 yarn workspace @aztec/prover-client test orchestrator_public_functions ``` from `yarn-project`. On my side, it takes around 6 seconds. LMK if this is still useful, and if so where I can update docs so the command is easily found!
1 parent 0b012f1 commit 1fa89da

File tree

5 files changed

+35
-2
lines changed

5 files changed

+35
-2
lines changed

noir-projects/noir-protocol-circuits/crates/types/src/constants.nr

+2
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,8 @@ pub global MAX_PUBLIC_CALLS_TO_UNIQUE_CONTRACT_CLASS_IDS: u32 = 21;
489489
// `AVM_PROOF_LENGTH_IN_FIELDS` must be updated when AVM circuit changes.
490490
// To determine latest value, hover `COMPUTED_AVM_PROOF_LENGTH_IN_FIELDS`
491491
// in barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp
492+
// This also changes the length of inputs for the public base rollup circuit, so its Prover.toml must be updated.
493+
// To do so: run: 'AZTEC_GENERATE_TEST_DATA=1 yarn workspace @aztec/prover-client test orchestrator_public_functions' from yarn-project.
492494
pub global AVM_PROOF_LENGTH_IN_FIELDS: u32 = 4154;
493495
pub global AVM_PUBLIC_COLUMN_MAX_SIZE: u32 = 1024;
494496
pub global AVM_PUBLIC_INPUTS_FLATTENED_SIZE: u32 =

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ export function updateInlineTestData(targetFileFromRepoRoot: string, itemName: s
4848
/**
4949
* Updates the sample Prover.toml files in noir-projects/noir-protocol-circuits/crates/.
5050
* @remarks Requires AZTEC_GENERATE_TEST_DATA=1 to be set
51-
* To re-gen, run 'AZTEC_GENERATE_TEST_DATA=1 FAKE_PROOFS=1 yarn test:e2e full.test '
51+
* To re-gen, run 'AZTEC_GENERATE_TEST_DATA=1 FAKE_PROOFS=1 yarn test:e2e full.test'
52+
* To re-gen public base only, run 'AZTEC_GENERATE_TEST_DATA=1 yarn workspace @aztec/prover-client test orchestrator_public_functions'
5253
*/
5354
export function updateProtocolCircuitSampleInputs(circuitName: string, value: string) {
5455
const logger = createConsoleLogger('aztec:testing:test_data');

yarn-project/prover-client/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
"@aztec/telemetry-client": "workspace:^",
7979
"@aztec/world-state": "workspace:^",
8080
"@google-cloud/storage": "^7.15.0",
81+
"@iarna/toml": "^2.2.5",
8182
"@noir-lang/types": "portal:../../noir/packages/types",
8283
"commander": "^12.1.0",
8384
"lodash.chunk": "^4.2.0",

yarn-project/prover-client/src/orchestrator/orchestrator_public_functions.test.ts

+29-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
import { mockTx } from '@aztec/circuit-types';
22
import { createLogger } from '@aztec/foundation/log';
3+
import { getTestData, isGenerateTestDataEnabled } from '@aztec/foundation/testing';
4+
import { updateProtocolCircuitSampleInputs } from '@aztec/foundation/testing/files';
35
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vks';
46
import { protocolContractTreeRoot } from '@aztec/protocol-contracts';
57

8+
import TOML from '@iarna/toml';
9+
610
import { TestContext } from '../mocks/test_context.js';
711

812
const logger = createLogger('prover-client:test:orchestrator-public-functions');
@@ -20,8 +24,9 @@ describe('prover/orchestrator/public-functions', () => {
2024

2125
describe('blocks with public functions', () => {
2226
let testCount = 1;
27+
const maybeSkip = isGenerateTestDataEnabled() ? it.skip : it;
2328

24-
it.each([
29+
maybeSkip.each([
2530
[0, 4],
2631
[1, 0],
2732
[2, 0],
@@ -52,5 +57,28 @@ describe('prover/orchestrator/public-functions', () => {
5257
expect(block.number).toEqual(context.blockNumber);
5358
},
5459
);
60+
61+
it('generates public base test data', async () => {
62+
if (!isGenerateTestDataEnabled()) {
63+
return;
64+
}
65+
66+
const tx = await mockTx(1234, {
67+
numberOfNonRevertiblePublicCallRequests: 2,
68+
});
69+
tx.data.constants.historicalHeader = context.getBlockHeader(0);
70+
tx.data.constants.vkTreeRoot = await getVKTreeRoot();
71+
tx.data.constants.protocolContractTreeRoot = protocolContractTreeRoot;
72+
73+
const [processed, _] = await context.processPublicFunctions([tx], 1);
74+
context.orchestrator.startNewEpoch(1, 1, 1);
75+
await context.orchestrator.startNewBlock(context.globalVariables, [], context.getPreviousBlockHeader());
76+
await context.orchestrator.addTxs(processed);
77+
await context.orchestrator.setBlockCompleted(context.blockNumber);
78+
const data = getTestData('rollup-base-public');
79+
if (data) {
80+
updateProtocolCircuitSampleInputs('rollup-base-public', TOML.stringify(data[0] as any));
81+
}
82+
});
5583
});
5684
});

yarn-project/yarn.lock

+1
Original file line numberDiff line numberDiff line change
@@ -1120,6 +1120,7 @@ __metadata:
11201120
"@aztec/telemetry-client": "workspace:^"
11211121
"@aztec/world-state": "workspace:^"
11221122
"@google-cloud/storage": "npm:^7.15.0"
1123+
"@iarna/toml": "npm:^2.2.5"
11231124
"@jest/globals": "npm:^29.5.0"
11241125
"@noir-lang/types": "portal:../../noir/packages/types"
11251126
"@types/jest": "npm:^29.5.0"

0 commit comments

Comments
 (0)