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

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 (66) 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 +2 -1
  4. package/dest/bb/cli.d.ts +1 -1
  5. package/dest/bb/execute.d.ts +1 -1
  6. package/dest/bb/execute.d.ts.map +1 -1
  7. package/dest/bb/execute.js +12 -8
  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/prover/client/bb_private_kernel_prover.d.ts +3 -3
  15. package/dest/prover/client/bb_private_kernel_prover.d.ts.map +1 -1
  16. package/dest/prover/client/bb_private_kernel_prover.js +24 -5
  17. package/dest/prover/client/bundle.d.ts +6 -0
  18. package/dest/prover/client/bundle.d.ts.map +1 -0
  19. package/dest/prover/client/bundle.js +8 -0
  20. package/dest/prover/client/lazy.d.ts +6 -0
  21. package/dest/prover/client/lazy.d.ts.map +1 -0
  22. package/dest/prover/client/lazy.js +8 -0
  23. package/dest/prover/index.d.ts +1 -1
  24. package/dest/prover/proof_utils.d.ts +1 -1
  25. package/dest/prover/server/bb_prover.d.ts +1 -10
  26. package/dest/prover/server/bb_prover.d.ts.map +1 -1
  27. package/dest/test/delay_values.d.ts +1 -1
  28. package/dest/test/delay_values.js +13 -13
  29. package/dest/test/index.d.ts +1 -1
  30. package/dest/test/test_circuit_prover.d.ts +1 -1
  31. package/dest/test/test_circuit_prover.d.ts.map +1 -1
  32. package/dest/test/test_verifier.d.ts +3 -1
  33. package/dest/test/test_verifier.d.ts.map +1 -1
  34. package/dest/test/test_verifier.js +15 -0
  35. package/dest/verification_key/verification_key_data.d.ts +1 -1
  36. package/dest/verifier/bb_verifier.d.ts +1 -1
  37. package/dest/verifier/bb_verifier.d.ts.map +1 -1
  38. package/dest/verifier/bb_verifier.js +3 -0
  39. package/dest/verifier/index.d.ts +1 -1
  40. package/dest/verifier/queued_chonk_verifier.d.ts +1 -1
  41. package/dest/verifier/queued_chonk_verifier.d.ts.map +1 -1
  42. package/package.json +23 -22
  43. package/src/avm_proving_tests/avm_proving_tester.ts +2 -2
  44. package/src/bb/execute.ts +5 -8
  45. package/src/prover/client/bb_private_kernel_prover.ts +29 -5
  46. package/src/prover/client/bundle.ts +11 -0
  47. package/src/prover/client/lazy.ts +11 -0
  48. package/src/test/delay_values.ts +13 -13
  49. package/src/test/test_verifier.ts +8 -0
  50. package/src/verifier/bb_verifier.ts +3 -0
  51. package/dest/prover/client/native/bb_native_private_kernel_prover.d.ts +0 -23
  52. package/dest/prover/client/native/bb_native_private_kernel_prover.d.ts.map +0 -1
  53. package/dest/prover/client/native/bb_native_private_kernel_prover.js +0 -66
  54. package/dest/prover/client/wasm/bb_wasm_private_kernel_prover.d.ts +0 -15
  55. package/dest/prover/client/wasm/bb_wasm_private_kernel_prover.d.ts.map +0 -1
  56. package/dest/prover/client/wasm/bb_wasm_private_kernel_prover.js +0 -46
  57. package/dest/prover/client/wasm/bundle.d.ts +0 -6
  58. package/dest/prover/client/wasm/bundle.d.ts.map +0 -1
  59. package/dest/prover/client/wasm/bundle.js +0 -8
  60. package/dest/prover/client/wasm/lazy.d.ts +0 -6
  61. package/dest/prover/client/wasm/lazy.d.ts.map +0 -1
  62. package/dest/prover/client/wasm/lazy.js +0 -8
  63. package/src/prover/client/native/bb_native_private_kernel_prover.ts +0 -105
  64. package/src/prover/client/wasm/bb_wasm_private_kernel_prover.ts +0 -58
  65. package/src/prover/client/wasm/bundle.ts +0 -11
  66. package/src/prover/client/wasm/lazy.ts +0 -11
