@aztec/bb-prover 3.0.3 → 4.0.0-devnet.1-patch.0
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 +1 -1
- package/dest/avm_proving_tests/avm_proving_tester.d.ts.map +1 -1
- package/dest/avm_proving_tests/avm_proving_tester.js +5 -2
- package/dest/bb/execute.d.ts +6 -6
- package/dest/bb/execute.d.ts.map +1 -1
- package/dest/bb/execute.js +46 -75
- package/dest/instrumentation.d.ts +1 -1
- package/dest/instrumentation.d.ts.map +1 -1
- package/dest/instrumentation.js +9 -39
- package/dest/prover/client/bb_private_kernel_prover.d.ts +9 -3
- package/dest/prover/client/bb_private_kernel_prover.d.ts.map +1 -1
- package/dest/prover/client/bb_private_kernel_prover.js +16 -4
- package/dest/prover/client/bundle.d.ts +3 -3
- package/dest/prover/client/bundle.d.ts.map +1 -1
- package/dest/prover/client/bundle.js +2 -3
- package/dest/prover/client/lazy.d.ts +3 -3
- package/dest/prover/client/lazy.d.ts.map +1 -1
- package/dest/prover/client/lazy.js +2 -3
- package/dest/prover/server/bb_prover.d.ts +6 -9
- package/dest/prover/server/bb_prover.d.ts.map +1 -1
- package/dest/prover/server/bb_prover.js +415 -42
- 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 +27 -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 +4 -4
- package/dest/test/test_circuit_prover.d.ts.map +1 -1
- package/dest/test/test_circuit_prover.js +462 -59
- package/dest/verification_key/verification_key_data.d.ts +1 -8
- package/dest/verification_key/verification_key_data.d.ts.map +1 -1
- package/dest/verification_key/verification_key_data.js +0 -19
- package/dest/verifier/bb_verifier.d.ts +1 -1
- package/dest/verifier/bb_verifier.d.ts.map +1 -1
- package/dest/verifier/bb_verifier.js +1 -4
- package/dest/verifier/queued_chonk_verifier.d.ts +1 -1
- package/dest/verifier/queued_chonk_verifier.d.ts.map +1 -1
- package/dest/verifier/queued_chonk_verifier.js +9 -40
- package/package.json +17 -17
- package/src/avm_proving_tests/avm_proving_tester.ts +6 -16
- package/src/bb/execute.ts +31 -59
- package/src/instrumentation.ts +8 -39
- package/src/prover/client/bb_private_kernel_prover.ts +20 -6
- package/src/prover/client/bundle.ts +3 -4
- package/src/prover/client/lazy.ts +3 -4
- package/src/prover/server/bb_prover.ts +22 -37
- package/src/test/delay_values.ts +28 -24
- package/src/test/index.ts +1 -0
- package/src/test/test_circuit_prover.ts +10 -13
- package/src/verification_key/verification_key_data.ts +0 -25
- package/src/verifier/bb_verifier.ts +1 -5
- package/src/verifier/queued_chonk_verifier.ts +9 -40
package/src/test/delay_values.ts
CHANGED
|
@@ -1,43 +1,47 @@
|
|
|
1
1
|
import { ProvingRequestType } from '@aztec/stdlib/proofs';
|
|
2
2
|
|
|
3
3
|
export const WITGEN_DELAY_MS: Record<ProvingRequestType, number> = {
|
|
4
|
-
[ProvingRequestType.
|
|
5
|
-
[ProvingRequestType.
|
|
4
|
+
[ProvingRequestType.PUBLIC_CHONK_VERIFIER]: 60,
|
|
5
|
+
[ProvingRequestType.PARITY_BASE]: 1_600,
|
|
6
|
+
[ProvingRequestType.PARITY_ROOT]: 40,
|
|
6
7
|
[ProvingRequestType.BLOCK_ROOT_FIRST_ROLLUP]: 45,
|
|
7
|
-
[ProvingRequestType.BLOCK_ROOT_SINGLE_TX_FIRST_ROLLUP]: 27,
|
|
8
8
|
[ProvingRequestType.BLOCK_ROOT_EMPTY_TX_FIRST_ROLLUP]: 18,
|
|
9
|
+
[ProvingRequestType.BLOCK_ROOT_SINGLE_TX_FIRST_ROLLUP]: 27,
|
|
10
|
+
[ProvingRequestType.CHECKPOINT_MERGE_ROLLUP]: 30,
|
|
11
|
+
[ProvingRequestType.CHECKPOINT_ROOT_SINGLE_BLOCK_ROLLUP]: 36_000,
|
|
12
|
+
[ProvingRequestType.ROOT_ROLLUP]: 35,
|
|
13
|
+
[ProvingRequestType.PUBLIC_TX_BASE_ROLLUP]: 2_500,
|
|
14
|
+
[ProvingRequestType.TX_MERGE_ROLLUP]: 25,
|
|
15
|
+
[ProvingRequestType.PUBLIC_VM]: 0,
|
|
16
|
+
|
|
17
|
+
// TBD
|
|
18
|
+
[ProvingRequestType.BLOCK_MERGE_ROLLUP]: 30,
|
|
9
19
|
[ProvingRequestType.BLOCK_ROOT_ROLLUP]: 40_000,
|
|
10
20
|
[ProvingRequestType.BLOCK_ROOT_SINGLE_TX_ROLLUP]: 20_000,
|
|
11
21
|
[ProvingRequestType.CHECKPOINT_ROOT_ROLLUP]: 40_000,
|
|
12
|
-
[ProvingRequestType.CHECKPOINT_ROOT_SINGLE_BLOCK_ROLLUP]: 36_600,
|
|
13
22
|
[ProvingRequestType.CHECKPOINT_PADDING_ROLLUP]: 0,
|
|
14
|
-
[ProvingRequestType.CHECKPOINT_MERGE_ROLLUP]: 30,
|
|
15
|
-
[ProvingRequestType.TX_MERGE_ROLLUP]: 0,
|
|
16
23
|
[ProvingRequestType.PRIVATE_TX_BASE_ROLLUP]: 2_500, // Guess based on public
|
|
17
|
-
[ProvingRequestType.PUBLIC_TX_BASE_ROLLUP]: 2_500,
|
|
18
|
-
[ProvingRequestType.PARITY_ROOT]: 40,
|
|
19
|
-
[ProvingRequestType.ROOT_ROLLUP]: 35,
|
|
20
|
-
[ProvingRequestType.PUBLIC_CHONK_VERIFIER]: 60,
|
|
21
|
-
[ProvingRequestType.PUBLIC_VM]: 0,
|
|
22
24
|
};
|
|
23
25
|
|
|
24
26
|
export const PROOF_DELAY_MS: Record<ProvingRequestType, number> = {
|
|
25
|
-
[ProvingRequestType.
|
|
27
|
+
[ProvingRequestType.PUBLIC_CHONK_VERIFIER]: 16_300,
|
|
28
|
+
[ProvingRequestType.PARITY_BASE]: 15_300,
|
|
29
|
+
[ProvingRequestType.PARITY_ROOT]: 18_600,
|
|
30
|
+
[ProvingRequestType.BLOCK_ROOT_FIRST_ROLLUP]: 17_400,
|
|
31
|
+
[ProvingRequestType.BLOCK_ROOT_EMPTY_TX_FIRST_ROLLUP]: 4_500,
|
|
32
|
+
[ProvingRequestType.BLOCK_ROOT_SINGLE_TX_FIRST_ROLLUP]: 9_200,
|
|
33
|
+
[ProvingRequestType.CHECKPOINT_MERGE_ROLLUP]: 10_200,
|
|
34
|
+
[ProvingRequestType.CHECKPOINT_ROOT_SINGLE_BLOCK_ROLLUP]: 37_100,
|
|
35
|
+
[ProvingRequestType.ROOT_ROLLUP]: 93_000,
|
|
36
|
+
[ProvingRequestType.TX_MERGE_ROLLUP]: 10_000,
|
|
37
|
+
[ProvingRequestType.PUBLIC_TX_BASE_ROLLUP]: 44_500,
|
|
38
|
+
[ProvingRequestType.PUBLIC_VM]: 180_000,
|
|
39
|
+
|
|
40
|
+
// TBD
|
|
26
41
|
[ProvingRequestType.BLOCK_MERGE_ROLLUP]: 15_000,
|
|
27
|
-
[ProvingRequestType.BLOCK_ROOT_FIRST_ROLLUP]: 16_500,
|
|
28
|
-
[ProvingRequestType.BLOCK_ROOT_SINGLE_TX_FIRST_ROLLUP]: 9_210,
|
|
29
|
-
[ProvingRequestType.BLOCK_ROOT_EMPTY_TX_FIRST_ROLLUP]: 4_560,
|
|
30
42
|
[ProvingRequestType.BLOCK_ROOT_ROLLUP]: 35_000,
|
|
31
43
|
[ProvingRequestType.BLOCK_ROOT_SINGLE_TX_ROLLUP]: 15_000,
|
|
32
44
|
[ProvingRequestType.CHECKPOINT_ROOT_ROLLUP]: 35_000,
|
|
33
|
-
[ProvingRequestType.CHECKPOINT_ROOT_SINGLE_BLOCK_ROLLUP]: 38_800,
|
|
34
45
|
[ProvingRequestType.CHECKPOINT_PADDING_ROLLUP]: 0,
|
|
35
|
-
[ProvingRequestType.
|
|
36
|
-
[ProvingRequestType.TX_MERGE_ROLLUP]: 0,
|
|
37
|
-
[ProvingRequestType.PRIVATE_TX_BASE_ROLLUP]: 45_000, // Guess based on public
|
|
38
|
-
[ProvingRequestType.PUBLIC_TX_BASE_ROLLUP]: 45_000,
|
|
39
|
-
[ProvingRequestType.PARITY_ROOT]: 18_600,
|
|
40
|
-
[ProvingRequestType.ROOT_ROLLUP]: 84_000,
|
|
41
|
-
[ProvingRequestType.PUBLIC_CHONK_VERIFIER]: 16_300,
|
|
42
|
-
[ProvingRequestType.PUBLIC_VM]: 0,
|
|
46
|
+
[ProvingRequestType.PRIVATE_TX_BASE_ROLLUP]: 22_000,
|
|
43
47
|
};
|
package/src/test/index.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED,
|
|
3
|
-
AVM_V2_VERIFICATION_KEY_LENGTH_IN_FIELDS_PADDED,
|
|
4
3
|
NESTED_RECURSIVE_PROOF_LENGTH,
|
|
5
4
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
6
5
|
RECURSIVE_PROOF_LENGTH,
|
|
@@ -51,14 +50,18 @@ import type { WitnessMap } from '@aztec/noir-types';
|
|
|
51
50
|
import { type CircuitSimulator, WASMSimulatorWithBlobs, emitCircuitSimulationStats } from '@aztec/simulator/server';
|
|
52
51
|
import type { AvmCircuitInputs } from '@aztec/stdlib/avm';
|
|
53
52
|
import {
|
|
54
|
-
type ProofAndVerificationKey,
|
|
55
53
|
type PublicInputsAndRecursiveProof,
|
|
56
54
|
type ServerCircuitProver,
|
|
57
|
-
makeProofAndVerificationKey,
|
|
58
55
|
makePublicInputsAndRecursiveProof,
|
|
59
56
|
} from '@aztec/stdlib/interfaces/server';
|
|
60
57
|
import type { ParityBasePrivateInputs, ParityPublicInputs, ParityRootPrivateInputs } from '@aztec/stdlib/parity';
|
|
61
|
-
import {
|
|
58
|
+
import {
|
|
59
|
+
type Proof,
|
|
60
|
+
ProvingRequestType,
|
|
61
|
+
RecursiveProof,
|
|
62
|
+
makeEmptyRecursiveProof,
|
|
63
|
+
makeRecursiveProof,
|
|
64
|
+
} from '@aztec/stdlib/proofs';
|
|
62
65
|
import {
|
|
63
66
|
type BlockMergeRollupPrivateInputs,
|
|
64
67
|
type BlockRollupPublicInputs,
|
|
@@ -81,7 +84,6 @@ import {
|
|
|
81
84
|
type TxMergeRollupPrivateInputs,
|
|
82
85
|
type TxRollupPublicInputs,
|
|
83
86
|
} from '@aztec/stdlib/rollup';
|
|
84
|
-
import { VerificationKeyData } from '@aztec/stdlib/vks';
|
|
85
87
|
import { type TelemetryClient, getTelemetryClient, trackSpan } from '@aztec/telemetry-client';
|
|
86
88
|
|
|
87
89
|
import { ProverInstrumentation } from '../instrumentation.js';
|
|
@@ -400,17 +402,12 @@ export class TestCircuitProver implements ServerCircuitProver {
|
|
|
400
402
|
);
|
|
401
403
|
}
|
|
402
404
|
|
|
403
|
-
public getAvmProof(
|
|
404
|
-
_inputs: AvmCircuitInputs,
|
|
405
|
-
): Promise<ProofAndVerificationKey<typeof AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED>> {
|
|
405
|
+
public getAvmProof(_inputs: AvmCircuitInputs): Promise<RecursiveProof<typeof AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED>> {
|
|
406
406
|
// We can't simulate the AVM because we don't have enough context to do so (e.g., DBs).
|
|
407
|
-
// We just return an empty proof
|
|
407
|
+
// We just return an empty proof.
|
|
408
408
|
this.logger.debug('Skipping AVM simulation in TestCircuitProver.');
|
|
409
409
|
return this.applyDelay(ProvingRequestType.PUBLIC_VM, () =>
|
|
410
|
-
|
|
411
|
-
makeEmptyRecursiveProof(AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED),
|
|
412
|
-
VerificationKeyData.makeFake(AVM_V2_VERIFICATION_KEY_LENGTH_IN_FIELDS_PADDED),
|
|
413
|
-
),
|
|
410
|
+
makeEmptyRecursiveProof(AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED),
|
|
414
411
|
);
|
|
415
412
|
}
|
|
416
413
|
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { AVM_V2_VERIFICATION_KEY_LENGTH_IN_FIELDS_PADDED } from '@aztec/constants';
|
|
2
1
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
2
|
import { BufferReader } from '@aztec/foundation/serialize';
|
|
4
3
|
import { VerificationKeyAsFields, VerificationKeyData } from '@aztec/stdlib/vks';
|
|
5
4
|
|
|
6
|
-
import { strict as assert } from 'assert';
|
|
7
5
|
import { promises as fs } from 'fs';
|
|
8
6
|
import * as path from 'path';
|
|
9
7
|
|
|
@@ -25,26 +23,3 @@ export async function extractVkData(vkDirectoryPath: string): Promise<Verificati
|
|
|
25
23
|
const vkAsFields = await VerificationKeyAsFields.fromKey(fields);
|
|
26
24
|
return new VerificationKeyData(vkAsFields, rawBinary);
|
|
27
25
|
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Reads the verification key data stored in a binary file at the specified directory location and parses into a VerificationKeyData.
|
|
31
|
-
* We do not assume any JSON file available but only the binary version, contrary to the above extractVkData() method.
|
|
32
|
-
* @param vkDirectoryPath - The directory containing the verification key binary data file.
|
|
33
|
-
* @returns The verification key data
|
|
34
|
-
*/
|
|
35
|
-
export async function extractAvmVkData(vkDirectoryPath: string): Promise<VerificationKeyData> {
|
|
36
|
-
const rawBinary = await fs.readFile(path.join(vkDirectoryPath, VK_FILENAME));
|
|
37
|
-
|
|
38
|
-
const numFields = rawBinary.length / Fr.SIZE_IN_BYTES;
|
|
39
|
-
assert(numFields <= AVM_V2_VERIFICATION_KEY_LENGTH_IN_FIELDS_PADDED, 'Invalid AVM verification key length');
|
|
40
|
-
const reader = BufferReader.asReader(rawBinary);
|
|
41
|
-
const fieldsArray = reader.readArray(numFields, Fr);
|
|
42
|
-
|
|
43
|
-
const fieldsArrayPadded = fieldsArray.concat(
|
|
44
|
-
Array(AVM_V2_VERIFICATION_KEY_LENGTH_IN_FIELDS_PADDED - fieldsArray.length).fill(new Fr(0)),
|
|
45
|
-
);
|
|
46
|
-
const vkAsFields = await VerificationKeyAsFields.fromKey(fieldsArrayPadded);
|
|
47
|
-
// TODO(#16644): We should have a different type for AVM verification keys since we don't have circuit size or num public inputs in AVM VKs.
|
|
48
|
-
const vk = new VerificationKeyData(vkAsFields, rawBinary);
|
|
49
|
-
return vk;
|
|
50
|
-
}
|
|
@@ -102,10 +102,6 @@ export class BBCircuitVerifier implements ClientProtocolCircuitVerifier {
|
|
|
102
102
|
|
|
103
103
|
// Block below is almost copy-pasted from verifyProofForCircuit
|
|
104
104
|
const operation = async (bbWorkingDirectory: string) => {
|
|
105
|
-
const logFunction = (message: string) => {
|
|
106
|
-
this.logger.debug(`${proofType} BB out - ${message}`);
|
|
107
|
-
};
|
|
108
|
-
|
|
109
105
|
const proofPath = path.join(bbWorkingDirectory, PROOF_FILENAME);
|
|
110
106
|
await writeChonkProofToPath(tx.chonkProof.attachPublicInputs(tx.data.publicInputs().toFields()), proofPath);
|
|
111
107
|
|
|
@@ -118,7 +114,7 @@ export class BBCircuitVerifier implements ClientProtocolCircuitVerifier {
|
|
|
118
114
|
this.config.bbBinaryPath,
|
|
119
115
|
proofPath,
|
|
120
116
|
verificationKeyPath,
|
|
121
|
-
|
|
117
|
+
this.logger,
|
|
122
118
|
this.config.bbIVCConcurrency,
|
|
123
119
|
);
|
|
124
120
|
verificationDuration = timer.ms();
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
type ObservableGauge,
|
|
11
11
|
type TelemetryClient,
|
|
12
12
|
type UpDownCounter,
|
|
13
|
-
|
|
13
|
+
createUpDownCounterWithDefault,
|
|
14
14
|
getTelemetryClient,
|
|
15
15
|
} from '@aztec/telemetry-client';
|
|
16
16
|
|
|
@@ -36,49 +36,18 @@ class IVCVerifierMetrics {
|
|
|
36
36
|
constructor(client: TelemetryClient, name = 'QueuedIVCVerifier') {
|
|
37
37
|
const meter = client.getMeter(name);
|
|
38
38
|
|
|
39
|
-
this.ivcVerificationHistogram = meter.createHistogram(Metrics.IVC_VERIFIER_TIME
|
|
40
|
-
unit: 'ms',
|
|
41
|
-
description: 'Duration to verify chonk proofs',
|
|
42
|
-
valueType: ValueType.INT,
|
|
43
|
-
});
|
|
39
|
+
this.ivcVerificationHistogram = meter.createHistogram(Metrics.IVC_VERIFIER_TIME);
|
|
44
40
|
|
|
45
|
-
this.ivcTotalVerificationHistogram = meter.createHistogram(Metrics.IVC_VERIFIER_TOTAL_TIME
|
|
46
|
-
unit: 'ms',
|
|
47
|
-
description: 'Total duration to verify chonk proofs, including serde',
|
|
48
|
-
valueType: ValueType.INT,
|
|
49
|
-
});
|
|
41
|
+
this.ivcTotalVerificationHistogram = meter.createHistogram(Metrics.IVC_VERIFIER_TOTAL_TIME);
|
|
50
42
|
|
|
51
|
-
this.ivcFailureCount = meter
|
|
52
|
-
description: 'Count of failed IVC proof verifications',
|
|
53
|
-
valueType: ValueType.INT,
|
|
54
|
-
});
|
|
43
|
+
this.ivcFailureCount = createUpDownCounterWithDefault(meter, Metrics.IVC_VERIFIER_FAILURE_COUNT);
|
|
55
44
|
|
|
56
45
|
this.aggDurationMetrics = {
|
|
57
|
-
avg: meter.createObservableGauge(Metrics.IVC_VERIFIER_AGG_DURATION_AVG,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
max: meter.createObservableGauge(Metrics.IVC_VERIFIER_AGG_DURATION_MAX, {
|
|
63
|
-
valueType: ValueType.DOUBLE,
|
|
64
|
-
description: 'MAX ivc verification',
|
|
65
|
-
unit: 'ms',
|
|
66
|
-
}),
|
|
67
|
-
min: meter.createObservableGauge(Metrics.IVC_VERIFIER_AGG_DURATION_MIN, {
|
|
68
|
-
valueType: ValueType.DOUBLE,
|
|
69
|
-
description: 'MIN ivc verification',
|
|
70
|
-
unit: 'ms',
|
|
71
|
-
}),
|
|
72
|
-
p50: meter.createObservableGauge(Metrics.IVC_VERIFIER_AGG_DURATION_P50, {
|
|
73
|
-
valueType: ValueType.DOUBLE,
|
|
74
|
-
description: 'P50 ivc verification',
|
|
75
|
-
unit: 'ms',
|
|
76
|
-
}),
|
|
77
|
-
p90: meter.createObservableGauge(Metrics.IVC_VERIFIER_AGG_DURATION_P90, {
|
|
78
|
-
valueType: ValueType.DOUBLE,
|
|
79
|
-
description: 'P90 ivc verification',
|
|
80
|
-
unit: 'ms',
|
|
81
|
-
}),
|
|
46
|
+
avg: meter.createObservableGauge(Metrics.IVC_VERIFIER_AGG_DURATION_AVG),
|
|
47
|
+
max: meter.createObservableGauge(Metrics.IVC_VERIFIER_AGG_DURATION_MAX),
|
|
48
|
+
min: meter.createObservableGauge(Metrics.IVC_VERIFIER_AGG_DURATION_MIN),
|
|
49
|
+
p50: meter.createObservableGauge(Metrics.IVC_VERIFIER_AGG_DURATION_P50),
|
|
50
|
+
p90: meter.createObservableGauge(Metrics.IVC_VERIFIER_AGG_DURATION_P90),
|
|
82
51
|
};
|
|
83
52
|
|
|
84
53
|
meter.addBatchObservableCallback(this.aggregate, Object.values(this.aggDurationMetrics));
|