Skip to content

Commit 1ad1aa9

Browse files
committed
Allow running e2e prover with fake proofs enabled
1 parent c912c79 commit 1ad1aa9

3 files changed

Lines changed: 40 additions & 22 deletions

File tree

yarn-project/bb-prover/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ export * from './test/index.js';
33
export * from './verifier/index.js';
44
export * from './config.js';
55
export * from './bb/execute.js';
6+
7+
export { type ClientProtocolCircuitVerifier } from '@aztec/circuit-types';

yarn-project/end-to-end/src/e2e_prover/e2e_prover_test.ts

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
createDebugLogger,
1717
deployL1Contract,
1818
} from '@aztec/aztec.js';
19-
import { BBCircuitVerifier } from '@aztec/bb-prover';
19+
import { BBCircuitVerifier, type ClientProtocolCircuitVerifier, TestCircuitVerifier } from '@aztec/bb-prover';
2020
import { RollupAbi } from '@aztec/l1-artifacts';
2121
import { TokenContract } from '@aztec/noir-contracts.js';
2222
import { type ProverNode, type ProverNodeConfig, createProverNode } from '@aztec/prover-node';
@@ -73,14 +73,14 @@ export class FullProverTest {
7373
private provenComponents: ProvenSetup[] = [];
7474
private bbConfigCleanup?: () => Promise<void>;
7575
private acvmConfigCleanup?: () => Promise<void>;
76-
circuitProofVerifier?: BBCircuitVerifier;
76+
circuitProofVerifier?: ClientProtocolCircuitVerifier;
7777
provenAssets: TokenContract[] = [];
7878
private context!: SubsystemsContext;
7979
private proverNode!: ProverNode;
8080
private simulatedProverNode!: ProverNode;
8181
private l1Contracts!: DeployL1Contracts;
8282

83-
constructor(testName: string, private minNumberOfTxsPerBlock: number) {
83+
constructor(testName: string, private minNumberOfTxsPerBlock: number, private realProofs = true) {
8484
this.logger = createDebugLogger(`aztec:full_prover_test:${testName}`);
8585
this.snapshotManager = createSnapshotManager(`full_prover_integration/${testName}`, dataPath);
8686
}
@@ -149,33 +149,39 @@ export class FullProverTest {
149149

150150
// Configure a full prover PXE
151151

152-
const [acvmConfig, bbConfig] = await Promise.all([getACVMConfig(this.logger), getBBConfig(this.logger)]);
153-
if (!acvmConfig || !bbConfig) {
154-
throw new Error('Missing ACVM or BB config');
155-
}
152+
let acvmConfig: Awaited<ReturnType<typeof getACVMConfig>> | undefined;
153+
let bbConfig: Awaited<ReturnType<typeof getBBConfig>> | undefined;
154+
if (this.realProofs) {
155+
[acvmConfig, bbConfig] = await Promise.all([getACVMConfig(this.logger), getBBConfig(this.logger)]);
156+
if (!acvmConfig || !bbConfig) {
157+
throw new Error('Missing ACVM or BB config');
158+
}
156159

157-
this.acvmConfigCleanup = acvmConfig.cleanup;
158-
this.bbConfigCleanup = bbConfig.cleanup;
160+
this.acvmConfigCleanup = acvmConfig.cleanup;
161+
this.bbConfigCleanup = bbConfig.cleanup;
159162

160-
if (!bbConfig?.bbWorkingDirectory || !bbConfig?.bbBinaryPath) {
161-
throw new Error(`Test must be run with BB native configuration`);
162-
}
163+
if (!bbConfig?.bbWorkingDirectory || !bbConfig?.bbBinaryPath) {
164+
throw new Error(`Test must be run with BB native configuration`);
165+
}
163166

164-
this.circuitProofVerifier = await BBCircuitVerifier.new(bbConfig);
167+
this.circuitProofVerifier = await BBCircuitVerifier.new(bbConfig);
165168

166-
this.logger.debug(`Configuring the node for real proofs...`);
167-
await this.aztecNode.setConfig({
168-
realProofs: true,
169-
minTxsPerBlock: this.minNumberOfTxsPerBlock,
170-
});
169+
this.logger.debug(`Configuring the node for real proofs...`);
170+
await this.aztecNode.setConfig({
171+
realProofs: true,
172+
minTxsPerBlock: this.minNumberOfTxsPerBlock,
173+
});
174+
} else {
175+
this.circuitProofVerifier = new TestCircuitVerifier();
176+
}
171177

172178
this.logger.debug(`Main setup completed, initializing full prover PXE, Node, and Prover Node...`);
173179

174180
for (let i = 0; i < 2; i++) {
175181
const result = await setupPXEService(
176182
this.aztecNode,
177183
{
178-
proverEnabled: true,
184+
proverEnabled: this.realProofs,
179185
bbBinaryPath: bbConfig?.bbBinaryPath,
180186
bbWorkingDirectory: bbConfig?.bbWorkingDirectory,
181187
},
@@ -239,7 +245,7 @@ export class FullProverTest {
239245
txProviderNodeUrl: undefined,
240246
dataDirectory: undefined,
241247
proverId: new Fr(81),
242-
realProofs: true,
248+
realProofs: this.realProofs,
243249
proverAgentConcurrency: 2,
244250
publisherPrivateKey: `0x${proverNodePrivateKey!.toString('hex')}`,
245251
proverNodeMaxPendingJobs: 100,
@@ -341,13 +347,17 @@ export class FullProverTest {
341347
}
342348

343349
async deployVerifier() {
350+
if (!this.realProofs) {
351+
return;
352+
}
353+
344354
if (!this.circuitProofVerifier) {
345355
throw new Error('No verifier');
346356
}
347357

348358
const { walletClient, publicClient, l1ContractAddresses } = this.context.deployL1ContractsValues;
349359

350-
const contract = await this.circuitProofVerifier.generateSolidityContract(
360+
const contract = await (this.circuitProofVerifier as BBCircuitVerifier).generateSolidityContract(
351361
'BlockRootRollupArtifact',
352362
'UltraHonkVerifier.sol',
353363
);

yarn-project/end-to-end/src/e2e_prover/full.test.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ const TIMEOUT = 1_800_000;
88
process.env.AVM_PROVING_STRICT = '1';
99

1010
describe('full_prover', () => {
11-
const t = new FullProverTest('full_prover', 2);
11+
const realProofs = !['true', '1'].includes(process.env.FAKE_PROOFS ?? '');
12+
const t = new FullProverTest('full_prover', 2, realProofs);
1213
let { provenAssets, accounts, tokenSim, logger } = t;
1314

1415
beforeAll(async () => {
@@ -83,6 +84,11 @@ describe('full_prover', () => {
8384
);
8485

8586
it('rejects txs with invalid proofs', async () => {
87+
if (!realProofs) {
88+
t.logger.warn(`Skipping test with fake proofs`);
89+
return;
90+
}
91+
8692
const privateInteraction = t.fakeProofsAsset.methods.transfer(accounts[1].address, 1);
8793
const publicInteraction = t.fakeProofsAsset.methods.transfer_public(accounts[0].address, accounts[1].address, 1, 0);
8894

0 commit comments

Comments
 (0)