@@ -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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicXVldWVkX2Nob25rX3ZlcmlmaWVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdmVyaWZpZXIvcXVldWVkX2Nob25rX3ZlcmlmaWVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUVBLE9BQU8sS0FBSyxFQUFFLDZCQUE2QixFQUFFLDBCQUEwQixFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFDakgsT0FBTyxLQUFLLEVBQUUsRUFBRSxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFDM0MsT0FBTyxFQU1MLEtBQUssZUFBZSxFQUlyQixNQUFNLHlCQUF5QixDQUFDO0FBSWpDLE9BQU8sS0FBSyxFQUFFLFFBQVEsRUFBRSxNQUFNLGNBQWMsQ0FBQztBQWdHN0MscUJBQWEsaUJBQWtCLFlBQVcsNkJBQTZCO0lBTW5FLE9BQU8sQ0FBQyxRQUFRO0lBQ2hCLE9BQU8sQ0FBQyxTQUFTO0lBQ2pCLE9BQU8sQ0FBQyxNQUFNO0lBUGhCLE9BQU8sQ0FBQyxLQUFLLENBQWM7SUFDM0IsT0FBTyxDQUFDLE9BQU8sQ0FBcUI7SUFFcEMsWUFDRSxNQUFNLEVBQUUsUUFBUSxFQUNSLFFBQVEsRUFBRSw2QkFBNkIsRUFDdkMsU0FBUyxHQUFFLGVBQXNDLEVBQ2pELE1BQU0seUNBQWtELEVBTWpFO0lBRVksV0FBVyxDQUFDLEVBQUUsRUFBRSxFQUFFLEdBQUcsT0FBTyxDQUFDLDBCQUEwQixDQUFDLENBSXBFO0lBRUQsSUFBSSxJQUFJLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FFcEI7Q0FDRiJ9
@@ -1 +1 @@
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,EAIrB,MAAM,yBAAyB,CAAC;AAIjC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAgG7C,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;gBAGlC,MAAM,EAAE,QAAQ,EACR,QAAQ,EAAE,6BAA6B,EACvC,SAAS,GAAE,eAAsC,EACjD,MAAM,yCAAkD;IAQrD,WAAW,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAMrE,IAAI,IAAI,OAAO,CAAC,IAAI,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,EAIrB,MAAM,yBAAyB,CAAC;AAIjC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAgG7C,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"}
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.fce3e4f",
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 && tsgo -b",
29
+ "build:dev": "tsgo -b --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.fce3e4f",
73
+ "@aztec/constants": "0.0.1-commit.fce3e4f",
74
+ "@aztec/foundation": "0.0.1-commit.fce3e4f",
75
+ "@aztec/noir-noirc_abi": "0.0.1-commit.fce3e4f",
76
+ "@aztec/noir-protocol-circuits-types": "0.0.1-commit.fce3e4f",
77
+ "@aztec/noir-types": "0.0.1-commit.fce3e4f",
78
+ "@aztec/simulator": "0.0.1-commit.fce3e4f",
79
+ "@aztec/stdlib": "0.0.1-commit.fce3e4f",
80
+ "@aztec/telemetry-client": "0.0.1-commit.fce3e4f",
81
+ "@aztec/world-state": "0.0.1-commit.fce3e4f",
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.fce3e4f",
89
+ "@aztec/kv-store": "0.0.1-commit.fce3e4f",
90
+ "@aztec/noir-contracts.js": "0.0.1-commit.fce3e4f",
91
+ "@aztec/noir-test-contracts.js": "0.0.1-commit.fce3e4f",
92
+ "@aztec/protocol-contracts": "0.0.1-commit.fce3e4f",
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.20251126.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 } 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';
@@ -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
@@ -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);
@@ -1,4 +1,7 @@
1
+ import { AztecClientBackend, Barretenberg } from '@aztec/bb.js';
1
2
  import { createLogger } from '@aztec/foundation/log';
