@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.
- package/dest/bb/execute.js +2 -2
- package/dest/honk.d.ts +1 -1
- package/dest/honk.js +2 -2
- package/dest/prover/client/bb_private_kernel_prover.d.ts +1 -1
- package/dest/prover/client/bb_private_kernel_prover.d.ts.map +1 -1
- package/dest/prover/client/bb_private_kernel_prover.js +1 -1
- package/dest/prover/server/bb_prover.d.ts +19 -29
- package/dest/prover/server/bb_prover.d.ts.map +1 -1
- package/dest/prover/server/bb_prover.js +51 -102
- package/dest/test/delay_values.d.ts.map +1 -1
- package/dest/test/delay_values.js +28 -18
- package/dest/test/test_circuit_prover.d.ts +18 -28
- package/dest/test/test_circuit_prover.d.ts.map +1 -1
- package/dest/test/test_circuit_prover.js +70 -53
- package/dest/verifier/bb_verifier.d.ts +1 -1
- package/dest/verifier/bb_verifier.d.ts.map +1 -1
- package/dest/verifier/bb_verifier.js +1 -1
- package/package.json +16 -16
- package/src/bb/execute.ts +2 -2
- package/src/honk.ts +1 -1
- package/src/prover/client/bb_private_kernel_prover.ts +5 -3
- package/src/prover/server/bb_prover.ts +205 -233
- package/src/test/delay_values.ts +28 -18
- package/src/test/test_circuit_prover.ts +204 -135
- package/src/verifier/bb_verifier.ts +5 -5
- package/dest/stats.d.ts +0 -4
- package/dest/stats.d.ts.map +0 -1
- package/dest/stats.js +0 -47
- package/src/stats.ts +0 -49
|
@@ -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
|
-
|
|
16
|
+
convertBlockMergeRollupPrivateInputsToWitnessMap,
|
|
17
|
+
convertBlockRootEmptyTxFirstRollupOutputsFromWitnessMap,
|
|
18
|
+
convertBlockRootEmptyTxFirstRollupPrivateInputsToWitnessMap,
|
|
19
|
+
convertBlockRootFirstRollupOutputsFromWitnessMap,
|
|
20
|
+
convertBlockRootFirstRollupPrivateInputsToWitnessMap,
|
|
20
21
|
convertBlockRootRollupOutputsFromWitnessMap,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
convertRootRollupInputsToWitnessMap,
|
|
43
|
+
convertPublicTxBaseRollupOutputsFromWitnessMap,
|
|
44
|
+
convertPublicTxBaseRollupPrivateInputsToWitnessMap,
|
|
36
45
|
convertRootRollupOutputsFromWitnessMap,
|
|
37
|
-
|
|
38
|
-
|
|
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 {
|
|
65
|
+
import type { ParityBasePrivateInputs, ParityPublicInputs, ParityRootPrivateInputs } from '@aztec/stdlib/parity';
|
|
55
66
|
import { Proof, RecursiveProof, makeRecursiveProofFromBinary } from '@aztec/stdlib/proofs';
|
|
56
67
|
import {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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
|
-
|
|
82
|
+
PublicTxBaseRollupPrivateInputs,
|
|
83
|
+
type RootRollupPrivateInputs,
|
|
68
84
|
type RootRollupPublicInputs,
|
|
69
|
-
type
|
|
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
|
|
139
|
-
public
|
|
140
|
-
inputs:
|
|
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
|
-
|
|
158
|
+
return this.createRecursiveProofAndVerify(
|
|
143
159
|
inputs,
|
|
144
|
-
'
|
|
160
|
+
'ParityBaseArtifact',
|
|
145
161
|
RECURSIVE_PROOF_LENGTH,
|
|
146
|
-
|
|
147
|
-
|
|
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
|
|
162
|
-
public
|
|
163
|
-
inputs:
|
|
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
|
-
|
|
176
|
+
return this.createRecursiveProofAndVerify(
|
|
166
177
|
inputs,
|
|
167
|
-
'
|
|
178
|
+
'ParityRootArtifact',
|
|
168
179
|
NESTED_RECURSIVE_PROOF_LENGTH,
|
|
169
|
-
|
|
170
|
-
|
|
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
|
|
230
|
-
inputs:
|
|
231
|
-
): Promise<
|
|
232
|
-
|
|
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
|
-
|
|
240
|
+
'PrivateTxBaseRollupArtifact',
|
|
239
241
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
240
|
-
|
|
241
|
-
|
|
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
|
|
257
|
-
inputs:
|
|
258
|
-
): Promise<
|
|
259
|
-
|
|
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
|
-
|
|
257
|
+
'PublicTxBaseRollupArtifact',
|
|
266
258
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
267
|
-
|
|
268
|
-
|
|
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
|
|
284
|
-
input:
|
|
285
|
-
): Promise<
|
|
286
|
-
|
|
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
|
-
'
|
|
274
|
+
'TxMergeRollupArtifact',
|
|
291
275
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
292
|
-
|
|
293
|
-
|
|
276
|
+
convertTxMergeRollupPrivateInputsToWitnessMap,
|
|
277
|
+
convertTxMergeRollupOutputsFromWitnessMap,
|
|
294
278
|
);
|
|
279
|
+
}
|
|
295
280
|
|
|
296
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
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
|
-
|
|
324
|
+
convertBlockRootRollupPrivateInputsToWitnessMap,
|
|
318
325
|
convertBlockRootRollupOutputsFromWitnessMap,
|
|
319
326
|
);
|
|
327
|
+
}
|
|
320
328
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
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
|
-
|
|
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
|
|
329
|
-
input:
|
|
353
|
+
public getCheckpointRootRollupProof(
|
|
354
|
+
input: CheckpointRootRollupPrivateInputs,
|
|
330
355
|
): Promise<
|
|
331
|
-
PublicInputsAndRecursiveProof<
|
|
356
|
+
PublicInputsAndRecursiveProof<CheckpointRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
|
|
332
357
|
> {
|
|
333
|
-
|
|
358
|
+
return this.createRecursiveProofAndVerify(
|
|
334
359
|
input,
|
|
335
|
-
'
|
|
360
|
+
'CheckpointRootRollupArtifact',
|
|
336
361
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
337
|
-
|
|
338
|
-
|
|
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
|
-
|
|
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<
|
|
370
|
+
PublicInputsAndRecursiveProof<CheckpointRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
|
|
357
371
|
> {
|
|
358
|
-
|
|
372
|
+
return this.createRecursiveProofAndVerify(
|
|
359
373
|
input,
|
|
360
|
-
'
|
|
374
|
+
'CheckpointRootSingleBlockRollupArtifact',
|
|
361
375
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
362
|
-
|
|
363
|
-
|
|
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
|
|
374
|
-
input:
|
|
381
|
+
public getCheckpointPaddingRollupProof(
|
|
382
|
+
input: CheckpointPaddingRollupPrivateInputs,
|
|
375
383
|
): Promise<
|
|
376
|
-
PublicInputsAndRecursiveProof<
|
|
384
|
+
PublicInputsAndRecursiveProof<CheckpointRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
|
|
377
385
|
> {
|
|
378
|
-
|
|
386
|
+
return this.createRecursiveProofAndVerify(
|
|
379
387
|
input,
|
|
380
|
-
'
|
|
388
|
+
'CheckpointPaddingRollupArtifact',
|
|
381
389
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
382
|
-
|
|
383
|
-
|
|
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
|
-
|
|
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<
|
|
398
|
+
PublicInputsAndRecursiveProof<CheckpointRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
|
|
402
399
|
> {
|
|
403
|
-
|
|
400
|
+
return this.createRecursiveProofAndVerify(
|
|
404
401
|
input,
|
|
405
|
-
'
|
|
402
|
+
'CheckpointMergeRollupArtifact',
|
|
406
403
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
407
|
-
|
|
408
|
-
|
|
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:
|
|
425
|
-
): Promise<PublicInputsAndRecursiveProof<RootRollupPublicInputs>> {
|
|
426
|
-
const {
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
package/src/test/delay_values.ts
CHANGED
|
@@ -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.
|
|
4
|
+
[ProvingRequestType.PARITY_BASE]: 60,
|
|
5
5
|
[ProvingRequestType.BLOCK_MERGE_ROLLUP]: 650,
|
|
6
|
-
[ProvingRequestType.
|
|
7
|
-
[ProvingRequestType.
|
|
8
|
-
[ProvingRequestType.
|
|
9
|
-
[ProvingRequestType.
|
|
10
|
-
[ProvingRequestType.
|
|
11
|
-
[ProvingRequestType.
|
|
12
|
-
[ProvingRequestType.
|
|
13
|
-
[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,
|
|
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.
|
|
25
|
+
[ProvingRequestType.PARITY_BASE]: 3_000,
|
|
21
26
|
[ProvingRequestType.BLOCK_MERGE_ROLLUP]: 15_000,
|
|
22
|
-
[ProvingRequestType.
|
|
23
|
-
[ProvingRequestType.
|
|
24
|
-
[ProvingRequestType.
|
|
25
|
-
[ProvingRequestType.
|
|
26
|
-
[ProvingRequestType.
|
|
27
|
-
[ProvingRequestType.
|
|
28
|
-
[ProvingRequestType.
|
|
29
|
-
[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,
|
|
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,
|