@aztec/bb-prover 3.0.0-nightly.20250917 → 3.0.0-nightly.20250919

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.
@@ -12,33 +12,44 @@ import { createLogger } from '@aztec/foundation/log';
12
12
  import { BufferReader } from '@aztec/foundation/serialize';
13
13
  import {
14
14
  type ServerProtocolArtifact,
15
- convertBaseParityInputsToWitnessMap,
16
- convertBaseParityOutputsFromWitnessMap,
17
- convertBlockMergeRollupInputsToWitnessMap,
18
15
  convertBlockMergeRollupOutputsFromWitnessMap,
19
- convertBlockRootRollupInputsToWitnessMap,
16
+ convertBlockMergeRollupPrivateInputsToWitnessMap,
17
+ convertBlockRootEmptyTxFirstRollupOutputsFromWitnessMap,
18
+ convertBlockRootEmptyTxFirstRollupPrivateInputsToWitnessMap,
19
+ convertBlockRootFirstRollupOutputsFromWitnessMap,
20
+ convertBlockRootFirstRollupPrivateInputsToWitnessMap,
20
21
  convertBlockRootRollupOutputsFromWitnessMap,
21
- convertEmptyBlockRootRollupInputsToWitnessMap,
22
- convertEmptyBlockRootRollupOutputsFromWitnessMap,
23
- convertMergeRollupInputsToWitnessMap,
24
- convertMergeRollupOutputsFromWitnessMap,
25
- convertPaddingBlockRootRollupInputsToWitnessMap,
26
- convertPaddingBlockRootRollupOutputsFromWitnessMap,
27
- convertPrivateBaseRollupInputsToWitnessMap,
28
- convertPrivateBaseRollupOutputsFromWitnessMap,
29
- convertPublicBaseRollupInputsToWitnessMap,
30
- convertPublicBaseRollupOutputsFromWitnessMap,
22
+ convertBlockRootRollupPrivateInputsToWitnessMap,
23
+ convertBlockRootSingleTxFirstRollupOutputsFromWitnessMap,
24
+ convertBlockRootSingleTxFirstRollupPrivateInputsToWitnessMap,
25
+ convertBlockRootSingleTxRollupOutputsFromWitnessMap,
26
+ convertBlockRootSingleTxRollupPrivateInputsToWitnessMap,
27
+ convertCheckpointMergeRollupOutputsFromWitnessMap,
28
+ convertCheckpointMergeRollupPrivateInputsToWitnessMap,
29
+ convertCheckpointPaddingRollupOutputsFromWitnessMap,
30
+ convertCheckpointPaddingRollupPrivateInputsToWitnessMap,
31
+ convertCheckpointRootRollupOutputsFromWitnessMap,
32
+ convertCheckpointRootRollupPrivateInputsToWitnessMap,
33
+ convertCheckpointRootSingleBlockRollupOutputsFromWitnessMap,
34
+ convertCheckpointRootSingleBlockRollupPrivateInputsToWitnessMap,
35
+ convertParityBaseOutputsFromWitnessMap,
36
+ convertParityBasePrivateInputsToWitnessMap,
37
+ convertParityRootOutputsFromWitnessMap,
38
+ convertParityRootPrivateInputsToWitnessMap,
39
+ convertPrivateTxBaseRollupOutputsFromWitnessMap,
40
+ convertPrivateTxBaseRollupPrivateInputsToWitnessMap,
31
41
  convertPublicTubeOutputsFromWitnessMap,
32
42
  convertPublicTubePrivateInputsToWitnessMap,
33
- convertRootParityInputsToWitnessMap,
34
- convertRootParityOutputsFromWitnessMap,
35
- convertRootRollupInputsToWitnessMap,
43
+ convertPublicTxBaseRollupOutputsFromWitnessMap,
44
+ convertPublicTxBaseRollupPrivateInputsToWitnessMap,
36
45
  convertRootRollupOutputsFromWitnessMap,
37
- convertSingleTxBlockRootRollupInputsToWitnessMap,
38
- convertSingleTxBlockRootRollupOutputsFromWitnessMap,
46
+ convertRootRollupPrivateInputsToWitnessMap,
47
+ convertTxMergeRollupOutputsFromWitnessMap,
48
+ convertTxMergeRollupPrivateInputsToWitnessMap,
39
49
  getServerCircuitArtifact,
40
50
  } from '@aztec/noir-protocol-circuits-types/server';
