@aztec/bb-prover 3.0.0-canary.a9708bd → 3.0.0-devnet.2-patch.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/avm_proving_tests/avm_proving_tester.d.ts +7 -6
- package/dest/avm_proving_tests/avm_proving_tester.d.ts.map +1 -1
- package/dest/avm_proving_tests/avm_proving_tester.js +33 -13
- package/dest/bb/cli.d.ts +1 -1
- package/dest/bb/execute.d.ts +5 -13
- package/dest/bb/execute.d.ts.map +1 -1
- package/dest/bb/execute.js +30 -92
- package/dest/bb/index.d.ts +1 -1
- package/dest/config.d.ts +1 -1
- package/dest/honk.d.ts +2 -2
- package/dest/honk.js +2 -2
- package/dest/index.d.ts +1 -1
- package/dest/instrumentation.d.ts +3 -3
- package/dest/instrumentation.d.ts.map +1 -1
- package/dest/prover/client/bb_private_kernel_prover.d.ts +12 -6
- package/dest/prover/client/bb_private_kernel_prover.d.ts.map +1 -1
- package/dest/prover/client/bb_private_kernel_prover.js +36 -7
- package/dest/prover/client/bundle.d.ts +6 -0
- package/dest/prover/client/bundle.d.ts.map +1 -0
- package/dest/prover/client/bundle.js +7 -0
- package/dest/prover/client/lazy.d.ts +6 -0
- package/dest/prover/client/lazy.d.ts.map +1 -0
- package/dest/prover/client/lazy.js +7 -0
- package/dest/prover/index.d.ts +1 -1
- package/dest/prover/proof_utils.d.ts +9 -9
- package/dest/prover/proof_utils.d.ts.map +1 -1
- package/dest/prover/proof_utils.js +42 -25
- package/dest/prover/server/bb_prover.d.ts +22 -42
- package/dest/prover/server/bb_prover.d.ts.map +1 -1
- package/dest/prover/server/bb_prover.js +66 -143
- package/dest/test/delay_values.d.ts +1 -1
- package/dest/test/delay_values.d.ts.map +1 -1
- package/dest/test/delay_values.js +33 -23
- package/dest/test/index.d.ts +1 -1
- package/dest/test/test_circuit_prover.d.ts +21 -31
- package/dest/test/test_circuit_prover.d.ts.map +1 -1
- package/dest/test/test_circuit_prover.js +74 -56
- package/dest/test/test_verifier.d.ts +3 -1
- package/dest/test/test_verifier.d.ts.map +1 -1
- package/dest/test/test_verifier.js +15 -0
- package/dest/verification_key/verification_key_data.d.ts +1 -1
- package/dest/verification_key/verification_key_data.js +1 -1
- package/dest/verifier/bb_verifier.d.ts +3 -5
- package/dest/verifier/bb_verifier.d.ts.map +1 -1
- package/dest/verifier/bb_verifier.js +24 -26
- package/dest/verifier/index.d.ts +2 -2
- package/dest/verifier/index.d.ts.map +1 -1
- package/dest/verifier/index.js +1 -1
- package/dest/verifier/queued_chonk_verifier.d.ts +15 -0
- package/dest/verifier/queued_chonk_verifier.d.ts.map +1 -0
- package/dest/verifier/{queued_ivc_verifier.js → queued_chonk_verifier.js} +3 -3
- package/package.json +23 -23
- package/src/avm_proving_tests/avm_proving_tester.ts +43 -19
- package/src/bb/execute.ts +20 -90
- package/src/honk.ts +1 -1
- package/src/instrumentation.ts +2 -2
- package/src/prover/client/bb_private_kernel_prover.ts +49 -10
- package/src/prover/client/bundle.ts +10 -0
- package/src/prover/client/lazy.ts +10 -0
- package/src/prover/proof_utils.ts +53 -31
- package/src/prover/server/bb_prover.ts +231 -288
- package/src/test/delay_values.ts +33 -23
- package/src/test/test_circuit_prover.ts +219 -142
- package/src/test/test_verifier.ts +8 -0
- package/src/verification_key/verification_key_data.ts +1 -1
- package/src/verifier/bb_verifier.ts +34 -33
- package/src/verifier/index.ts +1 -1
- package/src/verifier/{queued_ivc_verifier.ts → queued_chonk_verifier.ts} +3 -3
- package/dest/prover/client/native/bb_native_private_kernel_prover.d.ts +0 -23
- package/dest/prover/client/native/bb_native_private_kernel_prover.d.ts.map +0 -1
- package/dest/prover/client/native/bb_native_private_kernel_prover.js +0 -66
- package/dest/prover/client/wasm/bb_wasm_private_kernel_prover.d.ts +0 -15
- package/dest/prover/client/wasm/bb_wasm_private_kernel_prover.d.ts.map +0 -1
- package/dest/prover/client/wasm/bb_wasm_private_kernel_prover.js +0 -48
- package/dest/prover/client/wasm/bundle.d.ts +0 -6
- package/dest/prover/client/wasm/bundle.d.ts.map +0 -1
- package/dest/prover/client/wasm/bundle.js +0 -8
- package/dest/prover/client/wasm/lazy.d.ts +0 -6
- package/dest/prover/client/wasm/lazy.d.ts.map +0 -1
- package/dest/prover/client/wasm/lazy.js +0 -8
- package/dest/stats.d.ts +0 -4
- package/dest/stats.d.ts.map +0 -1
- package/dest/stats.js +0 -45
- package/dest/verifier/queued_ivc_verifier.d.ts +0 -15
- package/dest/verifier/queued_ivc_verifier.d.ts.map +0 -1
- package/src/prover/client/native/bb_native_private_kernel_prover.ts +0 -105
- package/src/prover/client/wasm/bb_wasm_private_kernel_prover.ts +0 -60
- package/src/prover/client/wasm/bundle.ts +0 -11
- package/src/prover/client/wasm/lazy.ts +0 -11
- package/src/stats.ts +0 -47
|
@@ -4,40 +4,52 @@ import {
|
|
|
4
4
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
5
5
|
PAIRING_POINTS_SIZE,
|
|
6
6
|
RECURSIVE_PROOF_LENGTH,
|
|
7
|
-
TUBE_PROOF_LENGTH,
|
|
8
7
|
ULTRA_KECCAK_PROOF_LENGTH,
|
|
9
8
|
} from '@aztec/constants';
|
|
10
|
-
import { Fr } from '@aztec/foundation/
|
|
9
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
11
10
|
import { runInDirectory } from '@aztec/foundation/fs';
|
|
12
11
|
import { createLogger } from '@aztec/foundation/log';
|
|
13
12
|
import { BufferReader } from '@aztec/foundation/serialize';
|
|
14
13
|
import {
|
|
15
14
|
type ServerProtocolArtifact,
|
|
16
|
-
convertBaseParityInputsToWitnessMap,
|
|
17
|
-
convertBaseParityOutputsFromWitnessMap,
|
|
18
|
-
convertBlockMergeRollupInputsToWitnessMap,
|
|
19
15
|
convertBlockMergeRollupOutputsFromWitnessMap,
|
|
20
|
-
|
|
16
|
+
convertBlockMergeRollupPrivateInputsToWitnessMap,
|
|
17
|
+
convertBlockRootEmptyTxFirstRollupOutputsFromWitnessMap,
|
|
18
|
+
convertBlockRootEmptyTxFirstRollupPrivateInputsToWitnessMap,
|
|
19
|
+
convertBlockRootFirstRollupOutputsFromWitnessMap,
|
|
20
|
+
convertBlockRootFirstRollupPrivateInputsToWitnessMap,
|
|
21
21
|
convertBlockRootRollupOutputsFromWitnessMap,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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,
|
|
41
|
+
convertPublicChonkVerifierOutputsFromWitnessMap,
|
|
42
|
+
convertPublicChonkVerifierPrivateInputsToWitnessMap,
|
|
43
|
+
convertPublicTxBaseRollupOutputsFromWitnessMap,
|
|
44
|
+
convertPublicTxBaseRollupPrivateInputsToWitnessMap,
|
|
35
45
|
convertRootRollupOutputsFromWitnessMap,
|
|
36
|
-
|
|
37
|
-
|
|
46
|
+
convertRootRollupPrivateInputsToWitnessMap,
|
|
47
|
+
convertTxMergeRollupOutputsFromWitnessMap,
|
|
48
|
+
convertTxMergeRollupPrivateInputsToWitnessMap,
|
|
38
49
|
getServerCircuitArtifact,
|
|
39
50
|
} from '@aztec/noir-protocol-circuits-types/server';
|
|
40
51
|
import { ServerCircuitVks } from '@aztec/noir-protocol-circuits-types/server/vks';
|
|
52
|
+
import { mapProtocolArtifactNameToCircuitName } from '@aztec/noir-protocol-circuits-types/types';
|
|
41
53
|
import type { WitnessMap } from '@aztec/noir-types';
|
|
42
54
|
import { NativeACVMSimulator } from '@aztec/simulator/server';
|
|
43
55
|
import type { AvmCircuitInputs, AvmCircuitPublicInputs } from '@aztec/stdlib/avm';
|
|
@@ -49,29 +61,35 @@ import {
|
|
|
49
61
|
makeProofAndVerificationKey,
|
|
50
62
|
makePublicInputsAndRecursiveProof,
|
|
51
63
|
} from '@aztec/stdlib/interfaces/server';
|
|
52
|
-
import type {
|
|
64
|
+
import type { ParityBasePrivateInputs, ParityPublicInputs, ParityRootPrivateInputs } from '@aztec/stdlib/parity';
|
|
53
65
|
import { Proof, RecursiveProof, makeRecursiveProofFromBinary } from '@aztec/stdlib/proofs';
|
|
54
66
|
import {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
67
|
+
BlockMergeRollupPrivateInputs,
|
|
68
|
+
BlockRollupPublicInputs,
|
|
69
|
+
BlockRootEmptyTxFirstRollupPrivateInputs,
|
|
70
|
+
BlockRootFirstRollupPrivateInputs,
|
|
71
|
+
BlockRootRollupPrivateInputs,
|
|
72
|
+
BlockRootSingleTxFirstRollupPrivateInputs,
|
|
73
|
+
BlockRootSingleTxRollupPrivateInputs,
|
|
74
|
+
CheckpointMergeRollupPrivateInputs,
|
|
75
|
+
CheckpointPaddingRollupPrivateInputs,
|
|
76
|
+
CheckpointRollupPublicInputs,
|
|
77
|
+
CheckpointRootRollupPrivateInputs,
|
|
78
|
+
CheckpointRootSingleBlockRollupPrivateInputs,
|
|
79
|
+
type PrivateTxBaseRollupPrivateInputs,
|
|
80
|
+
PublicChonkVerifierPrivateInputs,
|
|
81
|
+
PublicChonkVerifierPublicInputs,
|
|
82
|
+
PublicTxBaseRollupPrivateInputs,
|
|
83
|
+
type RootRollupPrivateInputs,
|
|
65
84
|
type RootRollupPublicInputs,
|
|
66
|
-
type
|
|
67
|
-
type
|
|
85
|
+
type TxMergeRollupPrivateInputs,
|
|
86
|
+
type TxRollupPublicInputs,
|
|
68
87
|
enhanceProofWithPiValidationFlag,
|
|
69
88
|
} from '@aztec/stdlib/rollup';
|
|
70
89
|
import type { CircuitProvingStats, CircuitWitnessGenerationStats } from '@aztec/stdlib/stats';
|
|
71
90
|
import type { VerificationKeyData } from '@aztec/stdlib/vks';
|
|
72
91
|
import { Attributes, type TelemetryClient, getTelemetryClient, trackSpan } from '@aztec/telemetry-client';
|
|
73
92
|
|
|
74
|
-
import crypto from 'crypto';
|
|
75
93
|
import { promises as fs } from 'fs';
|
|
76
94
|
import * as path from 'path';
|
|
77
95
|
|
|
@@ -84,17 +102,14 @@ import {
|
|
|
84
102
|
VK_FILENAME,
|
|
85
103
|
generateAvmProof,
|
|
86
104
|
generateProof,
|
|
87
|
-
generateTubeProof,
|
|
88
105
|
verifyAvmProof,
|
|
89
106
|
verifyProof,
|
|
90
107
|
} from '../../bb/execute.js';
|
|
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 {
|
|
95
|
-
import {
|
|
96
|
-
import { PRIVATE_TAIL_CIVC_VK, PUBLIC_TAIL_CIVC_VK } from '../../verifier/bb_verifier.js';
|
|
97
|
-
import { readProofAsFields, writeClientIVCProofToOutputDirectory } from '../proof_utils.js';
|
|
111
|
+
import { extractAvmVkData } from '../../verification_key/verification_key_data.js';
|
|
112
|
+
import { readProofsFromOutputDirectory } from '../proof_utils.js';
|
|
98
113
|
|
|
99
114
|
const logger = createLogger('bb-prover');
|
|
100
115
|
|
|
@@ -136,22 +151,17 @@ export class BBNativeRollupProver implements ServerCircuitProver {
|
|
|
136
151
|
* @param inputs - Inputs to the circuit.
|
|
137
152
|
* @returns The public inputs of the parity circuit.
|
|
138
153
|
*/
|
|
139
|
-
@trackSpan('BBNativeRollupProver.getBaseParityProof', { [Attributes.PROTOCOL_CIRCUIT_NAME]: 'base
|
|
140
|
-
public
|
|
141
|
-
inputs:
|
|
154
|
+
@trackSpan('BBNativeRollupProver.getBaseParityProof', { [Attributes.PROTOCOL_CIRCUIT_NAME]: 'parity-base' })
|
|
155
|
+
public getBaseParityProof(
|
|
156
|
+
inputs: ParityBasePrivateInputs,
|
|
142
157
|
): Promise<PublicInputsAndRecursiveProof<ParityPublicInputs, typeof RECURSIVE_PROOF_LENGTH>> {
|
|
143
|
-
|
|
158
|
+
return this.createRecursiveProofAndVerify(
|
|
144
159
|
inputs,
|
|
145
|
-
'
|
|
160
|
+
'ParityBaseArtifact',
|
|
146
161
|
RECURSIVE_PROOF_LENGTH,
|
|
147
|
-
|
|
148
|
-
|
|
162
|
+
convertParityBasePrivateInputsToWitnessMap,
|
|
163
|
+
convertParityBaseOutputsFromWitnessMap,
|
|
149
164
|
);
|
|
150
|
-
|
|
151
|
-
const verificationKey = this.getVerificationKeyDataForCircuit('BaseParityArtifact');
|
|
152
|
-
await this.verifyProof('BaseParityArtifact', proof.binaryProof);
|
|
153
|
-
|
|
154
|
-
return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
|
|
155
165
|
}
|
|
156
166
|
|
|
157
167
|
/**
|
|
@@ -159,22 +169,17 @@ export class BBNativeRollupProver implements ServerCircuitProver {
|
|
|
159
169
|
* @param inputs - Inputs to the circuit.
|
|
160
170
|
* @returns The public inputs of the parity circuit.
|
|
161
171
|
*/
|
|
162
|
-
@trackSpan('BBNativeRollupProver.getRootParityProof', { [Attributes.PROTOCOL_CIRCUIT_NAME]: 'root
|
|
163
|
-
public
|
|
164
|
-
inputs:
|
|
172
|
+
@trackSpan('BBNativeRollupProver.getRootParityProof', { [Attributes.PROTOCOL_CIRCUIT_NAME]: 'parity-root' })
|
|
173
|
+
public getRootParityProof(
|
|
174
|
+
inputs: ParityRootPrivateInputs,
|
|
165
175
|
): Promise<PublicInputsAndRecursiveProof<ParityPublicInputs, typeof NESTED_RECURSIVE_PROOF_LENGTH>> {
|
|
166
|
-
|
|
176
|
+
return this.createRecursiveProofAndVerify(
|
|
167
177
|
inputs,
|
|
168
|
-
'
|
|
178
|
+
'ParityRootArtifact',
|
|
169
179
|
NESTED_RECURSIVE_PROOF_LENGTH,
|
|
170
|
-
|
|
171
|
-
|
|
180
|
+
convertParityRootPrivateInputsToWitnessMap,
|
|
181
|
+
convertParityRootOutputsFromWitnessMap,
|
|
172
182
|
);
|
|
173
|
-
|
|
174
|
-
const verificationKey = this.getVerificationKeyDataForCircuit('RootParityArtifact');
|
|
175
|
-
await this.verifyProof('RootParityArtifact', proof.binaryProof);
|
|
176
|
-
|
|
177
|
-
return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
|
|
178
183
|
}
|
|
179
184
|
|
|
180
185
|
/**
|
|
@@ -197,24 +202,19 @@ export class BBNativeRollupProver implements ServerCircuitProver {
|
|
|
197
202
|
return proofAndVk;
|
|
198
203
|
}
|
|
199
204
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
* @param inputs - Inputs to the circuit.
|
|
203
|
-
* @returns The public inputs as outputs of the simulation.
|
|
204
|
-
*/
|
|
205
|
-
public async getPrivateBaseRollupProof(
|
|
206
|
-
inputs: PrivateBaseRollupInputs,
|
|
205
|
+
public async getPublicChonkVerifierProof(
|
|
206
|
+
inputs: PublicChonkVerifierPrivateInputs,
|
|
207
207
|
): Promise<
|
|
208
|
-
PublicInputsAndRecursiveProof<
|
|
208
|
+
PublicInputsAndRecursiveProof<PublicChonkVerifierPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
|
|
209
209
|
> {
|
|
210
|
-
const artifactName = '
|
|
210
|
+
const artifactName = 'PublicChonkVerifier';
|
|
211
211
|
|
|
212
212
|
const { circuitOutput, proof } = await this.createRecursiveProof(
|
|
213
213
|
inputs,
|
|
214
214
|
artifactName,
|
|
215
215
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
216
|
-
|
|
217
|
-
|
|
216
|
+
convertPublicChonkVerifierPrivateInputsToWitnessMap,
|
|
217
|
+
convertPublicChonkVerifierOutputsFromWitnessMap,
|
|
218
218
|
);
|
|
219
219
|
|
|
220
220
|
const verificationKey = this.getVerificationKeyDataForCircuit(artifactName);
|
|
@@ -224,31 +224,38 @@ export class BBNativeRollupProver implements ServerCircuitProver {
|
|
|
224
224
|
return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
+
/**
|
|
228
|
+
* Simulates the base rollup circuit from its inputs.
|
|
229
|
+
* @param inputs - Inputs to the circuit.
|
|
230
|
+
* @returns The public inputs as outputs of the simulation.
|
|
231
|
+
*/
|
|
232
|
+
public getPrivateTxBaseRollupProof(
|
|
233
|
+
inputs: PrivateTxBaseRollupPrivateInputs,
|
|
234
|
+
): Promise<PublicInputsAndRecursiveProof<TxRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
235
|
+
return this.createRecursiveProofAndVerify(
|
|
236
|
+
inputs,
|
|
237
|
+
'PrivateTxBaseRollupArtifact',
|
|
238
|
+
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
239
|
+
convertPrivateTxBaseRollupPrivateInputsToWitnessMap,
|
|
240
|
+
convertPrivateTxBaseRollupOutputsFromWitnessMap,
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
|
|
227
244
|
/**
|
|
228
245
|
* Requests that the public kernel tail circuit be executed and the proof generated
|
|
229
246
|
* @param kernelRequest - The object encapsulating the request for a proof
|
|
230
247
|
* @returns The requested circuit's public inputs and proof
|
|
231
248
|
*/
|
|
232
|
-
public
|
|
233
|
-
inputs:
|
|
234
|
-
): Promise<
|
|
235
|
-
|
|
236
|
-
> {
|
|
237
|
-
const artifactName = 'PublicBaseRollupArtifact';
|
|
238
|
-
|
|
239
|
-
const { circuitOutput, proof } = await this.createRecursiveProof(
|
|
249
|
+
public getPublicTxBaseRollupProof(
|
|
250
|
+
inputs: PublicTxBaseRollupPrivateInputs,
|
|
251
|
+
): Promise<PublicInputsAndRecursiveProof<TxRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
252
|
+
return this.createRecursiveProofAndVerify(
|
|
240
253
|
inputs,
|
|
241
|
-
|
|
254
|
+
'PublicTxBaseRollupArtifact',
|
|
242
255
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
243
|
-
|
|
244
|
-
|
|
256
|
+
convertPublicTxBaseRollupPrivateInputsToWitnessMap,
|
|
257
|
+
convertPublicTxBaseRollupOutputsFromWitnessMap,
|
|
245
258
|
);
|
|
246
|
-
|
|
247
|
-
const verificationKey = this.getVerificationKeyDataForCircuit(artifactName);
|
|
248
|
-
|
|
249
|
-
await this.verifyProof(artifactName, proof.binaryProof);
|
|
250
|
-
|
|
251
|
-
return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
|
|
252
259
|
}
|
|
253
260
|
|
|
254
261
|
/**
|
|
@@ -256,139 +263,144 @@ export class BBNativeRollupProver implements ServerCircuitProver {
|
|
|
256
263
|
* @param input - Inputs to the circuit.
|
|
257
264
|
* @returns The public inputs as outputs of the simulation.
|
|
258
265
|
*/
|
|
259
|
-
public
|
|
260
|
-
input:
|
|
261
|
-
): Promise<
|
|
262
|
-
|
|
263
|
-
> {
|
|
264
|
-
const { circuitOutput, proof } = await this.createRecursiveProof(
|
|
266
|
+
public getTxMergeRollupProof(
|
|
267
|
+
input: TxMergeRollupPrivateInputs,
|
|
268
|
+
): Promise<PublicInputsAndRecursiveProof<TxRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
269
|
+
return this.createRecursiveProofAndVerify(
|
|
265
270
|
input,
|
|
266
|
-
'
|
|
271
|
+
'TxMergeRollupArtifact',
|
|
267
272
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
268
|
-
|
|
269
|
-
|
|
273
|
+
convertTxMergeRollupPrivateInputsToWitnessMap,
|
|
274
|
+
convertTxMergeRollupOutputsFromWitnessMap,
|
|
270
275
|
);
|
|
276
|
+
}
|
|
271
277
|
|
|
272
|
-
|
|
278
|
+
public getBlockRootFirstRollupProof(
|
|
279
|
+
input: BlockRootFirstRollupPrivateInputs,
|
|
280
|
+
): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
281
|
+
return this.createRecursiveProofAndVerify(
|
|
282
|
+
input,
|
|
283
|
+
'BlockRootFirstRollupArtifact',
|
|
284
|
+
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
285
|
+
convertBlockRootFirstRollupPrivateInputsToWitnessMap,
|
|
286
|
+
convertBlockRootFirstRollupOutputsFromWitnessMap,
|
|
287
|
+
);
|
|
288
|
+
}
|
|
273
289
|
|
|
274
|
-
|
|
290
|
+
public getBlockRootSingleTxFirstRollupProof(
|
|
291
|
+
input: BlockRootSingleTxFirstRollupPrivateInputs,
|
|
292
|
+
): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
293
|
+
return this.createRecursiveProofAndVerify(
|
|
294
|
+
input,
|
|
295
|
+
'BlockRootSingleTxFirstRollupArtifact',
|
|
296
|
+
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
297
|
+
convertBlockRootSingleTxFirstRollupPrivateInputsToWitnessMap,
|
|
298
|
+
convertBlockRootSingleTxFirstRollupOutputsFromWitnessMap,
|
|
299
|
+
);
|
|
300
|
+
}
|
|
275
301
|
|
|
276
|
-
|
|
302
|
+
public getBlockRootEmptyTxFirstRollupProof(
|
|
303
|
+
input: BlockRootEmptyTxFirstRollupPrivateInputs,
|
|
304
|
+
): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
305
|
+
return this.createRecursiveProofAndVerify(
|
|
306
|
+
input,
|
|
307
|
+
'BlockRootEmptyTxFirstRollupArtifact',
|
|
308
|
+
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
309
|
+
convertBlockRootEmptyTxFirstRollupPrivateInputsToWitnessMap,
|
|
310
|
+
convertBlockRootEmptyTxFirstRollupOutputsFromWitnessMap,
|
|
311
|
+
);
|
|
277
312
|
}
|
|
278
313
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
*/
|
|
284
|
-
public async getBlockRootRollupProof(
|
|
285
|
-
input: BlockRootRollupInputs,
|
|
286
|
-
): Promise<
|
|
287
|
-
PublicInputsAndRecursiveProof<BlockRootOrBlockMergePublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
|
|
288
|
-
> {
|
|
289
|
-
const { circuitOutput, proof } = await this.createRecursiveProof(
|
|
314
|
+
public getBlockRootRollupProof(
|
|
315
|
+
input: BlockRootRollupPrivateInputs,
|
|
316
|
+
): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
317
|
+
return this.createRecursiveProofAndVerify(
|
|
290
318
|
input,
|
|
291
319
|
'BlockRootRollupArtifact',
|
|
292
320
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
293
|
-
|
|
321
|
+
convertBlockRootRollupPrivateInputsToWitnessMap,
|
|
294
322
|
convertBlockRootRollupOutputsFromWitnessMap,
|
|
295
323
|
);
|
|
324
|
+
}
|
|
296
325
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
326
|
+
public getBlockRootSingleTxRollupProof(
|
|
327
|
+
input: BlockRootSingleTxRollupPrivateInputs,
|
|
328
|
+
): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
329
|
+
return this.createRecursiveProofAndVerify(
|
|
330
|
+
input,
|
|
331
|
+
'BlockRootSingleTxRollupArtifact',
|
|
332
|
+
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
333
|
+
convertBlockRootSingleTxRollupPrivateInputsToWitnessMap,
|
|
334
|
+
convertBlockRootSingleTxRollupOutputsFromWitnessMap,
|
|
335
|
+
);
|
|
336
|
+
}
|
|
300
337
|
|
|
301
|
-
|
|
338
|
+
public getBlockMergeRollupProof(
|
|
339
|
+
input: BlockMergeRollupPrivateInputs,
|
|
340
|
+
): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
341
|
+
return this.createRecursiveProofAndVerify(
|
|
342
|
+
input,
|
|
343
|
+
'BlockMergeRollupArtifact',
|
|
344
|
+
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
345
|
+
convertBlockMergeRollupPrivateInputsToWitnessMap,
|
|
346
|
+
convertBlockMergeRollupOutputsFromWitnessMap,
|
|
347
|
+
);
|
|
302
348
|
}
|
|
303
349
|
|
|
304
|
-
public
|
|
305
|
-
input:
|
|
350
|
+
public getCheckpointRootRollupProof(
|
|
351
|
+
input: CheckpointRootRollupPrivateInputs,
|
|
306
352
|
): Promise<
|
|
307
|
-
PublicInputsAndRecursiveProof<
|
|
353
|
+
PublicInputsAndRecursiveProof<CheckpointRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
|
|
308
354
|
> {
|
|
309
|
-
|
|
355
|
+
return this.createRecursiveProofAndVerify(
|
|
310
356
|
input,
|
|
311
|
-
'
|
|
357
|
+
'CheckpointRootRollupArtifact',
|
|
312
358
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
313
|
-
|
|
314
|
-
|
|
359
|
+
convertCheckpointRootRollupPrivateInputsToWitnessMap,
|
|
360
|
+
convertCheckpointRootRollupOutputsFromWitnessMap,
|
|
315
361
|
);
|
|
316
|
-
|
|
317
|
-
const verificationKey = this.getVerificationKeyDataForCircuit('SingleTxBlockRootRollupArtifact');
|
|
318
|
-
|
|
319
|
-
await this.verifyProof('SingleTxBlockRootRollupArtifact', proof.binaryProof);
|
|
320
|
-
|
|
321
|
-
return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
|
|
322
362
|
}
|
|
323
363
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
* @param input - Inputs to the circuit.
|
|
327
|
-
* @returns The public inputs as outputs of the simulation.
|
|
328
|
-
*/
|
|
329
|
-
public async getEmptyBlockRootRollupProof(
|
|
330
|
-
input: EmptyBlockRootRollupInputs,
|
|
364
|
+
public getCheckpointRootSingleBlockRollupProof(
|
|
365
|
+
input: CheckpointRootSingleBlockRollupPrivateInputs,
|
|
331
366
|
): Promise<
|
|
332
|
-
PublicInputsAndRecursiveProof<
|
|
367
|
+
PublicInputsAndRecursiveProof<CheckpointRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
|
|
333
368
|
> {
|
|
334
|
-
|
|
369
|
+
return this.createRecursiveProofAndVerify(
|
|
335
370
|
input,
|
|
336
|
-
'
|
|
371
|
+
'CheckpointRootSingleBlockRollupArtifact',
|
|
337
372
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
338
|
-
|
|
339
|
-
|
|
373
|
+
convertCheckpointRootSingleBlockRollupPrivateInputsToWitnessMap,
|
|
374
|
+
convertCheckpointRootSingleBlockRollupOutputsFromWitnessMap,
|
|
340
375
|
);
|
|
341
|
-
|
|
342
|
-
const verificationKey = this.getVerificationKeyDataForCircuit('EmptyBlockRootRollupArtifact');
|
|
343
|
-
|
|
344
|
-
await this.verifyProof('EmptyBlockRootRollupArtifact', proof.binaryProof);
|
|
345
|
-
|
|
346
|
-
return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
|
|
347
376
|
}
|
|
348
377
|
|
|
349
|
-
public
|
|
350
|
-
input:
|
|
378
|
+
public getCheckpointPaddingRollupProof(
|
|
379
|
+
input: CheckpointPaddingRollupPrivateInputs,
|
|
351
380
|
): Promise<
|
|
352
|
-
PublicInputsAndRecursiveProof<
|
|
381
|
+
PublicInputsAndRecursiveProof<CheckpointRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
|
|
353
382
|
> {
|
|
354
|
-
|
|
383
|
+
return this.createRecursiveProofAndVerify(
|
|
355
384
|
input,
|
|
356
|
-
'
|
|
385
|
+
'CheckpointPaddingRollupArtifact',
|
|
357
386
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
358
|
-
|
|
359
|
-
|
|
387
|
+
convertCheckpointPaddingRollupPrivateInputsToWitnessMap,
|
|
388
|
+
convertCheckpointPaddingRollupOutputsFromWitnessMap,
|
|
360
389
|
);
|
|
361
|
-
|
|
362
|
-
const verificationKey = this.getVerificationKeyDataForCircuit('PaddingBlockRootRollupArtifact');
|
|
363
|
-
|
|
364
|
-
await this.verifyProof('PaddingBlockRootRollupArtifact', proof.binaryProof);
|
|
365
|
-
|
|
366
|
-
return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
|
|
367
390
|
}
|
|
368
391
|
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
* @param input - Inputs to the circuit.
|
|
372
|
-
* @returns The public inputs as outputs of the simulation.
|
|
373
|
-
*/
|
|
374
|
-
public async getBlockMergeRollupProof(
|
|
375
|
-
input: BlockMergeRollupInputs,
|
|
392
|
+
public getCheckpointMergeRollupProof(
|
|
393
|
+
input: CheckpointMergeRollupPrivateInputs,
|
|
376
394
|
): Promise<
|
|
377
|
-
PublicInputsAndRecursiveProof<
|
|
395
|
+
PublicInputsAndRecursiveProof<CheckpointRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
|
|
378
396
|
> {
|
|
379
|
-
|
|
397
|
+
return this.createRecursiveProofAndVerify(
|
|
380
398
|
input,
|
|
381
|
-
'
|
|
399
|
+
'CheckpointMergeRollupArtifact',
|
|
382
400
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
383
|
-
|
|
384
|
-
|
|
401
|
+
convertCheckpointMergeRollupPrivateInputsToWitnessMap,
|
|
402
|
+
convertCheckpointMergeRollupOutputsFromWitnessMap,
|
|
385
403
|
);
|
|
386
|
-
|
|
387
|
-
const verificationKey = this.getVerificationKeyDataForCircuit('BlockMergeRollupArtifact');
|
|
388
|
-
|
|
389
|
-
await this.verifyProof('BlockMergeRollupArtifact', proof.binaryProof);
|
|
390
|
-
|
|
391
|
-
return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
|
|
392
404
|
}
|
|
393
405
|
|
|
394
406
|
/**
|
|
@@ -397,23 +409,47 @@ export class BBNativeRollupProver implements ServerCircuitProver {
|
|
|
397
409
|
* @returns The public inputs as outputs of the simulation.
|
|
398
410
|
*/
|
|
399
411
|
public async getRootRollupProof(
|
|
400
|
-
input:
|
|
401
|
-
): Promise<PublicInputsAndRecursiveProof<RootRollupPublicInputs>> {
|
|
402
|
-
const {
|
|
412
|
+
input: RootRollupPrivateInputs,
|
|
413
|
+
): Promise<PublicInputsAndRecursiveProof<RootRollupPublicInputs, typeof NESTED_RECURSIVE_PROOF_LENGTH>> {
|
|
414
|
+
const { proof, ...output } = await this.createRecursiveProofAndVerify(
|
|
403
415
|
input,
|
|
404
416
|
'RootRollupArtifact',
|
|
405
|
-
|
|
417
|
+
ULTRA_KECCAK_PROOF_LENGTH,
|
|
418
|
+
convertRootRollupPrivateInputsToWitnessMap,
|
|
406
419
|
convertRootRollupOutputsFromWitnessMap,
|
|
407
420
|
);
|
|
408
421
|
|
|
409
|
-
const recursiveProof = makeRecursiveProofFromBinary(proof, NESTED_RECURSIVE_PROOF_LENGTH);
|
|
410
|
-
|
|
411
|
-
const verificationKey = this.getVerificationKeyDataForCircuit('RootRollupArtifact');
|
|
412
|
-
|
|
413
|
-
await this.verifyProof('RootRollupArtifact', proof);
|
|
422
|
+
const recursiveProof = makeRecursiveProofFromBinary(proof.binaryProof, NESTED_RECURSIVE_PROOF_LENGTH);
|
|
414
423
|
// TODO(https://github.com/AztecProtocol/aztec-packages/issues/13188): Remove this hack.
|
|
415
424
|
recursiveProof.binaryProof.numPublicInputs += PAIRING_POINTS_SIZE;
|
|
416
|
-
|
|
425
|
+
|
|
426
|
+
return { ...output, proof: recursiveProof };
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
private async createRecursiveProofAndVerify<
|
|
430
|
+
PROOF_LENGTH extends number,
|
|
431
|
+
CircuitInputType extends { toBuffer: () => Buffer },
|
|
432
|
+
CircuitOutputType extends { toBuffer: () => Buffer },
|
|
433
|
+
>(
|
|
434
|
+
input: CircuitInputType,
|
|
435
|
+
artifactName: ServerProtocolArtifact,
|
|
436
|
+
proofLength: PROOF_LENGTH,
|
|
437
|
+
convertInput: (input: CircuitInputType) => WitnessMap,
|
|
438
|
+
convertOutput: (outputWitness: WitnessMap) => CircuitOutputType,
|
|
439
|
+
) {
|
|
440
|
+
const { circuitOutput, proof } = await this.createRecursiveProof(
|
|
441
|
+
input,
|
|
442
|
+
artifactName,
|
|
443
|
+
proofLength,
|
|
444
|
+
convertInput,
|
|
445
|
+
convertOutput,
|
|
446
|
+
);
|
|
447
|
+
|
|
448
|
+
await this.verifyProof(artifactName, proof.binaryProof);
|
|
449
|
+
|
|
450
|
+
const verificationKey = this.getVerificationKeyDataForCircuit(artifactName);
|
|
451
|
+
|
|
452
|
+
return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
|
|
417
453
|
}
|
|
418
454
|
|
|
419
455
|
private async generateProofWithBB<
|
|
@@ -467,6 +503,7 @@ export class BBNativeRollupProver implements ServerCircuitProver {
|
|
|
467
503
|
workingDirectory,
|
|
468
504
|
circuitType,
|
|
469
505
|
Buffer.from(artifact.bytecode, 'base64'),
|
|
506
|
+
this.getVerificationKeyDataForCircuit(circuitType).keyAsBytes,
|
|
470
507
|
outputWitnessFile,
|
|
471
508
|
getUltraHonkFlavorForCircuit(circuitType),
|
|
472
509
|
logger,
|
|
@@ -483,49 +520,6 @@ export class BBNativeRollupProver implements ServerCircuitProver {
|
|
|
483
520
|
};
|
|
484
521
|
}
|
|
485
522
|
|
|
486
|
-
private async createProof<Input extends { toBuffer: () => Buffer }, Output extends { toBuffer: () => Buffer }>(
|
|
487
|
-
input: Input,
|
|
488
|
-
circuitType: ServerProtocolArtifact,
|
|
489
|
-
convertInput: (input: Input) => WitnessMap,
|
|
490
|
-
convertOutput: (outputWitness: WitnessMap) => Output,
|
|
491
|
-
): Promise<{ circuitOutput: Output; proof: Proof }> {
|
|
492
|
-
const operation = async (bbWorkingDirectory: string) => {
|
|
493
|
-
const { provingResult, circuitOutput: output } = await this.generateProofWithBB(
|
|
494
|
-
input,
|
|
495
|
-
circuitType,
|
|
496
|
-
convertInput,
|
|
497
|
-
convertOutput,
|
|
498
|
-
bbWorkingDirectory,
|
|
499
|
-
);
|
|
500
|
-
const vkData = this.getVerificationKeyDataForCircuit(circuitType);
|
|
501
|
-
|
|
502
|
-
const PROOF_LENGTH = circuitType == 'RootRollupArtifact' ? ULTRA_KECCAK_PROOF_LENGTH : RECURSIVE_PROOF_LENGTH;
|
|
503
|
-
const proof = await readProofAsFields(provingResult.proofPath!, vkData, PROOF_LENGTH, logger);
|
|
504
|
-
|
|
505
|
-
const circuitName = mapProtocolArtifactNameToCircuitName(circuitType);
|
|
506
|
-
|
|
507
|
-
this.instrumentation.recordDuration('provingDuration', circuitName, provingResult.durationMs);
|
|
508
|
-
this.instrumentation.recordSize('proofSize', circuitName, proof.binaryProof.buffer.length);
|
|
509
|
-
this.instrumentation.recordSize('circuitPublicInputCount', circuitName, vkData.numPublicInputs);
|
|
510
|
-
this.instrumentation.recordSize('circuitSize', circuitName, vkData.circuitSize);
|
|
511
|
-
|
|
512
|
-
logger.info(`Generated proof for ${circuitType} in ${Math.ceil(provingResult.durationMs)} ms`, {
|
|
513
|
-
circuitName,
|
|
514
|
-
// does not include reading the proof from disk
|
|
515
|
-
duration: provingResult.durationMs,
|
|
516
|
-
proofSize: proof.binaryProof.buffer.length,
|
|
517
|
-
eventName: 'circuit-proving',
|
|
518
|
-
// circuitOutput is the partial witness that became the input to the proof
|
|
519
|
-
inputSize: output.toBuffer().length,
|
|
520
|
-
circuitSize: vkData.circuitSize,
|
|
521
|
-
numPublicInputs: vkData.numPublicInputs,
|
|
522
|
-
} satisfies CircuitProvingStats);
|
|
523
|
-
|
|
524
|
-
return { circuitOutput: output, proof: proof.binaryProof };
|
|
525
|
-
};
|
|
526
|
-
return await this.runInDirectory(operation);
|
|
527
|
-
}
|
|
528
|
-
|
|
529
523
|
private async generateAvmProofWithBB(input: AvmCircuitInputs, workingDirectory: string): Promise<BBSuccess> {
|
|
530
524
|
logger.info(`Proving avm-circuit for TX ${input.hints.tx.hash}...`);
|
|
531
525
|
|
|
@@ -539,28 +533,6 @@ export class BBNativeRollupProver implements ServerCircuitProver {
|
|
|
539
533
|
return provingResult;
|
|
540
534
|
}
|
|
541
535
|
|
|
542
|
-
private async generateTubeProofWithBB(bbWorkingDirectory: string, input: TubeInputs): Promise<BBSuccess> {
|
|
543
|
-
logger.debug(`Proving tube...`);
|
|
544
|
-
|
|
545
|
-
const hasher = crypto.createHash('sha256');
|
|
546
|
-
hasher.update(input.toBuffer());
|
|
547
|
-
|
|
548
|
-
await writeClientIVCProofToOutputDirectory(input.clientIVCData, bbWorkingDirectory);
|
|
549
|
-
const provingResult = await generateTubeProof(
|
|
550
|
-
this.config.bbBinaryPath,
|
|
551
|
-
bbWorkingDirectory,
|
|
552
|
-
input.usePublicTailVk ? PUBLIC_TAIL_CIVC_VK : PRIVATE_TAIL_CIVC_VK,
|
|
553
|
-
logger.verbose,
|
|
554
|
-
);
|
|
555
|
-
|
|
556
|
-
if (provingResult.status === BB_RESULT.FAILURE) {
|
|
557
|
-
logger.error(`Failed to generate proof for tube circuit: ${provingResult.reason}`);
|
|
558
|
-
throw new ProvingError(provingResult.reason, provingResult, provingResult.retry);
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
return provingResult;
|
|
562
|
-
}
|
|
563
|
-
|
|
564
536
|
private async createAvmProof(
|
|
565
537
|
input: AvmCircuitInputs,
|
|
566
538
|
): Promise<ProofAndVerificationKey<typeof AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED>> {
|
|
@@ -595,35 +567,6 @@ export class BBNativeRollupProver implements ServerCircuitProver {
|
|
|
595
567
|
return await this.runInDirectory(operation);
|
|
596
568
|
}
|
|
597
569
|
|
|
598
|
-
public async getTubeProof(input: TubeInputs): Promise<ProofAndVerificationKey<typeof TUBE_PROOF_LENGTH>> {
|
|
599
|
-
const operation = async (bbWorkingDirectory: string) => {
|
|
600
|
-
logger.debug(`createTubeProof: ${bbWorkingDirectory}`);
|
|
601
|
-
const provingResult = await this.generateTubeProofWithBB(bbWorkingDirectory, input);
|
|
602
|
-
|
|
603
|
-
// Read the proof as fields
|
|
604
|
-
// TODO(AD): this is the only remaining use of extractVkData.
|
|
605
|
-
const tubeVK = await extractVkData(provingResult.vkDirectoryPath!);
|
|
606
|
-
const tubeProof = await readProofAsFields(provingResult.proofPath!, tubeVK, TUBE_PROOF_LENGTH, logger);
|
|
607
|
-
|
|
608
|
-
this.instrumentation.recordDuration('provingDuration', 'tubeCircuit', provingResult.durationMs);
|
|
609
|
-
this.instrumentation.recordSize('proofSize', 'tubeCircuit', tubeProof.binaryProof.buffer.length);
|
|
610
|
-
this.instrumentation.recordSize('circuitPublicInputCount', 'tubeCircuit', tubeVK.numPublicInputs);
|
|
611
|
-
this.instrumentation.recordSize('circuitSize', 'tubeCircuit', tubeVK.circuitSize);
|
|
612
|
-
|
|
613
|
-
// Sanity check the tube proof (can be removed later)
|
|
614
|
-
await this.verifyWithKey('ultra_rollup_honk', tubeVK, tubeProof.binaryProof);
|
|
615
|
-
|
|
616
|
-
logger.info(
|
|
617
|
-
`Generated proof for tubeCircuit in ${Math.ceil(provingResult.durationMs)} ms, size: ${
|
|
618
|
-
tubeProof.proof.length
|
|
619
|
-
} fields`,
|
|
620
|
-
);
|
|
621
|
-
|
|
622
|
-
return makeProofAndVerificationKey(tubeProof, tubeVK);
|
|
623
|
-
};
|
|
624
|
-
return await this.runInDirectory(operation);
|
|
625
|
-
}
|
|
626
|
-
|
|
627
570
|
/**
|
|
628
571
|
* Executes a circuit and returns its outputs and corresponding proof with embedded aggregation object
|
|
629
572
|
* @param witnessMap - The input witness
|
|
@@ -644,7 +587,7 @@ export class BBNativeRollupProver implements ServerCircuitProver {
|
|
|
644
587
|
convertInput: (input: CircuitInputType) => WitnessMap,
|
|
645
588
|
convertOutput: (outputWitness: WitnessMap) => CircuitOutputType,
|
|
646
589
|
): Promise<{ circuitOutput: CircuitOutputType; proof: RecursiveProof<PROOF_LENGTH> }> {
|
|
647
|
-
// this probably is gonna need to call
|
|
590
|
+
// this probably is gonna need to call chonk
|
|
648
591
|
const operation = async (bbWorkingDirectory: string) => {
|
|
649
592
|
const { provingResult, circuitOutput: output } = await this.generateProofWithBB(
|
|
650
593
|
input,
|
|
@@ -656,7 +599,7 @@ export class BBNativeRollupProver implements ServerCircuitProver {
|
|
|
656
599
|
|
|
657
600
|
const vkData = this.getVerificationKeyDataForCircuit(circuitType);
|
|
658
601
|
// Read the proof as fields
|
|
659
|
-
const proof = await
|
|
602
|
+
const proof = await readProofsFromOutputDirectory(provingResult.proofPath!, vkData, proofLength, logger);
|
|
660
603
|
|
|
661
604
|
const circuitName = mapProtocolArtifactNameToCircuitName(circuitType);
|
|
662
605
|
this.instrumentation.recordDuration('provingDuration', circuitName, provingResult.durationMs);
|