@aztec/bb-prover 4.0.0-nightly.20250907 → 4.0.0-nightly.20260108

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 (93) hide show
  1. package/dest/avm_proving_tests/avm_proving_tester.d.ts +7 -6
  2. package/dest/avm_proving_tests/avm_proving_tester.d.ts.map +1 -1
  3. package/dest/avm_proving_tests/avm_proving_tester.js +33 -13
  4. package/dest/bb/cli.d.ts +1 -1
  5. package/dest/bb/execute.d.ts +5 -13
  6. package/dest/bb/execute.d.ts.map +1 -1
  7. package/dest/bb/execute.js +30 -92
  8. package/dest/bb/index.d.ts +1 -1
  9. package/dest/config.d.ts +1 -1
  10. package/dest/honk.d.ts +2 -2
  11. package/dest/honk.js +2 -2
  12. package/dest/index.d.ts +1 -1
  13. package/dest/instrumentation.d.ts +3 -3
  14. package/dest/instrumentation.d.ts.map +1 -1
  15. package/dest/prover/client/bb_private_kernel_prover.d.ts +12 -6
  16. package/dest/prover/client/bb_private_kernel_prover.d.ts.map +1 -1
  17. package/dest/prover/client/bb_private_kernel_prover.js +36 -7
  18. package/dest/prover/client/bundle.d.ts +6 -0
  19. package/dest/prover/client/bundle.d.ts.map +1 -0
  20. package/dest/prover/client/bundle.js +7 -0
  21. package/dest/prover/client/lazy.d.ts +6 -0
  22. package/dest/prover/client/lazy.d.ts.map +1 -0
  23. package/dest/prover/client/lazy.js +7 -0
  24. package/dest/prover/index.d.ts +1 -1
  25. package/dest/prover/proof_utils.d.ts +9 -9
  26. package/dest/prover/proof_utils.d.ts.map +1 -1
  27. package/dest/prover/proof_utils.js +42 -25
  28. package/dest/prover/server/bb_prover.d.ts +23 -43
  29. package/dest/prover/server/bb_prover.d.ts.map +1 -1
  30. package/dest/prover/server/bb_prover.js +464 -165
  31. package/dest/test/delay_values.d.ts +1 -1
  32. package/dest/test/delay_values.d.ts.map +1 -1
  33. package/dest/test/delay_values.js +37 -25
  34. package/dest/test/index.d.ts +2 -1
  35. package/dest/test/index.d.ts.map +1 -1
  36. package/dest/test/index.js +1 -0
  37. package/dest/test/test_circuit_prover.d.ts +21 -31
  38. package/dest/test/test_circuit_prover.d.ts.map +1 -1
  39. package/dest/test/test_circuit_prover.js +503 -81
  40. package/dest/test/test_verifier.d.ts +3 -1
  41. package/dest/test/test_verifier.d.ts.map +1 -1
  42. package/dest/test/test_verifier.js +15 -0
  43. package/dest/verification_key/verification_key_data.d.ts +1 -1
  44. package/dest/verification_key/verification_key_data.js +1 -1
  45. package/dest/verifier/bb_verifier.d.ts +3 -5
  46. package/dest/verifier/bb_verifier.d.ts.map +1 -1
  47. package/dest/verifier/bb_verifier.js +24 -26
  48. package/dest/verifier/index.d.ts +2 -2
  49. package/dest/verifier/index.d.ts.map +1 -1
  50. package/dest/verifier/index.js +1 -1
  51. package/dest/verifier/queued_chonk_verifier.d.ts +15 -0
  52. package/dest/verifier/queued_chonk_verifier.d.ts.map +1 -0
  53. package/dest/verifier/{queued_ivc_verifier.js → queued_chonk_verifier.js} +3 -3
  54. package/package.json +23 -23
  55. package/src/avm_proving_tests/avm_proving_tester.ts +43 -19
  56. package/src/bb/execute.ts +20 -90
  57. package/src/honk.ts +1 -1
  58. package/src/instrumentation.ts +2 -2
  59. package/src/prover/client/bb_private_kernel_prover.ts +49 -10
  60. package/src/prover/client/bundle.ts +10 -0
  61. package/src/prover/client/lazy.ts +10 -0
  62. package/src/prover/proof_utils.ts +53 -31
  63. package/src/prover/server/bb_prover.ts +231 -293
  64. package/src/test/delay_values.ts +38 -24
  65. package/src/test/index.ts +1 -0
  66. package/src/test/test_circuit_prover.ts +219 -142
  67. package/src/test/test_verifier.ts +8 -0
  68. package/src/verification_key/verification_key_data.ts +1 -1
  69. package/src/verifier/bb_verifier.ts +34 -33
  70. package/src/verifier/index.ts +1 -1
  71. package/src/verifier/{queued_ivc_verifier.ts → queued_chonk_verifier.ts} +3 -3
  72. package/dest/prover/client/native/bb_native_private_kernel_prover.d.ts +0 -23
  73. package/dest/prover/client/native/bb_native_private_kernel_prover.d.ts.map +0 -1
  74. package/dest/prover/client/native/bb_native_private_kernel_prover.js +0 -66
  75. package/dest/prover/client/wasm/bb_wasm_private_kernel_prover.d.ts +0 -15
  76. package/dest/prover/client/wasm/bb_wasm_private_kernel_prover.d.ts.map +0 -1
  77. package/dest/prover/client/wasm/bb_wasm_private_kernel_prover.js +0 -48
  78. package/dest/prover/client/wasm/bundle.d.ts +0 -6
  79. package/dest/prover/client/wasm/bundle.d.ts.map +0 -1
  80. package/dest/prover/client/wasm/bundle.js +0 -8
  81. package/dest/prover/client/wasm/lazy.d.ts +0 -6
  82. package/dest/prover/client/wasm/lazy.d.ts.map +0 -1
  83. package/dest/prover/client/wasm/lazy.js +0 -8
  84. package/dest/stats.d.ts +0 -4
  85. package/dest/stats.d.ts.map +0 -1
  86. package/dest/stats.js +0 -45
  87. package/dest/verifier/queued_ivc_verifier.d.ts +0 -15
  88. package/dest/verifier/queued_ivc_verifier.d.ts.map +0 -1
  89. package/src/prover/client/native/bb_native_private_kernel_prover.ts +0 -105
  90. package/src/prover/client/wasm/bb_wasm_private_kernel_prover.ts +0 -60
  91. package/src/prover/client/wasm/bundle.ts +0 -11
  92. package/src/prover/client/wasm/lazy.ts +0 -11
  93. package/src/stats.ts +0 -47
