@aztec/bb-prover 3.0.0-nightly.20250908 → 3.0.0-nightly.20250911
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.d.ts +1 -9
- package/dest/bb/execute.d.ts.map +1 -1
- package/dest/bb/execute.js +9 -75
- package/dest/instrumentation.d.ts +2 -2
- package/dest/instrumentation.d.ts.map +1 -1
- package/dest/prover/client/wasm/bb_wasm_private_kernel_prover.d.ts.map +1 -1
- package/dest/prover/client/wasm/bb_wasm_private_kernel_prover.js +2 -4
- package/dest/prover/proof_utils.d.ts +2 -2
- package/dest/prover/proof_utils.d.ts.map +1 -1
- package/dest/prover/proof_utils.js +35 -18
- package/dest/prover/server/bb_prover.d.ts +4 -4
- package/dest/prover/server/bb_prover.d.ts.map +1 -1
- package/dest/prover/server/bb_prover.js +15 -41
- package/dest/stats.d.ts.map +1 -1
- package/dest/stats.js +2 -0
- package/dest/test/delay_values.js +2 -2
- package/dest/test/test_circuit_prover.d.ts +4 -3
- package/dest/test/test_circuit_prover.d.ts.map +1 -1
- package/dest/test/test_circuit_prover.js +3 -3
- package/dest/verifier/bb_verifier.d.ts +2 -4
- package/dest/verifier/bb_verifier.d.ts.map +1 -1
- package/dest/verifier/bb_verifier.js +18 -23
- package/package.json +16 -17
- package/src/bb/execute.ts +6 -73
- package/src/instrumentation.ts +2 -2
- package/src/prover/client/wasm/bb_wasm_private_kernel_prover.ts +2 -4
- package/src/prover/proof_utils.ts +46 -24
- package/src/prover/server/bb_prover.ts +34 -60
- package/src/stats.ts +2 -0
- package/src/test/delay_values.ts +2 -2
- package/src/test/test_circuit_prover.ts +16 -5
- package/src/verifier/bb_verifier.ts +27 -29
package/src/test/delay_values.ts
CHANGED
|
@@ -12,7 +12,7 @@ export const WITGEN_DELAY_MS: Record<ProvingRequestType, number> = {
|
|
|
12
12
|
[ProvingRequestType.PUBLIC_BASE_ROLLUP]: 470_000,
|
|
13
13
|
[ProvingRequestType.ROOT_PARITY]: 100,
|
|
14
14
|
[ProvingRequestType.ROOT_ROLLUP]: 650,
|
|
15
|
-
[ProvingRequestType.
|
|
15
|
+
[ProvingRequestType.PUBLIC_TUBE]: 0,
|
|
16
16
|
[ProvingRequestType.PUBLIC_VM]: 0,
|
|
17
17
|
};
|
|
18
18
|
|
|
@@ -28,6 +28,6 @@ export const PROOF_DELAY_MS: Record<ProvingRequestType, number> = {
|
|
|
28
28
|
[ProvingRequestType.PUBLIC_BASE_ROLLUP]: 160_000,
|
|
29
29
|
[ProvingRequestType.ROOT_PARITY]: 30_000,
|
|
30
30
|
[ProvingRequestType.ROOT_ROLLUP]: 15_000,
|
|
31
|
-
[ProvingRequestType.
|
|
31
|
+
[ProvingRequestType.PUBLIC_TUBE]: 30_000,
|
|
32
32
|
[ProvingRequestType.PUBLIC_VM]: 0,
|
|
33
33
|
};
|
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
NESTED_RECURSIVE_PROOF_LENGTH,
|
|
5
5
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
6
6
|
RECURSIVE_PROOF_LENGTH,
|
|
7
|
-
TUBE_PROOF_LENGTH,
|
|
8
7
|
} from '@aztec/constants';
|
|
9
8
|
import { createLogger } from '@aztec/foundation/log';
|
|
10
9
|
import { sleep } from '@aztec/foundation/sleep';
|
|
@@ -47,6 +46,7 @@ import {
|
|
|
47
46
|
makeProofAndVerificationKey,
|
|
48
47
|
makePublicInputsAndRecursiveProof,
|
|
49
48
|
} from '@aztec/stdlib/interfaces/server';
|
|
49
|
+
import type { PrivateToPublicKernelCircuitPublicInputs } from '@aztec/stdlib/kernel';
|
|
50
50
|
import type { BaseParityInputs, ParityPublicInputs, RootParityInputs } from '@aztec/stdlib/parity';
|
|
51
51
|
import { type Proof, ProvingRequestType, makeEmptyRecursiveProof, makeRecursiveProof } from '@aztec/stdlib/proofs';
|
|
52
52
|
import type {
|
|
@@ -59,10 +59,10 @@ import type {
|
|
|
59
59
|
PaddingBlockRootRollupInputs,
|
|
60
60
|
PrivateBaseRollupInputs,
|
|
61
61
|
PublicBaseRollupInputs,
|
|
62
|
+
PublicTubePrivateInputs,
|
|
62
63
|
RootRollupInputs,
|
|
63
64
|
RootRollupPublicInputs,
|
|
64
65
|
SingleTxBlockRootRollupInputs,
|
|
65
|
-
TubeInputs,
|
|
66
66
|
} from '@aztec/stdlib/rollup';
|
|
67
67
|
import { VerificationKeyData } from '@aztec/stdlib/vks';
|
|
68
68
|
import { type TelemetryClient, getTelemetryClient, trackSpan } from '@aztec/telemetry-client';
|
|
@@ -142,9 +142,20 @@ export class TestCircuitProver implements ServerCircuitProver {
|
|
|
142
142
|
);
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
-
public
|
|
146
|
-
|
|
147
|
-
|
|
145
|
+
public getPublicTubeProof(
|
|
146
|
+
inputs: PublicTubePrivateInputs,
|
|
147
|
+
): Promise<
|
|
148
|
+
PublicInputsAndRecursiveProof<
|
|
149
|
+
PrivateToPublicKernelCircuitPublicInputs,
|
|
150
|
+
typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH
|
|
151
|
+
>
|
|
152
|
+
> {
|
|
153
|
+
return this.applyDelay(ProvingRequestType.PUBLIC_TUBE, () =>
|
|
154
|
+
makePublicInputsAndRecursiveProof(
|
|
155
|
+
inputs.hidingKernelProofData.publicInputs,
|
|
156
|
+
makeEmptyRecursiveProof(NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH),
|
|
157
|
+
ProtocolCircuitVks.PublicTube,
|
|
158
|
+
),
|
|
148
159
|
);
|
|
149
160
|
}
|
|
150
161
|
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { runInDirectory } from '@aztec/foundation/fs';
|
|
2
2
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
3
3
|
import { Timer } from '@aztec/foundation/timer';
|
|
4
|
-
import {
|
|
5
|
-
import type {
|
|
4
|
+
import { ProtocolCircuitVks } from '@aztec/noir-protocol-circuits-types/server/vks';
|
|
5
|
+
import type {
|
|
6
|
+
ClientProtocolArtifact,
|
|
7
|
+
ProtocolArtifact,
|
|
8
|
+
ServerProtocolArtifact,
|
|
9
|
+
} from '@aztec/noir-protocol-circuits-types/types';
|
|
6
10
|
import type { ClientProtocolCircuitVerifier, IVCProofVerificationResult } from '@aztec/stdlib/interfaces/server';
|
|
7
11
|
import type { Proof } from '@aztec/stdlib/proofs';
|
|
8
12
|
import type { CircuitVerificationStats } from '@aztec/stdlib/stats';
|
|
@@ -11,7 +15,6 @@ import type { VerificationKeyData } from '@aztec/stdlib/vks';
|
|
|
11
15
|
|
|
12
16
|
import { promises as fs } from 'fs';
|
|
13
17
|
import * as path from 'path';
|
|
14
|
-
import { fileURLToPath } from 'url';
|
|
15
18
|
|
|
16
19
|
import {
|
|
17
20
|
BB_RESULT,
|
|
@@ -23,15 +26,9 @@ import {
|
|
|
23
26
|
} from '../bb/execute.js';
|
|
24
27
|
import type { BBConfig } from '../config.js';
|
|
25
28
|
import { getUltraHonkFlavorForCircuit } from '../honk.js';
|
|
26
|
-
import {
|
|
29
|
+
import { writeClientIVCProofToPath } from '../prover/proof_utils.js';
|
|
27
30
|
import { mapProtocolArtifactNameToCircuitName } from '../stats.js';
|
|
28
31
|
|
|
29
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
30
|
-
|
|
31
|
-
// Built by yarn generate
|
|
32
|
-
export const PRIVATE_TAIL_CIVC_VK = path.join(__dirname, '../../artifacts/private-civc-vk');
|
|
33
|
-
export const PUBLIC_TAIL_CIVC_VK = path.join(__dirname, '../../artifacts/public-civc-vk');
|
|
34
|
-
|
|
35
32
|
export class BBCircuitVerifier implements ClientProtocolCircuitVerifier {
|
|
36
33
|
private constructor(
|
|
37
34
|
private config: BBConfig,
|
|
@@ -47,10 +44,10 @@ export class BBCircuitVerifier implements ClientProtocolCircuitVerifier {
|
|
|
47
44
|
return new BBCircuitVerifier(config, logger);
|
|
48
45
|
}
|
|
49
46
|
|
|
50
|
-
public getVerificationKeyData(
|
|
51
|
-
const vk =
|
|
47
|
+
public getVerificationKeyData(circuit: ProtocolArtifact): VerificationKeyData {
|
|
48
|
+
const vk = ProtocolCircuitVks[circuit];
|
|
52
49
|
if (vk === undefined) {
|
|
53
|
-
throw new Error(
|
|
50
|
+
throw new Error(`Could not find VK for artifact ${circuit}`);
|
|
54
51
|
}
|
|
55
52
|
return vk;
|
|
56
53
|
}
|
|
@@ -93,42 +90,43 @@ export class BBCircuitVerifier implements ClientProtocolCircuitVerifier {
|
|
|
93
90
|
}
|
|
94
91
|
|
|
95
92
|
public async verifyProof(tx: Tx): Promise<IVCProofVerificationResult> {
|
|
93
|
+
const proofType = 'ClientIVC';
|
|
96
94
|
try {
|
|
97
95
|
const totalTimer = new Timer();
|
|
98
96
|
let verificationDuration = 0;
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
// are not being saved along the other vks yet. Reuse the 'verifyProofForCircuit' method above once
|
|
102
|
-
// we have all the verification keys available.
|
|
103
|
-
const expectedCircuit: ClientProtocolArtifact = tx.data.forPublic
|
|
104
|
-
? 'PrivateKernelTailToPublicArtifact'
|
|
105
|
-
: 'PrivateKernelTailArtifact';
|
|
106
|
-
const circuit = 'ClientIVC';
|
|
97
|
+
|
|
98
|
+
const circuit: ClientProtocolArtifact = tx.data.forPublic ? 'HidingKernelToPublic' : 'HidingKernelToRollup';
|
|
107
99
|
|
|
108
100
|
// Block below is almost copy-pasted from verifyProofForCircuit
|
|
109
101
|
const operation = async (bbWorkingDirectory: string) => {
|
|
110
102
|
const logFunction = (message: string) => {
|
|
111
|
-
this.logger.debug(`${
|
|
103
|
+
this.logger.debug(`${proofType} BB out - ${message}`);
|
|
112
104
|
};
|
|
113
105
|
|
|
114
|
-
|
|
106
|
+
const proofPath = path.join(bbWorkingDirectory, PROOF_FILENAME);
|
|
107
|
+
await writeClientIVCProofToPath(tx.clientIvcProof, proofPath);
|
|
108
|
+
|
|
109
|
+
const verificationKeyPath = path.join(bbWorkingDirectory, VK_FILENAME);
|
|
110
|
+
const verificationKey = this.getVerificationKeyData(circuit);
|
|
111
|
+
await fs.writeFile(verificationKeyPath, verificationKey.keyAsBytes);
|
|
112
|
+
|
|
115
113
|
const timer = new Timer();
|
|
116
114
|
const result = await verifyClientIvcProof(
|
|
117
115
|
this.config.bbBinaryPath,
|
|
118
|
-
|
|
119
|
-
|
|
116
|
+
proofPath,
|
|
117
|
+
verificationKeyPath,
|
|
120
118
|
logFunction,
|
|
121
119
|
this.config.bbIVCConcurrency,
|
|
122
120
|
);
|
|
123
121
|
verificationDuration = timer.ms();
|
|
124
122
|
|
|
125
123
|
if (result.status === BB_RESULT.FAILURE) {
|
|
126
|
-
const errorMessage = `Failed to verify ${
|
|
124
|
+
const errorMessage = `Failed to verify ${proofType} proof for ${circuit}!`;
|
|
127
125
|
throw new Error(errorMessage);
|
|
128
126
|
}
|
|
129
127
|
|
|
130
|
-
this.logger.debug(`${
|
|
131
|
-
circuitName: mapProtocolArtifactNameToCircuitName(
|
|
128
|
+
this.logger.debug(`${proofType} verification successful`, {
|
|
129
|
+
circuitName: mapProtocolArtifactNameToCircuitName(circuit),
|
|
132
130
|
duration: result.durationMs,
|
|
133
131
|
eventName: 'circuit-verification',
|
|
134
132
|
proofType: 'client-ivc',
|
|
@@ -137,7 +135,7 @@ export class BBCircuitVerifier implements ClientProtocolCircuitVerifier {
|
|
|
137
135
|
await runInDirectory(this.config.bbWorkingDirectory, operation, this.config.bbSkipCleanup, this.logger);
|
|
138
136
|
return { valid: true, durationMs: verificationDuration, totalDurationMs: totalTimer.ms() };
|
|
139
137
|
} catch (err) {
|
|
140
|
-
this.logger.warn(`Failed to verify
|
|
138
|
+
this.logger.warn(`Failed to verify ${proofType} proof for tx ${tx.getTxHash().toString()}: ${String(err)}`);
|
|
141
139
|
return { valid: false, durationMs: 0, totalDurationMs: 0 };
|
|
142
140
|
}
|
|
143
141
|
}
|