@aztec/bb-prover 0.0.1-commit.fce3e4f → 0.0.1-commit.ff7989d6c

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.
Files changed (55) hide show
  1. package/dest/avm_proving_tests/avm_proving_tester.d.ts +1 -1
  2. package/dest/avm_proving_tests/avm_proving_tester.d.ts.map +1 -1
  3. package/dest/avm_proving_tests/avm_proving_tester.js +20 -4
  4. package/dest/bb/execute.d.ts +6 -6
  5. package/dest/bb/execute.d.ts.map +1 -1
  6. package/dest/bb/execute.js +47 -76
  7. package/dest/instrumentation.d.ts +1 -1
  8. package/dest/instrumentation.d.ts.map +1 -1
  9. package/dest/instrumentation.js +21 -43
  10. package/dest/prover/client/bb_private_kernel_prover.d.ts +9 -3
  11. package/dest/prover/client/bb_private_kernel_prover.d.ts.map +1 -1
  12. package/dest/prover/client/bb_private_kernel_prover.js +16 -4
  13. package/dest/prover/client/bundle.d.ts +3 -3
  14. package/dest/prover/client/bundle.d.ts.map +1 -1
  15. package/dest/prover/client/bundle.js +2 -3
  16. package/dest/prover/client/lazy.d.ts +3 -3
  17. package/dest/prover/client/lazy.d.ts.map +1 -1
  18. package/dest/prover/client/lazy.js +2 -3
  19. package/dest/prover/proof_utils.js +1 -1
  20. package/dest/prover/server/bb_prover.d.ts +6 -9
  21. package/dest/prover/server/bb_prover.d.ts.map +1 -1
  22. package/dest/prover/server/bb_prover.js +416 -43
  23. package/dest/test/delay_values.d.ts +1 -1
  24. package/dest/test/delay_values.d.ts.map +1 -1
  25. package/dest/test/delay_values.js +28 -26
  26. package/dest/test/index.d.ts +2 -1
  27. package/dest/test/index.d.ts.map +1 -1
  28. package/dest/test/index.js +1 -0
  29. package/dest/test/test_circuit_prover.d.ts +4 -4
  30. package/dest/test/test_circuit_prover.d.ts.map +1 -1
  31. package/dest/test/test_circuit_prover.js +462 -59
  32. package/dest/verification_key/verification_key_data.d.ts +1 -8
  33. package/dest/verification_key/verification_key_data.d.ts.map +1 -1
  34. package/dest/verification_key/verification_key_data.js +1 -20
  35. package/dest/verifier/bb_verifier.d.ts +1 -1
  36. package/dest/verifier/bb_verifier.d.ts.map +1 -1
  37. package/dest/verifier/bb_verifier.js +1 -4
  38. package/dest/verifier/queued_chonk_verifier.d.ts +1 -1
  39. package/dest/verifier/queued_chonk_verifier.d.ts.map +1 -1
  40. package/dest/verifier/queued_chonk_verifier.js +9 -40
  41. package/package.json +19 -19
  42. package/src/avm_proving_tests/avm_proving_tester.ts +23 -19
  43. package/src/bb/execute.ts +32 -60
  44. package/src/instrumentation.ts +20 -43
  45. package/src/prover/client/bb_private_kernel_prover.ts +20 -6
  46. package/src/prover/client/bundle.ts +3 -4
  47. package/src/prover/client/lazy.ts +3 -4
  48. package/src/prover/proof_utils.ts +1 -1
  49. package/src/prover/server/bb_prover.ts +23 -38
  50. package/src/test/delay_values.ts +30 -26
  51. package/src/test/index.ts +1 -0
  52. package/src/test/test_circuit_prover.ts +10 -13
  53. package/src/verification_key/verification_key_data.ts +1 -26
  54. package/src/verifier/bb_verifier.ts +1 -5
  55. package/src/verifier/queued_chonk_verifier.ts +9 -40
@@ -6,7 +6,7 @@ import {
6
6
  RECURSIVE_PROOF_LENGTH,
7
7
  ULTRA_KECCAK_PROOF_LENGTH,
8
8
  } from '@aztec/constants';
9
- import { Fr } from '@aztec/foundation/fields';
9
+ import { Fr } from '@aztec/foundation/curves/bn254';
10
10
  import { runInDirectory } from '@aztec/foundation/fs';