41
51
  import { ServerCircuitVks } from '@aztec/noir-protocol-circuits-types/server/vks';
52
+ import { mapProtocolArtifactNameToCircuitName } from '@aztec/noir-protocol-circuits-types/types';
42
53
  import type { WitnessMap } from '@aztec/noir-types';
43
54
  import { NativeACVMSimulator } from '@aztec/simulator/server';
44
55
  import type { AvmCircuitInputs, AvmCircuitPublicInputs } from '@aztec/stdlib/avm';
@@ -51,22 +62,28 @@ import {
51
62
  makePublicInputsAndRecursiveProof,
52
63
  } from '@aztec/stdlib/interfaces/server';
53
64
  import type { PrivateToPublicKernelCircuitPublicInputs } from '@aztec/stdlib/kernel';
54
- import type { BaseParityInputs, ParityPublicInputs, RootParityInputs } from '@aztec/stdlib/parity';
65
+ import type { ParityBasePrivateInputs, ParityPublicInputs, ParityRootPrivateInputs } from '@aztec/stdlib/parity';
55
66
  import { Proof, RecursiveProof, makeRecursiveProofFromBinary } from '@aztec/stdlib/proofs';
56
67
  import {
57
- type BaseOrMergeRollupPublicInputs,
58
- type BlockMergeRollupInputs,
59
- type BlockRootOrBlockMergePublicInputs,
60
- type BlockRootRollupInputs,
61
- type EmptyBlockRootRollupInputs,
62
- type MergeRollupInputs,
63
- PaddingBlockRootRollupInputs,
64
- type PrivateBaseRollupInputs,
65
- PublicBaseRollupInputs,
68
+ BlockMergeRollupPrivateInputs,
69
+ BlockRollupPublicInputs,
70
+ BlockRootEmptyTxFirstRollupPrivateInputs,
71
+ BlockRootFirstRollupPrivateInputs,
72
+ BlockRootRollupPrivateInputs,
73
+ BlockRootSingleTxFirstRollupPrivateInputs,
74
+ BlockRootSingleTxRollupPrivateInputs,
75
+ CheckpointMergeRollupPrivateInputs,
76
+ CheckpointPaddingRollupPrivateInputs,
77
+ CheckpointRollupPublicInputs,
78
+ CheckpointRootRollupPrivateInputs,
79
+ CheckpointRootSingleBlockRollupPrivateInputs,
80
+ type PrivateTxBaseRollupPrivateInputs,
66
81
  PublicTubePrivateInputs,
67
- type RootRollupInputs,
82
+ PublicTxBaseRollupPrivateInputs,
83
+ type RootRollupPrivateInputs,
68
84
  type RootRollupPublicInputs,
69
- type SingleTxBlockRootRollupInputs,
85
+ type TxMergeRollupPrivateInputs,
86
+ type TxRollupPublicInputs,
70
87
  enhanceProofWithPiValidationFlag,
71
88
  } from '@aztec/stdlib/rollup';
72
89
  import type { CircuitProvingStats, CircuitWitnessGenerationStats } from '@aztec/stdlib/stats';
