diff --git a/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr b/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr index 2b2027457a60..6799a3334717 100644 --- a/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr +++ b/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr @@ -489,6 +489,8 @@ pub global MAX_PUBLIC_CALLS_TO_UNIQUE_CONTRACT_CLASS_IDS: u32 = 21; // `AVM_PROOF_LENGTH_IN_FIELDS` must be updated when AVM circuit changes. // To determine latest value, hover `COMPUTED_AVM_PROOF_LENGTH_IN_FIELDS` // in barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp +// This also changes the length of inputs for the public base rollup circuit, so its Prover.toml must be updated. +// To do so: run: 'AZTEC_GENERATE_TEST_DATA=1 yarn workspace @aztec/prover-client test orchestrator_public_functions' from yarn-project. pub global AVM_PROOF_LENGTH_IN_FIELDS: u32 = 4154; pub global AVM_PUBLIC_COLUMN_MAX_SIZE: u32 = 1024; pub global AVM_PUBLIC_INPUTS_FLATTENED_SIZE: u32 = diff --git a/yarn-project/foundation/src/testing/files/index.ts b/yarn-project/foundation/src/testing/files/index.ts index 02e0377440e0..f7c785be43ee 100644 --- a/yarn-project/foundation/src/testing/files/index.ts +++ b/yarn-project/foundation/src/testing/files/index.ts @@ -48,7 +48,8 @@ export function updateInlineTestData(targetFileFromRepoRoot: string, itemName: s /** * Updates the sample Prover.toml files in noir-projects/noir-protocol-circuits/crates/. * @remarks Requires AZTEC_GENERATE_TEST_DATA=1 to be set - * To re-gen, run 'AZTEC_GENERATE_TEST_DATA=1 FAKE_PROOFS=1 yarn test:e2e full.test ' + * To re-gen, run 'AZTEC_GENERATE_TEST_DATA=1 FAKE_PROOFS=1 yarn test:e2e full.test' + * To re-gen public base only, run 'AZTEC_GENERATE_TEST_DATA=1 yarn workspace @aztec/prover-client test orchestrator_public_functions' */ export function updateProtocolCircuitSampleInputs(circuitName: string, value: string) { const logger = createConsoleLogger('aztec:testing:test_data'); diff --git a/yarn-project/prover-client/package.json b/yarn-project/prover-client/package.json index cad67d34c474..a57f7a06d1b1 100644 --- a/yarn-project/prover-client/package.json +++ b/yarn-project/prover-client/package.json @@ -78,6 +78,7 @@ "@aztec/telemetry-client": "workspace:^", "@aztec/world-state": "workspace:^", "@google-cloud/storage": "^7.15.0", + "@iarna/toml": "^2.2.5", "@noir-lang/types": "portal:../../noir/packages/types", "commander": "^12.1.0", "lodash.chunk": "^4.2.0", diff --git a/yarn-project/prover-client/src/orchestrator/orchestrator_public_functions.test.ts b/yarn-project/prover-client/src/orchestrator/orchestrator_public_functions.test.ts index a33772019b32..f24e0fd30540 100644 --- a/yarn-project/prover-client/src/orchestrator/orchestrator_public_functions.test.ts +++ b/yarn-project/prover-client/src/orchestrator/orchestrator_public_functions.test.ts @@ -1,8 +1,12 @@ import { mockTx } from '@aztec/circuit-types'; import { createLogger } from '@aztec/foundation/log'; +import { getTestData, isGenerateTestDataEnabled } from '@aztec/foundation/testing'; +import { updateProtocolCircuitSampleInputs } from '@aztec/foundation/testing/files'; import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vks'; import { protocolContractTreeRoot } from '@aztec/protocol-contracts'; +import TOML from '@iarna/toml'; + import { TestContext } from '../mocks/test_context.js'; const logger = createLogger('prover-client:test:orchestrator-public-functions'); @@ -20,8 +24,9 @@ describe('prover/orchestrator/public-functions', () => { describe('blocks with public functions', () => { let testCount = 1; + const maybeSkip = isGenerateTestDataEnabled() ? it.skip : it; - it.each([ + maybeSkip.each([ [0, 4], [1, 0], [2, 0], @@ -52,5 +57,28 @@ describe('prover/orchestrator/public-functions', () => { expect(block.number).toEqual(context.blockNumber); }, ); + + it('generates public base test data', async () => { + if (!isGenerateTestDataEnabled()) { + return; + } + + const tx = await mockTx(1234, { + numberOfNonRevertiblePublicCallRequests: 2, + }); + tx.data.constants.historicalHeader = context.getBlockHeader(0); + tx.data.constants.vkTreeRoot = await getVKTreeRoot(); + tx.data.constants.protocolContractTreeRoot = protocolContractTreeRoot; + + const [processed, _] = await context.processPublicFunctions([tx], 1); + context.orchestrator.startNewEpoch(1, 1, 1); + await context.orchestrator.startNewBlock(context.globalVariables, [], context.getPreviousBlockHeader()); + await context.orchestrator.addTxs(processed); + await context.orchestrator.setBlockCompleted(context.blockNumber); + const data = getTestData('rollup-base-public'); + if (data) { + updateProtocolCircuitSampleInputs('rollup-base-public', TOML.stringify(data[0] as any)); + } + }); }); }); diff --git a/yarn-project/yarn.lock b/yarn-project/yarn.lock index ebb61ee3187a..a615d671028a 100644 --- a/yarn-project/yarn.lock +++ b/yarn-project/yarn.lock @@ -1120,6 +1120,7 @@ __metadata: "@aztec/telemetry-client": "workspace:^" "@aztec/world-state": "workspace:^" "@google-cloud/storage": "npm:^7.15.0" + "@iarna/toml": "npm:^2.2.5" "@jest/globals": "npm:^29.5.0" "@noir-lang/types": "portal:../../noir/packages/types" "@types/jest": "npm:^29.5.0"