11
11
  import { createLogger } from '@aztec/foundation/log';
12
12
  import { BufferReader } from '@aztec/foundation/serialize';
@@ -55,10 +55,8 @@ import { NativeACVMSimulator } from '@aztec/simulator/server';
55
55
  import type { AvmCircuitInputs, AvmCircuitPublicInputs } from '@aztec/stdlib/avm';
56
56
  import { ProvingError } from '@aztec/stdlib/errors';
57
57
  import {
58
- type ProofAndVerificationKey,
59
58
  type PublicInputsAndRecursiveProof,
60
59
  type ServerCircuitProver,
61
- makeProofAndVerificationKey,
62
60
  makePublicInputsAndRecursiveProof,
63
61
  } from '@aztec/stdlib/interfaces/server';
64
62
  import type { ParityBasePrivateInputs, ParityPublicInputs, ParityRootPrivateInputs } from '@aztec/stdlib/parity';
@@ -84,10 +82,9 @@ import {
84
82
  type RootRollupPublicInputs,
85
83
  type TxMergeRollupPrivateInputs,
86
84
  type TxRollupPublicInputs,
87
- enhanceProofWithPiValidationFlag,
88
85
  } from '@aztec/stdlib/rollup';
89
86
  import type { CircuitProvingStats, CircuitWitnessGenerationStats } from '@aztec/stdlib/stats';
90
- import type { VerificationKeyData } from '@aztec/stdlib/vks';
87
+ import { VerificationKeyData } from '@aztec/stdlib/vks';
91
88
  import { Attributes, type TelemetryClient, getTelemetryClient, trackSpan } from '@aztec/telemetry-client';
92
89
 
93
90
  import { promises as fs } from 'fs';
@@ -106,9 +103,8 @@ import {
106
103
  verifyProof,
107
104
  } from '../../bb/execute.js';
108
105
  import type { ACVMConfig, BBConfig } from '../../config.js';
109
- import { type UltraHonkFlavor, getUltraHonkFlavorForCircuit } from '../../honk.js';
106
+ import { getUltraHonkFlavorForCircuit } from '../../honk.js';
110
107
  import { ProverInstrumentation } from '../../instrumentation.js';
111
- import { extractAvmVkData } from '../../verification_key/verification_key_data.js';
112
108
  import { readProofsFromOutputDirectory } from '../proof_utils.js';
113
109
 
114
110
  const logger = createLogger('bb-prover');
@@ -192,14 +188,10 @@ export class BBNativeRollupProver implements ServerCircuitProver {
192
188
  }))
193
189
  public async getAvmProof(
194
190
  inputs: AvmCircuitInputs,
195
- skipPublicInputsValidation: boolean = false,
196
- ): Promise<ProofAndVerificationKey<typeof AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED>> {
197
- const proofAndVk = await this.createAvmProof(inputs);
198
- await this.verifyAvmProof(proofAndVk.proof.binaryProof, proofAndVk.verificationKey, inputs.publicInputs);
199
-
200
- // TODO(#14234)[Unconditional PIs validation]: remove next lines and directly return proofAndVk
201
- proofAndVk.proof.proof = enhanceProofWithPiValidationFlag(proofAndVk.proof.proof, skipPublicInputsValidation);
202
- return proofAndVk;
191
+ ): Promise<RecursiveProof<typeof AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED>> {
192
+ const proof = await this.createAvmProof(inputs);
193
+ await this.verifyAvmProof(proof.binaryProof, inputs.publicInputs);
194
+ return proof;
203
195
  }
204
196
 
