@aztec/bb-prover 0.0.1-commit.b655e406 → 0.0.1-commit.bf2612ae

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 (83) hide show
  1. package/dest/avm_proving_tests/avm_proving_tester.d.ts +3 -4
  2. package/dest/avm_proving_tests/avm_proving_tester.d.ts.map +1 -1
  3. package/dest/avm_proving_tests/avm_proving_tester.js +18 -4
  4. package/dest/bb/cli.d.ts +1 -1
  5. package/dest/bb/execute.d.ts +6 -6
  6. package/dest/bb/execute.d.ts.map +1 -1
  7. package/dest/bb/execute.js +59 -84
  8. package/dest/bb/index.d.ts +1 -1
  9. package/dest/config.d.ts +1 -1
  10. package/dest/honk.d.ts +1 -1
  11. package/dest/index.d.ts +1 -1
  12. package/dest/instrumentation.d.ts +1 -1
  13. package/dest/instrumentation.d.ts.map +1 -1
  14. package/dest/instrumentation.js +9 -39
  15. package/dest/prover/client/bb_private_kernel_prover.d.ts +11 -5
  16. package/dest/prover/client/bb_private_kernel_prover.d.ts.map +1 -1
  17. package/dest/prover/client/bb_private_kernel_prover.js +35 -6
  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 +1 -1
  26. package/dest/prover/proof_utils.js +1 -1
  27. package/dest/prover/server/bb_prover.d.ts +6 -18
  28. package/dest/prover/server/bb_prover.d.ts.map +1 -1
  29. package/dest/prover/server/bb_prover.js +415 -42
  30. package/dest/test/delay_values.d.ts +1 -1
  31. package/dest/test/delay_values.d.ts.map +1 -1
  32. package/dest/test/delay_values.js +29 -27
  33. package/dest/test/index.d.ts +2 -1
  34. package/dest/test/index.d.ts.map +1 -1
  35. package/dest/test/index.js +1 -0
  36. package/dest/test/test_circuit_prover.d.ts +4 -4
  37. package/dest/test/test_circuit_prover.d.ts.map +1 -1
  38. package/dest/test/test_circuit_prover.js +462 -59
  39. package/dest/test/test_verifier.d.ts +3 -1
  40. package/dest/test/test_verifier.d.ts.map +1 -1
  41. package/dest/test/test_verifier.js +15 -0
  42. package/dest/verification_key/verification_key_data.d.ts +1 -8
  43. package/dest/verification_key/verification_key_data.d.ts.map +1 -1
  44. package/dest/verification_key/verification_key_data.js +1 -20
  45. package/dest/verifier/bb_verifier.d.ts +1 -1
  46. package/dest/verifier/bb_verifier.d.ts.map +1 -1
  47. package/dest/verifier/bb_verifier.js +4 -4
  48. package/dest/verifier/index.d.ts +1 -1
  49. package/dest/verifier/queued_chonk_verifier.d.ts +1 -1
  50. package/dest/verifier/queued_chonk_verifier.d.ts.map +1 -1
  51. package/dest/verifier/queued_chonk_verifier.js +9 -40
  52. package/package.json +23 -22
  53. package/src/avm_proving_tests/avm_proving_tester.ts +19 -19
  54. package/src/bb/execute.ts +37 -68
  55. package/src/instrumentation.ts +8 -39
  56. package/src/prover/client/bb_private_kernel_prover.ts +45 -8
  57. package/src/prover/client/bundle.ts +10 -0
  58. package/src/prover/client/lazy.ts +10 -0
  59. package/src/prover/proof_utils.ts +1 -1
  60. package/src/prover/server/bb_prover.ts +22 -38
  61. package/src/test/delay_values.ts +31 -27
  62. package/src/test/index.ts +1 -0
  63. package/src/test/test_circuit_prover.ts +10 -13
  64. package/src/test/test_verifier.ts +8 -0
  65. package/src/verification_key/verification_key_data.ts +1 -26
  66. package/src/verifier/bb_verifier.ts +4 -5
  67. package/src/verifier/queued_chonk_verifier.ts +8 -40
  68. package/dest/prover/client/native/bb_native_private_kernel_prover.d.ts +0 -23
  69. package/dest/prover/client/native/bb_native_private_kernel_prover.d.ts.map +0 -1
  70. package/dest/prover/client/native/bb_native_private_kernel_prover.js +0 -66
  71. package/dest/prover/client/wasm/bb_wasm_private_kernel_prover.d.ts +0 -15
  72. package/dest/prover/client/wasm/bb_wasm_private_kernel_prover.d.ts.map +0 -1
  73. package/dest/prover/client/wasm/bb_wasm_private_kernel_prover.js +0 -46
  74. package/dest/prover/client/wasm/bundle.d.ts +0 -6
  75. package/dest/prover/client/wasm/bundle.d.ts.map +0 -1
  76. package/dest/prover/client/wasm/bundle.js +0 -8
  77. package/dest/prover/client/wasm/lazy.d.ts +0 -6
  78. package/dest/prover/client/wasm/lazy.d.ts.map +0 -1
  79. package/dest/prover/client/wasm/lazy.js +0 -8
  80. package/src/prover/client/native/bb_native_private_kernel_prover.ts +0 -105
  81. package/src/prover/client/wasm/bb_wasm_private_kernel_prover.ts +0 -58
  82. package/src/prover/client/wasm/bundle.ts +0 -11
  83. package/src/prover/client/wasm/lazy.ts +0 -11
