@aztec/bb-prover 3.0.0-nightly.20250917 → 3.0.0-nightly.20250918
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/prover/server/bb_prover.d.ts +13 -23
- package/dest/prover/server/bb_prover.d.ts.map +1 -1
- package/dest/prover/server/bb_prover.js +48 -99
- package/dest/stats.d.ts.map +1 -1
- package/dest/stats.js +16 -6
- package/dest/test/delay_values.d.ts.map +1 -1
- package/dest/test/delay_values.js +18 -8
- package/dest/test/test_circuit_prover.d.ts +12 -22
- package/dest/test/test_circuit_prover.d.ts.map +1 -1
- package/dest/test/test_circuit_prover.js +55 -38
- package/package.json +16 -16
- package/src/prover/server/bb_prover.ts +166 -188
- package/src/stats.ts +16 -6
- package/src/test/delay_values.ts +18 -8
- package/src/test/test_circuit_prover.ts +154 -79
|
@@ -14,16 +14,28 @@ import {
|
|
|
14
14
|
type ServerProtocolArtifact,
|
|
15
15
|
convertBaseParityInputsToWitnessMap,
|
|
16
16
|
convertBaseParityOutputsFromWitnessMap,
|
|
17
|
-
convertBlockMergeRollupInputsToWitnessMap,
|
|
18
17
|
convertBlockMergeRollupOutputsFromWitnessMap,
|
|
19
|
-
|
|
18
|
+
convertBlockMergeRollupPrivateInputsToWitnessMap,
|
|
19
|
+
convertBlockRootEmptyTxFirstRollupOutputsFromWitnessMap,
|
|
20
|
+
convertBlockRootEmptyTxFirstRollupPrivateInputsToWitnessMap,
|
|
21
|
+
convertBlockRootFirstRollupOutputsFromWitnessMap,
|
|
22
|
+
convertBlockRootFirstRollupPrivateInputsToWitnessMap,
|
|
20
23
|
convertBlockRootRollupOutputsFromWitnessMap,
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
convertBlockRootRollupPrivateInputsToWitnessMap,
|
|
25
|
+
convertBlockRootSingleTxFirstRollupOutputsFromWitnessMap,
|
|
26
|
+
convertBlockRootSingleTxFirstRollupPrivateInputsToWitnessMap,
|
|
27
|
+
convertBlockRootSingleTxRollupOutputsFromWitnessMap,
|
|
28
|
+
convertBlockRootSingleTxRollupPrivateInputsToWitnessMap,
|
|
29
|
+
convertCheckpointMergeRollupOutputsFromWitnessMap,
|
|
30
|
+
convertCheckpointMergeRollupPrivateInputsToWitnessMap,
|
|
31
|
+
convertCheckpointPaddingRollupOutputsFromWitnessMap,
|
|
32
|
+
convertCheckpointPaddingRollupPrivateInputsToWitnessMap,
|
|
33
|
+
convertCheckpointRootRollupOutputsFromWitnessMap,
|
|
34
|
+
convertCheckpointRootRollupPrivateInputsToWitnessMap,
|
|
35
|
+
convertCheckpointRootSingleBlockRollupOutputsFromWitnessMap,
|
|
36
|
+
convertCheckpointRootSingleBlockRollupPrivateInputsToWitnessMap,
|
|
23
37
|
convertMergeRollupInputsToWitnessMap,
|
|
24
38
|
convertMergeRollupOutputsFromWitnessMap,
|
|
25
|
-
convertPaddingBlockRootRollupInputsToWitnessMap,
|
|
26
|
-
convertPaddingBlockRootRollupOutputsFromWitnessMap,
|
|
27
39
|
convertPrivateBaseRollupInputsToWitnessMap,
|
|
28
40
|
convertPrivateBaseRollupOutputsFromWitnessMap,
|
|
29
41
|
convertPublicBaseRollupInputsToWitnessMap,
|
|
@@ -32,10 +44,8 @@ import {
|
|
|
32
44
|
convertPublicTubePrivateInputsToWitnessMap,
|
|
33
45
|
convertRootParityInputsToWitnessMap,
|
|
34
46
|
convertRootParityOutputsFromWitnessMap,
|
|
35
|
-
convertRootRollupInputsToWitnessMap,
|
|
36
47
|
convertRootRollupOutputsFromWitnessMap,
|
|
37
|
-
|
|
38
|
-
convertSingleTxBlockRootRollupOutputsFromWitnessMap,
|
|
48
|
+
convertRootRollupPrivateInputsToWitnessMap,
|
|
39
49
|
getServerCircuitArtifact,
|
|
40
50
|
} from '@aztec/noir-protocol-circuits-types/server';
|
|
41
51
|
import { ServerCircuitVks } from '@aztec/noir-protocol-circuits-types/server/vks';
|
|
@@ -55,18 +65,24 @@ import type { BaseParityInputs, ParityPublicInputs, RootParityInputs } from '@az
|
|
|
55
65
|
import { Proof, RecursiveProof, makeRecursiveProofFromBinary } from '@aztec/stdlib/proofs';
|
|
56
66
|
import {
|
|
57
67
|
type BaseOrMergeRollupPublicInputs,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
68
|
+
BlockMergeRollupPrivateInputs,
|
|
69
|
+
BlockRollupPublicInputs,
|
|
70
|
+
BlockRootEmptyTxFirstRollupPrivateInputs,
|
|
71
|
+
BlockRootFirstRollupPrivateInputs,
|
|
72
|
+
BlockRootRollupPrivateInputs,
|
|
73
|
+
BlockRootSingleTxFirstRollupPrivateInputs,
|
|
74
|
+
BlockRootSingleTxRollupPrivateInputs,
|
|
75
|
+
CheckpointMergeRollupPrivateInputs,
|
|
76
|
+
CheckpointPaddingRollupPrivateInputs,
|
|
77
|
+
CheckpointRollupPublicInputs,
|
|
78
|
+
CheckpointRootRollupPrivateInputs,
|
|
79
|
+
CheckpointRootSingleBlockRollupPrivateInputs,
|
|
62
80
|
type MergeRollupInputs,
|
|
63
|
-
PaddingBlockRootRollupInputs,
|
|
64
81
|
type PrivateBaseRollupInputs,
|
|
65
82
|
PublicBaseRollupInputs,
|
|
66
83
|
PublicTubePrivateInputs,
|
|
67
|
-
type
|
|
84
|
+
type RootRollupPrivateInputs,
|
|
68
85
|
type RootRollupPublicInputs,
|
|
69
|
-
type SingleTxBlockRootRollupInputs,
|
|
70
86
|
enhanceProofWithPiValidationFlag,
|
|
71
87
|
} from '@aztec/stdlib/rollup';
|
|
72
88
|
import type { CircuitProvingStats, CircuitWitnessGenerationStats } from '@aztec/stdlib/stats';
|
|
@@ -136,21 +152,16 @@ export class BBNativeRollupProver implements ServerCircuitProver {
|
|
|
136
152
|
* @returns The public inputs of the parity circuit.
|
|
137
153
|
*/
|
|
138
154
|
@trackSpan('BBNativeRollupProver.getBaseParityProof', { [Attributes.PROTOCOL_CIRCUIT_NAME]: 'base-parity' })
|
|
139
|
-
public
|
|
155
|
+
public getBaseParityProof(
|
|
140
156
|
inputs: BaseParityInputs,
|
|
141
157
|
): Promise<PublicInputsAndRecursiveProof<ParityPublicInputs, typeof RECURSIVE_PROOF_LENGTH>> {
|
|
142
|
-
|
|
158
|
+
return this.createRecursiveProofAndVerify(
|
|
143
159
|
inputs,
|
|
144
160
|
'BaseParityArtifact',
|
|
145
161
|
RECURSIVE_PROOF_LENGTH,
|
|
146
162
|
convertBaseParityInputsToWitnessMap,
|
|
147
163
|
convertBaseParityOutputsFromWitnessMap,
|
|
148
164
|
);
|
|
149
|
-
|
|
150
|
-
const verificationKey = this.getVerificationKeyDataForCircuit('BaseParityArtifact');
|
|
151
|
-
await this.verifyProof('BaseParityArtifact', proof.binaryProof);
|
|
152
|
-
|
|
153
|
-
return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
|
|
154
165
|
}
|
|
155
166
|
|
|
156
167
|
/**
|
|
@@ -159,21 +170,16 @@ export class BBNativeRollupProver implements ServerCircuitProver {
|
|
|
159
170
|
* @returns The public inputs of the parity circuit.
|
|
160
171
|
*/
|
|
161
172
|
@trackSpan('BBNativeRollupProver.getRootParityProof', { [Attributes.PROTOCOL_CIRCUIT_NAME]: 'root-parity' })
|
|
162
|
-
public
|
|
173
|
+
public getRootParityProof(
|
|
163
174
|
inputs: RootParityInputs,
|
|
164
175
|
): Promise<PublicInputsAndRecursiveProof<ParityPublicInputs, typeof NESTED_RECURSIVE_PROOF_LENGTH>> {
|
|
165
|
-
|
|
176
|
+
return this.createRecursiveProofAndVerify(
|
|
166
177
|
inputs,
|
|
167
178
|
'RootParityArtifact',
|
|
168
179
|
NESTED_RECURSIVE_PROOF_LENGTH,
|
|
169
180
|
convertRootParityInputsToWitnessMap,
|
|
170
181
|
convertRootParityOutputsFromWitnessMap,
|
|
171
182
|
);
|
|
172
|
-
|
|
173
|
-
const verificationKey = this.getVerificationKeyDataForCircuit('RootParityArtifact');
|
|
174
|
-
await this.verifyProof('RootParityArtifact', proof.binaryProof);
|
|
175
|
-
|
|
176
|
-
return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
|
|
177
183
|
}
|
|
178
184
|
|
|
179
185
|
/**
|
|
@@ -226,26 +232,18 @@ export class BBNativeRollupProver implements ServerCircuitProver {
|
|
|
226
232
|
* @param inputs - Inputs to the circuit.
|
|
227
233
|
* @returns The public inputs as outputs of the simulation.
|
|
228
234
|
*/
|
|
229
|
-
public
|
|
235
|
+
public getPrivateBaseRollupProof(
|
|
230
236
|
inputs: PrivateBaseRollupInputs,
|
|
231
237
|
): Promise<
|
|
232
238
|
PublicInputsAndRecursiveProof<BaseOrMergeRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
|
|
233
239
|
> {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
const { circuitOutput, proof } = await this.createRecursiveProof(
|
|
240
|
+
return this.createRecursiveProofAndVerify(
|
|
237
241
|
inputs,
|
|
238
|
-
|
|
242
|
+
'PrivateBaseRollupArtifact',
|
|
239
243
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
240
244
|
convertPrivateBaseRollupInputsToWitnessMap,
|
|
241
245
|
convertPrivateBaseRollupOutputsFromWitnessMap,
|
|
242
246
|
);
|
|
243
|
-
|
|
244
|
-
const verificationKey = this.getVerificationKeyDataForCircuit(artifactName);
|
|
245
|
-
|
|
246
|
-
await this.verifyProof(artifactName, proof.binaryProof);
|
|
247
|
-
|
|
248
|
-
return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
|
|
249
247
|
}
|
|
250
248
|
|
|
251
249
|
/**
|
|
@@ -253,26 +251,18 @@ export class BBNativeRollupProver implements ServerCircuitProver {
|
|
|
253
251
|
* @param kernelRequest - The object encapsulating the request for a proof
|
|
254
252
|
* @returns The requested circuit's public inputs and proof
|
|
255
253
|
*/
|
|
256
|
-
public
|
|
254
|
+
public getPublicBaseRollupProof(
|
|
257
255
|
inputs: PublicBaseRollupInputs,
|
|
258
256
|
): Promise<
|
|
259
257
|
PublicInputsAndRecursiveProof<BaseOrMergeRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
|
|
260
258
|
> {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
const { circuitOutput, proof } = await this.createRecursiveProof(
|
|
259
|
+
return this.createRecursiveProofAndVerify(
|
|
264
260
|
inputs,
|
|
265
|
-
|
|
261
|
+
'PublicBaseRollupArtifact',
|
|
266
262
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
267
263
|
convertPublicBaseRollupInputsToWitnessMap,
|
|
268
264
|
convertPublicBaseRollupOutputsFromWitnessMap,
|
|
269
265
|
);
|
|
270
|
-
|
|
271
|
-
const verificationKey = this.getVerificationKeyDataForCircuit(artifactName);
|
|
272
|
-
|
|
273
|
-
await this.verifyProof(artifactName, proof.binaryProof);
|
|
274
|
-
|
|
275
|
-
return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
|
|
276
266
|
}
|
|
277
267
|
|
|
278
268
|
/**
|
|
@@ -280,139 +270,146 @@ export class BBNativeRollupProver implements ServerCircuitProver {
|
|
|
280
270
|
* @param input - Inputs to the circuit.
|
|
281
271
|
* @returns The public inputs as outputs of the simulation.
|
|
282
272
|
*/
|
|
283
|
-
public
|
|
273
|
+
public getMergeRollupProof(
|
|
284
274
|
input: MergeRollupInputs,
|
|
285
275
|
): Promise<
|
|
286
276
|
PublicInputsAndRecursiveProof<BaseOrMergeRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
|
|
287
277
|
> {
|
|
288
|
-
|
|
278
|
+
return this.createRecursiveProofAndVerify(
|
|
289
279
|
input,
|
|
290
280
|
'MergeRollupArtifact',
|
|
291
281
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
292
282
|
convertMergeRollupInputsToWitnessMap,
|
|
293
283
|
convertMergeRollupOutputsFromWitnessMap,
|
|
294
284
|
);
|
|
285
|
+
}
|
|
295
286
|
|
|
296
|
-
|
|
287
|
+
public getBlockRootFirstRollupProof(
|
|
288
|
+
input: BlockRootFirstRollupPrivateInputs,
|
|
289
|
+
): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
290
|
+
return this.createRecursiveProofAndVerify(
|
|
291
|
+
input,
|
|
292
|
+
'BlockRootFirstRollupArtifact',
|
|
293
|
+
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
294
|
+
convertBlockRootFirstRollupPrivateInputsToWitnessMap,
|
|
295
|
+
convertBlockRootFirstRollupOutputsFromWitnessMap,
|
|
296
|
+
);
|
|
297
|
+
}
|
|
297
298
|
|
|
298
|
-
|
|
299
|
+
public getBlockRootSingleTxFirstRollupProof(
|
|
300
|
+
input: BlockRootSingleTxFirstRollupPrivateInputs,
|
|
301
|
+
): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
302
|
+
return this.createRecursiveProofAndVerify(
|
|
303
|
+
input,
|
|
304
|
+
'BlockRootSingleTxFirstRollupArtifact',
|
|
305
|
+
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
306
|
+
convertBlockRootSingleTxFirstRollupPrivateInputsToWitnessMap,
|
|
307
|
+
convertBlockRootSingleTxFirstRollupOutputsFromWitnessMap,
|
|
308
|
+
);
|
|
309
|
+
}
|
|
299
310
|
|
|
300
|
-
|
|
311
|
+
public getBlockRootEmptyTxFirstRollupProof(
|
|
312
|
+
input: BlockRootEmptyTxFirstRollupPrivateInputs,
|
|
313
|
+
): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
314
|
+
return this.createRecursiveProofAndVerify(
|
|
315
|
+
input,
|
|
316
|
+
'BlockRootEmptyTxFirstRollupArtifact',
|
|
317
|
+
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
318
|
+
convertBlockRootEmptyTxFirstRollupPrivateInputsToWitnessMap,
|
|
319
|
+
convertBlockRootEmptyTxFirstRollupOutputsFromWitnessMap,
|
|
320
|
+
);
|
|
301
321
|
}
|
|
302
322
|
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
*/
|
|
308
|
-
public async getBlockRootRollupProof(
|
|
309
|
-
input: BlockRootRollupInputs,
|
|
310
|
-
): Promise<
|
|
311
|
-
PublicInputsAndRecursiveProof<BlockRootOrBlockMergePublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
|
|
312
|
-
> {
|
|
313
|
-
const { circuitOutput, proof } = await this.createRecursiveProof(
|
|
323
|
+
public getBlockRootRollupProof(
|
|
324
|
+
input: BlockRootRollupPrivateInputs,
|
|
325
|
+
): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
326
|
+
return this.createRecursiveProofAndVerify(
|
|
314
327
|
input,
|
|
315
328
|
'BlockRootRollupArtifact',
|
|
316
329
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
317
|
-
|
|
330
|
+
convertBlockRootRollupPrivateInputsToWitnessMap,
|
|
318
331
|
convertBlockRootRollupOutputsFromWitnessMap,
|
|
319
332
|
);
|
|
333
|
+
}
|
|
320
334
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
335
|
+
public getBlockRootSingleTxRollupProof(
|
|
336
|
+
input: BlockRootSingleTxRollupPrivateInputs,
|
|
337
|
+
): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
338
|
+
return this.createRecursiveProofAndVerify(
|
|
339
|
+
input,
|
|
340
|
+
'BlockRootSingleTxRollupArtifact',
|
|
341
|
+
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
342
|
+
convertBlockRootSingleTxRollupPrivateInputsToWitnessMap,
|
|
343
|
+
convertBlockRootSingleTxRollupOutputsFromWitnessMap,
|
|
344
|
+
);
|
|
345
|
+
}
|
|
324
346
|
|
|
325
|
-
|
|
347
|
+
public getBlockMergeRollupProof(
|
|
348
|
+
input: BlockMergeRollupPrivateInputs,
|
|
349
|
+
): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
350
|
+
return this.createRecursiveProofAndVerify(
|
|
351
|
+
input,
|
|
352
|
+
'BlockMergeRollupArtifact',
|
|
353
|
+
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
354
|
+
convertBlockMergeRollupPrivateInputsToWitnessMap,
|
|
355
|
+
convertBlockMergeRollupOutputsFromWitnessMap,
|
|
356
|
+
);
|
|
326
357
|
}
|
|
327
358
|
|
|
328
|
-
public
|
|
329
|
-
input:
|
|
359
|
+
public getCheckpointRootRollupProof(
|
|
360
|
+
input: CheckpointRootRollupPrivateInputs,
|
|
330
361
|
): Promise<
|
|
331
|
-
PublicInputsAndRecursiveProof<
|
|
362
|
+
PublicInputsAndRecursiveProof<CheckpointRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
|
|
332
363
|
> {
|
|
333
|
-
|
|
364
|
+
return this.createRecursiveProofAndVerify(
|
|
334
365
|
input,
|
|
335
|
-
'
|
|
366
|
+
'CheckpointRootRollupArtifact',
|
|
336
367
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
337
|
-
|
|
338
|
-
|
|
368
|
+
convertCheckpointRootRollupPrivateInputsToWitnessMap,
|
|
369
|
+
convertCheckpointRootRollupOutputsFromWitnessMap,
|
|
339
370
|
);
|
|
340
|
-
|
|
341
|
-
const verificationKey = this.getVerificationKeyDataForCircuit('SingleTxBlockRootRollupArtifact');
|
|
342
|
-
|
|
343
|
-
await this.verifyProof('SingleTxBlockRootRollupArtifact', proof.binaryProof);
|
|
344
|
-
|
|
345
|
-
return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
|
|
346
371
|
}
|
|
347
372
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
* @param input - Inputs to the circuit.
|
|
351
|
-
* @returns The public inputs as outputs of the simulation.
|
|
352
|
-
*/
|
|
353
|
-
public async getEmptyBlockRootRollupProof(
|
|
354
|
-
input: EmptyBlockRootRollupInputs,
|
|
373
|
+
public getCheckpointRootSingleBlockRollupProof(
|
|
374
|
+
input: CheckpointRootSingleBlockRollupPrivateInputs,
|
|
355
375
|
): Promise<
|
|
356
|
-
PublicInputsAndRecursiveProof<
|
|
376
|
+
PublicInputsAndRecursiveProof<CheckpointRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
|
|
357
377
|
> {
|
|
358
|
-
|
|
378
|
+
return this.createRecursiveProofAndVerify(
|
|
359
379
|
input,
|
|
360
|
-
'
|
|
380
|
+
'CheckpointRootSingleBlockRollupArtifact',
|
|
361
381
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
362
|
-
|
|
363
|
-
|
|
382
|
+
convertCheckpointRootSingleBlockRollupPrivateInputsToWitnessMap,
|
|
383
|
+
convertCheckpointRootSingleBlockRollupOutputsFromWitnessMap,
|
|
364
384
|
);
|
|
365
|
-
|
|
366
|
-
const verificationKey = this.getVerificationKeyDataForCircuit('EmptyBlockRootRollupArtifact');
|
|
367
|
-
|
|
368
|
-
await this.verifyProof('EmptyBlockRootRollupArtifact', proof.binaryProof);
|
|
369
|
-
|
|
370
|
-
return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
|
|
371
385
|
}
|
|
372
386
|
|
|
373
|
-
public
|
|
374
|
-
input:
|
|
387
|
+
public getCheckpointPaddingRollupProof(
|
|
388
|
+
input: CheckpointPaddingRollupPrivateInputs,
|
|
375
389
|
): Promise<
|
|
376
|
-
PublicInputsAndRecursiveProof<
|
|
390
|
+
PublicInputsAndRecursiveProof<CheckpointRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
|
|
377
391
|
> {
|
|
378
|
-
|
|
392
|
+
return this.createRecursiveProofAndVerify(
|
|
379
393
|
input,
|
|
380
|
-
'
|
|
394
|
+
'CheckpointPaddingRollupArtifact',
|
|
381
395
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
382
|
-
|
|
383
|
-
|
|
396
|
+
convertCheckpointPaddingRollupPrivateInputsToWitnessMap,
|
|
397
|
+
convertCheckpointPaddingRollupOutputsFromWitnessMap,
|
|
384
398
|
);
|
|
385
|
-
|
|
386
|
-
const verificationKey = this.getVerificationKeyDataForCircuit('PaddingBlockRootRollupArtifact');
|
|
387
|
-
|
|
388
|
-
await this.verifyProof('PaddingBlockRootRollupArtifact', proof.binaryProof);
|
|
389
|
-
|
|
390
|
-
return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
|
|
391
399
|
}
|
|
392
400
|
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
* @param input - Inputs to the circuit.
|
|
396
|
-
* @returns The public inputs as outputs of the simulation.
|
|
397
|
-
*/
|
|
398
|
-
public async getBlockMergeRollupProof(
|
|
399
|
-
input: BlockMergeRollupInputs,
|
|
401
|
+
public getCheckpointMergeRollupProof(
|
|
402
|
+
input: CheckpointMergeRollupPrivateInputs,
|
|
400
403
|
): Promise<
|
|
401
|
-
PublicInputsAndRecursiveProof<
|
|
404
|
+
PublicInputsAndRecursiveProof<CheckpointRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
|
|
402
405
|
> {
|
|
403
|
-
|
|
406
|
+
return this.createRecursiveProofAndVerify(
|
|
404
407
|
input,
|
|
405
|
-
'
|
|
408
|
+
'CheckpointMergeRollupArtifact',
|
|
406
409
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
407
|
-
|
|
408
|
-
|
|
410
|
+
convertCheckpointMergeRollupPrivateInputsToWitnessMap,
|
|
411
|
+
convertCheckpointMergeRollupOutputsFromWitnessMap,
|
|
409
412
|
);
|
|
410
|
-
|
|
411
|
-
const verificationKey = this.getVerificationKeyDataForCircuit('BlockMergeRollupArtifact');
|
|
412
|
-
|
|
413
|
-
await this.verifyProof('BlockMergeRollupArtifact', proof.binaryProof);
|
|
414
|
-
|
|
415
|
-
return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
|
|
416
413
|
}
|
|
417
414
|
|
|
418
415
|
/**
|
|
@@ -421,23 +418,47 @@ export class BBNativeRollupProver implements ServerCircuitProver {
|
|
|
421
418
|
* @returns The public inputs as outputs of the simulation.
|
|
422
419
|
*/
|
|
423
420
|
public async getRootRollupProof(
|
|
424
|
-
input:
|
|
425
|
-
): Promise<PublicInputsAndRecursiveProof<RootRollupPublicInputs>> {
|
|
426
|
-
const {
|
|
421
|
+
input: RootRollupPrivateInputs,
|
|
422
|
+
): Promise<PublicInputsAndRecursiveProof<RootRollupPublicInputs, typeof NESTED_RECURSIVE_PROOF_LENGTH>> {
|
|
423
|
+
const { proof, ...output } = await this.createRecursiveProofAndVerify(
|
|
427
424
|
input,
|
|
428
425
|
'RootRollupArtifact',
|
|
429
|
-
|
|
426
|
+
ULTRA_KECCAK_PROOF_LENGTH,
|
|
427
|
+
convertRootRollupPrivateInputsToWitnessMap,
|
|
430
428
|
convertRootRollupOutputsFromWitnessMap,
|
|
431
429
|
);
|
|
432
430
|
|
|
433
|
-
const recursiveProof = makeRecursiveProofFromBinary(proof, NESTED_RECURSIVE_PROOF_LENGTH);
|
|
434
|
-
|
|
435
|
-
const verificationKey = this.getVerificationKeyDataForCircuit('RootRollupArtifact');
|
|
436
|
-
|
|
437
|
-
await this.verifyProof('RootRollupArtifact', proof);
|
|
431
|
+
const recursiveProof = makeRecursiveProofFromBinary(proof.binaryProof, NESTED_RECURSIVE_PROOF_LENGTH);
|
|
438
432
|
// TODO(https://github.com/AztecProtocol/aztec-packages/issues/13188): Remove this hack.
|
|
439
433
|
recursiveProof.binaryProof.numPublicInputs += PAIRING_POINTS_SIZE;
|
|
440
|
-
|
|
434
|
+
|
|
435
|
+
return { ...output, proof: recursiveProof };
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
private async createRecursiveProofAndVerify<
|
|
439
|
+
PROOF_LENGTH extends number,
|
|
440
|
+
CircuitInputType extends { toBuffer: () => Buffer },
|
|
441
|
+
CircuitOutputType extends { toBuffer: () => Buffer },
|
|
442
|
+
>(
|
|
443
|
+
input: CircuitInputType,
|
|
444
|
+
artifactName: ServerProtocolArtifact,
|
|
445
|
+
proofLength: PROOF_LENGTH,
|
|
446
|
+
convertInput: (input: CircuitInputType) => WitnessMap,
|
|
447
|
+
convertOutput: (outputWitness: WitnessMap) => CircuitOutputType,
|
|
448
|
+
) {
|
|
449
|
+
const { circuitOutput, proof } = await this.createRecursiveProof(
|
|
450
|
+
input,
|
|
451
|
+
artifactName,
|
|
452
|
+
proofLength,
|
|
453
|
+
convertInput,
|
|
454
|
+
convertOutput,
|
|
455
|
+
);
|
|
456
|
+
|
|
457
|
+
await this.verifyProof(artifactName, proof.binaryProof);
|
|
458
|
+
|
|
459
|
+
const verificationKey = this.getVerificationKeyDataForCircuit(artifactName);
|
|
460
|
+
|
|
461
|
+
return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
|
|
441
462
|
}
|
|
442
463
|
|
|
443
464
|
private async generateProofWithBB<
|
|
@@ -508,49 +529,6 @@ export class BBNativeRollupProver implements ServerCircuitProver {
|
|
|
508
529
|
};
|
|
509
530
|
}
|
|
510
531
|
|
|
511
|
-
private async createProof<Input extends { toBuffer: () => Buffer }, Output extends { toBuffer: () => Buffer }>(
|
|
512
|
-
input: Input,
|
|
513
|
-
circuitType: ServerProtocolArtifact,
|
|
514
|
-
convertInput: (input: Input) => WitnessMap,
|
|
515
|
-
convertOutput: (outputWitness: WitnessMap) => Output,
|
|
516
|
-
): Promise<{ circuitOutput: Output; proof: Proof }> {
|
|
517
|
-
const operation = async (bbWorkingDirectory: string) => {
|
|
518
|
-
const { provingResult, circuitOutput: output } = await this.generateProofWithBB(
|
|
519
|
-
input,
|
|
520
|
-
circuitType,
|
|
521
|
-
convertInput,
|
|
522
|
-
convertOutput,
|
|
523
|
-
bbWorkingDirectory,
|
|
524
|
-
);
|
|
525
|
-
const vkData = this.getVerificationKeyDataForCircuit(circuitType);
|
|
526
|
-
|
|
527
|
-
const PROOF_LENGTH = circuitType == 'RootRollupArtifact' ? ULTRA_KECCAK_PROOF_LENGTH : RECURSIVE_PROOF_LENGTH;
|
|
528
|
-
const proof = await readProofsFromOutputDirectory(provingResult.proofPath!, vkData, PROOF_LENGTH, logger);
|
|
529
|
-
|
|
530
|
-
const circuitName = mapProtocolArtifactNameToCircuitName(circuitType);
|
|
531
|
-
|
|
532
|
-
this.instrumentation.recordDuration('provingDuration', circuitName, provingResult.durationMs);
|
|
533
|
-
this.instrumentation.recordSize('proofSize', circuitName, proof.binaryProof.buffer.length);
|
|
534
|
-
this.instrumentation.recordSize('circuitPublicInputCount', circuitName, vkData.numPublicInputs);
|
|
535
|
-
this.instrumentation.recordSize('circuitSize', circuitName, vkData.circuitSize);
|
|
536
|
-
|
|
537
|
-
logger.info(`Generated proof for ${circuitType} in ${Math.ceil(provingResult.durationMs)} ms`, {
|
|
538
|
-
circuitName,
|
|
539
|
-
// does not include reading the proof from disk
|
|
540
|
-
duration: provingResult.durationMs,
|
|
541
|
-
proofSize: proof.binaryProof.buffer.length,
|
|
542
|
-
eventName: 'circuit-proving',
|
|
543
|
-
// circuitOutput is the partial witness that became the input to the proof
|
|
544
|
-
inputSize: output.toBuffer().length,
|
|
545
|
-
circuitSize: vkData.circuitSize,
|
|
546
|
-
numPublicInputs: vkData.numPublicInputs,
|
|
547
|
-
} satisfies CircuitProvingStats);
|
|
548
|
-
|
|
549
|
-
return { circuitOutput: output, proof: proof.binaryProof };
|
|
550
|
-
};
|
|
551
|
-
return await this.runInDirectory(operation);
|
|
552
|
-
}
|
|
553
|
-
|
|
554
532
|
private async generateAvmProofWithBB(input: AvmCircuitInputs, workingDirectory: string): Promise<BBSuccess> {
|
|
555
533
|
logger.info(`Proving avm-circuit for TX ${input.hints.tx.hash}...`);
|
|
556
534
|
|
package/src/stats.ts
CHANGED
|
@@ -15,16 +15,26 @@ export function mapProtocolArtifactNameToCircuitName(artifact: ProtocolArtifact)
|
|
|
15
15
|
return 'public-base-rollup';
|
|
16
16
|
case 'MergeRollupArtifact':
|
|
17
17
|
return 'merge-rollup';
|
|
18
|
+
case 'BlockRootFirstRollupArtifact':
|
|
19
|
+
return 'block-root-first-rollup';
|
|
20
|
+
case 'BlockRootSingleTxFirstRollupArtifact':
|
|
21
|
+
return 'block-root-single-tx-first-rollup';
|
|
22
|
+
case 'BlockRootEmptyTxFirstRollupArtifact':
|
|
23
|
+
return 'block-root-empty-tx-first-rollup';
|
|
18
24
|
case 'BlockRootRollupArtifact':
|
|
19
25
|
return 'block-root-rollup';
|
|
20
|
-
case '
|
|
21
|
-
return 'single-tx-
|
|
22
|
-
case 'EmptyBlockRootRollupArtifact':
|
|
23
|
-
return 'empty-block-root-rollup';
|
|
24
|
-
case 'PaddingBlockRootRollupArtifact':
|
|
25
|
-
return 'padding-block-root-rollup';
|
|
26
|
+
case 'BlockRootSingleTxRollupArtifact':
|
|
27
|
+
return 'block-root-single-tx-rollup';
|
|
26
28
|
case 'BlockMergeRollupArtifact':
|
|
27
29
|
return 'block-merge-rollup';
|
|
30
|
+
case 'CheckpointRootRollupArtifact':
|
|
31
|
+
return 'checkpoint-root-rollup';
|
|
32
|
+
case 'CheckpointRootSingleBlockRollupArtifact':
|
|
33
|
+
return 'checkpoint-root-single-block-rollup';
|
|
34
|
+
case 'CheckpointPaddingRollupArtifact':
|
|
35
|
+
return 'checkpoint-padding-rollup';
|
|
36
|
+
case 'CheckpointMergeRollupArtifact':
|
|
37
|
+
return 'checkpoint-merge-rollup';
|
|
28
38
|
case 'RootRollupArtifact':
|
|
29
39
|
return 'root-rollup';
|
|
30
40
|
case 'PrivateKernelInitArtifact':
|
package/src/test/delay_values.ts
CHANGED
|
@@ -3,12 +3,17 @@ import { ProvingRequestType } from '@aztec/stdlib/proofs';
|
|
|
3
3
|
export const WITGEN_DELAY_MS: Record<ProvingRequestType, number> = {
|
|
4
4
|
[ProvingRequestType.BASE_PARITY]: 60,
|
|
5
5
|
[ProvingRequestType.BLOCK_MERGE_ROLLUP]: 650,
|
|
6
|
-
[ProvingRequestType.
|
|
7
|
-
[ProvingRequestType.
|
|
8
|
-
[ProvingRequestType.
|
|
6
|
+
[ProvingRequestType.BLOCK_ROOT_FIRST_ROLLUP]: 60_000,
|
|
7
|
+
[ProvingRequestType.BLOCK_ROOT_SINGLE_TX_FIRST_ROLLUP]: 40_000,
|
|
8
|
+
[ProvingRequestType.BLOCK_ROOT_EMPTY_TX_FIRST_ROLLUP]: 20_000,
|
|
9
|
+
[ProvingRequestType.BLOCK_ROOT_ROLLUP]: 40_000,
|
|
10
|
+
[ProvingRequestType.BLOCK_ROOT_SINGLE_TX_ROLLUP]: 20_000,
|
|
11
|
+
[ProvingRequestType.CHECKPOINT_ROOT_ROLLUP]: 40_000,
|
|
12
|
+
[ProvingRequestType.CHECKPOINT_ROOT_SINGLE_BLOCK_ROLLUP]: 20_000,
|
|
13
|
+
[ProvingRequestType.CHECKPOINT_PADDING_ROLLUP]: 0,
|
|
14
|
+
[ProvingRequestType.CHECKPOINT_MERGE_ROLLUP]: 650,
|
|
9
15
|
[ProvingRequestType.MERGE_ROLLUP]: 0,
|
|
10
16
|
[ProvingRequestType.PRIVATE_BASE_ROLLUP]: 400_000,
|
|
11
|
-
[ProvingRequestType.SINGLE_TX_BLOCK_ROOT_ROLLUP]: 0, // TBD
|
|
12
17
|
[ProvingRequestType.PUBLIC_BASE_ROLLUP]: 470_000,
|
|
13
18
|
[ProvingRequestType.ROOT_PARITY]: 100,
|
|
14
19
|
[ProvingRequestType.ROOT_ROLLUP]: 650,
|
|
@@ -19,12 +24,17 @@ export const WITGEN_DELAY_MS: Record<ProvingRequestType, number> = {
|
|
|
19
24
|
export const PROOF_DELAY_MS: Record<ProvingRequestType, number> = {
|
|
20
25
|
[ProvingRequestType.BASE_PARITY]: 3_000,
|
|
21
26
|
[ProvingRequestType.BLOCK_MERGE_ROLLUP]: 15_000,
|
|
22
|
-
[ProvingRequestType.
|
|
23
|
-
[ProvingRequestType.
|
|
24
|
-
[ProvingRequestType.
|
|
27
|
+
[ProvingRequestType.BLOCK_ROOT_FIRST_ROLLUP]: 55_000,
|
|
28
|
+
[ProvingRequestType.BLOCK_ROOT_SINGLE_TX_FIRST_ROLLUP]: 35_000,
|
|
29
|
+
[ProvingRequestType.BLOCK_ROOT_EMPTY_TX_FIRST_ROLLUP]: 15_000,
|
|
30
|
+
[ProvingRequestType.BLOCK_ROOT_ROLLUP]: 35_000,
|
|
31
|
+
[ProvingRequestType.BLOCK_ROOT_SINGLE_TX_ROLLUP]: 15_000,
|
|
32
|
+
[ProvingRequestType.CHECKPOINT_ROOT_ROLLUP]: 35_000,
|
|
33
|
+
[ProvingRequestType.CHECKPOINT_ROOT_SINGLE_BLOCK_ROLLUP]: 15_000,
|
|
34
|
+
[ProvingRequestType.CHECKPOINT_PADDING_ROLLUP]: 0,
|
|
35
|
+
[ProvingRequestType.CHECKPOINT_MERGE_ROLLUP]: 15_000,
|
|
25
36
|
[ProvingRequestType.MERGE_ROLLUP]: 0,
|
|
26
37
|
[ProvingRequestType.PRIVATE_BASE_ROLLUP]: 145_000,
|
|
27
|
-
[ProvingRequestType.SINGLE_TX_BLOCK_ROOT_ROLLUP]: 0, // TBD
|
|
28
38
|
[ProvingRequestType.PUBLIC_BASE_ROLLUP]: 160_000,
|
|
29
39
|
[ProvingRequestType.ROOT_PARITY]: 30_000,
|
|
30
40
|
[ProvingRequestType.ROOT_ROLLUP]: 15_000,
|