205
197
  public async getPublicChonkVerifierProof(
@@ -471,6 +463,7 @@ export class BBNativeRollupProver implements ServerCircuitProver {
471
463
  this.config.acvmWorkingDirectory,
472
464
  this.config.acvmBinaryPath,
473
465
  outputWitnessFile,
466
+ logger,
474
467
  );
475
468
 
476
469
  const artifact = getServerCircuitArtifact(circuitType);
@@ -535,11 +528,10 @@ export class BBNativeRollupProver implements ServerCircuitProver {
535
528
 
536
529
  private async createAvmProof(
537
530
  input: AvmCircuitInputs,
538
- ): Promise<ProofAndVerificationKey<typeof AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED>> {
531
+ ): Promise<RecursiveProof<typeof AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED>> {
539
532
  const operation = async (bbWorkingDirectory: string) => {
540
533
  const provingResult = await this.generateAvmProofWithBB(input, bbWorkingDirectory);
541
534
 
542
- const avmVK = await extractAvmVkData(provingResult.vkDirectoryPath!);
543
535
  const avmProof = await this.readAvmProofAsFields(provingResult.proofPath!);
544
536
 
545
537
  const circuitType = 'avm-circuit' as const;
@@ -562,7 +554,7 @@ export class BBNativeRollupProver implements ServerCircuitProver {
562
554
  } satisfies CircuitProvingStats,
563
555
  );
564
556
 
565
- return makeProofAndVerificationKey(avmProof, avmVK);
557
+ return avmProof;
566
558
  };
567
559
  return await this.runInDirectory(operation);
568
560
  }
@@ -636,28 +628,19 @@ export class BBNativeRollupProver implements ServerCircuitProver {
636
628
  */
637
629
  public async verifyProof(circuitType: ServerProtocolArtifact, proof: Proof) {
638
630
  const verificationKey = this.getVerificationKeyDataForCircuit(circuitType);
639
- return await this.verifyWithKey(getUltraHonkFlavorForCircuit(circuitType), verificationKey, proof);
640
- }
641
-
642
- public async verifyAvmProof(
643
- proof: Proof,
644
- verificationKey: VerificationKeyData,
645
- publicInputs: AvmCircuitPublicInputs,
646
- ) {
647
- return await this.verifyWithKeyInternal(proof, verificationKey, (proofPath, vkPath) =>
648
- verifyAvmProof(this.config.bbBinaryPath, this.config.bbWorkingDirectory, proofPath, publicInputs, vkPath, logger),
631
+ return await this.verifyInternal(proof, verificationKey, (proofPath, vkPath) =>
632
+ verifyProof(this.config.bbBinaryPath, proofPath, vkPath, getUltraHonkFlavorForCircuit(circuitType), logger),
649
633
  );
650
634
  }
651
635
 
652
- public async verifyWithKey(flavor: UltraHonkFlavor, verificationKey: VerificationKeyData, proof: Proof) {
653
- return await this.verifyWithKeyInternal(proof, verificationKey, (proofPath, vkPath) =>
654
- verifyProof(this.config.bbBinaryPath, proofPath, vkPath, flavor, logger),
636
+ public async verifyAvmProof(proof: Proof, publicInputs: AvmCircuitPublicInputs) {
637
+ return await this.verifyInternal(proof, /*verificationKey=*/ undefined, (proofPath, /*unused*/ _vkPath) =>
638
+ verifyAvmProof(this.config.bbBinaryPath, this.config.bbWorkingDirectory, proofPath, publicInputs, logger),
655
639
  );
656
640
  }
657
-
658
- private async verifyWithKeyInternal(
641
+ private async verifyInternal(
659
642
  proof: Proof,
660
- verificationKey: { keyAsBytes: Buffer },
643
+ verificationKey: { keyAsBytes: Buffer } | undefined,
661
644
  verificationFunction: (proofPath: string, vkPath: string) => Promise<BBFailure | BBSuccess>,
662
645
  ) {
663
646
  const operation = async (bbWorkingDirectory: string) => {
@@ -665,11 +648,13 @@ export class BBNativeRollupProver implements ServerCircuitProver {
665
648
  const proofFileName = path.join(bbWorkingDirectory, PROOF_FILENAME);
666
649
  const verificationKeyPath = path.join(bbWorkingDirectory, VK_FILENAME);
667
650
  // TODO(https://github.com/AztecProtocol/aztec-packages/issues/13189): Put this proof parsing logic in the proof class.
668
- await fs.writeFile(publicInputsFileName, proof.buffer.slice(0, proof.numPublicInputs * 32));
669
- await fs.writeFile(proofFileName, proof.buffer.slice(proof.numPublicInputs * 32));
670
- await fs.writeFile(verificationKeyPath, verificationKey.keyAsBytes);
651
+ await fs.writeFile(publicInputsFileName, proof.buffer.subarray(0, proof.numPublicInputs * 32));
652
+ await fs.writeFile(proofFileName, proof.buffer.subarray(proof.numPublicInputs * 32));
653
+ if (verificationKey !== undefined) {
654
+ await fs.writeFile(verificationKeyPath, verificationKey.keyAsBytes);
655
+ }
671
656
 
672
- const result = await verificationFunction(proofFileName, verificationKeyPath!);
657
+ const result = await verificationFunction(proofFileName, verificationKeyPath);
673
658
 
674
659
  if (result.status === BB_RESULT.FAILURE) {
675
660
  const errorMessage = `Failed to verify proof from key!`;
@@ -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.PARITY_BASE]: 2000,
5
- [ProvingRequestType.BLOCK_MERGE_ROLLUP]: 30,
6
- [ProvingRequestType.BLOCK_ROOT_FIRST_ROLLUP]: 60_000,
7
- [ProvingRequestType.BLOCK_ROOT_SINGLE_TX_FIRST_ROLLUP]: 40_000,
4
+ [ProvingRequestType.PUBLIC_CHONK_VERIFIER]: 60,
5
+ [ProvingRequestType.PARITY_BASE]: 1_600,
6
+ [ProvingRequestType.PARITY_ROOT]: 40,
7
+ [ProvingRequestType.BLOCK_ROOT_FIRST_ROLLUP]: 45,
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_000,
13
22
  [ProvingRequestType.CHECKPOINT_PADDING_ROLLUP]: 0,
14
- [ProvingRequestType.CHECKPOINT_MERGE_ROLLUP]: 30,
15
- [ProvingRequestType.TX_MERGE_ROLLUP]: 0,
16
- [ProvingRequestType.PRIVATE_TX_BASE_ROLLUP]: 400_000,
17
- [ProvingRequestType.PUBLIC_TX_BASE_ROLLUP]: 470_000,
18
- [ProvingRequestType.PARITY_ROOT]: 39,
19
- [ProvingRequestType.ROOT_ROLLUP]: 35,
20
- [ProvingRequestType.PUBLIC_CHONK_VERIFIER]: 0,
21
- [ProvingRequestType.PUBLIC_VM]: 0,
23
+ [ProvingRequestType.PRIVATE_TX_BASE_ROLLUP]: 2_500, // Guess based on public
22
24
  };
23
25
 
24
26
  export const PROOF_DELAY_MS: Record<ProvingRequestType, number> = {
25
- [ProvingRequestType.PARITY_BASE]: 14_000,
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]: 55_000,
28
- [ProvingRequestType.BLOCK_ROOT_SINGLE_TX_FIRST_ROLLUP]: 35_000,
29
- [ProvingRequestType.BLOCK_ROOT_EMPTY_TX_FIRST_ROLLUP]: 4_000,
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]: 35_000,
34
45
  [ProvingRequestType.CHECKPOINT_PADDING_ROLLUP]: 0,
35
- [ProvingRequestType.CHECKPOINT_MERGE_ROLLUP]: 9_000,
36
- [ProvingRequestType.TX_MERGE_ROLLUP]: 0,
37
- [ProvingRequestType.PRIVATE_TX_BASE_ROLLUP]: 145_000,
38
- [ProvingRequestType.PUBLIC_TX_BASE_ROLLUP]: 160_000,
39
- [ProvingRequestType.PARITY_ROOT]: 16_000,
40
- [ProvingRequestType.ROOT_ROLLUP]: 140_000,
41
- [ProvingRequestType.PUBLIC_CHONK_VERIFIER]: 30_000,
42
- [ProvingRequestType.PUBLIC_VM]: 0,
46
+ [ProvingRequestType.PRIVATE_TX_BASE_ROLLUP]: 22_000,
43
47
  };
package/src/test/index.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from './test_circuit_prover.js';
2
2
  export * from './test_verifier.js';
3
+ export * from './delay_values.js';
@@ -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 { type Proof, ProvingRequestType, makeEmptyRecursiveProof, makeRecursiveProof } from '@aztec/stdlib/proofs';
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 and VK data.
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
- makeProofAndVerificationKey(
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
- import { Fr } from '@aztec/foundation/fields';
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
- logFunction,
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
- ValueType,
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.createUpDownCounter(Metrics.IVC_VERIFIER_FAILURE_COUNT, {
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
- valueType: ValueType.DOUBLE,
59
- description: 'AVG ivc verification',
60
- unit: 'ms',
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));