@@ -15,4 +15,4 @@ export declare class BBCircuitVerifier implements ClientProtocolCircuitVerifier
15
15
  verifyProofForCircuit(circuit: ServerProtocolArtifact, proof: Proof): Promise<void>;
16
16
  verifyProof(tx: Tx): Promise<IVCProofVerificationResult>;
17
17
  }
18
- //# sourceMappingURL=bb_verifier.d.ts.map
18
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmJfdmVyaWZpZXIuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy92ZXJpZmllci9iYl92ZXJpZmllci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQUFPLEVBQUUsS0FBSyxNQUFNLEVBQWdCLE1BQU0sdUJBQXVCLENBQUM7QUFHbEUsT0FBTyxFQUVMLEtBQUssZ0JBQWdCLEVBQ3JCLEtBQUssc0JBQXNCLEVBRTVCLE1BQU0sMkNBQTJDLENBQUM7QUFDbkQsT0FBTyxLQUFLLEVBQUUsNkJBQTZCLEVBQUUsMEJBQTBCLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNqSCxPQUFPLEtBQUssRUFBRSxL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3B;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,CA6CpE;CACF"}
@@ -19,6 +19,9 @@ export class BBCircuitVerifier {
19
19
  return Promise.resolve();
20
20
  }
21
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
+ }
22
25
  await fs.mkdir(config.bbWorkingDirectory, {
23
26
  recursive: true
24
27
  });
