@aztec/bb-prover 0.76.4 → 0.77.0-testnet-ignition.21

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 (82) hide show
  1. package/dest/avm_proving_tests/avm_proving_tester.d.ts +8 -8
  2. package/dest/avm_proving_tests/avm_proving_tester.d.ts.map +1 -1
  3. package/dest/avm_proving_tests/avm_proving_tester.js +24 -25
  4. package/dest/bb/cli.d.ts +3 -3
  5. package/dest/bb/cli.d.ts.map +1 -1
  6. package/dest/bb/cli.js +4 -9
  7. package/dest/bb/execute.d.ts +7 -37
  8. package/dest/bb/execute.d.ts.map +1 -1
  9. package/dest/bb/execute.js +359 -357
  10. package/dest/bb/index.js +4 -6
  11. package/dest/config.js +1 -2
  12. package/dest/honk.d.ts +1 -1
  13. package/dest/honk.d.ts.map +1 -1
  14. package/dest/honk.js +8 -5
  15. package/dest/index.d.ts +1 -1
  16. package/dest/index.d.ts.map +1 -1
  17. package/dest/index.js +0 -1
  18. package/dest/instrumentation.d.ts +2 -2
  19. package/dest/instrumentation.d.ts.map +1 -1
  20. package/dest/instrumentation.js +50 -47
  21. package/dest/prover/bb_native_private_kernel_prover.d.ts +4 -4
  22. package/dest/prover/bb_native_private_kernel_prover.d.ts.map +1 -1
  23. package/dest/prover/bb_native_private_kernel_prover.js +19 -19
  24. package/dest/prover/bb_private_kernel_prover.d.ts +7 -6
  25. package/dest/prover/bb_private_kernel_prover.d.ts.map +1 -1
  26. package/dest/prover/bb_private_kernel_prover.js +14 -15
  27. package/dest/prover/bb_prover.d.ts +7 -10
  28. package/dest/prover/bb_prover.d.ts.map +1 -1
  29. package/dest/prover/bb_prover.js +402 -447
  30. package/dest/prover/client_ivc_proof_utils.d.ts +3 -3
  31. package/dest/prover/client_ivc_proof_utils.d.ts.map +1 -1
  32. package/dest/prover/client_ivc_proof_utils.js +18 -12
  33. package/dest/prover/index.js +0 -1
  34. package/dest/stats.d.ts +2 -2
  35. package/dest/stats.d.ts.map +1 -1
  36. package/dest/stats.js +15 -14
  37. package/dest/test/delay_values.d.ts +4 -0
  38. package/dest/test/delay_values.d.ts.map +1 -0
  39. package/dest/test/delay_values.js +29 -0
  40. package/dest/test/index.js +0 -1
  41. package/dest/test/test_circuit_prover.d.ts +16 -7
  42. package/dest/test/test_circuit_prover.d.ts.map +1 -1
  43. package/dest/test/test_circuit_prover.js +165 -161
  44. package/dest/test/test_verifier.d.ts +2 -1
  45. package/dest/test/test_verifier.d.ts.map +1 -1
  46. package/dest/test/test_verifier.js +0 -1
  47. package/dest/verification_key/verification_key_data.d.ts +1 -1
  48. package/dest/verification_key/verification_key_data.d.ts.map +1 -1
  49. package/dest/verification_key/verification_key_data.js +13 -9
  50. package/dest/verifier/bb_verifier.d.ts +6 -4
  51. package/dest/verifier/bb_verifier.d.ts.map +1 -1
  52. package/dest/verifier/bb_verifier.js +18 -18
  53. package/dest/verifier/index.js +0 -1
  54. package/dest/wasm/bb_wasm_private_kernel_prover.d.ts +5 -4
  55. package/dest/wasm/bb_wasm_private_kernel_prover.d.ts.map +1 -1
  56. package/dest/wasm/bb_wasm_private_kernel_prover.js +26 -11
  57. package/dest/wasm/bundle.d.ts +1 -1
  58. package/dest/wasm/bundle.d.ts.map +1 -1
  59. package/dest/wasm/bundle.js +1 -2
  60. package/dest/wasm/lazy.d.ts +1 -1
  61. package/dest/wasm/lazy.d.ts.map +1 -1
  62. package/dest/wasm/lazy.js +1 -2
  63. package/package.json +18 -19
  64. package/src/avm_proving_tests/avm_proving_tester.ts +17 -33
  65. package/src/bb/cli.ts +3 -3
  66. package/src/bb/execute.ts +80 -211
  67. package/src/honk.ts +1 -1
  68. package/src/index.ts +1 -1
  69. package/src/instrumentation.ts +10 -10
  70. package/src/prover/bb_native_private_kernel_prover.ts +5 -4
  71. package/src/prover/bb_private_kernel_prover.ts +20 -20
  72. package/src/prover/bb_prover.ts +33 -100
  73. package/src/prover/client_ivc_proof_utils.ts +3 -3
  74. package/src/stats.ts +2 -2
  75. package/src/test/delay_values.ts +31 -0
  76. package/src/test/test_circuit_prover.ts +149 -120
  77. package/src/test/test_verifier.ts +2 -1
  78. package/src/verification_key/verification_key_data.ts +4 -7
  79. package/src/verifier/bb_verifier.ts +16 -9
  80. package/src/wasm/bb_wasm_private_kernel_prover.ts +18 -5
  81. package/src/wasm/bundle.ts +1 -1
  82. package/src/wasm/lazy.ts +1 -1
