Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
3 changes: 2 additions & 1 deletion yarn-project/foundation/src/testing/files/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
1 change: 1 addition & 0 deletions yarn-project/prover-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -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');
Expand All @@ -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],
Expand Down Expand Up @@ -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));
}
});
});
});
1 change: 1 addition & 0 deletions yarn-project/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down