@@ -91,7 +108,6 @@ import {
91
108
  import type { ACVMConfig, BBConfig } from '../../config.js';
92
109
  import { type UltraHonkFlavor, getUltraHonkFlavorForCircuit } from '../../honk.js';
93
110
  import { ProverInstrumentation } from '../../instrumentation.js';
94
- import { mapProtocolArtifactNameToCircuitName } from '../../stats.js';
95
111
  import { extractAvmVkData } from '../../verification_key/verification_key_data.js';
96
112
  import { readProofsFromOutputDirectory } from '../proof_utils.js';
97
113
 
@@ -135,22 +151,17 @@ export class BBNativeRollupProver implements ServerCircuitProver {
135
151
  * @param inputs - Inputs to the circuit.
136
152
  * @returns The public inputs of the parity circuit.
137
153
  */
138
- @trackSpan('BBNativeRollupProver.getBaseParityProof', { [Attributes.PROTOCOL_CIRCUIT_NAME]: 'base-parity' })
139
- public async getBaseParityProof(
140
- inputs: BaseParityInputs,
154
+ @trackSpan('BBNativeRollupProver.getBaseParityProof', { [Attributes.PROTOCOL_CIRCUIT_NAME]: 'parity-base' })
155
+ public getBaseParityProof(
156
+ inputs: ParityBasePrivateInputs,
141
157
  ): Promise<PublicInputsAndRecursiveProof<ParityPublicInputs, typeof RECURSIVE_PROOF_LENGTH>> {
142
- const { circuitOutput, proof } = await this.createRecursiveProof(
158
+ return this.createRecursiveProofAndVerify(
143
159
  inputs,
144
- 'BaseParityArtifact',
160
+ 'ParityBaseArtifact',
145
161
  RECURSIVE_PROOF_LENGTH,
146
- convertBaseParityInputsToWitnessMap,
147
- convertBaseParityOutputsFromWitnessMap,
162
+ convertParityBasePrivateInputsToWitnessMap,
163
+ convertParityBaseOutputsFromWitnessMap,
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
  /**
@@ -158,22 +169,17 @@ export class BBNativeRollupProver implements ServerCircuitProver {
158
169
  * @param inputs - Inputs to the circuit.
159
170
  * @returns The public inputs of the parity circuit.
160
171
  */
161
- @trackSpan('BBNativeRollupProver.getRootParityProof', { [Attributes.PROTOCOL_CIRCUIT_NAME]: 'root-parity' })
162
- public async getRootParityProof(
163
- inputs: RootParityInputs,
172
+ @trackSpan('BBNativeRollupProver.getRootParityProof', { [Attributes.PROTOCOL_CIRCUIT_NAME]: 'parity-root' })
173
+ public getRootParityProof(
174
+ inputs: ParityRootPrivateInputs,
164
175
  ): Promise<PublicInputsAndRecursiveProof<ParityPublicInputs, typeof NESTED_RECURSIVE_PROOF_LENGTH>> {
165
- const { circuitOutput, proof } = await this.createRecursiveProof(
176
+ return this.createRecursiveProofAndVerify(
166
177
  inputs,
167
- 'RootParityArtifact',
178
+ 'ParityRootArtifact',
168
179
  NESTED_RECURSIVE_PROOF_LENGTH,
169
- convertRootParityInputsToWitnessMap,
170
- convertRootParityOutputsFromWitnessMap,
180
+ convertParityRootPrivateInputsToWitnessMap,
181
+ convertParityRootOutputsFromWitnessMap,
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,16 @@ 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 async getPrivateBaseRollupProof(
230
- inputs: PrivateBaseRollupInputs,
231
- ): Promise<
232
- PublicInputsAndRecursiveProof<BaseOrMergeRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
233
- > {
234
- const artifactName = 'PrivateBaseRollupArtifact';
235
-
236
- const { circuitOutput, proof } = await this.createRecursiveProof(
235
+ public getPrivateTxBaseRollupProof(
236
+ inputs: PrivateTxBaseRollupPrivateInputs,
237
+ ): Promise<PublicInputsAndRecursiveProof<TxRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
238
+ return this.createRecursiveProofAndVerify(
237
239
  inputs,
238
- artifactName,
240
+ 'PrivateTxBaseRollupArtifact',
239
241
  NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
240
- convertPrivateBaseRollupInputsToWitnessMap,
241
- convertPrivateBaseRollupOutputsFromWitnessMap,
242
+ convertPrivateTxBaseRollupPrivateInputsToWitnessMap,
243
+ convertPrivateTxBaseRollupOutputsFromWitnessMap,
242
244
  );
243
-
244
- const verificationKey = this.getVerificationKeyDataForCircuit(artifactName);
245
-
246
- await this.verifyProof(artifactName, proof.binaryProof);
247
-
248
- return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
249
245
  }
250
246
 
251
247
  /**
@@ -253,26 +249,16 @@ export class BBNativeRollupProver implements ServerCircuitProver {
253
249
  * @param kernelRequest - The object encapsulating the request for a proof
254
250
  * @returns The requested circuit's public inputs and proof
255
251
  */
256
- public async getPublicBaseRollupProof(
257
- inputs: PublicBaseRollupInputs,
258
- ): Promise<
259
- PublicInputsAndRecursiveProof<BaseOrMergeRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
260
- > {
261
- const artifactName = 'PublicBaseRollupArtifact';
262
-
263
- const { circuitOutput, proof } = await this.createRecursiveProof(
252
+ public getPublicTxBaseRollupProof(
253
+ inputs: PublicTxBaseRollupPrivateInputs,
254
+ ): Promise<PublicInputsAndRecursiveProof<TxRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
255
+ return this.createRecursiveProofAndVerify(
264
256
  inputs,
265
- artifactName,
257
+ 'PublicTxBaseRollupArtifact',
266
258
  NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
267
- convertPublicBaseRollupInputsToWitnessMap,
268
- convertPublicBaseRollupOutputsFromWitnessMap,
259
+ convertPublicTxBaseRollupPrivateInputsToWitnessMap,
260
+ convertPublicTxBaseRollupOutputsFromWitnessMap,
269
261
  );
270
-
271
- const verificationKey = this.getVerificationKeyDataForCircuit(artifactName);
272
-
273
- await this.verifyProof(artifactName, proof.binaryProof);
274
-
275
- return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
276
262
  }
277
263
 
278
264
  /**
@@ -280,139 +266,144 @@ export class BBNativeRollupProver implements ServerCircuitProver {
280
266
  * @param input - Inputs to the circuit.
281
267
  * @returns The public inputs as outputs of the simulation.
282
268
  */
283
- public async getMergeRollupProof(
284
- input: MergeRollupInputs,
285
- ): Promise<
286
- PublicInputsAndRecursiveProof<BaseOrMergeRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
287
- > {
288
- const { circuitOutput, proof } = await this.createRecursiveProof(
269
+ public getTxMergeRollupProof(
270
+ input: TxMergeRollupPrivateInputs,
271
+ ): Promise<PublicInputsAndRecursiveProof<TxRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
272
+ return this.createRecursiveProofAndVerify(
289
273
  input,
290
- 'MergeRollupArtifact',
274
+ 'TxMergeRollupArtifact',
291
275
  NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
292
- convertMergeRollupInputsToWitnessMap,
293
- convertMergeRollupOutputsFromWitnessMap,
276
+ convertTxMergeRollupPrivateInputsToWitnessMap,
277
+ convertTxMergeRollupOutputsFromWitnessMap,
294
278
  );
279
+ }
295
280
 
296
- const verificationKey = this.getVerificationKeyDataForCircuit('MergeRollupArtifact');
281
+ public getBlockRootFirstRollupProof(
282
+ input: BlockRootFirstRollupPrivateInputs,
283
+ ): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
284
+ return this.createRecursiveProofAndVerify(
285
+ input,
286
+ 'BlockRootFirstRollupArtifact',
287
+ NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
288
+ convertBlockRootFirstRollupPrivateInputsToWitnessMap,
289
+ convertBlockRootFirstRollupOutputsFromWitnessMap,
290
+ );
291
+ }
297
292
 
298
- await this.verifyProof('MergeRollupArtifact', proof.binaryProof);
293
+ public getBlockRootSingleTxFirstRollupProof(
294
+ input: BlockRootSingleTxFirstRollupPrivateInputs,
295
+ ): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
296
+ return this.createRecursiveProofAndVerify(
297
+ input,
298
+ 'BlockRootSingleTxFirstRollupArtifact',
299
+ NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
300
+ convertBlockRootSingleTxFirstRollupPrivateInputsToWitnessMap,
301
+ convertBlockRootSingleTxFirstRollupOutputsFromWitnessMap,
302
+ );
303
+ }
299
304
 
300
- return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
305
+ public getBlockRootEmptyTxFirstRollupProof(
306
+ input: BlockRootEmptyTxFirstRollupPrivateInputs,
307
+ ): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
308
+ return this.createRecursiveProofAndVerify(
309
+ input,
310
+ 'BlockRootEmptyTxFirstRollupArtifact',
311
+ NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
312
+ convertBlockRootEmptyTxFirstRollupPrivateInputsToWitnessMap,
313
+ convertBlockRootEmptyTxFirstRollupOutputsFromWitnessMap,
314
+ );
301
315
  }
302
316
 
303
- /**
304
- * Simulates the block root rollup circuit from its inputs.
305
- * @param input - Inputs to the circuit.
306
- * @returns The public inputs as outputs of the simulation.
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(
317
+ public getBlockRootRollupProof(
318
+ input: BlockRootRollupPrivateInputs,
319
+ ): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
320
+ return this.createRecursiveProofAndVerify(
314
321
  input,
315
322
  'BlockRootRollupArtifact',
316
323
  NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
317
- convertBlockRootRollupInputsToWitnessMap,
324
+ convertBlockRootRollupPrivateInputsToWitnessMap,
318
325
  convertBlockRootRollupOutputsFromWitnessMap,
319
326
  );
327
+ }
320
328
 
321
- const verificationKey = this.getVerificationKeyDataForCircuit('BlockRootRollupArtifact');
322
-
323
- await this.verifyProof('BlockRootRollupArtifact', proof.binaryProof);
329
+ public getBlockRootSingleTxRollupProof(
330
+ input: BlockRootSingleTxRollupPrivateInputs,
331
+ ): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
332
+ return this.createRecursiveProofAndVerify(
333
+ input,
334
+ 'BlockRootSingleTxRollupArtifact',
335
+ NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
336
+ convertBlockRootSingleTxRollupPrivateInputsToWitnessMap,
337
+ convertBlockRootSingleTxRollupOutputsFromWitnessMap,
338
+ );
339
+ }
324
340
 
325
- return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
341
+ public getBlockMergeRollupProof(
342
+ input: BlockMergeRollupPrivateInputs,
343
+ ): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
344
+ return this.createRecursiveProofAndVerify(
345
+ input,
346
+ 'BlockMergeRollupArtifact',
347
+ NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
348
+ convertBlockMergeRollupPrivateInputsToWitnessMap,
349
+ convertBlockMergeRollupOutputsFromWitnessMap,
350
+ );
326
351
  }
327
352
 
328
- public async getSingleTxBlockRootRollupProof(
329
- input: SingleTxBlockRootRollupInputs,
353
+ public getCheckpointRootRollupProof(
354
+ input: CheckpointRootRollupPrivateInputs,
330
355
  ): Promise<
331
- PublicInputsAndRecursiveProof<BlockRootOrBlockMergePublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
356
+ PublicInputsAndRecursiveProof<CheckpointRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
332
357
  > {
333
- const { circuitOutput, proof } = await this.createRecursiveProof(
358
+ return this.createRecursiveProofAndVerify(
334
359
  input,
335
- 'SingleTxBlockRootRollupArtifact',
360
+ 'CheckpointRootRollupArtifact',
336
361
  NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
337
- convertSingleTxBlockRootRollupInputsToWitnessMap,
338
- convertSingleTxBlockRootRollupOutputsFromWitnessMap,
362
+ convertCheckpointRootRollupPrivateInputsToWitnessMap,
363
+ convertCheckpointRootRollupOutputsFromWitnessMap,
339
364
  );
340
-
341
- const verificationKey = this.getVerificationKeyDataForCircuit('SingleTxBlockRootRollupArtifact');
342
-
343
- await this.verifyProof('SingleTxBlockRootRollupArtifact', proof.binaryProof);
344
-
345
- return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
346
365
  }
347
366
 
348
- /**
349
- * Simulates the empty block root rollup circuit from its inputs.
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,
367
+ public getCheckpointRootSingleBlockRollupProof(
368
+ input: CheckpointRootSingleBlockRollupPrivateInputs,
355
369
  ): Promise<
356
- PublicInputsAndRecursiveProof<BlockRootOrBlockMergePublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
370
+ PublicInputsAndRecursiveProof<CheckpointRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
357
371
  > {
358
- const { circuitOutput, proof } = await this.createRecursiveProof(
372
+ return this.createRecursiveProofAndVerify(
359
373
  input,
360
- 'EmptyBlockRootRollupArtifact',
374
+ 'CheckpointRootSingleBlockRollupArtifact',
361
375
  NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
362
- convertEmptyBlockRootRollupInputsToWitnessMap,
363
- convertEmptyBlockRootRollupOutputsFromWitnessMap,
376
+ convertCheckpointRootSingleBlockRollupPrivateInputsToWitnessMap,
377
+ convertCheckpointRootSingleBlockRollupOutputsFromWitnessMap,
364
378
  );
365
-
366
- const verificationKey = this.getVerificationKeyDataForCircuit('EmptyBlockRootRollupArtifact');
367
-
368
- await this.verifyProof('EmptyBlockRootRollupArtifact', proof.binaryProof);
369
-
370
- return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
371
379
  }
372
380
 
373
- public async getPaddingBlockRootRollupProof(
374
- input: PaddingBlockRootRollupInputs,
381
+ public getCheckpointPaddingRollupProof(
382
+ input: CheckpointPaddingRollupPrivateInputs,
375
383
  ): Promise<
376
- PublicInputsAndRecursiveProof<BlockRootOrBlockMergePublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
384
+ PublicInputsAndRecursiveProof<CheckpointRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
377
385
  > {
378
- const { circuitOutput, proof } = await this.createRecursiveProof(
386
+ return this.createRecursiveProofAndVerify(
379
387
  input,
380
- 'PaddingBlockRootRollupArtifact',
388
+ 'CheckpointPaddingRollupArtifact',
381
389
  NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
382
- convertPaddingBlockRootRollupInputsToWitnessMap,
383
- convertPaddingBlockRootRollupOutputsFromWitnessMap,
390
+ convertCheckpointPaddingRollupPrivateInputsToWitnessMap,
391
+ convertCheckpointPaddingRollupOutputsFromWitnessMap,
384
392
  );
385
-
386
- const verificationKey = this.getVerificationKeyDataForCircuit('PaddingBlockRootRollupArtifact');
387
-
388
- await this.verifyProof('PaddingBlockRootRollupArtifact', proof.binaryProof);
389
-
390
- return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
391
393
  }
392
394
 
393
- /**
394
- * Simulates the block merge rollup circuit from its inputs.
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,
395
+ public getCheckpointMergeRollupProof(
396
+ input: CheckpointMergeRollupPrivateInputs,
400
397
  ): Promise<
401
- PublicInputsAndRecursiveProof<BlockRootOrBlockMergePublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
398
+ PublicInputsAndRecursiveProof<CheckpointRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
402
399
  > {
403
- const { circuitOutput, proof } = await this.createRecursiveProof(
400
+ return this.createRecursiveProofAndVerify(
404
401
  input,
405
- 'BlockMergeRollupArtifact',
402
+ 'CheckpointMergeRollupArtifact',
406
403
  NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
407
- convertBlockMergeRollupInputsToWitnessMap,
408
- convertBlockMergeRollupOutputsFromWitnessMap,
404
+ convertCheckpointMergeRollupPrivateInputsToWitnessMap,
405
+ convertCheckpointMergeRollupOutputsFromWitnessMap,
409
406
  );
410
-
411
- const verificationKey = this.getVerificationKeyDataForCircuit('BlockMergeRollupArtifact');
412
-
413
- await this.verifyProof('BlockMergeRollupArtifact', proof.binaryProof);
414
-
415
- return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
416
407
  }
417
408
 
418
409
  /**
@@ -421,23 +412,47 @@ export class BBNativeRollupProver implements ServerCircuitProver {
421
412
  * @returns The public inputs as outputs of the simulation.
422
413
  */
423
414
  public async getRootRollupProof(
424
- input: RootRollupInputs,
425
- ): Promise<PublicInputsAndRecursiveProof<RootRollupPublicInputs>> {
426
- const { circuitOutput, proof } = await this.createProof(
415
+ input: RootRollupPrivateInputs,
416
+ ): Promise<PublicInputsAndRecursiveProof<RootRollupPublicInputs, typeof NESTED_RECURSIVE_PROOF_LENGTH>> {
417
+ const { proof, ...output } = await this.createRecursiveProofAndVerify(
427
418
  input,
428
419
  'RootRollupArtifact',
429
- convertRootRollupInputsToWitnessMap,
420
+ ULTRA_KECCAK_PROOF_LENGTH,
421
+ convertRootRollupPrivateInputsToWitnessMap,
430
422
  convertRootRollupOutputsFromWitnessMap,
431
423
  );
432
424
 
433
- const recursiveProof = makeRecursiveProofFromBinary(proof, NESTED_RECURSIVE_PROOF_LENGTH);
434
-
435
- const verificationKey = this.getVerificationKeyDataForCircuit('RootRollupArtifact');
436
-
437
- await this.verifyProof('RootRollupArtifact', proof);
425
+ const recursiveProof = makeRecursiveProofFromBinary(proof.binaryProof, NESTED_RECURSIVE_PROOF_LENGTH);
438
426
  // TODO(https://github.com/AztecProtocol/aztec-packages/issues/13188): Remove this hack.
439
427
  recursiveProof.binaryProof.numPublicInputs += PAIRING_POINTS_SIZE;
440
- return makePublicInputsAndRecursiveProof(circuitOutput, recursiveProof, verificationKey);
428
+
429
+ return { ...output, proof: recursiveProof };
430
+ }
431
+
432
+ private async createRecursiveProofAndVerify<
433
+ PROOF_LENGTH extends number,
434
+ CircuitInputType extends { toBuffer: () => Buffer },
435
+ CircuitOutputType extends { toBuffer: () => Buffer },
436
+ >(
437
+ input: CircuitInputType,
438
+ artifactName: ServerProtocolArtifact,
439
+ proofLength: PROOF_LENGTH,
440
+ convertInput: (input: CircuitInputType) => WitnessMap,
441
+ convertOutput: (outputWitness: WitnessMap) => CircuitOutputType,
442
+ ) {
443
+ const { circuitOutput, proof } = await this.createRecursiveProof(
444
+ input,
445
+ artifactName,
446
+ proofLength,
447
+ convertInput,
448
+ convertOutput,
449
+ );
450
+
451
+ await this.verifyProof(artifactName, proof.binaryProof);
452
+
453
+ const verificationKey = this.getVerificationKeyDataForCircuit(artifactName);
454
+
455
+ return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
441
456
  }
442
457
 
443
458
  private async generateProofWithBB<
@@ -508,49 +523,6 @@ export class BBNativeRollupProver implements ServerCircuitProver {
508
523
  };
509
524
  }
510
525
 
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
526
  private async generateAvmProofWithBB(input: AvmCircuitInputs, workingDirectory: string): Promise<BBSuccess> {
555
527
  logger.info(`Proving avm-circuit for TX ${input.hints.tx.hash}...`);
556
528
 
@@ -1,32 +1,42 @@
1
1
  import { ProvingRequestType } from '@aztec/stdlib/proofs';
2
2
 
3
3
  export const WITGEN_DELAY_MS: Record<ProvingRequestType, number> = {
4
- [ProvingRequestType.BASE_PARITY]: 60,
4
+ [ProvingRequestType.PARITY_BASE]: 60,
5
5
  [ProvingRequestType.BLOCK_MERGE_ROLLUP]: 650,
6
- [ProvingRequestType.BLOCK_ROOT_ROLLUP]: 60_000,
7
- [ProvingRequestType.EMPTY_BLOCK_ROOT_ROLLUP]: 0,
8
- [ProvingRequestType.PADDING_BLOCK_ROOT_ROLLUP]: 0,
9
- [ProvingRequestType.MERGE_ROLLUP]: 0,
10
- [ProvingRequestType.PRIVATE_BASE_ROLLUP]: 400_000,
11
- [ProvingRequestType.SINGLE_TX_BLOCK_ROOT_ROLLUP]: 0, // TBD
12
- [ProvingRequestType.PUBLIC_BASE_ROLLUP]: 470_000,
13
- [ProvingRequestType.ROOT_PARITY]: 100,
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,
15
+ [ProvingRequestType.TX_MERGE_ROLLUP]: 0,
16
+ [ProvingRequestType.PRIVATE_TX_BASE_ROLLUP]: 400_000,
17
+ [ProvingRequestType.PUBLIC_TX_BASE_ROLLUP]: 470_000,
18
+ [ProvingRequestType.PARITY_ROOT]: 100,
14
19
  [ProvingRequestType.ROOT_ROLLUP]: 650,
15
20
  [ProvingRequestType.PUBLIC_TUBE]: 0,
16
21
  [ProvingRequestType.PUBLIC_VM]: 0,
17
22
  };
18
23
 
19
24
  export const PROOF_DELAY_MS: Record<ProvingRequestType, number> = {
20
- [ProvingRequestType.BASE_PARITY]: 3_000,
25
+ [ProvingRequestType.PARITY_BASE]: 3_000,
21
26
  [ProvingRequestType.BLOCK_MERGE_ROLLUP]: 15_000,
22
- [ProvingRequestType.BLOCK_ROOT_ROLLUP]: 55_000,
23
- [ProvingRequestType.EMPTY_BLOCK_ROOT_ROLLUP]: 0,
24
- [ProvingRequestType.PADDING_BLOCK_ROOT_ROLLUP]: 0,
25
- [ProvingRequestType.MERGE_ROLLUP]: 0,
26
- [ProvingRequestType.PRIVATE_BASE_ROLLUP]: 145_000,
27
- [ProvingRequestType.SINGLE_TX_BLOCK_ROOT_ROLLUP]: 0, // TBD
28
- [ProvingRequestType.PUBLIC_BASE_ROLLUP]: 160_000,
29
- [ProvingRequestType.ROOT_PARITY]: 30_000,
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,
36
+ [ProvingRequestType.TX_MERGE_ROLLUP]: 0,
37
+ [ProvingRequestType.PRIVATE_TX_BASE_ROLLUP]: 145_000,
38
+ [ProvingRequestType.PUBLIC_TX_BASE_ROLLUP]: 160_000,
39
+ [ProvingRequestType.PARITY_ROOT]: 30_000,
30
40
  [ProvingRequestType.ROOT_ROLLUP]: 15_000,
31
41
  [ProvingRequestType.PUBLIC_TUBE]: 30_000,
32
42
  [ProvingRequestType.PUBLIC_VM]: 0,