@aztec/bb-prover 0.43.0 → 0.45.0
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/bb/execute.d.ts +5 -1
- package/dest/bb/execute.d.ts.map +1 -1
- package/dest/bb/execute.js +20 -14
- package/dest/instrumentation.d.ts +47 -0
- package/dest/instrumentation.d.ts.map +1 -0
- package/dest/instrumentation.js +102 -0
- package/dest/prover/bb_native_proof_creator.d.ts.map +1 -1
- package/dest/prover/bb_native_proof_creator.js +10 -8
- package/dest/prover/bb_prover.d.ts +5 -2
- package/dest/prover/bb_prover.d.ts.map +1 -1
- package/dest/prover/bb_prover.js +442 -390
- package/dest/stats.d.ts +1 -2
- package/dest/stats.d.ts.map +1 -1
- package/dest/stats.js +2 -16
- package/dest/test/test_circuit_prover.d.ts +4 -1
- package/dest/test/test_circuit_prover.d.ts.map +1 -1
- package/dest/test/test_circuit_prover.js +165 -119
- package/dest/verifier/bb_verifier.d.ts.map +1 -1
- package/dest/verifier/bb_verifier.js +5 -3
- package/package.json +16 -7
- package/src/bb/execute.ts +20 -15
- package/src/instrumentation.ts +149 -0
- package/src/prover/bb_native_proof_creator.ts +9 -9
- package/src/prover/bb_prover.ts +73 -35
- package/src/stats.ts +1 -15
- package/src/test/test_circuit_prover.ts +28 -2
- package/src/verifier/bb_verifier.ts +4 -3
|
@@ -57,7 +57,9 @@ import {
|
|
|
57
57
|
convertSimulatedPublicTailOutputFromWitnessMap,
|
|
58
58
|
} from '@aztec/noir-protocol-circuits-types';
|
|
59
59
|
import { type SimulationProvider, WASMSimulator, emitCircuitSimulationStats } from '@aztec/simulator';
|
|
60
|
+
import { type TelemetryClient, trackSpan } from '@aztec/telemetry-client';
|
|
60
61
|
|
|
62
|
+
import { ProverInstrumentation } from '../instrumentation.js';
|
|
61
63
|
import { SimulatedPublicKernelArtifactMapping } from '../mappings/mappings.js';
|
|
62
64
|
import { mapPublicKernelToCircuitName } from '../stats.js';
|
|
63
65
|
|
|
@@ -81,11 +83,19 @@ const VERIFICATION_KEYS: Record<ServerProtocolArtifact, VerificationKeyAsFields>
|
|
|
81
83
|
*/
|
|
82
84
|
export class TestCircuitProver implements ServerCircuitProver {
|
|
83
85
|
private wasmSimulator = new WASMSimulator();
|
|
86
|
+
private instrumentation: ProverInstrumentation;
|
|
84
87
|
|
|
85
88
|
constructor(
|
|
89
|
+
telemetry: TelemetryClient,
|
|
86
90
|
private simulationProvider?: SimulationProvider,
|
|
87
91
|
private logger = createDebugLogger('aztec:test-prover'),
|
|
88
|
-
) {
|
|
92
|
+
) {
|
|
93
|
+
this.instrumentation = new ProverInstrumentation(telemetry, 'TestCircuitProver');
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
get tracer() {
|
|
97
|
+
return this.instrumentation.tracer;
|
|
98
|
+
}
|
|
89
99
|
|
|
90
100
|
public async getEmptyPrivateKernelProof(
|
|
91
101
|
inputs: PrivateKernelEmptyInputData,
|
|
@@ -111,6 +121,7 @@ export class TestCircuitProver implements ServerCircuitProver {
|
|
|
111
121
|
* @param inputs - Inputs to the circuit.
|
|
112
122
|
* @returns The public inputs of the parity circuit.
|
|
113
123
|
*/
|
|
124
|
+
@trackSpan('TestCircuitProver.getBaseParityProof')
|
|
114
125
|
public async getBaseParityProof(inputs: BaseParityInputs): Promise<RootParityInput<typeof RECURSIVE_PROOF_LENGTH>> {
|
|
115
126
|
const timer = new Timer();
|
|
116
127
|
const witnessMap = convertBaseParityInputsToWitnessMap(inputs);
|
|
@@ -125,6 +136,8 @@ export class TestCircuitProver implements ServerCircuitProver {
|
|
|
125
136
|
result,
|
|
126
137
|
);
|
|
127
138
|
|
|
139
|
+
this.instrumentation.recordDuration('simulationDuration', 'base-parity', timer);
|
|
140
|
+
|
|
128
141
|
emitCircuitSimulationStats(
|
|
129
142
|
'base-parity',
|
|
130
143
|
timer.ms(),
|
|
@@ -141,6 +154,7 @@ export class TestCircuitProver implements ServerCircuitProver {
|
|
|
141
154
|
* @param inputs - Inputs to the circuit.
|
|
142
155
|
* @returns The public inputs of the parity circuit.
|
|
143
156
|
*/
|
|
157
|
+
@trackSpan('TestCircuitProver.getRootParityProof')
|
|
144
158
|
public async getRootParityProof(
|
|
145
159
|
inputs: RootParityInputs,
|
|
146
160
|
): Promise<RootParityInput<typeof NESTED_RECURSIVE_PROOF_LENGTH>> {
|
|
@@ -158,6 +172,7 @@ export class TestCircuitProver implements ServerCircuitProver {
|
|
|
158
172
|
result,
|
|
159
173
|
);
|
|
160
174
|
|
|
175
|
+
this.instrumentation.recordDuration('simulationDuration', 'root-parity', timer);
|
|
161
176
|
emitCircuitSimulationStats(
|
|
162
177
|
'root-parity',
|
|
163
178
|
timer.ms(),
|
|
@@ -174,6 +189,7 @@ export class TestCircuitProver implements ServerCircuitProver {
|
|
|
174
189
|
* @param input - Inputs to the circuit.
|
|
175
190
|
* @returns The public inputs as outputs of the simulation.
|
|
176
191
|
*/
|
|
192
|
+
@trackSpan('TestCircuitProver.getBaseRollupProof')
|
|
177
193
|
public async getBaseRollupProof(
|
|
178
194
|
input: BaseRollupInputs,
|
|
179
195
|
): Promise<PublicInputsAndRecursiveProof<BaseOrMergeRollupPublicInputs>> {
|
|
@@ -185,6 +201,7 @@ export class TestCircuitProver implements ServerCircuitProver {
|
|
|
185
201
|
|
|
186
202
|
const result = convertSimulatedBaseRollupOutputsFromWitnessMap(witness);
|
|
187
203
|
|
|
204
|
+
this.instrumentation.recordDuration('simulationDuration', 'base-rollup', timer);
|
|
188
205
|
emitCircuitSimulationStats(
|
|
189
206
|
'base-rollup',
|
|
190
207
|
timer.ms(),
|
|
@@ -203,6 +220,7 @@ export class TestCircuitProver implements ServerCircuitProver {
|
|
|
203
220
|
* @param input - Inputs to the circuit.
|
|
204
221
|
* @returns The public inputs as outputs of the simulation.
|
|
205
222
|
*/
|
|
223
|
+
@trackSpan('TestCircuitProver.getMergeRollupProof')
|
|
206
224
|
public async getMergeRollupProof(
|
|
207
225
|
input: MergeRollupInputs,
|
|
208
226
|
): Promise<PublicInputsAndRecursiveProof<BaseOrMergeRollupPublicInputs>> {
|
|
@@ -214,6 +232,7 @@ export class TestCircuitProver implements ServerCircuitProver {
|
|
|
214
232
|
|
|
215
233
|
const result = convertMergeRollupOutputsFromWitnessMap(witness);
|
|
216
234
|
|
|
235
|
+
this.instrumentation.recordDuration('simulationDuration', 'merge-rollup', timer);
|
|
217
236
|
emitCircuitSimulationStats(
|
|
218
237
|
'merge-rollup',
|
|
219
238
|
timer.ms(),
|
|
@@ -233,6 +252,7 @@ export class TestCircuitProver implements ServerCircuitProver {
|
|
|
233
252
|
* @param input - Inputs to the circuit.
|
|
234
253
|
* @returns The public inputs as outputs of the simulation.
|
|
235
254
|
*/
|
|
255
|
+
@trackSpan('TestCircuitProver.getRootRollupProof')
|
|
236
256
|
public async getRootRollupProof(
|
|
237
257
|
input: RootRollupInputs,
|
|
238
258
|
): Promise<PublicInputsAndRecursiveProof<RootRollupPublicInputs>> {
|
|
@@ -244,6 +264,7 @@ export class TestCircuitProver implements ServerCircuitProver {
|
|
|
244
264
|
|
|
245
265
|
const result = convertRootRollupOutputsFromWitnessMap(witness);
|
|
246
266
|
|
|
267
|
+
this.instrumentation.recordDuration('simulationDuration', 'root-rollup', timer);
|
|
247
268
|
emitCircuitSimulationStats(
|
|
248
269
|
'root-rollup',
|
|
249
270
|
timer.ms(),
|
|
@@ -258,6 +279,7 @@ export class TestCircuitProver implements ServerCircuitProver {
|
|
|
258
279
|
);
|
|
259
280
|
}
|
|
260
281
|
|
|
282
|
+
@trackSpan('TestCircuitProver.getPublicKernelProof')
|
|
261
283
|
public async getPublicKernelProof(
|
|
262
284
|
kernelRequest: PublicKernelNonTailRequest,
|
|
263
285
|
): Promise<PublicInputsAndRecursiveProof<PublicKernelCircuitPublicInputs>> {
|
|
@@ -274,8 +296,10 @@ export class TestCircuitProver implements ServerCircuitProver {
|
|
|
274
296
|
);
|
|
275
297
|
|
|
276
298
|
const result = kernelOps.convertOutputs(witness);
|
|
299
|
+
const circuitName = mapPublicKernelToCircuitName(kernelRequest.type);
|
|
300
|
+
this.instrumentation.recordDuration('simulationDuration', circuitName, timer);
|
|
277
301
|
emitCircuitSimulationStats(
|
|
278
|
-
|
|
302
|
+
circuitName,
|
|
279
303
|
timer.ms(),
|
|
280
304
|
kernelRequest.inputs.toBuffer().length,
|
|
281
305
|
result.toBuffer().length,
|
|
@@ -289,6 +313,7 @@ export class TestCircuitProver implements ServerCircuitProver {
|
|
|
289
313
|
);
|
|
290
314
|
}
|
|
291
315
|
|
|
316
|
+
@trackSpan('TestCircuitProver.getPublicTailProof')
|
|
292
317
|
public async getPublicTailProof(
|
|
293
318
|
kernelRequest: PublicKernelTailRequest,
|
|
294
319
|
): Promise<PublicInputsAndRecursiveProof<KernelCircuitPublicInputs>> {
|
|
@@ -301,6 +326,7 @@ export class TestCircuitProver implements ServerCircuitProver {
|
|
|
301
326
|
);
|
|
302
327
|
|
|
303
328
|
const result = convertSimulatedPublicTailOutputFromWitnessMap(witness);
|
|
329
|
+
this.instrumentation.recordDuration('simulationDuration', 'public-kernel-tail', timer);
|
|
304
330
|
emitCircuitSimulationStats(
|
|
305
331
|
'public-kernel-tail',
|
|
306
332
|
timer.ms(),
|
|
@@ -129,9 +129,10 @@ export class BBCircuitVerifier implements ClientProtocolCircuitVerifier {
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
async verifyProof(tx: Tx): Promise<boolean> {
|
|
132
|
-
const { proof,
|
|
133
|
-
const expectedCircuit: ClientProtocolArtifact =
|
|
134
|
-
|
|
132
|
+
const { proof, data } = tx;
|
|
133
|
+
const expectedCircuit: ClientProtocolArtifact = data.forPublic
|
|
134
|
+
? 'PrivateKernelTailToPublicArtifact'
|
|
135
|
+
: 'PrivateKernelTailArtifact';
|
|
135
136
|
|
|
136
137
|
try {
|
|
137
138
|
await this.verifyProofForCircuit(expectedCircuit, proof);
|