@aztec/bb-prover 4.0.0-nightly.20250907 → 4.0.0-nightly.20260107
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 +23 -43
- package/dest/prover/server/bb_prover.d.ts.map +1 -1
- package/dest/prover/server/bb_prover.js +464 -165
- 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 +37 -25
- package/dest/test/index.d.ts +2 -1
- package/dest/test/index.d.ts.map +1 -1
- package/dest/test/index.js +1 -0
- 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 +503 -81
- 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 -293
- package/src/test/delay_values.ts +38 -24
- package/src/test/index.ts +1 -0
- 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,34 @@ 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
|
|
68
|
-
enhanceProofWithPiValidationFlag,
|
|
85
|
+
type TxMergeRollupPrivateInputs,
|
|
86
|
+
type TxRollupPublicInputs,
|
|
69
87
|
} from '@aztec/stdlib/rollup';
|
|
70
88
|
import type { CircuitProvingStats, CircuitWitnessGenerationStats } from '@aztec/stdlib/stats';
|
|
71
89
|
import type { VerificationKeyData } from '@aztec/stdlib/vks';
|
|
72
90
|
import { Attributes, type TelemetryClient, getTelemetryClient, trackSpan } from '@aztec/telemetry-client';
|
|
73
91
|
|
|
74
|
-
import crypto from 'crypto';
|
|
75
92
|
import { promises as fs } from 'fs';
|
|
76
93
|
import * as path from 'path';
|
|
77
94
|
|
|
@@ -84,17 +101,14 @@ import {
|
|
|
84
101
|
VK_FILENAME,
|
|
85
102
|
generateAvmProof,
|
|
86
103
|
generateProof,
|
|
87
|
-
generateTubeProof,
|
|
88
104
|
verifyAvmProof,
|
|
89
105
|
verifyProof,
|
|
90
106
|
} from '../../bb/execute.js';
|
|
91
107
|
import type { ACVMConfig, BBConfig } from '../../config.js';
|
|
92
108
|
import { type UltraHonkFlavor, getUltraHonkFlavorForCircuit } from '../../honk.js';
|
|
93
109
|
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';
|
|
110
|
+
import { extractAvmVkData } from '../../verification_key/verification_key_data.js';
|
|
111
|
+
import { readProofsFromOutputDirectory } from '../proof_utils.js';
|
|
98
112
|
|
|
99
113
|
const logger = createLogger('bb-prover');
|
|
100
114
|
|
|
@@ -136,22 +150,17 @@ export class BBNativeRollupProver implements ServerCircuitProver {
|
|
|
136
150
|
* @param inputs - Inputs to the circuit.
|
|
137
151
|
* @returns The public inputs of the parity circuit.
|
|
138
152
|
*/
|
|
139
|
-
@trackSpan('BBNativeRollupProver.getBaseParityProof', { [Attributes.PROTOCOL_CIRCUIT_NAME]: 'base
|
|
140
|
-
public
|
|
141
|
-
inputs:
|
|
153
|
+
@trackSpan('BBNativeRollupProver.getBaseParityProof', { [Attributes.PROTOCOL_CIRCUIT_NAME]: 'parity-base' })
|
|
154
|
+
public getBaseParityProof(
|
|
155
|
+
inputs: ParityBasePrivateInputs,
|
|
142
156
|
): Promise<PublicInputsAndRecursiveProof<ParityPublicInputs, typeof RECURSIVE_PROOF_LENGTH>> {
|
|
143
|
-
|
|
157
|
+
return this.createRecursiveProofAndVerify(
|
|
144
158
|
inputs,
|
|
145
|
-
'
|
|
159
|
+
'ParityBaseArtifact',
|
|
146
160
|
RECURSIVE_PROOF_LENGTH,
|
|
147
|
-
|
|
148
|
-
|
|
161
|
+
convertParityBasePrivateInputsToWitnessMap,
|
|
162
|
+
convertParityBaseOutputsFromWitnessMap,
|
|
149
163
|
);
|
|
150
|
-
|
|
151
|
-
const verificationKey = this.getVerificationKeyDataForCircuit('BaseParityArtifact');
|
|
152
|
-
await this.verifyProof('BaseParityArtifact', proof.binaryProof);
|
|
153
|
-
|
|
154
|
-
return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
|
|
155
164
|
}
|
|
156
165
|
|
|
157
166
|
/**
|
|
@@ -159,22 +168,17 @@ export class BBNativeRollupProver implements ServerCircuitProver {
|
|
|
159
168
|
* @param inputs - Inputs to the circuit.
|
|
160
169
|
* @returns The public inputs of the parity circuit.
|
|
161
170
|
*/
|
|
162
|
-
@trackSpan('BBNativeRollupProver.getRootParityProof', { [Attributes.PROTOCOL_CIRCUIT_NAME]: 'root
|
|
163
|
-
public
|
|
164
|
-
inputs:
|
|
171
|
+
@trackSpan('BBNativeRollupProver.getRootParityProof', { [Attributes.PROTOCOL_CIRCUIT_NAME]: 'parity-root' })
|
|
172
|
+
public getRootParityProof(
|
|
173
|
+
inputs: ParityRootPrivateInputs,
|
|
165
174
|
): Promise<PublicInputsAndRecursiveProof<ParityPublicInputs, typeof NESTED_RECURSIVE_PROOF_LENGTH>> {
|
|
166
|
-
|
|
175
|
+
return this.createRecursiveProofAndVerify(
|
|
167
176
|
inputs,
|
|
168
|
-
'
|
|
177
|
+
'ParityRootArtifact',
|
|
169
178
|
NESTED_RECURSIVE_PROOF_LENGTH,
|
|
170
|
-
|
|
171
|
-
|
|
179
|
+
convertParityRootPrivateInputsToWitnessMap,
|
|
180
|
+
convertParityRootOutputsFromWitnessMap,
|
|
172
181
|
);
|
|
173
|
-
|
|
174
|
-
const verificationKey = this.getVerificationKeyDataForCircuit('RootParityArtifact');
|
|
175
|
-
await this.verifyProof('RootParityArtifact', proof.binaryProof);
|
|
176
|
-
|
|
177
|
-
return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
|
|
178
182
|
}
|
|
179
183
|
|
|
180
184
|
/**
|
|
@@ -187,34 +191,25 @@ export class BBNativeRollupProver implements ServerCircuitProver {
|
|
|
187
191
|
}))
|
|
188
192
|
public async getAvmProof(
|
|
189
193
|
inputs: AvmCircuitInputs,
|
|
190
|
-
skipPublicInputsValidation: boolean = false,
|
|
191
194
|
): Promise<ProofAndVerificationKey<typeof AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED>> {
|
|
192
195
|
const proofAndVk = await this.createAvmProof(inputs);
|
|
193
196
|
await this.verifyAvmProof(proofAndVk.proof.binaryProof, proofAndVk.verificationKey, inputs.publicInputs);
|
|
194
|
-
|
|
195
|
-
// TODO(#14234)[Unconditional PIs validation]: remove next lines and directly return proofAndVk
|
|
196
|
-
proofAndVk.proof.proof = enhanceProofWithPiValidationFlag(proofAndVk.proof.proof, skipPublicInputsValidation);
|
|
197
197
|
return proofAndVk;
|
|
198
198
|
}
|
|
199
199
|
|
|
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,
|
|
200
|
+
public async getPublicChonkVerifierProof(
|
|
201
|
+
inputs: PublicChonkVerifierPrivateInputs,
|
|
207
202
|
): Promise<
|
|
208
|
-
PublicInputsAndRecursiveProof<
|
|
203
|
+
PublicInputsAndRecursiveProof<PublicChonkVerifierPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
|
|
209
204
|
> {
|
|
210
|
-
const artifactName = '
|
|
205
|
+
const artifactName = 'PublicChonkVerifier';
|
|
211
206
|
|
|
212
207
|
const { circuitOutput, proof } = await this.createRecursiveProof(
|
|
213
208
|
inputs,
|
|
214
209
|
artifactName,
|
|
215
210
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
216
|
-
|
|
217
|
-
|
|
211
|
+
convertPublicChonkVerifierPrivateInputsToWitnessMap,
|
|
212
|
+
convertPublicChonkVerifierOutputsFromWitnessMap,
|
|
218
213
|
);
|
|
219
214
|
|
|
220
215
|
const verificationKey = this.getVerificationKeyDataForCircuit(artifactName);
|
|
@@ -224,31 +219,38 @@ export class BBNativeRollupProver implements ServerCircuitProver {
|
|
|
224
219
|
return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
|
|
225
220
|
}
|
|
226
221
|
|
|
222
|
+
/**
|
|
223
|
+
* Simulates the base rollup circuit from its inputs.
|
|
224
|
+
* @param inputs - Inputs to the circuit.
|
|
225
|
+
* @returns The public inputs as outputs of the simulation.
|
|
226
|
+
*/
|
|
227
|
+
public getPrivateTxBaseRollupProof(
|
|
228
|
+
inputs: PrivateTxBaseRollupPrivateInputs,
|
|
229
|
+
): Promise<PublicInputsAndRecursiveProof<TxRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
230
|
+
return this.createRecursiveProofAndVerify(
|
|
231
|
+
inputs,
|
|
232
|
+
'PrivateTxBaseRollupArtifact',
|
|
233
|
+
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
234
|
+
convertPrivateTxBaseRollupPrivateInputsToWitnessMap,
|
|
235
|
+
convertPrivateTxBaseRollupOutputsFromWitnessMap,
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
|
|
227
239
|
/**
|
|
228
240
|
* Requests that the public kernel tail circuit be executed and the proof generated
|
|
229
241
|
* @param kernelRequest - The object encapsulating the request for a proof
|
|
230
242
|
* @returns The requested circuit's public inputs and proof
|
|
231
243
|
*/
|
|
232
|
-
public
|
|
233
|
-
inputs:
|
|
234
|
-
): Promise<
|
|
235
|
-
|
|
236
|
-
> {
|
|
237
|
-
const artifactName = 'PublicBaseRollupArtifact';
|
|
238
|
-
|
|
239
|
-
const { circuitOutput, proof } = await this.createRecursiveProof(
|
|
244
|
+
public getPublicTxBaseRollupProof(
|
|
245
|
+
inputs: PublicTxBaseRollupPrivateInputs,
|
|
246
|
+
): Promise<PublicInputsAndRecursiveProof<TxRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
247
|
+
return this.createRecursiveProofAndVerify(
|
|
240
248
|
inputs,
|
|
241
|
-
|
|
249
|
+
'PublicTxBaseRollupArtifact',
|
|
242
250
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
243
|
-
|
|
244
|
-
|
|
251
|
+
convertPublicTxBaseRollupPrivateInputsToWitnessMap,
|
|
252
|
+
convertPublicTxBaseRollupOutputsFromWitnessMap,
|
|
245
253
|
);
|
|
246
|
-
|
|
247
|
-
const verificationKey = this.getVerificationKeyDataForCircuit(artifactName);
|
|
248
|
-
|
|
249
|
-
await this.verifyProof(artifactName, proof.binaryProof);
|
|
250
|
-
|
|
251
|
-
return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
|
|
252
254
|
}
|
|
253
255
|
|
|
254
256
|
/**
|
|
@@ -256,139 +258,144 @@ export class BBNativeRollupProver implements ServerCircuitProver {
|
|
|
256
258
|
* @param input - Inputs to the circuit.
|
|
257
259
|
* @returns The public inputs as outputs of the simulation.
|
|
258
260
|
*/
|
|
259
|
-
public
|
|
260
|
-
input:
|
|
261
|
-
): Promise<
|
|
262
|
-
|
|
263
|
-
> {
|
|
264
|
-
const { circuitOutput, proof } = await this.createRecursiveProof(
|
|
261
|
+
public getTxMergeRollupProof(
|
|
262
|
+
input: TxMergeRollupPrivateInputs,
|
|
263
|
+
): Promise<PublicInputsAndRecursiveProof<TxRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
264
|
+
return this.createRecursiveProofAndVerify(
|
|
265
265
|
input,
|
|
266
|
-
'
|
|
266
|
+
'TxMergeRollupArtifact',
|
|
267
267
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
268
|
-
|
|
269
|
-
|
|
268
|
+
convertTxMergeRollupPrivateInputsToWitnessMap,
|
|
269
|
+
convertTxMergeRollupOutputsFromWitnessMap,
|
|
270
270
|
);
|
|
271
|
+
}
|
|
271
272
|
|
|
272
|
-
|
|
273
|
+
public getBlockRootFirstRollupProof(
|
|
274
|
+
input: BlockRootFirstRollupPrivateInputs,
|
|
275
|
+
): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
276
|
+
return this.createRecursiveProofAndVerify(
|
|
277
|
+
input,
|
|
278
|
+
'BlockRootFirstRollupArtifact',
|
|
279
|
+
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
280
|
+
convertBlockRootFirstRollupPrivateInputsToWitnessMap,
|
|
281
|
+
convertBlockRootFirstRollupOutputsFromWitnessMap,
|
|
282
|
+
);
|
|
283
|
+
}
|
|
273
284
|
|
|
274
|
-
|
|
285
|
+
public getBlockRootSingleTxFirstRollupProof(
|
|
286
|
+
input: BlockRootSingleTxFirstRollupPrivateInputs,
|
|
287
|
+
): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
288
|
+
return this.createRecursiveProofAndVerify(
|
|
289
|
+
input,
|
|
290
|
+
'BlockRootSingleTxFirstRollupArtifact',
|
|
291
|
+
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
292
|
+
convertBlockRootSingleTxFirstRollupPrivateInputsToWitnessMap,
|
|
293
|
+
convertBlockRootSingleTxFirstRollupOutputsFromWitnessMap,
|
|
294
|
+
);
|
|
295
|
+
}
|
|
275
296
|
|
|
276
|
-
|
|
297
|
+
public getBlockRootEmptyTxFirstRollupProof(
|
|
298
|
+
input: BlockRootEmptyTxFirstRollupPrivateInputs,
|
|
299
|
+
): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
300
|
+
return this.createRecursiveProofAndVerify(
|
|
301
|
+
input,
|
|
302
|
+
'BlockRootEmptyTxFirstRollupArtifact',
|
|
303
|
+
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
304
|
+
convertBlockRootEmptyTxFirstRollupPrivateInputsToWitnessMap,
|
|
305
|
+
convertBlockRootEmptyTxFirstRollupOutputsFromWitnessMap,
|
|
306
|
+
);
|
|
277
307
|
}
|
|
278
308
|
|
|
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(
|
|
309
|
+
public getBlockRootRollupProof(
|
|
310
|
+
input: BlockRootRollupPrivateInputs,
|
|
311
|
+
): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
312
|
+
return this.createRecursiveProofAndVerify(
|
|
290
313
|
input,
|
|
291
314
|
'BlockRootRollupArtifact',
|
|
292
315
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
293
|
-
|
|
316
|
+
convertBlockRootRollupPrivateInputsToWitnessMap,
|
|
294
317
|
convertBlockRootRollupOutputsFromWitnessMap,
|
|
295
318
|
);
|
|
319
|
+
}
|
|
296
320
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
321
|
+
public getBlockRootSingleTxRollupProof(
|
|
322
|
+
input: BlockRootSingleTxRollupPrivateInputs,
|
|
323
|
+
): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
324
|
+
return this.createRecursiveProofAndVerify(
|
|
325
|
+
input,
|
|
326
|
+
'BlockRootSingleTxRollupArtifact',
|
|
327
|
+
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
328
|
+
convertBlockRootSingleTxRollupPrivateInputsToWitnessMap,
|
|
329
|
+
convertBlockRootSingleTxRollupOutputsFromWitnessMap,
|
|
330
|
+
);
|
|
331
|
+
}
|
|
300
332
|
|
|
301
|
-
|
|
333
|
+
public getBlockMergeRollupProof(
|
|
334
|
+
input: BlockMergeRollupPrivateInputs,
|
|
335
|
+
): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
336
|
+
return this.createRecursiveProofAndVerify(
|
|
337
|
+
input,
|
|
338
|
+
'BlockMergeRollupArtifact',
|
|
339
|
+
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
340
|
+
convertBlockMergeRollupPrivateInputsToWitnessMap,
|
|
341
|
+
convertBlockMergeRollupOutputsFromWitnessMap,
|
|
342
|
+
);
|
|
302
343
|
}
|
|
303
344
|
|
|
304
|
-
public
|
|
305
|
-
input:
|
|
345
|
+
public getCheckpointRootRollupProof(
|
|
346
|
+
input: CheckpointRootRollupPrivateInputs,
|
|
306
347
|
): Promise<
|
|
307
|
-
PublicInputsAndRecursiveProof<
|
|
348
|
+
PublicInputsAndRecursiveProof<CheckpointRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
|
|
308
349
|
> {
|
|
309
|
-
|
|
350
|
+
return this.createRecursiveProofAndVerify(
|
|
310
351
|
input,
|
|
311
|
-
'
|
|
352
|
+
'CheckpointRootRollupArtifact',
|
|
312
353
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
313
|
-
|
|
314
|
-
|
|
354
|
+
convertCheckpointRootRollupPrivateInputsToWitnessMap,
|
|
355
|
+
convertCheckpointRootRollupOutputsFromWitnessMap,
|
|
315
356
|
);
|
|
316
|
-
|
|
317
|
-
const verificationKey = this.getVerificationKeyDataForCircuit('SingleTxBlockRootRollupArtifact');
|
|
318
|
-
|
|
319
|
-
await this.verifyProof('SingleTxBlockRootRollupArtifact', proof.binaryProof);
|
|
320
|
-
|
|
321
|
-
return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
|
|
322
357
|
}
|
|
323
358
|
|
|
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,
|
|
359
|
+
public getCheckpointRootSingleBlockRollupProof(
|
|
360
|
+
input: CheckpointRootSingleBlockRollupPrivateInputs,
|
|
331
361
|
): Promise<
|
|
332
|
-
PublicInputsAndRecursiveProof<
|
|
362
|
+
PublicInputsAndRecursiveProof<CheckpointRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
|
|
333
363
|
> {
|
|
334
|
-
|
|
364
|
+
return this.createRecursiveProofAndVerify(
|
|
335
365
|
input,
|
|
336
|
-
'
|
|
366
|
+
'CheckpointRootSingleBlockRollupArtifact',
|
|
337
367
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
338
|
-
|
|
339
|
-
|
|
368
|
+
convertCheckpointRootSingleBlockRollupPrivateInputsToWitnessMap,
|
|
369
|
+
convertCheckpointRootSingleBlockRollupOutputsFromWitnessMap,
|
|
340
370
|
);
|
|
341
|
-
|
|
342
|
-
const verificationKey = this.getVerificationKeyDataForCircuit('EmptyBlockRootRollupArtifact');
|
|
343
|
-
|
|
344
|
-
await this.verifyProof('EmptyBlockRootRollupArtifact', proof.binaryProof);
|
|
345
|
-
|
|
346
|
-
return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
|
|
347
371
|
}
|
|
348
372
|
|
|
349
|
-
public
|
|
350
|
-
input:
|
|
373
|
+
public getCheckpointPaddingRollupProof(
|
|
374
|
+
input: CheckpointPaddingRollupPrivateInputs,
|
|
351
375
|
): Promise<
|
|
352
|
-
PublicInputsAndRecursiveProof<
|
|
376
|
+
PublicInputsAndRecursiveProof<CheckpointRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
|
|
353
377
|
> {
|
|
354
|
-
|
|
378
|
+
return this.createRecursiveProofAndVerify(
|
|
355
379
|
input,
|
|
356
|
-
'
|
|
380
|
+
'CheckpointPaddingRollupArtifact',
|
|
357
381
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
358
|
-
|
|
359
|
-
|
|
382
|
+
convertCheckpointPaddingRollupPrivateInputsToWitnessMap,
|
|
383
|
+
convertCheckpointPaddingRollupOutputsFromWitnessMap,
|
|
360
384
|
);
|
|
361
|
-
|
|
362
|
-
const verificationKey = this.getVerificationKeyDataForCircuit('PaddingBlockRootRollupArtifact');
|
|
363
|
-
|
|
364
|
-
await this.verifyProof('PaddingBlockRootRollupArtifact', proof.binaryProof);
|
|
365
|
-
|
|
366
|
-
return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
|
|
367
385
|
}
|
|
368
386
|
|
|
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,
|
|
387
|
+
public getCheckpointMergeRollupProof(
|
|
388
|
+
input: CheckpointMergeRollupPrivateInputs,
|
|
376
389
|
): Promise<
|
|
377
|
-
PublicInputsAndRecursiveProof<
|
|
390
|
+
PublicInputsAndRecursiveProof<CheckpointRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
|
|
378
391
|
> {
|
|
379
|
-
|
|
392
|
+
return this.createRecursiveProofAndVerify(
|
|
380
393
|
input,
|
|
381
|
-
'
|
|
394
|
+
'CheckpointMergeRollupArtifact',
|
|
382
395
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
383
|
-
|
|
384
|
-
|
|
396
|
+
convertCheckpointMergeRollupPrivateInputsToWitnessMap,
|
|
397
|
+
convertCheckpointMergeRollupOutputsFromWitnessMap,
|
|
385
398
|
);
|
|
386
|
-
|
|
387
|
-
const verificationKey = this.getVerificationKeyDataForCircuit('BlockMergeRollupArtifact');
|
|
388
|
-
|
|
389
|
-
await this.verifyProof('BlockMergeRollupArtifact', proof.binaryProof);
|
|
390
|
-
|
|
391
|
-
return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
|
|
392
399
|
}
|
|
393
400
|
|
|
394
401
|
/**
|
|
@@ -397,23 +404,47 @@ export class BBNativeRollupProver implements ServerCircuitProver {
|
|
|
397
404
|
* @returns The public inputs as outputs of the simulation.
|
|
398
405
|
*/
|
|
399
406
|
public async getRootRollupProof(
|
|
400
|
-
input:
|
|
401
|
-
): Promise<PublicInputsAndRecursiveProof<RootRollupPublicInputs>> {
|
|
402
|
-
const {
|
|
407
|
+
input: RootRollupPrivateInputs,
|
|
408
|
+
): Promise<PublicInputsAndRecursiveProof<RootRollupPublicInputs, typeof NESTED_RECURSIVE_PROOF_LENGTH>> {
|
|
409
|
+
const { proof, ...output } = await this.createRecursiveProofAndVerify(
|
|
403
410
|
input,
|
|
404
411
|
'RootRollupArtifact',
|
|
405
|
-
|
|
412
|
+
ULTRA_KECCAK_PROOF_LENGTH,
|
|
413
|
+
convertRootRollupPrivateInputsToWitnessMap,
|
|
406
414
|
convertRootRollupOutputsFromWitnessMap,
|
|
407
415
|
);
|
|
408
416
|
|
|
409
|
-
const recursiveProof = makeRecursiveProofFromBinary(proof, NESTED_RECURSIVE_PROOF_LENGTH);
|
|
410
|
-
|
|
411
|
-
const verificationKey = this.getVerificationKeyDataForCircuit('RootRollupArtifact');
|
|
412
|
-
|
|
413
|
-
await this.verifyProof('RootRollupArtifact', proof);
|
|
417
|
+
const recursiveProof = makeRecursiveProofFromBinary(proof.binaryProof, NESTED_RECURSIVE_PROOF_LENGTH);
|
|
414
418
|
// TODO(https://github.com/AztecProtocol/aztec-packages/issues/13188): Remove this hack.
|
|
415
419
|
recursiveProof.binaryProof.numPublicInputs += PAIRING_POINTS_SIZE;
|
|
416
|
-
|
|
420
|
+
|
|
421
|
+
return { ...output, proof: recursiveProof };
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
private async createRecursiveProofAndVerify<
|
|
425
|
+
PROOF_LENGTH extends number,
|
|
426
|
+
CircuitInputType extends { toBuffer: () => Buffer },
|
|
427
|
+
CircuitOutputType extends { toBuffer: () => Buffer },
|
|
428
|
+
>(
|
|
429
|
+
input: CircuitInputType,
|
|
430
|
+
artifactName: ServerProtocolArtifact,
|
|
431
|
+
proofLength: PROOF_LENGTH,
|
|
432
|
+
convertInput: (input: CircuitInputType) => WitnessMap,
|
|
433
|
+
convertOutput: (outputWitness: WitnessMap) => CircuitOutputType,
|
|
434
|
+
) {
|
|
435
|
+
const { circuitOutput, proof } = await this.createRecursiveProof(
|
|
436
|
+
input,
|
|
437
|
+
artifactName,
|
|
438
|
+
proofLength,
|
|
439
|
+
convertInput,
|
|
440
|
+
convertOutput,
|
|
441
|
+
);
|
|
442
|
+
|
|
443
|
+
await this.verifyProof(artifactName, proof.binaryProof);
|
|
444
|
+
|
|
445
|
+
const verificationKey = this.getVerificationKeyDataForCircuit(artifactName);
|
|
446
|
+
|
|
447
|
+
return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
|
|
417
448
|
}
|
|
418
449
|
|
|
419
450
|
private async generateProofWithBB<
|
|
@@ -467,6 +498,7 @@ export class BBNativeRollupProver implements ServerCircuitProver {
|
|
|
467
498
|
workingDirectory,
|
|
468
499
|
circuitType,
|
|
469
500
|
Buffer.from(artifact.bytecode, 'base64'),
|
|
501
|
+
this.getVerificationKeyDataForCircuit(circuitType).keyAsBytes,
|
|
470
502
|
outputWitnessFile,
|
|
471
503
|
getUltraHonkFlavorForCircuit(circuitType),
|
|
472
504
|
logger,
|
|
@@ -483,49 +515,6 @@ export class BBNativeRollupProver implements ServerCircuitProver {
|
|
|
483
515
|
};
|
|
484
516
|
}
|
|
485
517
|
|
|
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
518
|
private async generateAvmProofWithBB(input: AvmCircuitInputs, workingDirectory: string): Promise<BBSuccess> {
|
|
530
519
|
logger.info(`Proving avm-circuit for TX ${input.hints.tx.hash}...`);
|
|
531
520
|
|
|
@@ -539,28 +528,6 @@ export class BBNativeRollupProver implements ServerCircuitProver {
|
|
|
539
528
|
return provingResult;
|
|
540
529
|
}
|
|
541
530
|
|
|
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
531
|
private async createAvmProof(
|
|
565
532
|
input: AvmCircuitInputs,
|
|
566
533
|
): Promise<ProofAndVerificationKey<typeof AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED>> {
|
|
@@ -595,35 +562,6 @@ export class BBNativeRollupProver implements ServerCircuitProver {
|
|
|
595
562
|
return await this.runInDirectory(operation);
|
|
596
563
|
}
|
|
597
564
|
|
|
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
565
|
/**
|
|
628
566
|
* Executes a circuit and returns its outputs and corresponding proof with embedded aggregation object
|
|
629
567
|
* @param witnessMap - The input witness
|
|
@@ -644,7 +582,7 @@ export class BBNativeRollupProver implements ServerCircuitProver {
|
|
|
644
582
|
convertInput: (input: CircuitInputType) => WitnessMap,
|
|
645
583
|
convertOutput: (outputWitness: WitnessMap) => CircuitOutputType,
|
|
646
584
|
): Promise<{ circuitOutput: CircuitOutputType; proof: RecursiveProof<PROOF_LENGTH> }> {
|
|
647
|
-
// this probably is gonna need to call
|
|
585
|
+
// this probably is gonna need to call chonk
|
|
648
586
|
const operation = async (bbWorkingDirectory: string) => {
|
|
649
587
|
const { provingResult, circuitOutput: output } = await this.generateProofWithBB(
|
|
650
588
|
input,
|
|
@@ -656,7 +594,7 @@ export class BBNativeRollupProver implements ServerCircuitProver {
|
|
|
656
594
|
|
|
657
595
|
const vkData = this.getVerificationKeyDataForCircuit(circuitType);
|
|
658
596
|
// Read the proof as fields
|
|
659
|
-
const proof = await
|
|
597
|
+
const proof = await readProofsFromOutputDirectory(provingResult.proofPath!, vkData, proofLength, logger);
|
|
660
598
|
|
|
661
599
|
const circuitName = mapProtocolArtifactNameToCircuitName(circuitType);
|
|
662
600
|
this.instrumentation.recordDuration('provingDuration', circuitName, provingResult.durationMs);
|