3
+ import { Timer } from '@aztec/foundation/timer';
4
+ import { serializeWitness } from '@aztec/noir-noirc_abi';
2
5
  import {
3
6
  convertHidingKernelPublicInputsToWitnessMapWithAbi,
4
7
  convertHidingKernelToRollupInputsToWitnessMapWithAbi,
@@ -37,9 +40,11 @@ import type {
37
40
  PrivateKernelTailCircuitPublicInputs,
38
41
  } from '@aztec/stdlib/kernel';
39
42
  import type { NoirCompiledCircuitWithName } from '@aztec/stdlib/noir';
40
- import type { ChonkProofWithPublicInputs } from '@aztec/stdlib/proofs';
43
+ import { ChonkProofWithPublicInputs } from '@aztec/stdlib/proofs';
41
44
  import type { CircuitSimulationStats, CircuitWitnessGenerationStats } from '@aztec/stdlib/stats';
42
45
 
46
+ import { ungzip } from 'pako';
47
+
43
48
  export abstract class BBPrivateKernelProver implements PrivateKernelProver {
44
49
  constructor(
45
50
  protected artifactProvider: ArtifactProvider,
@@ -263,11 +268,30 @@ export abstract class BBPrivateKernelProver implements PrivateKernelProver {
263
268
  return kernelProofOutput;
264
269
  }
265
270
 
266
- public createChonkProof(_executionSteps: PrivateExecutionStep[]): Promise<ChonkProofWithPublicInputs> {
267
- throw new Error('Not implemented');
271
+ public async createChonkProof(executionSteps: PrivateExecutionStep[]): Promise<ChonkProofWithPublicInputs> {
272
+ const timer = new Timer();
273
+ this.log.info(`Generating ClientIVC proof...`);
274
+ const backend = new AztecClientBackend(
275
+ executionSteps.map(step => ungzip(step.bytecode)),
276
+ await Barretenberg.initSingleton(),
277
+ );
278
+
279
+ const [proof] = await backend.prove(
280
+ executionSteps.map(step => ungzip(serializeWitness(step.witness))),
281
+ executionSteps.map(step => step.vk),
282
+ );
283
+ this.log.info(`Generated ClientIVC proof`, {
284
+ eventName: 'client-ivc-proof-generation',
285
+ duration: timer.ms(),
286
+ proofSize: proof.length,
287
+ });
288
+ return ChonkProofWithPublicInputs.fromBufferArray(proof);
268
289
  }
269
290
 
270
- public computeGateCountForCircuit(_bytecode: Buffer, _circuitName: string): Promise<number> {
271
- throw new Error('Not implemented');
291
+ public async computeGateCountForCircuit(_bytecode: Buffer, _circuitName: string): Promise<number> {
292
+ // Note we do not pass the vk to the backend. This is unneeded for gate counts.
293
+ const backend = new AztecClientBackend([ungzip(_bytecode)], await Barretenberg.initSingleton());
294
+ const gateCount = await backend.gates();
295
+ return gateCount[0];
272
296
  }
273
297
  }
@@ -0,0 +1,11 @@
1
+ import { createLogger } from '@aztec/foundation/log';
2
+ import { BundleArtifactProvider } from '@aztec/noir-protocol-circuits-types/client/bundle';
3
+ import type { CircuitSimulator } from '@aztec/simulator/client';
4
+
5
+ import { BBPrivateKernelProver } from './bb_private_kernel_prover.js';
6
+
7
+ export class BBBundlePrivateKernelProver extends BBPrivateKernelProver {
8
+ constructor(simulator: CircuitSimulator, log = createLogger('bb-prover:bundle')) {
9
+ super(new BundleArtifactProvider(), simulator, log);
10
+ }
11
+ }
@@ -0,0 +1,11 @@
1
+ import { createLogger } from '@aztec/foundation/log';
2
+ import { LazyArtifactProvider } from '@aztec/noir-protocol-circuits-types/client/lazy';
3
+ import type { CircuitSimulator } from '@aztec/simulator/client';
4
+
5
+ import { BBPrivateKernelProver } from './bb_private_kernel_prover.js';
6
+
7
+ export class BBLazyPrivateKernelProver extends BBPrivateKernelProver {
8
+ constructor(simulator: CircuitSimulator, log = createLogger('bb-prover:lazy')) {
9
+ super(new LazyArtifactProvider(), simulator, log);
10
+ }
11
+ }
@@ -1,43 +1,43 @@
1
1
  import { ProvingRequestType } from '@aztec/stdlib/proofs';
2
2
 
3
3
  export const WITGEN_DELAY_MS: Record<ProvingRequestType, number> = {
4
- [ProvingRequestType.PARITY_BASE]: 60,
5
- [ProvingRequestType.BLOCK_MERGE_ROLLUP]: 650,
4
+ [ProvingRequestType.PARITY_BASE]: 2000,
5
+ [ProvingRequestType.BLOCK_MERGE_ROLLUP]: 30,
6
6
  [ProvingRequestType.BLOCK_ROOT_FIRST_ROLLUP]: 60_000,
7
7
  [ProvingRequestType.BLOCK_ROOT_SINGLE_TX_FIRST_ROLLUP]: 40_000,
8
- [ProvingRequestType.BLOCK_ROOT_EMPTY_TX_FIRST_ROLLUP]: 20_000,
8
+ [ProvingRequestType.BLOCK_ROOT_EMPTY_TX_FIRST_ROLLUP]: 18,
9
9
  [ProvingRequestType.BLOCK_ROOT_ROLLUP]: 40_000,
10
10
  [ProvingRequestType.BLOCK_ROOT_SINGLE_TX_ROLLUP]: 20_000,
11
11
  [ProvingRequestType.CHECKPOINT_ROOT_ROLLUP]: 40_000,
12
- [ProvingRequestType.CHECKPOINT_ROOT_SINGLE_BLOCK_ROLLUP]: 20_000,
12
+ [ProvingRequestType.CHECKPOINT_ROOT_SINGLE_BLOCK_ROLLUP]: 36_000,
13
13
  [ProvingRequestType.CHECKPOINT_PADDING_ROLLUP]: 0,
14
- [ProvingRequestType.CHECKPOINT_MERGE_ROLLUP]: 650,
14
+ [ProvingRequestType.CHECKPOINT_MERGE_ROLLUP]: 30,
15
15
  [ProvingRequestType.TX_MERGE_ROLLUP]: 0,
16
16
  [ProvingRequestType.PRIVATE_TX_BASE_ROLLUP]: 400_000,
17
17
  [ProvingRequestType.PUBLIC_TX_BASE_ROLLUP]: 470_000,
18
- [ProvingRequestType.PARITY_ROOT]: 100,
19
- [ProvingRequestType.ROOT_ROLLUP]: 650,
18
+ [ProvingRequestType.PARITY_ROOT]: 39,
19
+ [ProvingRequestType.ROOT_ROLLUP]: 35,
20
20
  [ProvingRequestType.PUBLIC_CHONK_VERIFIER]: 0,
21
21
  [ProvingRequestType.PUBLIC_VM]: 0,
22
22
  };
23
23
 
24
24
  export const PROOF_DELAY_MS: Record<ProvingRequestType, number> = {
25
- [ProvingRequestType.PARITY_BASE]: 3_000,
25
+ [ProvingRequestType.PARITY_BASE]: 14_000,
26
26
  [ProvingRequestType.BLOCK_MERGE_ROLLUP]: 15_000,
27
27
  [ProvingRequestType.BLOCK_ROOT_FIRST_ROLLUP]: 55_000,
28
28
  [ProvingRequestType.BLOCK_ROOT_SINGLE_TX_FIRST_ROLLUP]: 35_000,
29
- [ProvingRequestType.BLOCK_ROOT_EMPTY_TX_FIRST_ROLLUP]: 15_000,
29
+ [ProvingRequestType.BLOCK_ROOT_EMPTY_TX_FIRST_ROLLUP]: 4_000,
30
30
  [ProvingRequestType.BLOCK_ROOT_ROLLUP]: 35_000,
31
31
  [ProvingRequestType.BLOCK_ROOT_SINGLE_TX_ROLLUP]: 15_000,
32
32
  [ProvingRequestType.CHECKPOINT_ROOT_ROLLUP]: 35_000,
33
- [ProvingRequestType.CHECKPOINT_ROOT_SINGLE_BLOCK_ROLLUP]: 15_000,
33
+ [ProvingRequestType.CHECKPOINT_ROOT_SINGLE_BLOCK_ROLLUP]: 35_000,
34
34
  [ProvingRequestType.CHECKPOINT_PADDING_ROLLUP]: 0,
35
- [ProvingRequestType.CHECKPOINT_MERGE_ROLLUP]: 15_000,
35
+ [ProvingRequestType.CHECKPOINT_MERGE_ROLLUP]: 9_000,
36
36
  [ProvingRequestType.TX_MERGE_ROLLUP]: 0,
37
37
  [ProvingRequestType.PRIVATE_TX_BASE_ROLLUP]: 145_000,
38
38
  [ProvingRequestType.PUBLIC_TX_BASE_ROLLUP]: 160_000,
39
- [ProvingRequestType.PARITY_ROOT]: 30_000,
40
- [ProvingRequestType.ROOT_ROLLUP]: 15_000,
39
+ [ProvingRequestType.PARITY_ROOT]: 16_000,
40
+ [ProvingRequestType.ROOT_ROLLUP]: 140_000,
41
41
  [ProvingRequestType.PUBLIC_CHONK_VERIFIER]: 30_000,
42
42
  [ProvingRequestType.PUBLIC_VM]: 0,
43
43
  };
@@ -2,7 +2,15 @@ import type { ClientProtocolCircuitVerifier, IVCProofVerificationResult } from '
2
2
  import type { Tx } from '@aztec/stdlib/tx';
3
3
 
4
4
  export class TestCircuitVerifier implements ClientProtocolCircuitVerifier {
5
+ constructor(private verificationDelayMs?: number) {}
5
6
  verifyProof(_tx: Tx): Promise<IVCProofVerificationResult> {
7
+ if (this.verificationDelayMs !== undefined && this.verificationDelayMs > 0) {
8
+ return new Promise(resolve => {
9
+ setTimeout(() => {
10
+ resolve({ valid: true, durationMs: this.verificationDelayMs!, totalDurationMs: this.verificationDelayMs! });
11
+ }, this.verificationDelayMs);
12
+ });
13
+ }
6
14
  return Promise.resolve({ valid: true, durationMs: 0, totalDurationMs: 0 });
7
15
  }
8
16
 
@@ -40,6 +40,9 @@ export class BBCircuitVerifier implements ClientProtocolCircuitVerifier {
40
40
  }
41
41
 
42
42
  public static async new(config: BBConfig, logger = createLogger('bb-prover:verifier')) {
43
+ if (!config.bbWorkingDirectory) {
44
+ throw new Error(`Barretenberg working directory (BB_WORKING_DIRECTORY) is not set`);
45
+ }
43
46
  await fs.mkdir(config.bbWorkingDirectory, { recursive: true });
44
47
  return new BBCircuitVerifier(config, logger);
45
48
  }
@@ -1,23 +0,0 @@
1
- import { type Logger } from '@aztec/foundation/log';
2
- import type { CircuitSimulator } from '@aztec/simulator/server';
3
- import { type PrivateExecutionStep } from '@aztec/stdlib/kernel';
4
- import type { ChonkProofWithPublicInputs } from '@aztec/stdlib/proofs';
5
- import type { BBConfig } from '../../../config.js';
6
- import { BBPrivateKernelProver } from '../bb_private_kernel_prover.js';
7
- /**
8
- * This proof creator implementation uses the native bb binary.
9
- */
10
- export declare class BBNativePrivateKernelProver extends BBPrivateKernelProver {
11
- private bbBinaryPath;
12
- private bbWorkingDirectory;
13
- private skipCleanup;
14
- protected simulator: CircuitSimulator;
15
- protected log: Logger;
16
- private constructor();
17
- static new(config: BBConfig, simulator: CircuitSimulator, log?: Logger): Promise<BBNativePrivateKernelProver>;
18
- private _createChonkProof;
19
- createChonkProof(executionSteps: PrivateExecutionStep[]): Promise<ChonkProofWithPublicInputs>;
20
- computeGateCountForCircuit(bytecode: Buffer, circuitName: string): Promise<number>;
21
- private runInDirectory;
22
- }
23
- //# sourceMappingURL=bb_native_private_kernel_prover.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bb_native_private_kernel_prover.d.ts","sourceRoot":"","sources":["../../../../src/prover/client/native/bb_native_private_kernel_prover.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAElE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,KAAK,oBAAoB,EAAkC,MAAM,sBAAsB,CAAC;AACjG,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAMvE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAEvE;;GAEG;AACH,qBAAa,2BAA4B,SAAQ,qBAAqB;IAElE,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,kBAAkB;IAC1B,OAAO,CAAC,WAAW;cACA,SAAS,EAAE,gBAAgB;cAC3B,GAAG;IALxB,OAAO;WAUa,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,gBAAgB,EAAE,GAAG,CAAC,EAAE,MAAM;YAWrE,iBAAiB;IAuBT,gBAAgB,CAAC,cAAc,EAAE,oBAAoB,EAAE,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAQ7F,0BAA0B,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAoBxG,OAAO,CAAC,cAAc;CAavB"}
@@ -1,66 +0,0 @@
1
- import { runInDirectory } from '@aztec/foundation/fs';
2
- import { createLogger } from '@aztec/foundation/log';
3
- import { BundleArtifactProvider } from '@aztec/noir-protocol-circuits-types/client/bundle';
4
- import { serializePrivateExecutionSteps } from '@aztec/stdlib/kernel';
5
- import { promises as fs } from 'fs';
6
- import path from 'path';
7
- import { BB_RESULT, computeGateCountForCircuit, executeBbChonkProof } from '../../../bb/execute.js';
8
- import { readChonkProofFromOutputDirectory } from '../../proof_utils.js';
9
- import { BBPrivateKernelProver } from '../bb_private_kernel_prover.js';
10
- /**
11
- * This proof creator implementation uses the native bb binary.
12
- */ export class BBNativePrivateKernelProver extends BBPrivateKernelProver {
13
- bbBinaryPath;
14
- bbWorkingDirectory;
15
- skipCleanup;
16
- simulator;
17
- log;
18
- constructor(bbBinaryPath, bbWorkingDirectory, skipCleanup, simulator, log = createLogger('bb-prover:native')){
19
- super(new BundleArtifactProvider(), simulator, log), this.bbBinaryPath = bbBinaryPath, this.bbWorkingDirectory = bbWorkingDirectory, this.skipCleanup = skipCleanup, this.simulator = simulator, this.log = log;
20
- }
21
- static async new(config, simulator, log) {
22
- await fs.mkdir(config.bbWorkingDirectory, {
23
- recursive: true
24
- });
25
- return new BBNativePrivateKernelProver(config.bbBinaryPath, config.bbWorkingDirectory, !!config.bbSkipCleanup, simulator, log);
26
- }
27
- async _createChonkProof(directory, executionSteps) {
28
- const inputsPath = path.join(directory, 'ivc-inputs.msgpack');
29
- await fs.writeFile(inputsPath, serializePrivateExecutionSteps(executionSteps));
30
- const provingResult = await executeBbChonkProof(this.bbBinaryPath, directory, inputsPath, this.log.info);
31
- if (provingResult.status === BB_RESULT.FAILURE) {
32
- this.log.error(`Failed to generate chonk proof`);
33
- throw new Error(provingResult.reason);
34
- }
35
- const proof = await readChonkProofFromOutputDirectory(directory);
36
- this.log.info(`Generated Chonk proof`, {
37
- duration: provingResult.durationMs,
38
- eventName: 'circuit-proving'
39
- });
40
- return proof;
41
- }
42
- async createChonkProof(executionSteps) {
43
- this.log.info(`Generating Chonk proof`);
44
- const operation = async (directory)=>{
45
- return await this._createChonkProof(directory, executionSteps);
46
- };
47
- return await this.runInDirectory(operation);
48
- }
49
- async computeGateCountForCircuit(bytecode, circuitName) {
50
- const logFunction = (message)=>{
51
- this.log.debug(`$bb gates ${circuitName} - ${message}`);
52
- };
53
- const result = await computeGateCountForCircuit(this.bbBinaryPath, this.bbWorkingDirectory, circuitName, bytecode, 'mega_honk', logFunction);
54
- if (result.status === BB_RESULT.FAILURE) {
55
- throw new Error(result.reason);
56
- }
57
- return result.circuitSize;
58
- }
59
- runInDirectory(fn) {
60
- const log = this.log;
61
- return runInDirectory(this.bbWorkingDirectory, (dir)=>fn(dir).catch((err)=>{
62
- log.error(`Error running operation at ${dir}: ${err}`);
63
- throw err;
64
- }), this.skipCleanup, this.log);
65
- }
66
- }
@@ -1,15 +0,0 @@
1
- import type { ArtifactProvider } from '@aztec/noir-protocol-circuits-types/types';
2
- import type { CircuitSimulator } from '@aztec/simulator/client';
3
- import type { PrivateExecutionStep } from '@aztec/stdlib/kernel';
4
- import { ChonkProofWithPublicInputs } from '@aztec/stdlib/proofs';
5
- import { BBPrivateKernelProver } from '../bb_private_kernel_prover.js';
6
- export declare abstract class BBWASMPrivateKernelProver extends BBPrivateKernelProver {
7
- protected artifactProvider: ArtifactProvider;
8
- protected simulator: CircuitSimulator;
9
- private threads;
10
- protected log: import("@aztec/foundation/log").Logger;
11
- constructor(artifactProvider: ArtifactProvider, simulator: CircuitSimulator, threads?: number, log?: import("@aztec/foundation/log").Logger);
12
- createChonkProof(executionSteps: PrivateExecutionStep[]): Promise<ChonkProofWithPublicInputs>;
13
- computeGateCountForCircuit(_bytecode: Buffer, _circuitName: string): Promise<number>;
14
- }
15
- //# sourceMappingURL=bb_wasm_private_kernel_prover.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bb_wasm_private_kernel_prover.d.ts","sourceRoot":"","sources":["../../../../src/prover/client/wasm/bb_wasm_private_kernel_prover.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAClF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAIlE,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAEvE,8BAAsB,yBAA0B,SAAQ,qBAAqB;cAEtD,gBAAgB,EAAE,gBAAgB;cAClC,SAAS,EAAE,gBAAgB;IAC9C,OAAO,CAAC,OAAO;cACI,GAAG;gBAHH,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,gBAAgB,EACtC,OAAO,GAAE,MAAU,EACR,GAAG,yCAAiC;IAKnC,gBAAgB,CAAC,cAAc,EAAE,oBAAoB,EAAE,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAqB7F,0BAA0B,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAa3G"}
@@ -1,46 +0,0 @@
1
- import { AztecClientBackend } from '@aztec/bb.js';
2
- import { createLogger } from '@aztec/foundation/log';
3
- import { Timer } from '@aztec/foundation/timer';
4
- import { serializeWitness } from '@aztec/noir-noirc_abi';
5
- import { ChonkProofWithPublicInputs } from '@aztec/stdlib/proofs';
6
- import { ungzip } from 'pako';
7
- import { BBPrivateKernelProver } from '../bb_private_kernel_prover.js';
8
- export class BBWASMPrivateKernelProver extends BBPrivateKernelProver {
9
- artifactProvider;
10
- simulator;
11
- threads;
12
- log;
13
- constructor(artifactProvider, simulator, threads = 1, log = createLogger('bb-prover:wasm')){
14
- super(artifactProvider, simulator, log), this.artifactProvider = artifactProvider, this.simulator = simulator, this.threads = threads, this.log = log;
15
- }
16
- async createChonkProof(executionSteps) {
17
- const timer = new Timer();
18
- this.log.info(`Generating Chonk proof...`);
19
- const backend = new AztecClientBackend(executionSteps.map((step)=>ungzip(step.bytecode)), {
20
- threads: this.threads,
21
- logger: this.log.verbose,
22
- wasmPath: process.env.BB_WASM_PATH
23
- });
24
- const [proof] = await backend.prove(executionSteps.map((step)=>ungzip(serializeWitness(step.witness))), executionSteps.map((step)=>step.vk));
25
- await backend.destroy();
26
- this.log.info(`Generated Chonk proof`, {
27
- eventName: 'chonk-proof-generation',
28
- duration: timer.ms(),
29
- proofSize: proof.length
30
- });
31
- return ChonkProofWithPublicInputs.fromBufferArray(proof);
32
- }
33
- async computeGateCountForCircuit(_bytecode, _circuitName) {
34
- // Note we do not pass the vk to the backend. This is unneeded for gate counts.
35
- const backend = new AztecClientBackend([
36
- ungzip(_bytecode)
37
- ], {
38
- threads: this.threads,
39
- logger: this.log.verbose,
40
- wasmPath: process.env.BB_WASM_PATH
41
- });
42
- const gateCount = await backend.gates();
43
- await backend.destroy();
44
- return gateCount[0];
45
- }
46
- }
@@ -1,6 +0,0 @@
1
- import type { CircuitSimulator } from '@aztec/simulator/client';
2
- import { BBWASMPrivateKernelProver } from './bb_wasm_private_kernel_prover.js';
3
- export declare class BBWASMBundlePrivateKernelProver extends BBWASMPrivateKernelProver {
4
- constructor(simulator: CircuitSimulator, threads?: number, log?: import("@aztec/foundation/log").Logger);
5
- }
6
- //# sourceMappingURL=bundle.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../../../src/prover/client/wasm/bundle.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAE/E,qBAAa,+BAAgC,SAAQ,yBAAyB;gBAChE,SAAS,EAAE,gBAAgB,EAAE,OAAO,SAAK,EAAE,GAAG,yCAAwC;CAGnG"}
@@ -1,8 +0,0 @@
1
- import { createLogger } from '@aztec/foundation/log';
2
- import { BundleArtifactProvider } from '@aztec/noir-protocol-circuits-types/client/bundle';
3
- import { BBWASMPrivateKernelProver } from './bb_wasm_private_kernel_prover.js';
4
- export class BBWASMBundlePrivateKernelProver extends BBWASMPrivateKernelProver {
5
- constructor(simulator, threads = 16, log = createLogger('bb-prover:wasm:bundle')){
6
- super(new BundleArtifactProvider(), simulator, threads, log);
7
- }
8
- }
@@ -1,6 +0,0 @@
1
- import type { CircuitSimulator } from '@aztec/simulator/client';
2
- import { BBWASMPrivateKernelProver } from './bb_wasm_private_kernel_prover.js';
3
- export declare class BBWASMLazyPrivateKernelProver extends BBWASMPrivateKernelProver {
4
- constructor(simulator: CircuitSimulator, threads?: number, log?: import("@aztec/foundation/log").Logger);
5
- }
6
- //# sourceMappingURL=lazy.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../../../src/prover/client/wasm/lazy.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAE/E,qBAAa,6BAA8B,SAAQ,yBAAyB;gBAC9D,SAAS,EAAE,gBAAgB,EAAE,OAAO,SAAK,EAAE,GAAG,yCAAsC;CAGjG"}
@@ -1,8 +0,0 @@
1
- import { createLogger } from '@aztec/foundation/log';
2
- import { LazyArtifactProvider } from '@aztec/noir-protocol-circuits-types/client/lazy';
3
- import { BBWASMPrivateKernelProver } from './bb_wasm_private_kernel_prover.js';
4
- export class BBWASMLazyPrivateKernelProver extends BBWASMPrivateKernelProver {
5
- constructor(simulator, threads = 16, log = createLogger('bb-prover:wasm:lazy')){
6
- super(new LazyArtifactProvider(), simulator, threads, log);
7
- }
8
- }
@@ -1,105 +0,0 @@
1
- import { runInDirectory } from '@aztec/foundation/fs';
2
- import { type Logger, createLogger } from '@aztec/foundation/log';
3
- import { BundleArtifactProvider } from '@aztec/noir-protocol-circuits-types/client/bundle';
4
- import type { CircuitSimulator } from '@aztec/simulator/server';
5
- import { type PrivateExecutionStep, serializePrivateExecutionSteps } from '@aztec/stdlib/kernel';
6
- import type { ChonkProofWithPublicInputs } from '@aztec/stdlib/proofs';
7
-
8
- import { promises as fs } from 'fs';
9
- import path from 'path';
10
-
11
- import { BB_RESULT, computeGateCountForCircuit, executeBbChonkProof } from '../../../bb/execute.js';
12
- import type { BBConfig } from '../../../config.js';
13
- import { readChonkProofFromOutputDirectory } from '../../proof_utils.js';
14
- import { BBPrivateKernelProver } from '../bb_private_kernel_prover.js';
15
-
16
- /**
17
- * This proof creator implementation uses the native bb binary.
18
- */
19
- export class BBNativePrivateKernelProver extends BBPrivateKernelProver {
20
- private constructor(
21
- private bbBinaryPath: string,
22
- private bbWorkingDirectory: string,
23
- private skipCleanup: boolean,
24
- protected override simulator: CircuitSimulator,
25
- protected override log = createLogger('bb-prover:native'),
26
- ) {
27
- super(new BundleArtifactProvider(), simulator, log);
28
- }
29
-
30
- public static async new(config: BBConfig, simulator: CircuitSimulator, log?: Logger) {
31
- await fs.mkdir(config.bbWorkingDirectory, { recursive: true });
32
- return new BBNativePrivateKernelProver(
33
- config.bbBinaryPath,
34
- config.bbWorkingDirectory,
35
- !!config.bbSkipCleanup,
36
- simulator,
37
- log,
38
- );
39
- }
40
-
41
- private async _createChonkProof(
42
- directory: string,
43
- executionSteps: PrivateExecutionStep[],
44
- ): Promise<ChonkProofWithPublicInputs> {
45
- const inputsPath = path.join(directory, 'ivc-inputs.msgpack');
46
- await fs.writeFile(inputsPath, serializePrivateExecutionSteps(executionSteps));
47
- const provingResult = await executeBbChonkProof(this.bbBinaryPath, directory, inputsPath, this.log.info);
48
-
49
- if (provingResult.status === BB_RESULT.FAILURE) {
50
- this.log.error(`Failed to generate chonk proof`);
51
- throw new Error(provingResult.reason);
52
- }
53
-
54
- const proof = await readChonkProofFromOutputDirectory(directory);
55
-
56
- this.log.info(`Generated Chonk proof`, {
57
- duration: provingResult.durationMs,
58
- eventName: 'circuit-proving',
59
- });
60
-
61
- return proof;
62
- }
63
-
64
- public override async createChonkProof(executionSteps: PrivateExecutionStep[]): Promise<ChonkProofWithPublicInputs> {
65
- this.log.info(`Generating Chonk proof`);
66
- const operation = async (directory: string) => {
67
- return await this._createChonkProof(directory, executionSteps);
68
- };
69
- return await this.runInDirectory(operation);
70
- }
71
-
72
- public override async computeGateCountForCircuit(bytecode: Buffer, circuitName: string): Promise<number> {
73
- const logFunction = (message: string) => {
74
- this.log.debug(`$bb gates ${circuitName} - ${message}`);
75
- };
76
-
77
- const result = await computeGateCountForCircuit(
78
- this.bbBinaryPath,
79
- this.bbWorkingDirectory,
80
- circuitName,
81
- bytecode,
82
- 'mega_honk',
83
- logFunction,
84
- );
85
- if (result.status === BB_RESULT.FAILURE) {
86
- throw new Error(result.reason);
87
- }
88
-
89
- return result.circuitSize as number;
90
- }
91
-
92
- private runInDirectory<T>(fn: (dir: string) => Promise<T>) {
93
- const log = this.log;
94
- return runInDirectory(
95
- this.bbWorkingDirectory,
96
- (dir: string) =>
97
- fn(dir).catch(err => {
98
- log.error(`Error running operation at ${dir}: ${err}`);
99
- throw err;
100
- }),
101
- this.skipCleanup,
102
- this.log,
103
- );
104
- }
105
- }