@aztec-labs/bb-prover 6.0.0-nightly.20260829
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 +27 -0
- package/dest/avm_proving_tests/avm_proving_tester.d.ts.map +1 -0
- package/dest/avm_proving_tests/avm_proving_tester.js +236 -0
- package/dest/bb/bb_js_backend.d.ts +196 -0
- package/dest/bb/bb_js_backend.d.ts.map +1 -0
- package/dest/bb/bb_js_backend.js +385 -0
- package/dest/bb/bb_js_debug.d.ts +52 -0
- package/dest/bb/bb_js_debug.d.ts.map +1 -0
- package/dest/bb/bb_js_debug.js +176 -0
- package/dest/bb/cli.d.ts +12 -0
- package/dest/bb/cli.d.ts.map +1 -0
- package/dest/bb/cli.js +19 -0
- package/dest/bb/file_names.d.ts +4 -0
- package/dest/bb/file_names.d.ts.map +1 -0
- package/dest/bb/file_names.js +5 -0
- package/dest/bb/index.d.ts +3 -0
- package/dest/bb/index.d.ts.map +1 -0
- package/dest/bb/index.js +16 -0
- package/dest/config.d.ts +31 -0
- package/dest/config.d.ts.map +1 -0
- package/dest/config.js +1 -0
- package/dest/honk.d.ts +13 -0
- package/dest/honk.d.ts.map +1 -0
- package/dest/honk.js +20 -0
- package/dest/index.d.ts +10 -0
- package/dest/index.d.ts.map +1 -0
- package/dest/index.js +8 -0
- package/dest/instrumentation.d.ts +47 -0
- package/dest/instrumentation.d.ts.map +1 -0
- package/dest/instrumentation.js +76 -0
- package/dest/prover/client/bb_private_kernel_prover.d.ts +54 -0
- package/dest/prover/client/bb_private_kernel_prover.d.ts.map +1 -0
- package/dest/prover/client/bb_private_kernel_prover.js +205 -0
- 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 +3 -0
- package/dest/prover/index.d.ts.map +1 -0
- package/dest/prover/index.js +2 -0
- package/dest/prover/proof_utils.d.ts +29 -0
- package/dest/prover/proof_utils.d.ts.map +1 -0
- package/dest/prover/proof_utils.js +95 -0
- package/dest/prover/server/bb_prover.d.ts +88 -0
- package/dest/prover/server/bb_prover.d.ts.map +1 -0
- package/dest/prover/server/bb_prover.js +823 -0
- package/dest/test/delay_values.d.ts +4 -0
- package/dest/test/delay_values.d.ts.map +1 -0
- package/dest/test/delay_values.js +37 -0
- package/dest/test/index.d.ts +4 -0
- package/dest/test/index.d.ts.map +1 -0
- package/dest/test/index.js +3 -0
- package/dest/test/test_circuit_prover.d.ts +64 -0
- package/dest/test/test_circuit_prover.d.ts.map +1 -0
- package/dest/test/test_circuit_prover.js +576 -0
- package/dest/test/test_verifier.d.ts +9 -0
- package/dest/test/test_verifier.d.ts.map +1 -0
- package/dest/test/test_verifier.js +27 -0
- package/dest/verification_key/verification_key_data.d.ts +8 -0
- package/dest/verification_key/verification_key_data.d.ts.map +1 -0
- package/dest/verification_key/verification_key_data.js +19 -0
- package/dest/verifier/batch_chonk_verifier.d.ts +57 -0
- package/dest/verifier/batch_chonk_verifier.d.ts.map +1 -0
- package/dest/verifier/batch_chonk_verifier.js +389 -0
- package/dest/verifier/bb_verifier.d.ts +21 -0
- package/dest/verifier/bb_verifier.d.ts.map +1 -0
- package/dest/verifier/bb_verifier.js +193 -0
- package/dest/verifier/index.d.ts +4 -0
- package/dest/verifier/index.d.ts.map +1 -0
- package/dest/verifier/index.js +3 -0
- package/dest/verifier/queued_chonk_verifier.d.ts +26 -0
- package/dest/verifier/queued_chonk_verifier.d.ts.map +1 -0
- package/dest/verifier/queued_chonk_verifier.js +102 -0
- package/package.json +113 -0
- package/src/avm_proving_tests/avm_proving_tester.ts +235 -0
- package/src/bb/bb_js_backend.ts +442 -0
- package/src/bb/bb_js_debug.ts +227 -0
- package/src/bb/cli.ts +31 -0
- package/src/bb/file_names.ts +6 -0
- package/src/bb/index.ts +22 -0
- package/src/config.ts +31 -0
- package/src/honk.ts +35 -0
- package/src/index.ts +10 -0
- package/src/instrumentation.ts +119 -0
- package/src/prover/client/bb_private_kernel_prover.ts +531 -0
- package/src/prover/client/bundle.ts +10 -0
- package/src/prover/client/lazy.ts +10 -0
- package/src/prover/index.ts +2 -0
- package/src/prover/proof_utils.ts +154 -0
- package/src/prover/server/bb_prover.ts +658 -0
- package/src/test/delay_values.ts +41 -0
- package/src/test/index.ts +3 -0
- package/src/test/test_circuit_prover.ts +424 -0
- package/src/test/test_verifier.ts +20 -0
- package/src/verification_key/verification_key_data.ts +24 -0
- package/src/verifier/batch_chonk_verifier.ts +420 -0
- package/src/verifier/bb_verifier.ts +130 -0
- package/src/verifier/index.ts +3 -0
- package/src/verifier/queued_chonk_verifier.ts +108 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// File-naming conventions used by `bb` CLI output directories. Retained for consumers that still
|
|
2
|
+
// read/write proofs to disk alongside bb-prover's in-memory bb.js flows.
|
|
3
|
+
|
|
4
|
+
export const VK_FILENAME = 'vk';
|
|
5
|
+
export const PROOF_FILENAME = 'proof';
|
|
6
|
+
export const PUBLIC_INPUTS_FILENAME = 'public_inputs';
|
package/src/bb/index.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env -S node --no-warnings
|
|
2
|
+
import { createConsoleLogger } from '@aztec-labs/foundation/log';
|
|
3
|
+
import 'source-map-support/register.js';
|
|
4
|
+
|
|
5
|
+
import { getProgram } from './cli.js';
|
|
6
|
+
|
|
7
|
+
const log = createConsoleLogger();
|
|
8
|
+
|
|
9
|
+
/** CLI main entrypoint */
|
|
10
|
+
async function main() {
|
|
11
|
+
process.once('SIGINT', () => process.exit(0));
|
|
12
|
+
process.once('SIGTERM', () => process.exit(0));
|
|
13
|
+
|
|
14
|
+
const program = getProgram(log);
|
|
15
|
+
await program.parseAsync(process.argv);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
main().catch(err => {
|
|
19
|
+
log(`Error in command execution`);
|
|
20
|
+
log(err);
|
|
21
|
+
process.exit(1);
|
|
22
|
+
});
|
package/src/config.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface BBConfig {
|
|
2
|
+
bbBinaryPath: string;
|
|
3
|
+
bbWorkingDirectory: string;
|
|
4
|
+
/** Whether to skip tmp dir cleanup for debugging purposes */
|
|
5
|
+
bbSkipCleanup: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Number of long-lived bb processes pooled by the RPC verifier (BBCircuitVerifier).
|
|
8
|
+
* Also caps concurrent verifications via the wrapping QueuedIVCVerifier.
|
|
9
|
+
*/
|
|
10
|
+
numConcurrentIVCVerifiers: number;
|
|
11
|
+
/** Thread count for the RPC IVC verifier. */
|
|
12
|
+
bbIVCConcurrency: number;
|
|
13
|
+
/**
|
|
14
|
+
* Upper bound on proofs per batch for the peer chonk batch verifier.
|
|
15
|
+
* Proofs are verified immediately as they arrive — this only caps how many
|
|
16
|
+
* can accumulate while a batch is already being processed.
|
|
17
|
+
* Default 16: at 4 cores, a full batch of 16 verifies in ~245ms wall time.
|
|
18
|
+
*/
|
|
19
|
+
bbChonkVerifyMaxBatch: number;
|
|
20
|
+
/** Thread count for the peer batch verifier parallel reduce. Default 6 to leave cores for the rest of the node. */
|
|
21
|
+
bbChonkVerifyConcurrency: number;
|
|
22
|
+
/** When set, bb.js operations write input/output files and log equivalent CLI commands to this directory. */
|
|
23
|
+
bbDebugOutputDir?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface ACVMConfig {
|
|
27
|
+
/** The path to the ACVM binary */
|
|
28
|
+
acvmBinaryPath: string;
|
|
29
|
+
/** The working directory to use for simulation/proving */
|
|
30
|
+
acvmWorkingDirectory: string;
|
|
31
|
+
}
|
package/src/honk.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ServerProtocolArtifact } from '@aztec-labs/noir-protocol-circuits-types/server';
|
|
2
|
+
|
|
3
|
+
export type UltraHonkFlavor = 'ultra_honk' | 'ultra_keccak_honk' | 'ultra_starknet_honk' | 'ultra_rollup_honk';
|
|
4
|
+
|
|
5
|
+
const UltraKeccakHonkCircuits = ['RootRollupArtifact'] as const satisfies ServerProtocolArtifact[];
|
|
6
|
+
const UltraHonkCircuits = [
|
|
7
|
+
'InboxParity64Artifact',
|
|
8
|
+
'InboxParity256Artifact',
|
|
9
|
+
'InboxParity1024Artifact',
|
|
10
|
+
] as const satisfies ServerProtocolArtifact[];
|
|
11
|
+
|
|
12
|
+
export type UltraKeccakHonkServerProtocolArtifact = (typeof UltraKeccakHonkCircuits)[number];
|
|
13
|
+
export type UltraHonkServerProtocolArtifact = (typeof UltraHonkCircuits)[number];
|
|
14
|
+
export type UltraRollupHonkServerProtocolArtifact = Exclude<
|
|
15
|
+
Exclude<ServerProtocolArtifact, UltraKeccakHonkServerProtocolArtifact>,
|
|
16
|
+
UltraHonkServerProtocolArtifact
|
|
17
|
+
>;
|
|
18
|
+
|
|
19
|
+
export function getUltraHonkFlavorForCircuit(artifact: UltraKeccakHonkServerProtocolArtifact): 'ultra_keccak_honk';
|
|
20
|
+
export function getUltraHonkFlavorForCircuit(artifact: UltraHonkServerProtocolArtifact): 'ultra_honk';
|
|
21
|
+
export function getUltraHonkFlavorForCircuit(artifact: UltraRollupHonkServerProtocolArtifact): 'ultra_rollup_honk';
|
|
22
|
+
export function getUltraHonkFlavorForCircuit(artifact: ServerProtocolArtifact): UltraHonkFlavor;
|
|
23
|
+
export function getUltraHonkFlavorForCircuit(artifact: ServerProtocolArtifact): UltraHonkFlavor {
|
|
24
|
+
// STARKNET: how to allow for the distinction between keccak/starknet? ultra_keccak_honk is returned in both cases
|
|
25
|
+
if (isUltraKeccakHonkCircuit(artifact)) {
|
|
26
|
+
return 'ultra_keccak_honk';
|
|
27
|
+
} else if (UltraHonkCircuits.includes(artifact as UltraHonkServerProtocolArtifact)) {
|
|
28
|
+
return 'ultra_honk';
|
|
29
|
+
}
|
|
30
|
+
return 'ultra_rollup_honk';
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function isUltraKeccakHonkCircuit(artifact: ServerProtocolArtifact): artifact is UltraKeccakHonkServerProtocolArtifact {
|
|
34
|
+
return UltraKeccakHonkCircuits.includes(artifact as UltraKeccakHonkServerProtocolArtifact);
|
|
35
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './prover/index.js';
|
|
2
|
+
export * from './test/index.js';
|
|
3
|
+
export * from './verifier/index.js';
|
|
4
|
+
export * from './config.js';
|
|
5
|
+
export * from './bb/file_names.js';
|
|
6
|
+
export * from './bb/bb_js_backend.js';
|
|
7
|
+
export * from './honk.js';
|
|
8
|
+
export * from './verification_key/verification_key_data.js';
|
|
9
|
+
|
|
10
|
+
export { type ClientProtocolCircuitVerifier } from '@aztec-labs/stdlib/interfaces/server';
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import type { Timer } from '@aztec-labs/foundation/timer';
|
|
2
|
+
import type { CircuitName } from '@aztec-labs/stdlib/stats';
|
|
3
|
+
import {
|
|
4
|
+
Attributes,
|
|
5
|
+
type Gauge,
|
|
6
|
+
type Histogram,
|
|
7
|
+
Metrics,
|
|
8
|
+
type TelemetryClient,
|
|
9
|
+
type Tracer,
|
|
10
|
+
} from '@aztec-labs/telemetry-client';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Instrumentation class for Prover implementations.
|
|
14
|
+
*/
|
|
15
|
+
export class ProverInstrumentation {
|
|
16
|
+
private simulationDuration: Histogram;
|
|
17
|
+
private witGenDuration: Histogram;
|
|
18
|
+
private provingDuration: Histogram;
|
|
19
|
+
|
|
20
|
+
private witGenInputSize: Gauge;
|
|
21
|
+
private witGenOutputSize: Gauge;
|
|
22
|
+
|
|
23
|
+
private proofSize: Gauge;
|
|
24
|
+
private circuitSize: Gauge;
|
|
25
|
+
private circuitPublicInputCount: Gauge;
|
|
26
|
+
|
|
27
|
+
public readonly tracer: Tracer;
|
|
28
|
+
|
|
29
|
+
constructor(telemetry: TelemetryClient, name: string) {
|
|
30
|
+
this.tracer = telemetry.getTracer(name);
|
|
31
|
+
const meter = telemetry.getMeter(name);
|
|
32
|
+
|
|
33
|
+
this.simulationDuration = meter.createHistogram(Metrics.CIRCUIT_SIMULATION_DURATION);
|
|
34
|
+
|
|
35
|
+
this.witGenDuration = meter.createHistogram(Metrics.CIRCUIT_WITNESS_GEN_DURATION);
|
|
36
|
+
|
|
37
|
+
this.provingDuration = meter.createHistogram(Metrics.CIRCUIT_PROVING_DURATION);
|
|
38
|
+
|
|
39
|
+
this.witGenInputSize = meter.createGauge(Metrics.CIRCUIT_WITNESS_GEN_INPUT_SIZE);
|
|
40
|
+
|
|
41
|
+
this.witGenOutputSize = meter.createGauge(Metrics.CIRCUIT_WITNESS_GEN_OUTPUT_SIZE);
|
|
42
|
+
|
|
43
|
+
this.proofSize = meter.createGauge(Metrics.CIRCUIT_PROVING_PROOF_SIZE);
|
|
44
|
+
|
|
45
|
+
this.circuitPublicInputCount = meter.createGauge(Metrics.CIRCUIT_PUBLIC_INPUTS_COUNT);
|
|
46
|
+
|
|
47
|
+
this.circuitSize = meter.createGauge(Metrics.CIRCUIT_SIZE);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Records the duration of a circuit operation.
|
|
52
|
+
* @param metric - The metric to record
|
|
53
|
+
* @param circuitName - The name of the circuit
|
|
54
|
+
* @param timerOrMS - The duration
|
|
55
|
+
*/
|
|
56
|
+
recordDuration(
|
|
57
|
+
metric: 'simulationDuration' | 'witGenDuration' | 'provingDuration',
|
|
58
|
+
circuitName: CircuitName,
|
|
59
|
+
timerOrMS: Timer | number,
|
|
60
|
+
) {
|
|
61
|
+
// Simulation duration is stored in ms, while the others are stored in seconds
|
|
62
|
+
if (metric === 'simulationDuration') {
|
|
63
|
+
const ms = typeof timerOrMS === 'number' ? timerOrMS : timerOrMS.ms();
|
|
64
|
+
this[metric].record(Math.trunc(ms), {
|
|
65
|
+
[Attributes.PROTOCOL_CIRCUIT_NAME]: circuitName,
|
|
66
|
+
});
|
|
67
|
+
} else {
|
|
68
|
+
const s = typeof timerOrMS === 'number' ? timerOrMS / 1000 : timerOrMS.s();
|
|
69
|
+
this[metric].record(s, {
|
|
70
|
+
[Attributes.PROTOCOL_CIRCUIT_NAME]: circuitName,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Records the duration of an AVM circuit operation.
|
|
77
|
+
* @param metric - The metric to record
|
|
78
|
+
* @param appCircuitName - The name of the function circuit (should be a `contract:function` string)
|
|
79
|
+
* @param timerOrMS - The duration
|
|
80
|
+
*/
|
|
81
|
+
recordAvmDuration(metric: 'witGenDuration' | 'provingDuration', appCircuitName: string, timerOrMS: Timer | number) {
|
|
82
|
+
const s = typeof timerOrMS === 'number' ? timerOrMS / 1000 : timerOrMS.s();
|
|
83
|
+
this[metric].record(s, {
|
|
84
|
+
[Attributes.APP_CIRCUIT_NAME]: appCircuitName,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Records the size of a circuit operation.
|
|
90
|
+
* @param metric - Records the size of a circuit operation.
|
|
91
|
+
* @param circuitName - The name of the circuit
|
|
92
|
+
* @param size - The size
|
|
93
|
+
*/
|
|
94
|
+
recordSize(
|
|
95
|
+
metric: 'witGenInputSize' | 'witGenOutputSize' | 'proofSize' | 'circuitSize' | 'circuitPublicInputCount',
|
|
96
|
+
circuitName: CircuitName,
|
|
97
|
+
size: number,
|
|
98
|
+
) {
|
|
99
|
+
this[metric].record(Math.ceil(size), {
|
|
100
|
+
[Attributes.PROTOCOL_CIRCUIT_NAME]: circuitName,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Records the size of an AVM circuit operation.
|
|
106
|
+
* @param metric - The metric to record
|
|
107
|
+
* @param appCircuitName - The name of the function circuit (should be a `contract:function` string)
|
|
108
|
+
* @param size - The size
|
|
109
|
+
*/
|
|
110
|
+
recordAvmSize(
|
|
111
|
+
metric: 'witGenInputSize' | 'witGenOutputSize' | 'proofSize' | 'circuitSize' | 'circuitPublicInputCount',
|
|
112
|
+
appCircuitName: string,
|
|
113
|
+
size: number,
|
|
114
|
+
) {
|
|
115
|
+
this[metric].record(Math.ceil(size), {
|
|
116
|
+
[Attributes.APP_CIRCUIT_NAME]: appCircuitName,
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
}
|