@@ -1,16 +1,18 @@
1
- import { type ClientProtocolCircuitVerifier, Tx } from '@aztec/circuit-types';
2
- import { type CircuitVerificationStats } from '@aztec/circuit-types/stats';
3
- import { type Proof, type VerificationKeyData } from '@aztec/circuits.js';
4
1
  import { runInDirectory } from '@aztec/foundation/fs';
5
2
  import { type Logger, createLogger } from '@aztec/foundation/log';
6
- import { type ClientProtocolArtifact, type ServerProtocolArtifact } from '@aztec/noir-protocol-circuits-types/types';
7
- import { ServerCircuitVks } from '@aztec/noir-protocol-circuits-types/vks';
3
+ import { ServerCircuitVks } from '@aztec/noir-protocol-circuits-types/server/vks';
4
+ import type { ClientProtocolArtifact, ServerProtocolArtifact } from '@aztec/noir-protocol-circuits-types/types';
5
+ import type { ClientProtocolCircuitVerifier } from '@aztec/stdlib/interfaces/server';
6
+ import type { Proof } from '@aztec/stdlib/proofs';
7
+ import type { CircuitVerificationStats } from '@aztec/stdlib/stats';
8
+ import { Tx } from '@aztec/stdlib/tx';
9
+ import type { VerificationKeyData } from '@aztec/stdlib/vks';
8
10
 
9
11
  import { promises as fs } from 'fs';
10
12
  import * as path from 'path';
11
13
 
12
14
  import { BB_RESULT, PROOF_FILENAME, VK_FILENAME, verifyClientIvcProof, verifyProof } from '../bb/execute.js';
13
- import { type BBConfig } from '../config.js';
15
+ import type { BBConfig } from '../config.js';
14
16
  import { getUltraHonkFlavorForCircuit } from '../honk.js';
15
17
  import { writeToOutputDirectory } from '../prover/client_ivc_proof_utils.js';
16
18
  import { mapProtocolArtifactNameToCircuitName } from '../stats.js';
@@ -62,7 +64,7 @@ export class BBCircuitVerifier implements ClientProtocolCircuitVerifier {
62
64
  proofType: 'ultra-honk',
63
65
  } satisfies CircuitVerificationStats);
64
66
  };
65
- await runInDirectory(this.config.bbWorkingDirectory, operation, this.config.bbSkipCleanup);
67
+ await runInDirectory(this.config.bbWorkingDirectory, operation, this.config.bbSkipCleanup, this.logger);
66
68
  }
67
69
 
68
70
  public async verifyProof(tx: Tx): Promise<boolean> {
@@ -83,7 +85,12 @@ export class BBCircuitVerifier implements ClientProtocolCircuitVerifier {
83
85
  };
84
86
 
85
87
  await writeToOutputDirectory(tx.clientIvcProof, bbWorkingDirectory);
86
- const result = await verifyClientIvcProof(this.config.bbBinaryPath, bbWorkingDirectory, logFunction);
88
+ const result = await verifyClientIvcProof(
89
+ this.config.bbBinaryPath,
90
+ bbWorkingDirectory.concat('/proof'),
91
+ bbWorkingDirectory.concat('/vk'),
92
+ logFunction,
93
+ );
87
94
 
88
95
  if (result.status === BB_RESULT.FAILURE) {
89
96
  const errorMessage = `Failed to verify ${circuit} proof!`;
@@ -97,7 +104,7 @@ export class BBCircuitVerifier implements ClientProtocolCircuitVerifier {
97
104
  proofType: 'client-ivc',
98
105
  } satisfies CircuitVerificationStats);
99
106
  };
