@aztec/bb-prover 1.2.0 → 2.0.0-nightly.20250813
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/avm_proving_tests/avm_proving_tester.d.ts +7 -7
- package/dest/avm_proving_tests/avm_proving_tester.d.ts.map +1 -1
- package/dest/avm_proving_tests/avm_proving_tester.js +99 -13
- package/dest/prover/proof_utils.d.ts.map +1 -1
- package/dest/prover/proof_utils.js +2 -2
- package/dest/prover/server/bb_prover.d.ts.map +1 -1
- package/dest/prover/server/bb_prover.js +3 -2
- package/dest/verifier/bb_verifier.js +1 -2
- package/package.json +16 -16
- package/src/avm_proving_tests/avm_proving_tester.ts +134 -10
- package/src/prover/proof_utils.ts +4 -1
- package/src/prover/server/bb_prover.ts +4 -1
- package/src/verifier/bb_verifier.ts +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PublicTxSimulationTester, SimpleContractDataSource, type TestEnqueuedCall, type TestPrivateInsertions } from '@aztec/simulator/public/fixtures';
|
|
1
|
+
import { PublicTxSimulationTester, SimpleContractDataSource, type TestEnqueuedCall, type TestExecutorMetrics, type TestPrivateInsertions } from '@aztec/simulator/public/fixtures';
|
|
2
2
|
import { type AvmCircuitInputs, AvmCircuitPublicInputs } from '@aztec/stdlib/avm';
|
|
3
3
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
4
|
import type { MerkleTreeWriteOperations } from '@aztec/stdlib/interfaces/server';
|
|
@@ -7,12 +7,12 @@ import { type BBResult, type BBSuccess } from '../bb/execute.js';
|
|
|
7
7
|
export declare class AvmProvingTester extends PublicTxSimulationTester {
|
|
8
8
|
private bbWorkingDirectory;
|
|
9
9
|
private checkCircuitOnly;
|
|
10
|
-
constructor(bbWorkingDirectory: string, checkCircuitOnly: boolean, contractDataSource: SimpleContractDataSource, merkleTrees: MerkleTreeWriteOperations, globals?: GlobalVariables);
|
|
11
|
-
static new(checkCircuitOnly?: boolean, globals?: GlobalVariables): Promise<AvmProvingTester>;
|
|
12
|
-
prove(avmCircuitInputs: AvmCircuitInputs): Promise<BBResult>;
|
|
10
|
+
constructor(bbWorkingDirectory: string, checkCircuitOnly: boolean, contractDataSource: SimpleContractDataSource, merkleTrees: MerkleTreeWriteOperations, globals?: GlobalVariables, metrics?: TestExecutorMetrics);
|
|
11
|
+
static new(checkCircuitOnly?: boolean, globals?: GlobalVariables, metrics?: TestExecutorMetrics): Promise<AvmProvingTester>;
|
|
12
|
+
prove(avmCircuitInputs: AvmCircuitInputs, txLabel?: string): Promise<BBResult>;
|
|
13
13
|
verify(proofRes: BBSuccess, publicInputs: AvmCircuitPublicInputs): Promise<BBResult>;
|
|
14
|
-
proveVerify(avmCircuitInputs: AvmCircuitInputs): Promise<void>;
|
|
15
|
-
simProveVerify(sender: AztecAddress, setupCalls: TestEnqueuedCall[], appCalls: TestEnqueuedCall[], teardownCall: TestEnqueuedCall | undefined, expectRevert: boolean | undefined, feePayer?: AztecAddress, privateInsertions?: TestPrivateInsertions): Promise<void>;
|
|
16
|
-
simProveVerifyAppLogic(appCall: TestEnqueuedCall, expectRevert?: boolean): Promise<void>;
|
|
14
|
+
proveVerify(avmCircuitInputs: AvmCircuitInputs, txLabel?: string): Promise<void>;
|
|
15
|
+
simProveVerify(sender: AztecAddress, setupCalls: TestEnqueuedCall[], appCalls: TestEnqueuedCall[], teardownCall: TestEnqueuedCall | undefined, expectRevert: boolean | undefined, feePayer?: AztecAddress, privateInsertions?: TestPrivateInsertions, txLabel?: string): Promise<void>;
|
|
16
|
+
simProveVerifyAppLogic(appCall: TestEnqueuedCall, expectRevert?: boolean, txLabel?: string): Promise<void>;
|
|
17
17
|
}
|
|
18
18
|
//# sourceMappingURL=avm_proving_tester.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avm_proving_tester.d.ts","sourceRoot":"","sources":["../../src/avm_proving_tests/avm_proving_tester.ts"],"names":[],"mappings":"
|
|
1
|
+
{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EAAE,EAC9B,QAAQ,EAAE,gBAAgB,EAAE,EAC5B,YAAY,EAAE,gBAAgB,GAAG,SAAS,EAC1C,YAAY,EAAE,OAAO,GAAG,SAAS,EACjC,QAAQ,eAAS,EACjB,iBAAiB,CAAC,EAAE,qBAAqB,EACzC,OAAO,GAAE,MAAsB;IAiBpB,sBAAsB,CACjC,OAAO,EAAE,gBAAgB,EACzB,YAAY,CAAC,EAAE,OAAO,EACtB,OAAO,GAAE,MAAsB;CAalC"}
|
|
@@ -6,25 +6,111 @@ import { tmpdir } from 'node:os';
|
|
|
6
6
|
import path from 'path';
|
|
7
7
|
import { BB_RESULT, VK_FILENAME, generateAvmProof, verifyAvmProof } from '../bb/execute.js';
|
|
8
8
|
const BB_PATH = path.resolve('../../barretenberg/cpp/build/bin/bb');
|
|
9
|
+
// An InterceptingLogger that records all log messages and forwards them to a wrapped logger.
|
|
10
|
+
class InterceptingLogger {
|
|
11
|
+
logs = [];
|
|
12
|
+
level;
|
|
13
|
+
module;
|
|
14
|
+
logger;
|
|
15
|
+
constructor(logger){
|
|
16
|
+
this.logger = logger;
|
|
17
|
+
this.level = logger.level;
|
|
18
|
+
this.module = logger.module;
|
|
19
|
+
}
|
|
20
|
+
isLevelEnabled(level) {
|
|
21
|
+
return this.logger.isLevelEnabled(level);
|
|
22
|
+
}
|
|
23
|
+
createChild(_childModule) {
|
|
24
|
+
throw new Error('Not implemented');
|
|
25
|
+
}
|
|
26
|
+
intercept(level, msg, ...args) {
|
|
27
|
+
this.logs.push(...msg.split('\n'));
|
|
28
|
+
// Forward to the wrapped logger
|
|
29
|
+
this.logger[level](msg, ...args);
|
|
30
|
+
}
|
|
31
|
+
// Log methods for each level
|
|
32
|
+
silent(msg, ...args) {
|
|
33
|
+
this.intercept('silent', msg, ...args);
|
|
34
|
+
}
|
|
35
|
+
fatal(msg, ...args) {
|
|
36
|
+
this.intercept('fatal', msg, ...args);
|
|
37
|
+
}
|
|
38
|
+
warn(msg, ...args) {
|
|
39
|
+
this.intercept('warn', msg, ...args);
|
|
40
|
+
}
|
|
41
|
+
info(msg, ...args) {
|
|
42
|
+
this.intercept('info', msg, ...args);
|
|
43
|
+
}
|
|
44
|
+
verbose(msg, ...args) {
|
|
45
|
+
this.intercept('verbose', msg, ...args);
|
|
46
|
+
}
|
|
47
|
+
debug(msg, ...args) {
|
|
48
|
+
this.intercept('debug', msg, ...args);
|
|
49
|
+
}
|
|
50
|
+
trace(msg, ...args) {
|
|
51
|
+
this.intercept('trace', msg, ...args);
|
|
52
|
+
}
|
|
53
|
+
// Error log function can be string or Error
|
|
54
|
+
error(err, ...args) {
|
|
55
|
+
const msg = typeof err === 'string' ? err : err.message;
|
|
56
|
+
this.logs.push(msg);
|
|
57
|
+
this.logger.error(msg, err, ...args);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
9
60
|
export class AvmProvingTester extends PublicTxSimulationTester {
|
|
10
61
|
bbWorkingDirectory;
|
|
11
62
|
checkCircuitOnly;
|
|
12
|
-
constructor(bbWorkingDirectory, checkCircuitOnly, contractDataSource, merkleTrees, globals){
|
|
13
|
-
super(merkleTrees, contractDataSource, globals), this.bbWorkingDirectory = bbWorkingDirectory, this.checkCircuitOnly = checkCircuitOnly;
|
|
63
|
+
constructor(bbWorkingDirectory, checkCircuitOnly, contractDataSource, merkleTrees, globals, metrics){
|
|
64
|
+
super(merkleTrees, contractDataSource, globals, metrics), this.bbWorkingDirectory = bbWorkingDirectory, this.checkCircuitOnly = checkCircuitOnly;
|
|
14
65
|
}
|
|
15
|
-
static async new(checkCircuitOnly = false, globals) {
|
|
66
|
+
static async new(checkCircuitOnly = false, globals, metrics) {
|
|
16
67
|
const bbWorkingDirectory = await fs.mkdtemp(path.join(tmpdir(), 'bb-'));
|
|
17
68
|
const contractDataSource = new SimpleContractDataSource();
|
|
18
69
|
const merkleTrees = await (await NativeWorldStateService.tmp()).fork();
|
|
19
|
-
return new AvmProvingTester(bbWorkingDirectory, checkCircuitOnly, contractDataSource, merkleTrees, globals);
|
|
70
|
+
return new AvmProvingTester(bbWorkingDirectory, checkCircuitOnly, contractDataSource, merkleTrees, globals, metrics);
|
|
20
71
|
}
|
|
21
|
-
async prove(avmCircuitInputs) {
|
|
72
|
+
async prove(avmCircuitInputs, txLabel = 'unlabeledTx') {
|
|
73
|
+
const interceptingLogger = new InterceptingLogger(this.logger);
|
|
22
74
|
// Then we prove.
|
|
23
|
-
const proofRes = await generateAvmProof(BB_PATH, this.bbWorkingDirectory, avmCircuitInputs,
|
|
75
|
+
const proofRes = await generateAvmProof(BB_PATH, this.bbWorkingDirectory, avmCircuitInputs, interceptingLogger, this.checkCircuitOnly);
|
|
24
76
|
if (proofRes.status === BB_RESULT.FAILURE) {
|
|
25
77
|
this.logger.error(`Proof generation failed: ${proofRes.reason}`);
|
|
26
78
|
}
|
|
27
79
|
expect(proofRes.status).toEqual(BB_RESULT.SUCCESS);
|
|
80
|
+
// Parse the logs into a structured format.
|
|
81
|
+
const logs = interceptingLogger.logs;
|
|
82
|
+
// const traceSizes: { name: string; size: number }[] = [];
|
|
83
|
+
// logs.forEach(log => {
|
|
84
|
+
// const match = log.match(/\b(\w+): (\d+) \(~2/);
|
|
85
|
+
// if (match) {
|
|
86
|
+
// traceSizes.push({
|
|
87
|
+
// name: match[1],
|
|
88
|
+
// size: parseInt(match[2]),
|
|
89
|
+
// });
|
|
90
|
+
// }
|
|
91
|
+
// });
|
|
92
|
+
const times = {};
|
|
93
|
+
logs.forEach((log)=>{
|
|
94
|
+
const match = log.match(/\b([\w/]+)_ms: (\d+)/);
|
|
95
|
+
if (match) {
|
|
96
|
+
times[match[1]] = parseInt(match[2]);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
// Hack to make labels match.
|
|
100
|
+
const txLabelWithCount = `${txLabel}/${this.txCount - 1}`;
|
|
101
|
+
// I need to cast because TS doesnt realize metrics is protected not private.
|
|
102
|
+
this.metrics?.recordProverMetrics(txLabelWithCount, {
|
|
103
|
+
proverSimulationStepMs: times['simulation/all'],
|
|
104
|
+
proverProvingStepMs: times['proving/all'],
|
|
105
|
+
proverTraceGenerationStepMs: times['tracegen/all'],
|
|
106
|
+
traceGenerationInteractionsMs: times['tracegen/interactions'],
|
|
107
|
+
traceGenerationTracesMs: times['tracegen/traces'],
|
|
108
|
+
provingSumcheckMs: times['prove/sumcheck'],
|
|
109
|
+
provingPcsMs: times['prove/pcs_rounds'],
|
|
110
|
+
provingLogDerivativeInverseMs: times['prove/log_derivative_inverse_round'],
|
|
111
|
+
provingLogDerivativeInverseCommitmentsMs: times['prove/log_derivative_inverse_commitments_round'],
|
|
112
|
+
provingWireCommitmentsMs: times['prove/wire_commitments_round']
|
|
113
|
+
});
|
|
28
114
|
return proofRes;
|
|
29
115
|
}
|
|
30
116
|
async verify(proofRes, publicInputs) {
|
|
@@ -35,21 +121,21 @@ export class AvmProvingTester extends PublicTxSimulationTester {
|
|
|
35
121
|
}
|
|
36
122
|
return await verifyAvmProof(BB_PATH, this.bbWorkingDirectory, proofRes.proofPath, publicInputs, path.join(proofRes.vkDirectoryPath, VK_FILENAME), this.logger);
|
|
37
123
|
}
|
|
38
|
-
async proveVerify(avmCircuitInputs) {
|
|
39
|
-
const provingRes = await this.prove(avmCircuitInputs);
|
|
124
|
+
async proveVerify(avmCircuitInputs, txLabel = 'unlabeledTx') {
|
|
125
|
+
const provingRes = await this.prove(avmCircuitInputs, txLabel);
|
|
40
126
|
expect(provingRes.status).toEqual(BB_RESULT.SUCCESS);
|
|
41
127
|
const verificationRes = await this.verify(provingRes, avmCircuitInputs.publicInputs);
|
|
42
128
|
expect(verificationRes.status).toBe(BB_RESULT.SUCCESS);
|
|
43
129
|
}
|
|
44
|
-
async simProveVerify(sender, setupCalls, appCalls, teardownCall, expectRevert, feePayer = sender, privateInsertions) {
|
|
45
|
-
const simRes = await this.simulateTx(sender, setupCalls, appCalls, teardownCall, feePayer, privateInsertions);
|
|
130
|
+
async simProveVerify(sender, setupCalls, appCalls, teardownCall, expectRevert, feePayer = sender, privateInsertions, txLabel = 'unlabeledTx') {
|
|
131
|
+
const simRes = await this.simulateTx(sender, setupCalls, appCalls, teardownCall, feePayer, privateInsertions, txLabel);
|
|
46
132
|
expect(simRes.revertCode.isOK()).toBe(expectRevert ? false : true);
|
|
47
133
|
const avmCircuitInputs = simRes.avmProvingRequest.inputs;
|
|
48
|
-
await this.proveVerify(avmCircuitInputs);
|
|
134
|
+
await this.proveVerify(avmCircuitInputs, txLabel);
|
|
49
135
|
}
|
|
50
|
-
async simProveVerifyAppLogic(appCall, expectRevert) {
|
|
136
|
+
async simProveVerifyAppLogic(appCall, expectRevert, txLabel = 'unlabeledTx') {
|
|
51
137
|
await this.simProveVerify(/*sender=*/ AztecAddress.fromNumber(42), /*setupCalls=*/ [], [
|
|
52
138
|
appCall
|
|
53
|
-
], undefined, expectRevert);
|
|
139
|
+
], undefined, expectRevert, /*feePayer=*/ undefined, /*privateInsertions=*/ undefined, txLabel);
|
|
54
140
|
}
|
|
55
141
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proof_utils.d.ts","sourceRoot":"","sources":["../../src/prover/proof_utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"proof_utils.d.ts","sourceRoot":"","sources":["../../src/prover/proof_utils.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAS,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAa7D;;;;;GAKG;AACH,wBAAsB,qCAAqC,CAAC,SAAS,EAAE,MAAM,2BAG5E;AAED;;;;;GAKG;AACH,wBAAsB,oCAAoC,CAAC,cAAc,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,iBAG3G;AAED,wBAAsB,iBAAiB,CAAC,YAAY,SAAS,MAAM,EACjE,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,mBAAmB,EAC3B,WAAW,EAAE,YAAY,EACzB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC,CA4CvC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IPA_CLAIM_SIZE, NESTED_RECURSIVE_PROOF_LENGTH, NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH, PAIRING_POINTS_SIZE } from '@aztec/constants';
|
|
1
|
+
import { IPA_CLAIM_SIZE, NESTED_RECURSIVE_PROOF_LENGTH, NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH, PAIRING_POINTS_SIZE, ULTRA_KECCAK_PROOF_LENGTH } from '@aztec/constants';
|
|
2
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
3
3
|
import { ClientIvcProof, Proof, RecursiveProof } from '@aztec/stdlib/proofs';
|
|
4
4
|
import assert from 'assert';
|
|
@@ -36,7 +36,7 @@ export async function readProofAsFields(filePath, vkData, proofLength, logger) {
|
|
|
36
36
|
]);
|
|
37
37
|
const json = JSON.parse(proofString);
|
|
38
38
|
let numPublicInputs = vkData.numPublicInputs - PAIRING_POINTS_SIZE;
|
|
39
|
-
assert(proofLength == NESTED_RECURSIVE_PROOF_LENGTH || proofLength == NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH, `Proof length must be one of the expected proof lengths, received ${proofLength}`);
|
|
39
|
+
assert(proofLength == NESTED_RECURSIVE_PROOF_LENGTH || proofLength == NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH || proofLength == ULTRA_KECCAK_PROOF_LENGTH, `Proof length must be one of the expected proof lengths, received ${proofLength}`);
|
|
40
40
|
if (proofLength == NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH) {
|
|
41
41
|
numPublicInputs -= IPA_CLAIM_SIZE;
|
|
42
42
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bb_prover.d.ts","sourceRoot":"","sources":["../../../src/prover/server/bb_prover.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oCAAoC,EACpC,6BAA6B,EAC7B,yCAAyC,EAEzC,sBAAsB,EACtB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"bb_prover.d.ts","sourceRoot":"","sources":["../../../src/prover/server/bb_prover.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oCAAoC,EACpC,6BAA6B,EAC7B,yCAAyC,EAEzC,sBAAsB,EACtB,iBAAiB,EAElB,MAAM,kBAAkB,CAAC;AAK1B,OAAO,EACL,KAAK,sBAAsB,EAwB5B,MAAM,4CAA4C,CAAC;AAIpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAElF,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,6BAA6B,EAClC,KAAK,mBAAmB,EAGzB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACnG,OAAO,EAAE,KAAK,EAAgD,MAAM,sBAAsB,CAAC;AAC3F,OAAO,EACL,KAAK,6BAA6B,EAClC,KAAK,sBAAsB,EAC3B,KAAK,iCAAiC,EACtC,KAAK,qBAAqB,EAC1B,KAAK,0BAA0B,EAC/B,KAAK,iBAAiB,EACtB,4BAA4B,EAC5B,KAAK,uBAAuB,EAC5B,sBAAsB,EACtB,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,6BAA6B,EAClC,KAAK,UAAU,EAEhB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAc,KAAK,eAAe,EAAiC,MAAM,yBAAyB,CAAC;AAmB1G,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,KAAK,eAAe,EAAg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AYvB"}
|
|
@@ -4,7 +4,7 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
4
4
|
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
}
|
|
7
|
-
import { AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED, NESTED_RECURSIVE_PROOF_LENGTH, NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH, PAIRING_POINTS_SIZE, RECURSIVE_PROOF_LENGTH, TUBE_PROOF_LENGTH } from '@aztec/constants';
|
|
7
|
+
import { AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED, NESTED_RECURSIVE_PROOF_LENGTH, NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH, PAIRING_POINTS_SIZE, RECURSIVE_PROOF_LENGTH, TUBE_PROOF_LENGTH, ULTRA_KECCAK_PROOF_LENGTH } from '@aztec/constants';
|
|
8
8
|
import { Fr } from '@aztec/foundation/fields';
|
|
9
9
|
import { runInDirectory } from '@aztec/foundation/fs';
|
|
10
10
|
import { createLogger } from '@aztec/foundation/log';
|
|
@@ -212,7 +212,8 @@ const SERVER_CIRCUIT_RECURSIVE = true;
|
|
|
212
212
|
const operation = async (bbWorkingDirectory)=>{
|
|
213
213
|
const { provingResult, circuitOutput: output } = await this.generateProofWithBB(input, circuitType, convertInput, convertOutput, bbWorkingDirectory);
|
|
214
214
|
const vkData = this.getVerificationKeyDataForCircuit(circuitType);
|
|
215
|
-
const
|
|
215
|
+
const PROOF_LENGTH = circuitType == 'RootRollupArtifact' ? ULTRA_KECCAK_PROOF_LENGTH : RECURSIVE_PROOF_LENGTH;
|
|
216
|
+
const proof = await readProofAsFields(provingResult.proofPath, vkData, PROOF_LENGTH, logger);
|
|
216
217
|
const circuitName = mapProtocolArtifactNameToCircuitName(circuitType);
|
|
217
218
|
this.instrumentation.recordDuration('provingDuration', circuitName, provingResult.durationMs);
|
|
218
219
|
this.instrumentation.recordSize('proofSize', circuitName, proof.binaryProof.buffer.length);
|
|
@@ -2,7 +2,6 @@ import { runInDirectory } from '@aztec/foundation/fs';
|
|
|
2
2
|
import { createLogger } from '@aztec/foundation/log';
|
|
3
3
|
import { Timer } from '@aztec/foundation/timer';
|
|
4
4
|
import { ServerCircuitVks } from '@aztec/noir-protocol-circuits-types/server/vks';
|
|
5
|
-
import { Tx } from '@aztec/stdlib/tx';
|
|
6
5
|
import { promises as fs } from 'fs';
|
|
7
6
|
import * as path from 'path';
|
|
8
7
|
import { fileURLToPath } from 'url';
|
|
@@ -99,7 +98,7 @@ export class BBCircuitVerifier {
|
|
|
99
98
|
totalDurationMs: totalTimer.ms()
|
|
100
99
|
};
|
|
101
100
|
} catch (err) {
|
|
102
|
-
this.logger.warn(`Failed to verify ClientIVC proof for tx ${
|
|
101
|
+
this.logger.warn(`Failed to verify ClientIVC proof for tx ${tx.getTxHash().toString()}: ${String(err)}`);
|
|
103
102
|
return {
|
|
104
103
|
valid: false,
|
|
105
104
|
durationMs: 0,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/bb-prover",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-nightly.20250813",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -70,27 +70,27 @@
|
|
|
70
70
|
]
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@aztec/bb.js": "
|
|
74
|
-
"@aztec/constants": "
|
|
75
|
-
"@aztec/foundation": "
|
|
76
|
-
"@aztec/noir-noirc_abi": "
|
|
77
|
-
"@aztec/noir-protocol-circuits-types": "
|
|
78
|
-
"@aztec/noir-types": "
|
|
79
|
-
"@aztec/simulator": "
|
|
80
|
-
"@aztec/stdlib": "
|
|
81
|
-
"@aztec/telemetry-client": "
|
|
82
|
-
"@aztec/world-state": "
|
|
73
|
+
"@aztec/bb.js": "2.0.0-nightly.20250813",
|
|
74
|
+
"@aztec/constants": "2.0.0-nightly.20250813",
|
|
75
|
+
"@aztec/foundation": "2.0.0-nightly.20250813",
|
|
76
|
+
"@aztec/noir-noirc_abi": "2.0.0-nightly.20250813",
|
|
77
|
+
"@aztec/noir-protocol-circuits-types": "2.0.0-nightly.20250813",
|
|
78
|
+
"@aztec/noir-types": "2.0.0-nightly.20250813",
|
|
79
|
+
"@aztec/simulator": "2.0.0-nightly.20250813",
|
|
80
|
+
"@aztec/stdlib": "2.0.0-nightly.20250813",
|
|
81
|
+
"@aztec/telemetry-client": "2.0.0-nightly.20250813",
|
|
82
|
+
"@aztec/world-state": "2.0.0-nightly.20250813",
|
|
83
83
|
"commander": "^12.1.0",
|
|
84
84
|
"pako": "^2.1.0",
|
|
85
85
|
"source-map-support": "^0.5.21",
|
|
86
86
|
"tslib": "^2.4.0"
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": {
|
|
89
|
-
"@aztec/ethereum": "
|
|
90
|
-
"@aztec/kv-store": "
|
|
91
|
-
"@aztec/noir-contracts.js": "
|
|
92
|
-
"@aztec/noir-test-contracts.js": "
|
|
93
|
-
"@aztec/protocol-contracts": "
|
|
89
|
+
"@aztec/ethereum": "2.0.0-nightly.20250813",
|
|
90
|
+
"@aztec/kv-store": "2.0.0-nightly.20250813",
|
|
91
|
+
"@aztec/noir-contracts.js": "2.0.0-nightly.20250813",
|
|
92
|
+
"@aztec/noir-test-contracts.js": "2.0.0-nightly.20250813",
|
|
93
|
+
"@aztec/protocol-contracts": "2.0.0-nightly.20250813",
|
|
94
94
|
"@jest/globals": "^30.0.0",
|
|
95
95
|
"@types/jest": "^30.0.0",
|
|
96
96
|
"@types/node": "^22.15.17",
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import type { LogFn, LogLevel, Logger } from '@aztec/foundation/log';
|
|
1
2
|
import {
|
|
2
3
|
PublicTxSimulationTester,
|
|
3
4
|
SimpleContractDataSource,
|
|
4
5
|
type TestEnqueuedCall,
|
|
6
|
+
type TestExecutorMetrics,
|
|
5
7
|
type TestPrivateInsertions,
|
|
6
8
|
} from '@aztec/simulator/public/fixtures';
|
|
7
9
|
import { type AvmCircuitInputs, AvmCircuitPublicInputs } from '@aztec/stdlib/avm';
|
|
@@ -25,6 +27,65 @@ import {
|
|
|
25
27
|
|
|
26
28
|
const BB_PATH = path.resolve('../../barretenberg/cpp/build/bin/bb');
|
|
27
29
|
|
|
30
|
+
// An InterceptingLogger that records all log messages and forwards them to a wrapped logger.
|
|
31
|
+
class InterceptingLogger implements Logger {
|
|
32
|
+
public readonly logs: string[] = [];
|
|
33
|
+
public level: LogLevel;
|
|
34
|
+
public module: string;
|
|
35
|
+
|
|
36
|
+
private logger: Logger;
|
|
37
|
+
|
|
38
|
+
constructor(logger: Logger) {
|
|
39
|
+
this.logger = logger;
|
|
40
|
+
this.level = logger.level;
|
|
41
|
+
this.module = logger.module;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
isLevelEnabled(level: LogLevel): boolean {
|
|
45
|
+
return this.logger.isLevelEnabled(level);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
createChild(_childModule: string): Logger {
|
|
49
|
+
throw new Error('Not implemented');
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
private intercept(level: LogLevel, msg: string, ...args: any[]) {
|
|
53
|
+
this.logs.push(...msg.split('\n'));
|
|
54
|
+
// Forward to the wrapped logger
|
|
55
|
+
(this.logger[level] as LogFn)(msg, ...args);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Log methods for each level
|
|
59
|
+
silent(msg: string, ...args: any[]) {
|
|
60
|
+
this.intercept('silent', msg, ...args);
|
|
61
|
+
}
|
|
62
|
+
fatal(msg: string, ...args: any[]) {
|
|
63
|
+
this.intercept('fatal', msg, ...args);
|
|
64
|
+
}
|
|
65
|
+
warn(msg: string, ...args: any[]) {
|
|
66
|
+
this.intercept('warn', msg, ...args);
|
|
67
|
+
}
|
|
68
|
+
info(msg: string, ...args: any[]) {
|
|
69
|
+
this.intercept('info', msg, ...args);
|
|
70
|
+
}
|
|
71
|
+
verbose(msg: string, ...args: any[]) {
|
|
72
|
+
this.intercept('verbose', msg, ...args);
|
|
73
|
+
}
|
|
74
|
+
debug(msg: string, ...args: any[]) {
|
|
75
|
+
this.intercept('debug', msg, ...args);
|
|
76
|
+
}
|
|
77
|
+
trace(msg: string, ...args: any[]) {
|
|
78
|
+
this.intercept('trace', msg, ...args);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Error log function can be string or Error
|
|
82
|
+
error(err: Error | string, ...args: any[]) {
|
|
83
|
+
const msg = typeof err === 'string' ? err : err.message;
|
|
84
|
+
this.logs.push(msg);
|
|
85
|
+
this.logger.error(msg, err, ...args);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
28
89
|
export class AvmProvingTester extends PublicTxSimulationTester {
|
|
29
90
|
constructor(
|
|
30
91
|
private bbWorkingDirectory: string,
|
|
@@ -32,31 +93,78 @@ export class AvmProvingTester extends PublicTxSimulationTester {
|
|
|
32
93
|
contractDataSource: SimpleContractDataSource,
|
|
33
94
|
merkleTrees: MerkleTreeWriteOperations,
|
|
34
95
|
globals?: GlobalVariables,
|
|
96
|
+
metrics?: TestExecutorMetrics,
|
|
35
97
|
) {
|
|
36
|
-
super(merkleTrees, contractDataSource, globals);
|
|
98
|
+
super(merkleTrees, contractDataSource, globals, metrics);
|
|
37
99
|
}
|
|
38
100
|
|
|
39
|
-
static async new(checkCircuitOnly: boolean = false, globals?: GlobalVariables) {
|
|
101
|
+
static async new(checkCircuitOnly: boolean = false, globals?: GlobalVariables, metrics?: TestExecutorMetrics) {
|
|
40
102
|
const bbWorkingDirectory = await fs.mkdtemp(path.join(tmpdir(), 'bb-'));
|
|
41
103
|
|
|
42
104
|
const contractDataSource = new SimpleContractDataSource();
|
|
43
105
|
const merkleTrees = await (await NativeWorldStateService.tmp()).fork();
|
|
44
|
-
return new AvmProvingTester(
|
|
106
|
+
return new AvmProvingTester(
|
|
107
|
+
bbWorkingDirectory,
|
|
108
|
+
checkCircuitOnly,
|
|
109
|
+
contractDataSource,
|
|
110
|
+
merkleTrees,
|
|
111
|
+
globals,
|
|
112
|
+
metrics,
|
|
113
|
+
);
|
|
45
114
|
}
|
|
46
115
|
|
|
47
|
-
async prove(avmCircuitInputs: AvmCircuitInputs): Promise<BBResult> {
|
|
116
|
+
async prove(avmCircuitInputs: AvmCircuitInputs, txLabel: string = 'unlabeledTx'): Promise<BBResult> {
|
|
117
|
+
const interceptingLogger = new InterceptingLogger(this.logger);
|
|
118
|
+
|
|
48
119
|
// Then we prove.
|
|
49
120
|
const proofRes = await generateAvmProof(
|
|
50
121
|
BB_PATH,
|
|
51
122
|
this.bbWorkingDirectory,
|
|
52
123
|
avmCircuitInputs,
|
|
53
|
-
|
|
124
|
+
interceptingLogger,
|
|
54
125
|
this.checkCircuitOnly,
|
|
55
126
|
);
|
|
56
127
|
if (proofRes.status === BB_RESULT.FAILURE) {
|
|
57
128
|
this.logger.error(`Proof generation failed: ${proofRes.reason}`);
|
|
58
129
|
}
|
|
59
130
|
expect(proofRes.status).toEqual(BB_RESULT.SUCCESS);
|
|
131
|
+
|
|
132
|
+
// Parse the logs into a structured format.
|
|
133
|
+
const logs = interceptingLogger.logs;
|
|
134
|
+
// const traceSizes: { name: string; size: number }[] = [];
|
|
135
|
+
// logs.forEach(log => {
|
|
136
|
+
// const match = log.match(/\b(\w+): (\d+) \(~2/);
|
|
137
|
+
// if (match) {
|
|
138
|
+
// traceSizes.push({
|
|
139
|
+
// name: match[1],
|
|
140
|
+
// size: parseInt(match[2]),
|
|
141
|
+
// });
|
|
142
|
+
// }
|
|
143
|
+
// });
|
|
144
|
+
const times: { [key: string]: number } = {};
|
|
145
|
+
logs.forEach(log => {
|
|
146
|
+
const match = log.match(/\b([\w/]+)_ms: (\d+)/);
|
|
147
|
+
if (match) {
|
|
148
|
+
times[match[1]] = parseInt(match[2]);
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
// Hack to make labels match.
|
|
153
|
+
const txLabelWithCount = `${txLabel}/${this.txCount - 1}`;
|
|
154
|
+
// I need to cast because TS doesnt realize metrics is protected not private.
|
|
155
|
+
(this as any).metrics?.recordProverMetrics(txLabelWithCount, {
|
|
156
|
+
proverSimulationStepMs: times['simulation/all'],
|
|
157
|
+
proverProvingStepMs: times['proving/all'],
|
|
158
|
+
proverTraceGenerationStepMs: times['tracegen/all'],
|
|
159
|
+
traceGenerationInteractionsMs: times['tracegen/interactions'],
|
|
160
|
+
traceGenerationTracesMs: times['tracegen/traces'],
|
|
161
|
+
provingSumcheckMs: times['prove/sumcheck'],
|
|
162
|
+
provingPcsMs: times['prove/pcs_rounds'],
|
|
163
|
+
provingLogDerivativeInverseMs: times['prove/log_derivative_inverse_round'],
|
|
164
|
+
provingLogDerivativeInverseCommitmentsMs: times['prove/log_derivative_inverse_commitments_round'],
|
|
165
|
+
provingWireCommitmentsMs: times['prove/wire_commitments_round'],
|
|
166
|
+
});
|
|
167
|
+
|
|
60
168
|
return proofRes as BBSuccess;
|
|
61
169
|
}
|
|
62
170
|
|
|
@@ -77,8 +185,8 @@ export class AvmProvingTester extends PublicTxSimulationTester {
|
|
|
77
185
|
);
|
|
78
186
|
}
|
|
79
187
|
|
|
80
|
-
public async proveVerify(avmCircuitInputs: AvmCircuitInputs) {
|
|
81
|
-
const provingRes = await this.prove(avmCircuitInputs);
|
|
188
|
+
public async proveVerify(avmCircuitInputs: AvmCircuitInputs, txLabel: string = 'unlabeledTx') {
|
|
189
|
+
const provingRes = await this.prove(avmCircuitInputs, txLabel);
|
|
82
190
|
expect(provingRes.status).toEqual(BB_RESULT.SUCCESS);
|
|
83
191
|
|
|
84
192
|
const verificationRes = await this.verify(provingRes as BBSuccess, avmCircuitInputs.publicInputs);
|
|
@@ -93,21 +201,37 @@ export class AvmProvingTester extends PublicTxSimulationTester {
|
|
|
93
201
|
expectRevert: boolean | undefined,
|
|
94
202
|
feePayer = sender,
|
|
95
203
|
privateInsertions?: TestPrivateInsertions,
|
|
204
|
+
txLabel: string = 'unlabeledTx',
|
|
96
205
|
) {
|
|
97
|
-
const simRes = await this.simulateTx(
|
|
206
|
+
const simRes = await this.simulateTx(
|
|
207
|
+
sender,
|
|
208
|
+
setupCalls,
|
|
209
|
+
appCalls,
|
|
210
|
+
teardownCall,
|
|
211
|
+
feePayer,
|
|
212
|
+
privateInsertions,
|
|
213
|
+
txLabel,
|
|
214
|
+
);
|
|
98
215
|
expect(simRes.revertCode.isOK()).toBe(expectRevert ? false : true);
|
|
99
216
|
|
|
100
217
|
const avmCircuitInputs = simRes.avmProvingRequest.inputs;
|
|
101
|
-
await this.proveVerify(avmCircuitInputs);
|
|
218
|
+
await this.proveVerify(avmCircuitInputs, txLabel);
|
|
102
219
|
}
|
|
103
220
|
|
|
104
|
-
public async simProveVerifyAppLogic(
|
|
221
|
+
public async simProveVerifyAppLogic(
|
|
222
|
+
appCall: TestEnqueuedCall,
|
|
223
|
+
expectRevert?: boolean,
|
|
224
|
+
txLabel: string = 'unlabeledTx',
|
|
225
|
+
) {
|
|
105
226
|
await this.simProveVerify(
|
|
106
227
|
/*sender=*/ AztecAddress.fromNumber(42),
|
|
107
228
|
/*setupCalls=*/ [],
|
|
108
229
|
[appCall],
|
|
109
230
|
undefined,
|
|
110
231
|
expectRevert,
|
|
232
|
+
/*feePayer=*/ undefined,
|
|
233
|
+
/*privateInsertions=*/ undefined,
|
|
234
|
+
txLabel,
|
|
111
235
|
);
|
|
112
236
|
}
|
|
113
237
|
}
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
NESTED_RECURSIVE_PROOF_LENGTH,
|
|
4
4
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
5
5
|
PAIRING_POINTS_SIZE,
|
|
6
|
+
ULTRA_KECCAK_PROOF_LENGTH,
|
|
6
7
|
} from '@aztec/constants';
|
|
7
8
|
import { Fr } from '@aztec/foundation/fields';
|
|
8
9
|
import type { Logger } from '@aztec/foundation/log';
|
|
@@ -62,7 +63,9 @@ export async function readProofAsFields<PROOF_LENGTH extends number>(
|
|
|
62
63
|
|
|
63
64
|
let numPublicInputs = vkData.numPublicInputs - PAIRING_POINTS_SIZE;
|
|
64
65
|
assert(
|
|
65
|
-
proofLength == NESTED_RECURSIVE_PROOF_LENGTH ||
|
|
66
|
+
proofLength == NESTED_RECURSIVE_PROOF_LENGTH ||
|
|
67
|
+
proofLength == NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH ||
|
|
68
|
+
proofLength == ULTRA_KECCAK_PROOF_LENGTH,
|
|
66
69
|
`Proof length must be one of the expected proof lengths, received ${proofLength}`,
|
|
67
70
|
);
|
|
68
71
|
if (proofLength == NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH) {
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
PAIRING_POINTS_SIZE,
|
|
6
6
|
RECURSIVE_PROOF_LENGTH,
|
|
7
7
|
TUBE_PROOF_LENGTH,
|
|
8
|
+
ULTRA_KECCAK_PROOF_LENGTH,
|
|
8
9
|
} from '@aztec/constants';
|
|
9
10
|
import { Fr } from '@aztec/foundation/fields';
|
|
10
11
|
import { runInDirectory } from '@aztec/foundation/fs';
|
|
@@ -501,7 +502,9 @@ export class BBNativeRollupProver implements ServerCircuitProver {
|
|
|
501
502
|
bbWorkingDirectory,
|
|
502
503
|
);
|
|
503
504
|
const vkData = this.getVerificationKeyDataForCircuit(circuitType);
|
|
504
|
-
|
|
505
|
+
|
|
506
|
+
const PROOF_LENGTH = circuitType == 'RootRollupArtifact' ? ULTRA_KECCAK_PROOF_LENGTH : RECURSIVE_PROOF_LENGTH;
|
|
507
|
+
const proof = await readProofAsFields(provingResult.proofPath!, vkData, PROOF_LENGTH, logger);
|
|
505
508
|
|
|
506
509
|
const circuitName = mapProtocolArtifactNameToCircuitName(circuitType);
|
|
507
510
|
|
|
@@ -137,7 +137,7 @@ export class BBCircuitVerifier implements ClientProtocolCircuitVerifier {
|
|
|
137
137
|
await runInDirectory(this.config.bbWorkingDirectory, operation, this.config.bbSkipCleanup, this.logger);
|
|
138
138
|
return { valid: true, durationMs: verificationDuration, totalDurationMs: totalTimer.ms() };
|
|
139
139
|
} catch (err) {
|
|
140
|
-
this.logger.warn(`Failed to verify ClientIVC proof for tx ${
|
|
140
|
+
this.logger.warn(`Failed to verify ClientIVC proof for tx ${tx.getTxHash().toString()}: ${String(err)}`);
|
|
141
141
|
return { valid: false, durationMs: 0, totalDurationMs: 0 };
|
|
142
142
|
}
|
|
143
143
|
}
|