@@ -1,7 +1,9 @@
1
1
  import type { ClientProtocolCircuitVerifier, IVCProofVerificationResult } from '@aztec/stdlib/interfaces/server';
2
2
  import type { Tx } from '@aztec/stdlib/tx';
3
3
  export declare class TestCircuitVerifier implements ClientProtocolCircuitVerifier {
4
+ private verificationDelayMs?;
5
+ constructor(verificationDelayMs?: number | undefined);
4
6
  verifyProof(_tx: Tx): Promise<IVCProofVerificationResult>;
5
7
  stop(): Promise<void>;
6
8
  }
7
- //# sourceMappingURL=test_verifier.d.ts.map
9
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdF92ZXJpZmllci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3Rlc3QvdGVzdF92ZXJpZmllci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSw2QkFBNkIsRUFBRSwwQkFBMEIsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQ2pILE9BQU8sS0FBSyxFQUFFLEVBQUUsRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBRTNDLHFCQUFhLG1CQUFvQixZQUFXLDZCQUE2QjtJQUMzRCxPQUFPLENBQUMsbUJBQW1CLENBQUM7SUFBeEMsWUFBb0IsbUJBQW1CLENBQUMsb0JBQVEsRUFBSTtJQUNwRCxXQUFXLENBQUMsR0FBRyxFQUFFLEVBQUUsR0FBRyxPQUFPLENBQUMsMEJBQTBCLENBQUMsQ0FTeEQ7SUFFTSxJQUFJLElBQUksT0FBTyxDQUFDLElBQUksQ0FBQyxDQUUzQjtDQUNGIn0=
@@ -1 +1 @@
1
- {"version":3,"file":"test_verifier.d.ts","sourceRoot":"","sources":["../../src/test/test_verifier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AACjH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAE3C,qBAAa,mBAAoB,YAAW,6BAA6B;IACvE,WAAW,CAAC,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAIlD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAG7B"}
1
+ {"version":3,"file":"test_verifier.d.ts","sourceRoot":"","sources":["../../src/test/test_verifier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AACjH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAE3C,qBAAa,mBAAoB,YAAW,6BAA6B;IAC3D,OAAO,CAAC,mBAAmB,CAAC;IAAxC,YAAoB,mBAAmB,CAAC,oBAAQ,EAAI;IACpD,WAAW,CAAC,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,0BAA0B,CAAC,CASxD;IAEM,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAE3B;CACF"}
@@ -1,5 +1,20 @@
1
1
  export class TestCircuitVerifier {
2
+ verificationDelayMs;
3
+ constructor(verificationDelayMs){
4
+ this.verificationDelayMs = verificationDelayMs;
5
+ }
2
6
  verifyProof(_tx) {
7
+ if (this.verificationDelayMs !== undefined && this.verificationDelayMs > 0) {
8
+ return new Promise((resolve)=>{
9
+ setTimeout(()=>{
10
+ resolve({
11
+ valid: true,
12
+ durationMs: this.verificationDelayMs,
13
+ totalDurationMs: this.verificationDelayMs
14
+ });
15
+ }, this.verificationDelayMs);
16
+ });
17
+ }
3
18
  return Promise.resolve({
4
19
  valid: true,
5
20
  durationMs: 0,
@@ -12,4 +12,4 @@ export declare function extractVkData(vkDirectoryPath: string): Promise<Verifica
12
12
  * @returns The verification key data
13
13
  */
14
14
  export declare function extractAvmVkData(vkDirectoryPath: string): Promise<VerificationKeyData>;
15
- //# sourceMappingURL=verification_key_data.d.ts.map
15
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmVyaWZpY2F0aW9uX2tleV9kYXRhLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdmVyaWZpY2F0aW9uX2tleS92ZXJpZmljYXRpb25fa2V5X2RhdGEudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBR0EsT0FBTyxFQUEyQixtQkFBbUIsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBUWpGOzs7O0dBSUc7QUFDSCx3QkFBc0IsYUFBYSxDQUFDLGVBQWUsRUFBRSxNQUFNLEdBQUcsT0FBTyxDQUFDLG1CQUFtQixDQUFDLENBVXpGO0FBRUQ7Ozs7O0dBS0c7QUFDSCx3QkFBc0IsZ0JBQWdCLENBQUMsZUFBZSxFQUFFLE1BQU0sR0FBRyxPQUFPLENBQUMsbUJBQW1CLENBQUMsQ0FlNUYifQ==
@@ -1,5 +1,5 @@
1
1
  import { AVM_V2_VERIFICATION_KEY_LENGTH_IN_FIELDS_PADDED } from '@aztec/constants';
2
- import { Fr } from '@aztec/foundation/fields';
2
+ import { Fr } from '@aztec/foundation/curves/bn254';
3
3
  import { BufferReader } from '@aztec/foundation/serialize';
4
4
  import { VerificationKeyAsFields, VerificationKeyData } from '@aztec/stdlib/vks';
5
5
  import { strict as assert } from 'assert';
@@ -1,20 +1,18 @@
1
1
  import { type Logger } from '@aztec/foundation/log';
2
- import type { ServerProtocolArtifact } from '@aztec/noir-protocol-circuits-types/types';
2
+ import { type ProtocolArtifact, type ServerProtocolArtifact } from '@aztec/noir-protocol-circuits-types/types';
3
3
  import type { ClientProtocolCircuitVerifier, IVCProofVerificationResult } from '@aztec/stdlib/interfaces/server';
4
4
  import type { Proof } from '@aztec/stdlib/proofs';
5
5
  import { Tx } from '@aztec/stdlib/tx';
6
6
  import type { VerificationKeyData } from '@aztec/stdlib/vks';
7
7
  import type { BBConfig } from '../config.js';
8
- export declare const PRIVATE_TAIL_CIVC_VK: string;
9
- export declare const PUBLIC_TAIL_CIVC_VK: string;
10
8
  export declare class BBCircuitVerifier implements ClientProtocolCircuitVerifier {
11
9
  private config;
12
10
  private logger;
13
11
  private constructor();
14
12
  stop(): Promise<void>;
15
13
  static new(config: BBConfig, logger?: Logger): Promise<BBCircuitVerifier>;
16
- getVerificationKeyData(circuitType: ServerProtocolArtifact): VerificationKeyData;
14
+ getVerificationKeyData(circuit: ProtocolArtifact): VerificationKeyData;
17
15
  verifyProofForCircuit(circuit: ServerProtocolArtifact, proof: Proof): Promise<void>;
18
16
  verifyProof(tx: Tx): Promise<IVCProofVerificationResult>;
19
17
  }
20
- //# sourceMappingURL=bb_verifier.d.ts.map
18
+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JBQXNCLEVBQUUsS0FBSyxFQUFFLEtBQUssaUJBbUMvRTtJQUVZLFdBQVcsQ0FBQyxFQUFFLEVBQUUsRUFBRSxHQUFHLE9BQU8sQ0FBQywwQkFBMEIsQ0FBQyxDQWlEcEU7Q0FDRiJ9
@@ -1 +1 @@
1
- {"version":3,"file":"bb_verifier.d.ts","sourceRoot":"","sources":["../../src/verifier/bb_verifier.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAGlE,OAAO,KAAK,EAA0B,sBAAsB,EAAE,MAAM,2CAA2C,CAAC;AAChH,OAAO,KAAK,EAAE,6BAA6B,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AACjH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACtC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAc7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAQ7C,eAAO,MAAM,oBAAoB,QAA0D,CAAC;AAC5F,eAAO,MAAM,mBAAmB,QAAyD,CAAC;AAE1F,qBAAa,iBAAkB,YAAW,6BAA6B;IAEnE,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,MAAM;IAFhB,OAAO;IAKA,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;WAIR,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,SAAqC;IAK9E,sBAAsB,CAAC,WAAW,EAAE,sBAAsB,GAAG,mBAAmB;IAQ1E,qBAAqB,CAAC,OAAO,EAAE,sBAAsB,EAAE,KAAK,EAAE,KAAK;IAqCnE,WAAW,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,0BAA0B,CAAC;CAiDtE"}
1
+ {"version":3,"file":"bb_verifier.d.ts","sourceRoot":"","sources":["../../src/verifier/bb_verifier.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAGlE,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAE5B,MAAM,2CAA2C,CAAC;AACnD,OAAO,KAAK,EAAE,6BAA6B,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AACjH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACtC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAa7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAI7C,qBAAa,iBAAkB,YAAW,6BAA6B;IAEnE,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,MAAM;IAFhB,OAAO,eAGH;IAEG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAE3B;IAED,OAAoB,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,SAAqC,8BAMpF;IAEM,sBAAsB,CAAC,OAAO,EAAE,gBAAgB,GAAG,mBAAmB,CAM5E;IAEY,qBAAqB,CAAC,OAAO,EAAE,sBAAsB,EAAE,KAAK,EAAE,KAAK,iBAmC/E;IAEY,WAAW,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAiDpE;CACF"}
@@ -1,18 +1,13 @@
1
1
  import { runInDirectory } from '@aztec/foundation/fs';
2
2
  import { createLogger } from '@aztec/foundation/log';
3
3
  import { Timer } from '@aztec/foundation/timer';
4
- import { ServerCircuitVks } from '@aztec/noir-protocol-circuits-types/server/vks';
4
+ import { ProtocolCircuitVks } from '@aztec/noir-protocol-circuits-types/server/vks';
5
+ import { mapProtocolArtifactNameToCircuitName } from '@aztec/noir-protocol-circuits-types/types';
5
6
  import { promises as fs } from 'fs';
6
7
  import * as path from 'path';
7
- import { fileURLToPath } from 'url';
8
- import { BB_RESULT, PROOF_FILENAME, PUBLIC_INPUTS_FILENAME, VK_FILENAME, verifyClientIvcProof, verifyProof } from '../bb/execute.js';
8
+ import { BB_RESULT, PROOF_FILENAME, PUBLIC_INPUTS_FILENAME, VK_FILENAME, verifyChonkProof, verifyProof } from '../bb/execute.js';
9
9
  import { getUltraHonkFlavorForCircuit } from '../honk.js';
10
- import { writeClientIVCProofToOutputDirectory } from '../prover/proof_utils.js';
11
- import { mapProtocolArtifactNameToCircuitName } from '../stats.js';
12
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
13
- // Built by yarn generate
14
- export const PRIVATE_TAIL_CIVC_VK = path.join(__dirname, '../../artifacts/private-civc-vk');
15
- export const PUBLIC_TAIL_CIVC_VK = path.join(__dirname, '../../artifacts/public-civc-vk');
10
+ import { writeChonkProofToPath } from '../prover/proof_utils.js';
16
11
  export class BBCircuitVerifier {
17
12
  config;
18
13
  logger;
@@ -24,15 +19,18 @@ export class BBCircuitVerifier {
24
19
  return Promise.resolve();
25
20
  }
26
21
  static async new(config, logger = createLogger('bb-prover:verifier')) {
22
+ if (!config.bbWorkingDirectory) {
23
+ throw new Error(`Barretenberg working directory (BB_WORKING_DIRECTORY) is not set`);
24
+ }
27
25
  await fs.mkdir(config.bbWorkingDirectory, {
28
26
  recursive: true
29
27
  });
30
28
  return new BBCircuitVerifier(config, logger);
31
29
  }
32
- getVerificationKeyData(circuitType) {
33
- const vk = ServerCircuitVks[circuitType];
30
+ getVerificationKeyData(circuit) {
31
+ const vk = ProtocolCircuitVks[circuit];
34
32
  if (vk === undefined) {
35
- throw new Error('Could not find VK for server artifact ' + circuitType);
33
+ throw new Error(`Could not find VK for artifact ${circuit}`);
36
34
  }
37
35
  return vk;
38
36
  }
@@ -62,33 +60,33 @@ export class BBCircuitVerifier {
62
60
  await runInDirectory(this.config.bbWorkingDirectory, operation, this.config.bbSkipCleanup, this.logger);
63
61
  }
64
62
  async verifyProof(tx) {
63
+ const proofType = 'Chonk';
65
64
  try {
66
65
  const totalTimer = new Timer();
67
66
  let verificationDuration = 0;
68
- // TODO(#7370) The verification keys should be supplied separately and based on the expectedCircuit
69
- // rather than read from the tx object itself. We also need the vks for the translator and ecc, which
70
- // are not being saved along the other vks yet. Reuse the 'verifyProofForCircuit' method above once
71
- // we have all the verification keys available.
72
- const expectedCircuit = tx.data.forPublic ? 'PrivateKernelTailToPublicArtifact' : 'PrivateKernelTailArtifact';
73
- const circuit = 'ClientIVC';
67
+ const circuit = tx.data.forPublic ? 'HidingKernelToPublic' : 'HidingKernelToRollup';
74
68
  // Block below is almost copy-pasted from verifyProofForCircuit
75
69
  const operation = async (bbWorkingDirectory)=>{
76
70
  const logFunction = (message)=>{
77
- this.logger.debug(`${circuit} BB out - ${message}`);
71
+ this.logger.debug(`${proofType} BB out - ${message}`);
78
72
  };
79
- await writeClientIVCProofToOutputDirectory(tx.clientIvcProof, bbWorkingDirectory);
73
+ const proofPath = path.join(bbWorkingDirectory, PROOF_FILENAME);
74
+ await writeChonkProofToPath(tx.chonkProof.attachPublicInputs(tx.data.publicInputs().toFields()), proofPath);
75
+ const verificationKeyPath = path.join(bbWorkingDirectory, VK_FILENAME);
76
+ const verificationKey = this.getVerificationKeyData(circuit);
77
+ await fs.writeFile(verificationKeyPath, verificationKey.keyAsBytes);
80
78
  const timer = new Timer();
81
- const result = await verifyClientIvcProof(this.config.bbBinaryPath, bbWorkingDirectory.concat('/proof'), tx.data.forPublic ? PUBLIC_TAIL_CIVC_VK : PRIVATE_TAIL_CIVC_VK, logFunction, this.config.bbIVCConcurrency);
79
+ const result = await verifyChonkProof(this.config.bbBinaryPath, proofPath, verificationKeyPath, logFunction, this.config.bbIVCConcurrency);
82
80
  verificationDuration = timer.ms();
83
81
  if (result.status === BB_RESULT.FAILURE) {
84
- const errorMessage = `Failed to verify ${circuit} proof for ${expectedCircuit}!`;
82
+ const errorMessage = `Failed to verify ${proofType} proof for ${circuit}!`;
85
83
  throw new Error(errorMessage);
86
84
  }
87
- this.logger.debug(`${circuit} verification successful`, {
88
- circuitName: mapProtocolArtifactNameToCircuitName(expectedCircuit),
85
+ this.logger.debug(`${proofType} verification successful`, {
86
+ circuitName: mapProtocolArtifactNameToCircuitName(circuit),
89
87
  duration: result.durationMs,
90
88
  eventName: 'circuit-verification',
91
- proofType: 'client-ivc'
89
+ proofType: 'chonk'
92
90
  });
93
91
  };
94
92
  await runInDirectory(this.config.bbWorkingDirectory, operation, this.config.bbSkipCleanup, this.logger);
@@ -98,7 +96,7 @@ export class BBCircuitVerifier {
98
96
  totalDurationMs: totalTimer.ms()
99
97
  };
100
98
  } catch (err) {
101
- this.logger.warn(`Failed to verify ClientIVC proof for tx ${tx.getTxHash().toString()}: ${String(err)}`);
99
+ this.logger.warn(`Failed to verify ${proofType} proof for tx ${tx.getTxHash().toString()}: ${String(err)}`);
102
100
  return {
103
101
  valid: false,
104
102
  durationMs: 0,
@@ -1,3 +1,3 @@
1
1
  export * from './bb_verifier.js';
2
- export * from './queued_ivc_verifier.js';
3
- //# sourceMappingURL=index.d.ts.map
2
+ export * from './queued_chonk_verifier.js';
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy92ZXJpZmllci9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLGtCQUFrQixDQUFDO0FBQ2pDLGNBQWMsNEJBQTRCLENBQUMifQ==
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/verifier/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/verifier/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC"}
@@ -1,2 +1,2 @@
1
1
  export * from './bb_verifier.js';
2
- export * from './queued_ivc_verifier.js';
2
+ export * from './queued_chonk_verifier.js';
@@ -0,0 +1,15 @@
1
+ import type { ClientProtocolCircuitVerifier, IVCProofVerificationResult } from '@aztec/stdlib/interfaces/server';
2
+ import type { Tx } from '@aztec/stdlib/tx';
3
+ import { type TelemetryClient } from '@aztec/telemetry-client';
4
+ import type { BBConfig } from '../config.js';
5
+ export declare class QueuedIVCVerifier implements ClientProtocolCircuitVerifier {
6
+ private verifier;
7
+ private telemetry;
8
+ private logger;
9
+ private queue;
10
+ private metrics;
11
+ constructor(config: BBConfig, verifier: ClientProtocolCircuitVerifier, telemetry?: TelemetryClient, logger?: import("@aztec/foundation/log").Logger);
12
+ verifyProof(tx: Tx): Promise<IVCProofVerificationResult>;
13
+ stop(): Promise<void>;
14
+ }
15
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicXVldWVkX2Nob25rX3ZlcmlmaWVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdmVyaWZpZXIvcXVldWVkX2Nob25rX3ZlcmlmaWVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUVBLE9BQU8sS0FBSyxFQUFFLDZCQUE2QixFQUFFLDBCQUEwQixFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFDakgsT0FBTyxLQUFLLEVBQUUsRUFBRSxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFDM0MsT0FBTyxFQU1MLEtBQUssZUFBZSxFQUlyQixNQUFNLHlCQUF5QixDQUFDO0FBSWpDLE9BQU8sS0FBSyxFQUFFLFFBQVEsRUFBRSxNQUFNLGNBQWMsQ0FBQztBQWdHN0MscUJBQWEsaUJBQWtCLFlBQVcsNkJBQTZCO0lBTW5FLE9BQU8sQ0FBQyxRQUFRO0lBQ2hCLE9BQU8sQ0FBQyxTQUFTO0lBQ2p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class IVCVerifierMetrics {
19
19
  const meter = client.getMeter(name);
20
20
  this.ivcVerificationHistogram = meter.createHistogram(Metrics.IVC_VERIFIER_TIME, {
21
21
  unit: 'ms',
22
- description: 'Duration to verify client IVC proofs',
22
+ description: 'Duration to verify chonk proofs',
23
23
  valueType: ValueType.INT
24
24
  });
25
25
  this.ivcTotalVerificationHistogram = meter.createHistogram(Metrics.IVC_VERIFIER_TOTAL_TIME, {
26
26
  unit: 'ms',
27
- description: 'Total duration to verify client IVC proofs, including serde',
27
+ description: 'Total duration to verify chonk proofs, including serde',
28
28
  valueType: ValueType.INT
29
29
  });
30
30
  this.ivcFailureCount = meter.createUpDownCounter(Metrics.IVC_VERIFIER_FAILURE_COUNT, {
@@ -112,7 +112,7 @@ export class QueuedIVCVerifier {
112
112
  logger;
113
113
  queue;
114
114
  metrics;
115
- constructor(config, verifier, telemetry = getTelemetryClient(), logger = createLogger('bb-prover:queued_ivc_verifier')){
115
+ constructor(config, verifier, telemetry = getTelemetryClient(), logger = createLogger('bb-prover:queued_chonk_verifier')){
116
116
  this.verifier = verifier;
117
117
  this.telemetry = telemetry;
118
118
  this.logger = logger;
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@aztec/bb-prover",
3
- "version": "4.0.0-nightly.20250907",
3
+ "version": "4.0.0-nightly.20260108",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./dest/index.js",
7
- "./client/wasm/bundle": "./dest/prover/client/wasm/bundle.js",
8
- "./client/wasm/lazy": "./dest/prover/client/wasm/lazy.js",
9
- "./client/native": "./dest/prover/client/native/bb_native_private_kernel_prover.js",
7
+ "./client/bundle": "./dest/prover/client/bundle.js",
8
+ "./client/lazy": "./dest/prover/client/lazy.js",
9
+ "./client": "./dest/prover/client/bb_private_kernel_prover.js",
10
10
  "./verifier": "./dest/verifier/index.js",
11
11
  "./test": "./dest/test/index.js",
12
12
  "./config": "./dest/config.js"
@@ -25,10 +25,9 @@
25
25
  "../package.common.json"
26
26
  ],
27
27
  "scripts": {
28
- "build": "yarn clean && tsc -b",
29
- "build:dev": "tsc -b --watch",
28
+ "build": "yarn clean && ../scripts/tsc.sh",
29
+ "build:dev": "../scripts/tsc.sh --watch",
30
30
  "clean": "rm -rf ./dest .tsbuildinfo",
31
- "generate": "scripts/copy_ivc_hiding_circuit_vks.sh",
32
31
  "bb": "node --no-warnings ./dest/bb/index.js",
33
32
  "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}"
34
33
  },
@@ -70,36 +69,37 @@
70
69
  ]
71
70
  },
72
71
  "dependencies": {
73
- "@aztec/bb.js": "4.0.0-nightly.20250907",
74
- "@aztec/constants": "4.0.0-nightly.20250907",
75
- "@aztec/foundation": "4.0.0-nightly.20250907",
76
- "@aztec/noir-noirc_abi": "4.0.0-nightly.20250907",
77
- "@aztec/noir-protocol-circuits-types": "4.0.0-nightly.20250907",
78
- "@aztec/noir-types": "4.0.0-nightly.20250907",
79
- "@aztec/simulator": "4.0.0-nightly.20250907",
80
- "@aztec/stdlib": "4.0.0-nightly.20250907",
81
- "@aztec/telemetry-client": "4.0.0-nightly.20250907",
82
- "@aztec/world-state": "4.0.0-nightly.20250907",
72
+ "@aztec/bb.js": "4.0.0-nightly.20260108",
73
+ "@aztec/constants": "4.0.0-nightly.20260108",
74
+ "@aztec/foundation": "4.0.0-nightly.20260108",
75
+ "@aztec/noir-noirc_abi": "4.0.0-nightly.20260108",
76
+ "@aztec/noir-protocol-circuits-types": "4.0.0-nightly.20260108",
77
+ "@aztec/noir-types": "4.0.0-nightly.20260108",
78
+ "@aztec/simulator": "4.0.0-nightly.20260108",
79
+ "@aztec/stdlib": "4.0.0-nightly.20260108",
80
+ "@aztec/telemetry-client": "4.0.0-nightly.20260108",
81
+ "@aztec/world-state": "4.0.0-nightly.20260108",
83
82
  "commander": "^12.1.0",
84
83
  "pako": "^2.1.0",
85
84
  "source-map-support": "^0.5.21",
86
85
  "tslib": "^2.4.0"
87
86
  },
88
87
  "devDependencies": {
89
- "@aztec/ethereum": "4.0.0-nightly.20250907",
90
- "@aztec/kv-store": "4.0.0-nightly.20250907",
91
- "@aztec/noir-contracts.js": "4.0.0-nightly.20250907",
92
- "@aztec/noir-test-contracts.js": "4.0.0-nightly.20250907",
93
- "@aztec/protocol-contracts": "4.0.0-nightly.20250907",
88
+ "@aztec/ethereum": "4.0.0-nightly.20260108",
89
+ "@aztec/kv-store": "4.0.0-nightly.20260108",
90
+ "@aztec/noir-contracts.js": "4.0.0-nightly.20260108",
91
+ "@aztec/noir-test-contracts.js": "4.0.0-nightly.20260108",
92
+ "@aztec/protocol-contracts": "4.0.0-nightly.20260108",
94
93
  "@jest/globals": "^30.0.0",
95
94
  "@types/jest": "^30.0.0",
96
95
  "@types/node": "^22.15.17",
97
96
  "@types/source-map-support": "^0.5.10",
97
+ "@typescript/native-preview": "7.0.0-dev.20251126.1",
98
98
  "jest": "^30.0.0",
99
99
  "jest-mock-extended": "^4.0.0",
100
100
  "ts-node": "^10.9.1",
101
101
  "typescript": "^5.3.3",
102
- "viem": "2.23.7"
102
+ "viem": "npm:@aztec/viem@2.38.2"
103
103
  },
104
104
  "files": [
105
105
  "dest",
@@ -8,7 +8,7 @@ import {
8
8
  type TestPrivateInsertions,
9
9
  } from '@aztec/simulator/public/fixtures';
10
10
  import type { PublicTxResult } from '@aztec/simulator/server';
11
- import { type AvmCircuitInputs, AvmCircuitPublicInputs } from '@aztec/stdlib/avm';
11
+ import { AvmCircuitInputs, AvmCircuitPublicInputs, PublicSimulatorConfig } from '@aztec/stdlib/avm';
12
12
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
13
13
  import type { MerkleTreeWriteOperations } from '@aztec/stdlib/interfaces/server';
14
14
  import type { GlobalVariables } from '@aztec/stdlib/tx';
@@ -27,7 +27,7 @@ import {
27
27
  verifyAvmProof,
28
28
  } from '../bb/execute.js';
29
29
 
30
- const BB_PATH = path.resolve('../../barretenberg/cpp/build/bin/bb');
30
+ const BB_PATH = path.resolve('../../barretenberg/cpp/build/bin/bb-avm');
31
31
 
32
32
  // An InterceptingLogger that records all log messages and forwards them to a wrapped logger.
33
33
  class InterceptingLogger implements Logger {
@@ -88,34 +88,45 @@ class InterceptingLogger implements Logger {
88
88
  }
89
89
  }
90
90
 
91
+ // Config with collectHints enabled for proving tests
92
+ const provingConfig: PublicSimulatorConfig = PublicSimulatorConfig.from({
93
+ skipFeeEnforcement: false,
94
+ collectCallMetadata: true, // For results.
95
+ collectDebugLogs: false,
96
+ collectHints: true, // Required for proving!
97
+ collectPublicInputs: true, // Required for proving!
98
+ collectStatistics: false,
99
+ });
100
+
91
101
  export class AvmProvingTester extends PublicTxSimulationTester {
102
+ private bbWorkingDirectory: string = '';
103
+
92
104
  constructor(
93
- private bbWorkingDirectory: string,
94
105
  private checkCircuitOnly: boolean,
95
106
  contractDataSource: SimpleContractDataSource,
96
107
  merkleTrees: MerkleTreeWriteOperations,
97
108
  globals?: GlobalVariables,
98
109
  metrics?: TestExecutorMetrics,
99
110
  ) {
100
- super(merkleTrees, contractDataSource, globals, metrics);
111
+ // simulator factory is undefined because for proving, we use the default C++ simulator
112
+ super(merkleTrees, contractDataSource, globals, metrics, /*simulatorFactory=*/ undefined, provingConfig);
101
113
  }
102
114
 
103
- static async new(checkCircuitOnly: boolean = false, globals?: GlobalVariables, metrics?: TestExecutorMetrics) {
104
- const bbWorkingDirectory = await fs.mkdtemp(path.join(tmpdir(), 'bb-'));
105
-
115
+ static async new(
116
+ worldStateService: NativeWorldStateService, // make sure to close this later
117
+ checkCircuitOnly: boolean = false,
118
+ globals?: GlobalVariables,
119
+ metrics?: TestExecutorMetrics,
120
+ ) {
106
121
  const contractDataSource = new SimpleContractDataSource();
107
- const merkleTrees = await (await NativeWorldStateService.tmp()).fork();
108
- return new AvmProvingTester(
109
- bbWorkingDirectory,
110
- checkCircuitOnly,
111
- contractDataSource,
112
- merkleTrees,
113
- globals,
114
- metrics,
115
- );
122
+ const merkleTrees = await worldStateService.fork();
123
+ return new AvmProvingTester(checkCircuitOnly, contractDataSource, merkleTrees, globals, metrics);
116
124
  }
117
125
 
118
126
  async prove(avmCircuitInputs: AvmCircuitInputs, txLabel: string = 'unlabeledTx'): Promise<BBResult> {
127
+ // We use a new working directory for each proof.
128
+ this.bbWorkingDirectory = await fs.mkdtemp(path.join(tmpdir(), 'bb-'));
129
+
119
130
  const interceptingLogger = new InterceptingLogger(this.logger);
120
131
 
121
132
  // Then we prove.
@@ -151,6 +162,11 @@ export class AvmProvingTester extends PublicTxSimulationTester {
151
162
  }
152
163
  });
153
164
 
165
+ // Throw if logs did not contain any times.
166
+ if (Object.keys(times).length === 0) {
167
+ throw new Error('AVM stdout did not contain any proving times in the stats!');
168
+ }
169
+
154
170
  // Hack to make labels match.
155
171
  const txLabelWithCount = `${txLabel}/${this.txCount - 1}`;
156
172
  // I need to cast because TS doesnt realize metrics is protected not private.
@@ -204,7 +220,9 @@ export class AvmProvingTester extends PublicTxSimulationTester {
204
220
  feePayer = sender,
205
221
  privateInsertions?: TestPrivateInsertions,
206
222
  txLabel: string = 'unlabeledTx',
223
+ disableRevertCheck: boolean = false,
207
224
  ): Promise<PublicTxResult> {
225
+ const simTimer = new Timer();
208
226
  const simRes = await this.simulateTx(
209
227
  sender,
210
228
  setupCalls,
@@ -214,11 +232,16 @@ export class AvmProvingTester extends PublicTxSimulationTester {
214
232
  privateInsertions,
215
233
  txLabel,
216
234
  );
217
- expect(simRes.revertCode.isOK()).toBe(expectRevert ? false : true);
235
+ const simDuration = simTimer.ms();
236
+ this.logger.info(`Simulation took ${simDuration} ms for tx ${txLabel}`);
237
+
238
+ if (!disableRevertCheck) {
239
+ expect(simRes.revertCode.isOK()).toBe(expectRevert ? false : true);
240
+ }
218
241
 
219
242
  const opString = this.checkCircuitOnly ? 'Check circuit' : 'Proving and verification';
220
243
 
221
- const avmCircuitInputs = simRes.avmProvingRequest.inputs;
244
+ const avmCircuitInputs = new AvmCircuitInputs(simRes.hints!, simRes.publicInputs!);
222
245
  const timer = new Timer();
223
246
  await this.proveVerify(avmCircuitInputs, txLabel);
224
247
  this.logger.info(`${opString} took ${timer.ms()} ms for tx ${txLabel}`);
@@ -240,10 +263,11 @@ export class AvmProvingTester extends PublicTxSimulationTester {
240
263
  setupCalls ?? [],
241
264
  appCalls ?? [],
242
265
  teardownCall,
243
- /*expectRevert=*/ false,
266
+ undefined,
244
267
  feePayer,
245
268
  privateInsertions,
246
269
  txLabel,
270
+ true,
247
271
  );
248
272
  }
249
273