@@ -64,16 +67,13 @@ export class BBCircuitVerifier {
64
67
  const circuit = tx.data.forPublic ? 'HidingKernelToPublic' : 'HidingKernelToRollup';
65
68
  // Block below is almost copy-pasted from verifyProofForCircuit
66
69
  const operation = async (bbWorkingDirectory)=>{
67
- const logFunction = (message)=>{
68
- this.logger.debug(`${proofType} BB out - ${message}`);
69
- };
70
70
  const proofPath = path.join(bbWorkingDirectory, PROOF_FILENAME);
71
71
  await writeChonkProofToPath(tx.chonkProof.attachPublicInputs(tx.data.publicInputs().toFields()), proofPath);
72
72
  const verificationKeyPath = path.join(bbWorkingDirectory, VK_FILENAME);
73
73
  const verificationKey = this.getVerificationKeyData(circuit);
74
74
  await fs.writeFile(verificationKeyPath, verificationKey.keyAsBytes);
75
75
  const timer = new Timer();
76
- const result = await verifyChonkProof(this.config.bbBinaryPath, proofPath, verificationKeyPath, logFunction, this.config.bbIVCConcurrency);
76
+ const result = await verifyChonkProof(this.config.bbBinaryPath, proofPath, verificationKeyPath, this.logger, this.config.bbIVCConcurrency);
77
77
  verificationDuration = timer.ms();
78
78
  if (result.status === BB_RESULT.FAILURE) {
79
79
  const errorMessage = `Failed to verify ${proofType} proof for ${circuit}!`;
@@ -1,3 +1,3 @@
1
1
  export * from './bb_verifier.js';
2
2
  export * from './queued_chonk_verifier.js';
3
- //# sourceMappingURL=index.d.ts.map
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy92ZXJpZmllci9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLGtCQUFrQixDQUFDO0FBQ2pDLGNBQWMsNEJBQTRCLENBQUMifQ==
@@ -12,4 +12,4 @@ export declare class QueuedIVCVerifier implements ClientProtocolCircuitVerifier
12
12
  verifyProof(tx: Tx): Promise<IVCProofVerificationResult>;
13
13
  stop(): Promise<void>;
14
14
  }
15
- //# sourceMappingURL=queued_chonk_verifier.d.ts.map
15
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicXVldWVkX2Nob25rX3ZlcmlmaWVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdmVyaWZpZXIvcXVldWVkX2Nob25rX3ZlcmlmaWVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUVBLE9BQU8sS0FBSyxFQUFFLDZCQUE2QixFQUFFLDBCQUEwQixFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFDakgsT0FBTyxLQUFLLEVBQUUsRUFBRSxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFDM0MsT0FBTyxFQU1MLEtBQUssZUFBZSxFQUdyQixNQUFNLHlCQUF5QixDQUFDO0FBSWpDLE9BQU8sS0FBSyxFQUFFLFFBQVEsRUFBRSxNQUFNLGNBQWMsQ0FBQztBQWlFN0MscUJBQWEsaUJBQWtCLFlBQVcsNkJBQTZCO0lBTW5FLE9BQU8sQ0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CAAC;CAGtB"}
1
+ {"version":3,"file":"queued_chonk_verifier.d.ts","sourceRoot":"","sources":["../../src/verifier/queued_chonk_verifier.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,6BAA6B,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AACjH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAML,KAAK,eAAe,EAGrB,MAAM,yBAAyB,CAAC;AAIjC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAiE7C,qBAAa,iBAAkB,YAAW,6BAA6B;IAMnE,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,MAAM;IAPhB,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,OAAO,CAAqB;IAEpC,YACE,MAAM,EAAE,QAAQ,EACR,QAAQ,EAAE,6BAA6B,EACvC,SAAS,GAAE,eAAsC,EACjD,MAAM,yCAAkD,EAMjE;IAEY,WAAW,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAIpE;IAED,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAEpB;CACF"}
@@ -1,6 +1,6 @@
1
1
  import { createLogger } from '@aztec/foundation/log';
2
2
  import { SerialQueue } from '@aztec/foundation/queue';
3
- import { Attributes, Metrics, ValueType, getTelemetryClient } from '@aztec/telemetry-client';
3
+ import { Attributes, Metrics, getTelemetryClient } from '@aztec/telemetry-client';
4
4
  import { createHistogram } from 'node:perf_hooks';
5
5
  class IVCVerifierMetrics {
6
6
  ivcVerificationHistogram;
@@ -17,46 +17,15 @@ class IVCVerifierMetrics {
17
17
  aggDurationMetrics;
18
18
  constructor(client, name = 'QueuedIVCVerifier'){
19
19
  const meter = client.getMeter(name);
20
- this.ivcVerificationHistogram = meter.createHistogram(Metrics.IVC_VERIFIER_TIME, {
21
- unit: 'ms',
22
- description: 'Duration to verify chonk proofs',
23
- valueType: ValueType.INT
24
- });
25
- this.ivcTotalVerificationHistogram = meter.createHistogram(Metrics.IVC_VERIFIER_TOTAL_TIME, {
26
- unit: 'ms',
27
- description: 'Total duration to verify chonk proofs, including serde',
28
- valueType: ValueType.INT
29
- });
30
- this.ivcFailureCount = meter.createUpDownCounter(Metrics.IVC_VERIFIER_FAILURE_COUNT, {
31
- description: 'Count of failed IVC proof verifications',
32
- valueType: ValueType.INT
33
- });
20
+ this.ivcVerificationHistogram = meter.createHistogram(Metrics.IVC_VERIFIER_TIME);
21
+ this.ivcTotalVerificationHistogram = meter.createHistogram(Metrics.IVC_VERIFIER_TOTAL_TIME);
22
+ this.ivcFailureCount = meter.createUpDownCounter(Metrics.IVC_VERIFIER_FAILURE_COUNT);
34
23
  this.aggDurationMetrics = {
35
- avg: meter.createObservableGauge(Metrics.IVC_VERIFIER_AGG_DURATION_AVG, {
36
- valueType: ValueType.DOUBLE,
37
- description: 'AVG ivc verification',
38
- unit: 'ms'
39
- }),
40
- max: meter.createObservableGauge(Metrics.IVC_VERIFIER_AGG_DURATION_MAX, {
41
- valueType: ValueType.DOUBLE,
42
- description: 'MAX ivc verification',
43
- unit: 'ms'
44
- }),
45
- min: meter.createObservableGauge(Metrics.IVC_VERIFIER_AGG_DURATION_MIN, {
46
- valueType: ValueType.DOUBLE,
47
- description: 'MIN ivc verification',
48
- unit: 'ms'
49
- }),
50
- p50: meter.createObservableGauge(Metrics.IVC_VERIFIER_AGG_DURATION_P50, {
51
- valueType: ValueType.DOUBLE,
52
- description: 'P50 ivc verification',
53
- unit: 'ms'
54
- }),
55
- p90: meter.createObservableGauge(Metrics.IVC_VERIFIER_AGG_DURATION_P90, {
56
- valueType: ValueType.DOUBLE,
57
- description: 'P90 ivc verification',
58
- unit: 'ms'
59
- })
24
+ avg: meter.createObservableGauge(Metrics.IVC_VERIFIER_AGG_DURATION_AVG),
25
+ max: meter.createObservableGauge(Metrics.IVC_VERIFIER_AGG_DURATION_MAX),
26
+ min: meter.createObservableGauge(Metrics.IVC_VERIFIER_AGG_DURATION_MIN),
27
+ p50: meter.createObservableGauge(Metrics.IVC_VERIFIER_AGG_DURATION_P50),
28
+ p90: meter.createObservableGauge(Metrics.IVC_VERIFIER_AGG_DURATION_P90)
60
29
  };
61
30
  meter.addBatchObservableCallback(this.aggregate, Object.values(this.aggDurationMetrics));
62
31
  }
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@aztec/bb-prover",
3
- "version": "0.0.1-commit.b655e406",
3
+ "version": "0.0.1-commit.bf2612ae",
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,8 +25,8 @@
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
31
  "bb": "node --no-warnings ./dest/bb/index.js",
32
32
  "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}"
@@ -69,36 +69,37 @@
69
69
  ]
70
70
  },
71
71
  "dependencies": {
72
- "@aztec/bb.js": "0.0.1-commit.b655e406",
73
- "@aztec/constants": "0.0.1-commit.b655e406",
74
- "@aztec/foundation": "0.0.1-commit.b655e406",
75
- "@aztec/noir-noirc_abi": "0.0.1-commit.b655e406",
76
- "@aztec/noir-protocol-circuits-types": "0.0.1-commit.b655e406",
77
- "@aztec/noir-types": "0.0.1-commit.b655e406",
78
- "@aztec/simulator": "0.0.1-commit.b655e406",
79
- "@aztec/stdlib": "0.0.1-commit.b655e406",
80
- "@aztec/telemetry-client": "0.0.1-commit.b655e406",
81
- "@aztec/world-state": "0.0.1-commit.b655e406",
72
+ "@aztec/bb.js": "0.0.1-commit.bf2612ae",
73
+ "@aztec/constants": "0.0.1-commit.bf2612ae",
74
+ "@aztec/foundation": "0.0.1-commit.bf2612ae",
75
+ "@aztec/noir-noirc_abi": "0.0.1-commit.bf2612ae",
76
+ "@aztec/noir-protocol-circuits-types": "0.0.1-commit.bf2612ae",
77
+ "@aztec/noir-types": "0.0.1-commit.bf2612ae",
78
+ "@aztec/simulator": "0.0.1-commit.bf2612ae",
79
+ "@aztec/stdlib": "0.0.1-commit.bf2612ae",
80
+ "@aztec/telemetry-client": "0.0.1-commit.bf2612ae",
81
+ "@aztec/world-state": "0.0.1-commit.bf2612ae",
82
82
  "commander": "^12.1.0",
83
83
  "pako": "^2.1.0",
84
84
  "source-map-support": "^0.5.21",
85
85
  "tslib": "^2.4.0"
86
86
  },
87
87
  "devDependencies": {
88
- "@aztec/ethereum": "0.0.1-commit.b655e406",
89
- "@aztec/kv-store": "0.0.1-commit.b655e406",
90
- "@aztec/noir-contracts.js": "0.0.1-commit.b655e406",
91
- "@aztec/noir-test-contracts.js": "0.0.1-commit.b655e406",
92
- "@aztec/protocol-contracts": "0.0.1-commit.b655e406",
88
+ "@aztec/ethereum": "0.0.1-commit.bf2612ae",
89
+ "@aztec/kv-store": "0.0.1-commit.bf2612ae",
90
+ "@aztec/noir-contracts.js": "0.0.1-commit.bf2612ae",
91
+ "@aztec/noir-test-contracts.js": "0.0.1-commit.bf2612ae",
92
+ "@aztec/protocol-contracts": "0.0.1-commit.bf2612ae",
93
93
  "@jest/globals": "^30.0.0",
94
94
  "@types/jest": "^30.0.0",
95
95
  "@types/node": "^22.15.17",
96
96
  "@types/source-map-support": "^0.5.10",
97
+ "@typescript/native-preview": "7.0.0-dev.20260113.1",
97
98
  "jest": "^30.0.0",
98
99
  "jest-mock-extended": "^4.0.0",
99
100
  "ts-node": "^10.9.1",
100
101
  "typescript": "^5.3.3",
101
- "viem": "npm:@spalladino/viem@2.38.2-eip7594.0"
102
+ "viem": "npm:@aztec/viem@2.38.2"
102
103
  },
103
104
  "files": [
104
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';
@@ -18,14 +18,7 @@ import fs from 'node:fs/promises';
18
18
  import { tmpdir } from 'node:os';
19
19
  import path from 'path';
20
20
 
21
- import {
22
- type BBResult,
23
- type BBSuccess,
24
- BB_RESULT,
25
- VK_FILENAME,
26
- generateAvmProof,
27
- verifyAvmProof,
28
- } from '../bb/execute.js';
21
+ import { type BBResult, type BBSuccess, BB_RESULT, generateAvmProof, verifyAvmProof } from '../bb/execute.js';
29
22
 
30
23
  const BB_PATH = path.resolve('../../barretenberg/cpp/build/bin/bb-avm');
31
24
 
@@ -88,6 +81,16 @@ class InterceptingLogger implements Logger {
88
81
  }
89
82
  }
90
83
 
84
+ // Config with collectHints enabled for proving tests
85
+ const provingConfig: PublicSimulatorConfig = PublicSimulatorConfig.from({
86
+ skipFeeEnforcement: false,
87
+ collectCallMetadata: true, // For results.
88
+ collectDebugLogs: false,
89
+ collectHints: true, // Required for proving!
90
+ collectPublicInputs: true, // Required for proving!
91
+ collectStatistics: false,
92
+ });
93
+
91
94
  export class AvmProvingTester extends PublicTxSimulationTester {
92
95
  private bbWorkingDirectory: string = '';
93
96
 
@@ -98,7 +101,8 @@ export class AvmProvingTester extends PublicTxSimulationTester {
98
101
  globals?: GlobalVariables,
99
102
  metrics?: TestExecutorMetrics,
100
103
  ) {
101
- super(merkleTrees, contractDataSource, globals, metrics);
104
+ // simulator factory is undefined because for proving, we use the default C++ simulator
105
+ super(merkleTrees, contractDataSource, globals, metrics, /*simulatorFactory=*/ undefined, provingConfig);
102
106
  }
103
107
 
104
108
  static async new(
@@ -182,14 +186,7 @@ export class AvmProvingTester extends PublicTxSimulationTester {
182
186
  return proofRes;
183
187
  }
184
188
 
185
- return await verifyAvmProof(
186
- BB_PATH,
187
- this.bbWorkingDirectory,
188
- proofRes.proofPath!,
189
- publicInputs,
190
- path.join(proofRes.vkDirectoryPath!, VK_FILENAME),
191
- this.logger,
192
- );
189
+ return await verifyAvmProof(BB_PATH, this.bbWorkingDirectory, proofRes.proofPath!, publicInputs, this.logger);
193
190
  }
194
191
 
195
192
  public async proveVerify(avmCircuitInputs: AvmCircuitInputs, txLabel: string = 'unlabeledTx') {
@@ -211,6 +208,7 @@ export class AvmProvingTester extends PublicTxSimulationTester {
211
208
  txLabel: string = 'unlabeledTx',
212
209
  disableRevertCheck: boolean = false,
213
210
  ): Promise<PublicTxResult> {
211
+ const simTimer = new Timer();
214
212
  const simRes = await this.simulateTx(
215
213
  sender,
216
214
  setupCalls,
@@ -220,6 +218,8 @@ export class AvmProvingTester extends PublicTxSimulationTester {
220
218
  privateInsertions,
221
219
  txLabel,
222
220
  );
221
+ const simDuration = simTimer.ms();
222
+ this.logger.info(`Simulation took ${simDuration} ms for tx ${txLabel}`);
223
223
 
224
224
  if (!disableRevertCheck) {
225
225
  expect(simRes.revertCode.isOK()).toBe(expectRevert ? false : true);
@@ -227,7 +227,7 @@ export class AvmProvingTester extends PublicTxSimulationTester {
227
227
 
228
228
  const opString = this.checkCircuitOnly ? 'Check circuit' : 'Proving and verification';
229
229
 
230
- const avmCircuitInputs = simRes.avmProvingRequest.inputs;
230
+ const avmCircuitInputs = new AvmCircuitInputs(simRes.hints!, simRes.publicInputs!);
231
231
  const timer = new Timer();
232
232
  await this.proveVerify(avmCircuitInputs, txLabel);
233
233
  this.logger.info(`${opString} took ${timer.ms()} ms for tx ${txLabel}`);
package/src/bb/execute.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { sha256 } from '@aztec/foundation/crypto';
1
+ import { sha256 } from '@aztec/foundation/crypto/sha256';
2
2
  import type { LogFn, Logger } from '@aztec/foundation/log';
3
3
  import { Timer } from '@aztec/foundation/timer';
4
4
  import type { AvmCircuitInputs, AvmCircuitPublicInputs } from '@aztec/stdlib/avm';
@@ -6,6 +6,7 @@ import type { AvmCircuitInputs, AvmCircuitPublicInputs } from '@aztec/stdlib/avm
6
6
  import * as proc from 'child_process';
7
7
  import { promises as fs } from 'fs';
8
8
  import { basename, dirname, join } from 'path';
9
+ import readline from 'readline';
9
10
 
10
11
  import type { UltraHonkFlavor } from '../honk.js';
11
12
 
@@ -85,6 +86,7 @@ export function executeBB(
85
86
  logger(`BB concurrency: ${env.HARDWARE_CONCURRENCY}`);
86
87
  logger(`Executing BB with: ${pathToBB} ${command} ${args.join(' ')}`);
87
88
  const bb = proc.spawn(pathToBB, [command, ...args], {
89
+ stdio: ['ignore', 'pipe', 'pipe'],
88
90
  env,
89
91
  });
90
92
 
@@ -99,14 +101,9 @@ export function executeBB(
99
101
  }, timeout);
100
102
  }
101
103
 
102
- bb.stdout.on('data', data => {
103
- const message = data.toString('utf-8').replace(/\n$/, '');
104
- logger(message);
105
- });
106
- bb.stderr.on('data', data => {
107
- const message = data.toString('utf-8').replace(/\n$/, '');
108
- logger(message);
109
- });
104
+ readline.createInterface({ input: bb.stdout }).on('line', logger);
105
+ readline.createInterface({ input: bb.stderr }).on('line', logger);
106
+
110
107
  bb.on('close', (exitCode: number, signal?: string) => {
111
108
  if (timeoutId) {
112
109
  clearTimeout(timeoutId);
@@ -356,7 +353,7 @@ export async function generateAvmProof(
356
353
  durationMs: duration,
357
354
  proofPath: join(outputPath, PROOF_FILENAME),
358
355
  pkPath: undefined,
359
- vkDirectoryPath: outputPath,
356
+ vkDirectoryPath: undefined, // AVM VK is fixed in the binary.
360
357
  };
361
358
  }
362
359
  // Not a great error message here but it is difficult to decipher what comes from bb
@@ -375,7 +372,7 @@ export async function generateAvmProof(
375
372
  * @param pathToBB - The full path to the bb binary
376
373
  * @param proofFullPath - The full path to the proof to be verified
377
374
  * @param verificationKeyPath - The full path to the circuit verification key
378
- * @param log - A logging function
375
+ * @param logger - A logger
379
376
  * @returns An object containing a result indication and duration taken
380
377
  */
381
378
  export async function verifyProof(
@@ -383,16 +380,25 @@ export async function verifyProof(
383
380
  proofFullPath: string,
384
381
  verificationKeyPath: string,
385
382
  ultraHonkFlavor: UltraHonkFlavor,
386
- log: Logger,
383
+ logger: Logger,
387
384
  ): Promise<BBFailure | BBSuccess> {
388
- return await verifyProofInternal(
389
- pathToBB,
385
+ // Specify the public inputs path in the case of UH verification.
386
+ // Take proofFullPath and remove the suffix past the / to get the directory.
387
+ const proofDir = proofFullPath.substring(0, proofFullPath.lastIndexOf('/'));
388
+ const publicInputsFullPath = join(proofDir, '/public_inputs');
389
+ logger.debug(`public inputs path: ${publicInputsFullPath}`);
390
+
391
+ const args = [
392
+ '-p',
390
393
  proofFullPath,
394
+ '-k',
391
395
  verificationKeyPath,
392
- `verify`,
393
- log,
394
- getArgs(ultraHonkFlavor),
395
- );
396
+ '-i',
397
+ publicInputsFullPath,
398
+ '--disable_zk',
399
+ ...getArgs(ultraHonkFlavor),
400
+ ];
401
+ return await verifyProofInternal(pathToBB, `verify`, args, logger);
396
402
  }
397
403
 
398
404
  export async function verifyAvmProof(
@@ -400,7 +406,6 @@ export async function verifyAvmProof(
400
406
  workingDirectory: string,
401
407
  proofFullPath: string,
402
408
  publicInputs: AvmCircuitPublicInputs,
403
- verificationKeyPath: string,
404
409
  logger: Logger,
405
410
  ): Promise<BBFailure | BBSuccess> {
406
411
  const inputsBuffer = publicInputs.serializeWithMessagePack();
@@ -417,10 +422,8 @@ export async function verifyAvmProof(
417
422
  return { status: BB_RESULT.FAILURE, reason: `Could not write avm inputs to ${avmInputsPath}` };
418
423
  }
419
424
 
420
- return await verifyProofInternal(pathToBB, proofFullPath, verificationKeyPath, 'avm_verify', logger, [
421
- '--avm-public-inputs',
422
- avmInputsPath,
423
- ]);
425
+ const args = ['-p', proofFullPath, '--avm-public-inputs', avmInputsPath];
426
+ return await verifyProofInternal(pathToBB, 'avm_verify', args, logger);
424
427
  }
425
428
 
426
429
  /**
@@ -428,7 +431,7 @@ export async function verifyAvmProof(
428
431
  * TODO(#7370) The verification keys should be supplied separately
429
432
  * @param pathToBB - The full path to the bb binary
430
433
  * @param targetPath - The path to the folder with the proof, accumulator, and verification keys
431
- * @param log - A logging function
434
+ * @param logger - A logger
432
435
  * @param concurrency - The number of threads to use for the verification
433
436
  * @returns An object containing a result indication and duration taken
434
437
  */
@@ -436,7 +439,7 @@ export async function verifyChonkProof(
436
439
  pathToBB: string,
437
440
  proofPath: string,
438
441
  keyPath: string,
439
- log: LogFn,
442
+ logger: Logger,
440
443
  concurrency = 1,
441
444
  ): Promise<BBFailure | BBSuccess> {
442
445
  const binaryPresent = await fs
@@ -447,43 +450,25 @@ export async function verifyChonkProof(
447
450
  return { status: BB_RESULT.FAILURE, reason: `Failed to find bb binary at ${pathToBB}` };
448
451
  }
449
452
 
450
- try {
451
- const args = ['--scheme', 'chonk', '-p', proofPath, '-k', keyPath, '-v'];
452
- const timer = new Timer();
453
- const command = 'verify';
454
-
455
- const result = await executeBB(pathToBB, command, args, log, concurrency);
456
- const duration = timer.ms();
457
- if (result.status == BB_RESULT.SUCCESS) {
458
- return { status: BB_RESULT.SUCCESS, durationMs: duration };
459
- }
460
- // Not a great error message here but it is difficult to decipher what comes from bb
461
- return {
462
- status: BB_RESULT.FAILURE,
463
- reason: `Failed to verify proof. Exit code ${result.exitCode}. Signal ${result.signal}.`,
464
- retry: !!result.signal,
465
- };
466
- } catch (error) {
467
- return { status: BB_RESULT.FAILURE, reason: `${error}` };
468
- }
453
+ const args = ['--scheme', 'chonk', '-p', proofPath, '-k', keyPath, '-v'];
454
+ return await verifyProofInternal(pathToBB, 'verify', args, logger, concurrency);
469
455
  }
470
456
 
471
457
  /**
472
458
  * Used for verifying proofs with BB
473
459
  * @param pathToBB - The full path to the bb binary
474
- * @param proofFullPath - The full path to the proof to be verified
475
- * @param verificationKeyPath - The full path to the circuit verification key
476
460
  * @param command - The BB command to execute (verify/avm_verify)
477
- * @param log - A logging function
461
+ * @param args - The arguments to pass to the command
462
+ * @param logger - A logger
463
+ * @param concurrency - The number of threads to use for the verification
478
464
  * @returns An object containing a result indication and duration taken
479
465
  */
480
466
  async function verifyProofInternal(
481
467
  pathToBB: string,
482
- proofFullPath: string,
483
- verificationKeyPath: string,
484
468
  command: 'verify' | 'avm_verify',
469
+ args: string[],
485
470
  logger: Logger,
486
- extraArgs: string[] = [],
471
+ concurrency?: number,
487
472
  ): Promise<BBFailure | BBSuccess> {
488
473
  const binaryPresent = await fs
489
474
  .access(pathToBB, fs.constants.R_OK)
@@ -498,28 +483,12 @@ async function verifyProofInternal(
498
483
  };
499
484
 
500
485
  try {
501
- let args;
502
-
503
- if (command == 'verify') {
504
- // Specify the public inputs path in the case of UH verification.
505
- // Take proofFullPath and remove the suffix past the / to get the directory.
506
- const proofDir = proofFullPath.substring(0, proofFullPath.lastIndexOf('/'));
507
- const publicInputsFullPath = join(proofDir, '/public_inputs');
508
- logger.debug(`public inputs path: ${publicInputsFullPath}`);
509
-
510
- args = ['-p', proofFullPath, '-k', verificationKeyPath, '-i', publicInputsFullPath, '--disable_zk', ...extraArgs];
511
- } else {
512
- args = ['-p', proofFullPath, '-k', verificationKeyPath, ...extraArgs];
513
- }
514
-
515
486
  const loggingArg =
516
487
  logger.level === 'debug' || logger.level === 'trace' ? '-d' : logger.level === 'verbose' ? '-v' : '';
517
- if (loggingArg !== '') {
518
- args.push(loggingArg);
519
- }
488
+ const finalArgs = loggingArg !== '' ? [...args, loggingArg] : args;
520
489
 
521
490
  const timer = new Timer();
522
- const result = await executeBB(pathToBB, command, args, logFunction);
491
+ const result = await executeBB(pathToBB, command, finalArgs, logFunction, concurrency);
523
492
  const duration = timer.ms();
524
493
  if (result.status == BB_RESULT.SUCCESS) {
525
494
  return { status: BB_RESULT.SUCCESS, durationMs: duration };
@@ -7,7 +7,6 @@ import {
7
7
  Metrics,
8
8
  type TelemetryClient,
9
9
  type Tracer,
10
- ValueType,
11
10
  } from '@aztec/telemetry-client';
12
11
 
13
12
  /**
@@ -31,51 +30,21 @@ export class ProverInstrumentation {
31
30
  this.tracer = telemetry.getTracer(name);
32
31
  const meter = telemetry.getMeter(name);
33
32
 
34
- this.simulationDuration = meter.createHistogram(Metrics.CIRCUIT_SIMULATION_DURATION, {
35
- description: 'Records how long it takes to simulate a circuit',
36
- unit: 'ms',
37
- valueType: ValueType.INT,
38
- });
33
+ this.simulationDuration = meter.createHistogram(Metrics.CIRCUIT_SIMULATION_DURATION);
39
34
 
40
- this.witGenDuration = meter.createHistogram(Metrics.CIRCUIT_WITNESS_GEN_DURATION, {
41
- description: 'Records how long it takes to generate the partial witness for a circuit',
42
- unit: 's',
43
- valueType: ValueType.DOUBLE,
44
- });
35
+ this.witGenDuration = meter.createHistogram(Metrics.CIRCUIT_WITNESS_GEN_DURATION);
45
36
 
46
- this.provingDuration = meter.createHistogram(Metrics.CIRCUIT_PROVING_DURATION, {
47
- unit: 's',
48
- description: 'Records how long it takes to prove a circuit',
49
- valueType: ValueType.DOUBLE,
50
- });
37
+ this.provingDuration = meter.createHistogram(Metrics.CIRCUIT_PROVING_DURATION);
51
38
 
52
- this.witGenInputSize = meter.createGauge(Metrics.CIRCUIT_WITNESS_GEN_INPUT_SIZE, {
53
- unit: 'By',
54
- description: 'Records the size of the input to the witness generation',
55
- valueType: ValueType.INT,
56
- });
39
+ this.witGenInputSize = meter.createGauge(Metrics.CIRCUIT_WITNESS_GEN_INPUT_SIZE);
57
40
 
58
- this.witGenOutputSize = meter.createGauge(Metrics.CIRCUIT_WITNESS_GEN_OUTPUT_SIZE, {
59
- unit: 'By',
60
- description: 'Records the size of the output of the witness generation',
61
- valueType: ValueType.INT,
62
- });
41
+ this.witGenOutputSize = meter.createGauge(Metrics.CIRCUIT_WITNESS_GEN_OUTPUT_SIZE);
63
42
 
64
- this.proofSize = meter.createGauge(Metrics.CIRCUIT_PROVING_PROOF_SIZE, {
65
- unit: 'By',
66
- description: 'Records the size of the proof generated for a circuit',
67
- valueType: ValueType.INT,
68
- });
43
+ this.proofSize = meter.createGauge(Metrics.CIRCUIT_PROVING_PROOF_SIZE);
69
44
 
70
- this.circuitPublicInputCount = meter.createGauge(Metrics.CIRCUIT_PUBLIC_INPUTS_COUNT, {
71
- description: 'Records the number of public inputs in a circuit',
72
- valueType: ValueType.INT,
73
- });
45
+ this.circuitPublicInputCount = meter.createGauge(Metrics.CIRCUIT_PUBLIC_INPUTS_COUNT);
74
46
 
75
- this.circuitSize = meter.createGauge(Metrics.CIRCUIT_SIZE, {
76
- description: 'Records the size of the circuit in gates',
77
- valueType: ValueType.INT,
78
- });
47
+ this.circuitSize = meter.createGauge(Metrics.CIRCUIT_SIZE);
79
48
  }
80
49
 
81
50
  /**