100
- await runInDirectory(this.config.bbWorkingDirectory, operation, this.config.bbSkipCleanup);
107
+ await runInDirectory(this.config.bbWorkingDirectory, operation, this.config.bbSkipCleanup, this.logger);
101
108
  return true;
102
109
  } catch (err) {
103
110
  this.logger.warn(`Failed to verify ClientIVC proof for tx ${Tx.getHash(tx)}: ${String(err)}`);
@@ -1,12 +1,12 @@
1
1
  import { AztecClientBackend } from '@aztec/bb.js';
2
- import { ClientIvcProof } from '@aztec/circuits.js';
3
2
  import { createLogger } from '@aztec/foundation/log';
4
3
  import { Timer } from '@aztec/foundation/timer';
5
- import { type ArtifactProvider } from '@aztec/noir-protocol-circuits-types/types';
6
- import { type SimulationProvider } from '@aztec/simulator/client';
4
+ import type { ArtifactProvider } from '@aztec/noir-protocol-circuits-types/types';
5
+ import type { SimulationProvider } from '@aztec/simulator/client';
6
+ import { ClientIvcProof } from '@aztec/stdlib/proofs';
7
7
 
8
8
  import { serializeWitness } from '@noir-lang/noirc_abi';
9
- import { type WitnessMap } from '@noir-lang/types';
9
+ import type { WitnessMap } from '@noir-lang/types';
10
10
  import { ungzip } from 'pako';
11
11
 
12
12
  import { BBPrivateKernelProver } from '../prover/bb_private_kernel_prover.js';
@@ -26,7 +26,7 @@ export abstract class BBWASMPrivateKernelProver extends BBPrivateKernelProver {
26
26
  this.log.info(`Generating ClientIVC proof...`);
27
27
  const backend = new AztecClientBackend(
28
28
  acirs.map(acir => ungzip(acir)),
29
- { threads: this.threads },
29
+ { threads: this.threads, logger: this.log.verbose, wasmPath: process.env.BB_WASM_PATH },
30
30
  );
31
31
 
32
32
  const [proof, vk] = await backend.prove(witnessStack.map(witnessMap => ungzip(serializeWitness(witnessMap))));
@@ -39,4 +39,17 @@ export abstract class BBWASMPrivateKernelProver extends BBPrivateKernelProver {
39
39
  });
40
40
  return new ClientIvcProof(Buffer.from(proof), Buffer.from(vk));
41
41
  }
42
+
43
+ public override async computeGateCountForCircuit(_bytecode: Buffer, _circuitName: string): Promise<number> {
44
+ const backend = new AztecClientBackend([ungzip(_bytecode)], {
45
+ threads: this.threads,
46
+ logger: this.log.verbose,
47
+ wasmPath: process.env.BB_WASM_PATH,
48
+ });
49
+
50
+ const gateCount = await backend.gates();
51
+ await backend.destroy();
52
+
53
+ return gateCount[0];
54
+ }
42
55
  }
@@ -1,6 +1,6 @@
1
1
  import { createLogger } from '@aztec/foundation/log';
2
2
  import { BundleArtifactProvider } from '@aztec/noir-protocol-circuits-types/client/bundle';
3
- import { type SimulationProvider } from '@aztec/simulator/client';
3
+ import type { SimulationProvider } from '@aztec/simulator/client';
4
4
 
5
5
  import { BBWASMPrivateKernelProver } from './bb_wasm_private_kernel_prover.js';
6
6
 
package/src/wasm/lazy.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { createLogger } from '@aztec/foundation/log';
2
2
  import { LazyArtifactProvider } from '@aztec/noir-protocol-circuits-types/client/lazy';
3
- import { type SimulationProvider } from '@aztec/simulator/client';
3
+ import type { SimulationProvider } from '@aztec/simulator/client';
4
4
 
5
5
  import { BBWASMPrivateKernelProver } from './bb_wasm_private_kernel_prover.js';
6
6