@aztec/bb-prover 0.0.1-fake-ceab37513c → 0.0.6-commit.a2d1860fe9

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 (95) 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 +38 -15
  4. package/dest/bb/cli.d.ts +1 -1
  5. package/dest/bb/execute.d.ts +9 -17
  6. package/dest/bb/execute.d.ts.map +1 -1
  7. package/dest/bb/execute.js +74 -165
  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/instrumentation.js +21 -43
  16. package/dest/prover/client/bb_private_kernel_prover.d.ts +12 -6
  17. package/dest/prover/client/bb_private_kernel_prover.d.ts.map +1 -1
  18. package/dest/prover/client/bb_private_kernel_prover.js +38 -7
  19. package/dest/prover/client/bundle.d.ts +6 -0
  20. package/dest/prover/client/bundle.d.ts.map +1 -0
  21. package/dest/prover/client/bundle.js +7 -0
  22. package/dest/prover/client/lazy.d.ts +6 -0
  23. package/dest/prover/client/lazy.d.ts.map +1 -0
  24. package/dest/prover/client/lazy.js +7 -0
  25. package/dest/prover/index.d.ts +1 -1
  26. package/dest/prover/proof_utils.d.ts +9 -9
  27. package/dest/prover/proof_utils.d.ts.map +1 -1
  28. package/dest/prover/proof_utils.js +42 -25
  29. package/dest/prover/server/bb_prover.d.ts +27 -50
  30. package/dest/prover/server/bb_prover.d.ts.map +1 -1
  31. package/dest/prover/server/bb_prover.js +478 -182
  32. package/dest/test/delay_values.d.ts +1 -1
  33. package/dest/test/delay_values.d.ts.map +1 -1
  34. package/dest/test/delay_values.js +37 -25
  35. package/dest/test/index.d.ts +2 -1
  36. package/dest/test/index.d.ts.map +1 -1
  37. package/dest/test/index.js +1 -0
  38. package/dest/test/test_circuit_prover.d.ts +24 -34
  39. package/dest/test/test_circuit_prover.d.ts.map +1 -1
  40. package/dest/test/test_circuit_prover.js +506 -85
  41. package/dest/test/test_verifier.d.ts +3 -1
  42. package/dest/test/test_verifier.d.ts.map +1 -1
  43. package/dest/test/test_verifier.js +15 -0
  44. package/dest/verification_key/verification_key_data.d.ts +1 -8
  45. package/dest/verification_key/verification_key_data.d.ts.map +1 -1
  46. package/dest/verification_key/verification_key_data.js +1 -20
  47. package/dest/verifier/bb_verifier.d.ts +3 -5
  48. package/dest/verifier/bb_verifier.d.ts.map +1 -1
  49. package/dest/verifier/bb_verifier.js +23 -28
  50. package/dest/verifier/index.d.ts +2 -2
  51. package/dest/verifier/index.d.ts.map +1 -1
  52. package/dest/verifier/index.js +1 -1
  53. package/dest/verifier/queued_chonk_verifier.d.ts +15 -0
  54. package/dest/verifier/queued_chonk_verifier.d.ts.map +1 -0
  55. package/dest/verifier/{queued_ivc_verifier.js → queued_chonk_verifier.js} +10 -41
  56. package/package.json +23 -23
  57. package/src/avm_proving_tests/avm_proving_tester.ts +49 -35
  58. package/src/bb/execute.ts +50 -148
  59. package/src/honk.ts +1 -1
  60. package/src/instrumentation.ts +22 -45
  61. package/src/prover/client/bb_private_kernel_prover.ts +50 -10
  62. package/src/prover/client/bundle.ts +10 -0
  63. package/src/prover/client/lazy.ts +10 -0
  64. package/src/prover/proof_utils.ts +53 -31
  65. package/src/prover/server/bb_prover.ts +252 -324
  66. package/src/test/delay_values.ts +38 -24
  67. package/src/test/index.ts +1 -0
  68. package/src/test/test_circuit_prover.ts +229 -155
  69. package/src/test/test_verifier.ts +8 -0
  70. package/src/verification_key/verification_key_data.ts +1 -26
  71. package/src/verifier/bb_verifier.ts +33 -36
  72. package/src/verifier/index.ts +1 -1
  73. package/src/verifier/{queued_ivc_verifier.ts → queued_chonk_verifier.ts} +10 -41
  74. package/dest/prover/client/native/bb_native_private_kernel_prover.d.ts +0 -23
  75. package/dest/prover/client/native/bb_native_private_kernel_prover.d.ts.map +0 -1
  76. package/dest/prover/client/native/bb_native_private_kernel_prover.js +0 -66
  77. package/dest/prover/client/wasm/bb_wasm_private_kernel_prover.d.ts +0 -15
  78. package/dest/prover/client/wasm/bb_wasm_private_kernel_prover.d.ts.map +0 -1
  79. package/dest/prover/client/wasm/bb_wasm_private_kernel_prover.js +0 -48
  80. package/dest/prover/client/wasm/bundle.d.ts +0 -6
  81. package/dest/prover/client/wasm/bundle.d.ts.map +0 -1
  82. package/dest/prover/client/wasm/bundle.js +0 -8
  83. package/dest/prover/client/wasm/lazy.d.ts +0 -6
  84. package/dest/prover/client/wasm/lazy.d.ts.map +0 -1
  85. package/dest/prover/client/wasm/lazy.js +0 -8
  86. package/dest/stats.d.ts +0 -4
  87. package/dest/stats.d.ts.map +0 -1
  88. package/dest/stats.js +0 -45
  89. package/dest/verifier/queued_ivc_verifier.d.ts +0 -15
  90. package/dest/verifier/queued_ivc_verifier.d.ts.map +0 -1
  91. package/src/prover/client/native/bb_native_private_kernel_prover.ts +0 -105
  92. package/src/prover/client/wasm/bb_wasm_private_kernel_prover.ts +0 -60
  93. package/src/prover/client/wasm/bundle.ts +0 -11
  94. package/src/prover/client/wasm/lazy.ts +0 -11
  95. package/src/stats.ts +0 -47
@@ -1,20 +1,21 @@
1
1
  import { PublicTxSimulationTester, SimpleContractDataSource, type TestEnqueuedCall, type TestExecutorMetrics, type TestPrivateInsertions } from '@aztec/simulator/public/fixtures';
2
2
  import type { PublicTxResult } from '@aztec/simulator/server';
3
- import { type AvmCircuitInputs, AvmCircuitPublicInputs } from '@aztec/stdlib/avm';
3
+ import { AvmCircuitInputs, AvmCircuitPublicInputs } from '@aztec/stdlib/avm';
4
4
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
5
5
  import type { MerkleTreeWriteOperations } from '@aztec/stdlib/interfaces/server';
6
6
  import type { GlobalVariables } from '@aztec/stdlib/tx';
7
+ import { NativeWorldStateService } from '@aztec/world-state';
7
8
  import { type BBResult, type BBSuccess } from '../bb/execute.js';
8
9
  export declare class AvmProvingTester extends PublicTxSimulationTester {
9
- private bbWorkingDirectory;
10
10
  private checkCircuitOnly;
11
- constructor(bbWorkingDirectory: string, checkCircuitOnly: boolean, contractDataSource: SimpleContractDataSource, merkleTrees: MerkleTreeWriteOperations, globals?: GlobalVariables, metrics?: TestExecutorMetrics);
12
- static new(checkCircuitOnly?: boolean, globals?: GlobalVariables, metrics?: TestExecutorMetrics): Promise<AvmProvingTester>;
11
+ private bbWorkingDirectory;
12
+ constructor(checkCircuitOnly: boolean, contractDataSource: SimpleContractDataSource, merkleTrees: MerkleTreeWriteOperations, globals?: GlobalVariables, metrics?: TestExecutorMetrics);
13
+ static new(worldStateService: NativeWorldStateService, checkCircuitOnly?: boolean, globals?: GlobalVariables, metrics?: TestExecutorMetrics): Promise<AvmProvingTester>;
13
14
  prove(avmCircuitInputs: AvmCircuitInputs, txLabel?: string): Promise<BBResult>;
14
15
  verify(proofRes: BBSuccess, publicInputs: AvmCircuitPublicInputs): Promise<BBResult>;
15
16
  proveVerify(avmCircuitInputs: AvmCircuitInputs, txLabel?: string): Promise<void>;
16
- simProveVerify(sender: AztecAddress, setupCalls: TestEnqueuedCall[], appCalls: TestEnqueuedCall[], teardownCall: TestEnqueuedCall | undefined, expectRevert: boolean | undefined, feePayer?: AztecAddress, privateInsertions?: TestPrivateInsertions, txLabel?: string): Promise<PublicTxResult>;
17
+ simProveVerify(sender: AztecAddress, setupCalls: TestEnqueuedCall[], appCalls: TestEnqueuedCall[], teardownCall: TestEnqueuedCall | undefined, expectRevert: boolean | undefined, feePayer?: AztecAddress, privateInsertions?: TestPrivateInsertions, txLabel?: string, disableRevertCheck?: boolean): Promise<PublicTxResult>;
17
18
  executeTxWithLabel(txLabel: string, sender: AztecAddress, setupCalls?: TestEnqueuedCall[], appCalls?: TestEnqueuedCall[], teardownCall?: TestEnqueuedCall, feePayer?: AztecAddress, privateInsertions?: TestPrivateInsertions): Promise<PublicTxResult>;
18
19
  simProveVerifyAppLogic(appCall: TestEnqueuedCall, expectRevert?: boolean, txLabel?: string): Promise<void>;
19
20
  }
20
- //# sourceMappingURL=avm_proving_tester.d.ts.map
21
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXZtX3Byb3ZpbmdfdGVzdGVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvYXZtX3Byb3ZpbmdfdGVzdHMvYXZtX3Byb3ZpbmdfdGVzdGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUVBLE9BQU8sRUFDTCx3QkFBd0IsRUFDeEIsd0JBQXdCLEVBQ3hCLEtBQUssZ0JBQWdCLEVBQ3JCLEtBQUssbUJBQW1CLEVBQ3hCLEtBQUsscUJBQXFCLEVBQzNCLE1BQU0sa0NBQWtDLENBQUM7QUFDMUMsT0FBTyxLQUFLLEVBQUUsY0FBYyxFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFDOUQsT0FBTyxFQUFFLGdCQUFnQixFQUFFLHNCQUFzQixFQUF5QixNQUFNLG1CQUFtQixDQUFDO0FBQ3BHLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUMzRCxPQUFPLEtBQUssRUFBRSx5QkFBeUIsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQ2pGLE9BQU8sS0FBSyxFQUFFLGVBQWUsRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBQ3hELE9BQU8sRUFBRSx1QkFBdUIsRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBTTdELE9BQU8sRUFBRSxLQUFLLFFBQVEsRUFBRSxLQUFLLFNBQVMsRUFBK0MsTUFBTSxrQkFBa0IsQ0FBQztBQTZFOUcscUJBQWEsZ0JBQ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G,OAAO,CAAC,QAAQ,CAAC,CAQzF;IAEY,WAAW,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,OAAO,GAAE,MAAsB,iBAM3F;IAEY,cAAc,CACzB,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,gBAAgB,EAAE,EAC9B,QAAQ,EAAE,gBAAgB,EAAE,EAC5B,YAAY,EAAE,gBAAgB,GAAG,SAAS,EAC1C,YAAY,EAAE,OAAO,GAAG,SAAS,EACjC,QAAQ,eAAS,EACjB,iBAAiB,CAAC,EAAE,qBAAqB,EACzC,OAAO,GAAE,MAAsB,EAC/B,kBAAkB,GAAE,OAAe,GAClC,OAAO,CAAC,cAAc,CAAC,CA0BzB;IAEqB,kBAAkB,CACtC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,YAAY,EACpB,UAAU,CAAC,EAAE,gBAAgB,EAAE,EAC/B,QAAQ,CAAC,EAAE,gBAAgB,EAAE,EAC7B,YAAY,CAAC,EAAE,gBAAgB,EAC/B,QAAQ,CAAC,EAAE,YAAY,EACvB,iBAAiB,CAAC,EAAE,qBAAqB,2BAa1C;IAEY,sBAAsB,CACjC,OAAO,EAAE,gBAAgB,EACzB,YAAY,CAAC,EAAE,OAAO,EACtB,OAAO,GAAE,MAAsB,iBAYhC;CACF"}
@@ -1,12 +1,12 @@
1
1
  import { Timer } from '@aztec/foundation/timer';
2
2
  import { PublicTxSimulationTester, SimpleContractDataSource } from '@aztec/simulator/public/fixtures';
3
+ import { AvmCircuitInputs, PublicSimulatorConfig } from '@aztec/stdlib/avm';
3
4
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
4
- import { NativeWorldStateService } from '@aztec/world-state';
5
5
  import fs from 'node:fs/promises';
6
6
  import { tmpdir } from 'node:os';
7
7
  import path from 'path';
8
- import { BB_RESULT, VK_FILENAME, generateAvmProof, verifyAvmProof } from '../bb/execute.js';
9
- const BB_PATH = path.resolve('../../barretenberg/cpp/build/bin/bb');
8
+ import { BB_RESULT, generateAvmProof, verifyAvmProof } from '../bb/execute.js';
9
+ const BB_PATH = path.resolve('../../barretenberg/cpp/build/bin/bb-avm');
10
10
  // An InterceptingLogger that records all log messages and forwards them to a wrapped logger.
11
11
  class InterceptingLogger {
12
12
  logs = [];
@@ -24,6 +24,9 @@ class InterceptingLogger {
24
24
  createChild(_childModule) {
25
25
  throw new Error('Not implemented');
26
26
  }
27
+ getBindings() {
28
+ return this.logger.getBindings();
29
+ }
27
30
  intercept(level, msg, ...args) {
28
31
  this.logs.push(...msg.split('\n'));
29
32
  // Forward to the wrapped logger
@@ -58,19 +61,30 @@ class InterceptingLogger {
58
61
  this.logger.error(msg, err, ...args);
59
62
  }
60
63
  }
64
+ // Config with collectHints enabled for proving tests
65
+ const provingConfig = PublicSimulatorConfig.from({
66
+ skipFeeEnforcement: false,
67
+ collectCallMetadata: true,
68
+ collectDebugLogs: false,
69
+ collectHints: true,
70
+ collectPublicInputs: true,
71
+ collectStatistics: false
72
+ });
61
73
  export class AvmProvingTester extends PublicTxSimulationTester {
62
- bbWorkingDirectory;
63
74
  checkCircuitOnly;
64
- constructor(bbWorkingDirectory, checkCircuitOnly, contractDataSource, merkleTrees, globals, metrics){
65
- super(merkleTrees, contractDataSource, globals, metrics), this.bbWorkingDirectory = bbWorkingDirectory, this.checkCircuitOnly = checkCircuitOnly;
75
+ bbWorkingDirectory;
76
+ constructor(checkCircuitOnly, contractDataSource, merkleTrees, globals, metrics){
77
+ // simulator factory is undefined because for proving, we use the default C++ simulator
78
+ super(merkleTrees, contractDataSource, globals, metrics, /*simulatorFactory=*/ undefined, provingConfig), this.checkCircuitOnly = checkCircuitOnly, this.bbWorkingDirectory = '';
66
79
  }
67
- static async new(checkCircuitOnly = false, globals, metrics) {
68
- const bbWorkingDirectory = await fs.mkdtemp(path.join(tmpdir(), 'bb-'));
80
+ static async new(worldStateService, checkCircuitOnly = false, globals, metrics) {
69
81
  const contractDataSource = new SimpleContractDataSource();
70
- const merkleTrees = await (await NativeWorldStateService.tmp()).fork();
71
- return new AvmProvingTester(bbWorkingDirectory, checkCircuitOnly, contractDataSource, merkleTrees, globals, metrics);
82
+ const merkleTrees = await worldStateService.fork();
83
+ return new AvmProvingTester(checkCircuitOnly, contractDataSource, merkleTrees, globals, metrics);
72
84
  }
73
85
  async prove(avmCircuitInputs, txLabel = 'unlabeledTx') {
86
+ // We use a new working directory for each proof.
87
+ this.bbWorkingDirectory = await fs.mkdtemp(path.join(tmpdir(), 'bb-'));
74
88
  const interceptingLogger = new InterceptingLogger(this.logger);
75
89
  // Then we prove.
76
90
  const proofRes = await generateAvmProof(BB_PATH, this.bbWorkingDirectory, avmCircuitInputs, interceptingLogger, this.checkCircuitOnly);
@@ -97,6 +111,10 @@ export class AvmProvingTester extends PublicTxSimulationTester {
97
111
  times[match[1]] = parseInt(match[2]);
98
112
  }
99
113
  });
114
+ // Throw if logs did not contain any times.
115
+ if (Object.keys(times).length === 0) {
116
+ throw new Error('AVM stdout did not contain any proving times in the stats!');
117
+ }
100
118
  // Hack to make labels match.
101
119
  const txLabelWithCount = `${txLabel}/${this.txCount - 1}`;
102
120
  // I need to cast because TS doesnt realize metrics is protected not private.
@@ -120,7 +138,7 @@ export class AvmProvingTester extends PublicTxSimulationTester {
120
138
  // Check-circuit does not generate a proof to verify.
121
139
  return proofRes;
122
140
  }
123
- return await verifyAvmProof(BB_PATH, this.bbWorkingDirectory, proofRes.proofPath, publicInputs, path.join(proofRes.vkDirectoryPath, VK_FILENAME), this.logger);
141
+ return await verifyAvmProof(BB_PATH, this.bbWorkingDirectory, proofRes.proofPath, publicInputs, this.logger);
124
142
  }
125
143
  async proveVerify(avmCircuitInputs, txLabel = 'unlabeledTx') {
126
144
  const provingRes = await this.prove(avmCircuitInputs, txLabel);
@@ -128,18 +146,23 @@ export class AvmProvingTester extends PublicTxSimulationTester {
128
146
  const verificationRes = await this.verify(provingRes, avmCircuitInputs.publicInputs);
129
147
  expect(verificationRes.status).toBe(BB_RESULT.SUCCESS);
130
148
  }
131
- async simProveVerify(sender, setupCalls, appCalls, teardownCall, expectRevert, feePayer = sender, privateInsertions, txLabel = 'unlabeledTx') {
149
+ async simProveVerify(sender, setupCalls, appCalls, teardownCall, expectRevert, feePayer = sender, privateInsertions, txLabel = 'unlabeledTx', disableRevertCheck = false) {
150
+ const simTimer = new Timer();
132
151
  const simRes = await this.simulateTx(sender, setupCalls, appCalls, teardownCall, feePayer, privateInsertions, txLabel);
133
- expect(simRes.revertCode.isOK()).toBe(expectRevert ? false : true);
152
+ const simDuration = simTimer.ms();
153
+ this.logger.info(`Simulation took ${simDuration} ms for tx ${txLabel}`);
154
+ if (!disableRevertCheck) {
155
+ expect(simRes.revertCode.isOK()).toBe(expectRevert ? false : true);
156
+ }
134
157
  const opString = this.checkCircuitOnly ? 'Check circuit' : 'Proving and verification';
135
- const avmCircuitInputs = simRes.avmProvingRequest.inputs;
158
+ const avmCircuitInputs = new AvmCircuitInputs(simRes.hints, simRes.publicInputs);
136
159
  const timer = new Timer();
137
160
  await this.proveVerify(avmCircuitInputs, txLabel);
138
161
  this.logger.info(`${opString} took ${timer.ms()} ms for tx ${txLabel}`);
139
162
  return simRes;
140
163
  }
141
164
  async executeTxWithLabel(txLabel, sender, setupCalls, appCalls, teardownCall, feePayer, privateInsertions) {
142
- return await this.simProveVerify(sender, setupCalls ?? [], appCalls ?? [], teardownCall, /*expectRevert=*/ false, feePayer, privateInsertions, txLabel);
165
+ return await this.simProveVerify(sender, setupCalls ?? [], appCalls ?? [], teardownCall, undefined, feePayer, privateInsertions, txLabel, true);
143
166
  }
144
167
  async simProveVerifyAppLogic(appCall, expectRevert, txLabel = 'unlabeledTx') {
145
168
  await this.simProveVerify(/*sender=*/ AztecAddress.fromNumber(42), /*setupCalls=*/ [], [
package/dest/bb/cli.d.ts CHANGED
@@ -9,4 +9,4 @@ export declare const ProtocolCircuitArtifacts: Record<ProtocolArtifact, NoirComp
9
9
  * @returns The CLI.
10
10
  */
11
11
  export declare function getProgram(log: LogFn): Command;
12
- //# sourceMappingURL=cli.d.ts.map
12
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2xpLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvYmIvY2xpLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLEtBQUssRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBR25ELE9BQU8sS0FBSyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sMkNBQTJDLENBQUM7QUFDbEYsT0FBTyxLQUFLLEVBQUUsbUJBQW1CLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUU5RCxPQUFPLEVBQUUsT0FBTyxFQUFFLE1BQU0sV0FBVyxDQUFDO0FBRXBDLGVBQU8sTUFBTSx3QkFBd0IsRUFBRSxNQUFNLENBQUMsZ0JBQWdCLEVBQUUsbUJBQW1CLENBR2xGLENBQUM7QUFFRjs7OztHQUlHO0FBQ0gsd0JBQWdCLFVBQVUsQ0FBQyxHQUFHLEVBQUUsS0FBSyxHQUFHLE9BQU8sQ0FhOUMifQ==
@@ -7,7 +7,6 @@ export declare const PROOF_FILENAME = "proof";
7
7
  export declare const AVM_INPUTS_FILENAME = "avm_inputs.bin";
8
8
  export declare const AVM_BYTECODE_FILENAME = "avm_bytecode.bin";
9
9
  export declare const AVM_PUBLIC_INPUTS_FILENAME = "avm_public_inputs.bin";
10
- export declare const CLIENT_IVC_PROOF_FILE_NAME = "proof";
11
10
  export declare enum BB_RESULT {
12
11
  SUCCESS = 0,
13
12
  FAILURE = 1,
@@ -49,7 +48,7 @@ type BBExecResult = {
49
48
  * @returns The completed partial witness outputted from the circuit
50
49
  */
51
50
  export declare function executeBB(pathToBB: string, command: string, args: string[], logger: LogFn, concurrency?: number, timeout?: number, resultParser?: (code: number) => code is 0): Promise<BBExecResult>;
52
- export declare function executeBbClientIvcProof(pathToBB: string, workingDirectory: string, inputsPath: string, log: LogFn, writeVk?: boolean): Promise<BBFailure | BBSuccess>;
51
+ export declare function executeBbChonkProof(pathToBB: string, workingDirectory: string, inputsPath: string, log: LogFn, writeVk?: boolean): Promise<BBFailure | BBSuccess>;
53
52
  /**
54
53
  * Used for generating proofs of noir circuits.
55
54
  * It is assumed that the working directory is a temporary and/or random directory used solely for generating this proof.
@@ -61,14 +60,7 @@ export declare function executeBbClientIvcProof(pathToBB: string, workingDirecto
61
60
  * @param log - A logging function
62
61
  * @returns An object containing a result indication, the location of the proof and the duration taken
63
62
  */
64
- export declare function generateProof(pathToBB: string, workingDirectory: string, circuitName: string, bytecode: Buffer, inputWitnessFile: string, flavor: UltraHonkFlavor, log: Logger): Promise<BBFailure | BBSuccess>;
65
- /**
66
- * Used for generating proofs of the tube circuit
67
- * It is assumed that the working directory is a temporary and/or random directory used solely for generating this proof.
68
- *
69
- * @returns An object containing a result indication, the location of the proof and the duration taken
70
- */
71
- export declare function generateTubeProof(pathToBB: string, workingDirectory: string, vkPath: string, log: LogFn): Promise<BBFailure | BBSuccess>;
63
+ export declare function generateProof(pathToBB: string, workingDirectory: string, circuitName: string, bytecode: Buffer, verificationKey: Buffer, inputWitnessFile: string, flavor: UltraHonkFlavor, log: Logger): Promise<BBFailure | BBSuccess>;
72
64
  /**
73
65
  * Used for generating AVM proofs.
74
66
  * It is assumed that the working directory is a temporary and/or random directory used solely for generating this proof.
@@ -85,21 +77,21 @@ export declare function generateAvmProof(pathToBB: string, workingDirectory: str
85
77
  * @param pathToBB - The full path to the bb binary
86
78
  * @param proofFullPath - The full path to the proof to be verified
87
79
  * @param verificationKeyPath - The full path to the circuit verification key
88
- * @param log - A logging function
80
+ * @param logger - A logger
89
81
  * @returns An object containing a result indication and duration taken
90
82
  */
91
- export declare function verifyProof(pathToBB: string, proofFullPath: string, verificationKeyPath: string, ultraHonkFlavor: UltraHonkFlavor, log: Logger): Promise<BBFailure | BBSuccess>;
92
- export declare function verifyAvmProof(pathToBB: string, workingDirectory: string, proofFullPath: string, publicInputs: AvmCircuitPublicInputs, verificationKeyPath: string, logger: Logger): Promise<BBFailure | BBSuccess>;
83
+ export declare function verifyProof(pathToBB: string, proofFullPath: string, verificationKeyPath: string, ultraHonkFlavor: UltraHonkFlavor, logger: Logger): Promise<BBFailure | BBSuccess>;
84
+ export declare function verifyAvmProof(pathToBB: string, workingDirectory: string, proofFullPath: string, publicInputs: AvmCircuitPublicInputs, logger: Logger): Promise<BBFailure | BBSuccess>;
93
85
  /**
94
- * Verifies a ClientIvcProof
86
+ * Verifies a ChonkProof
95
87
  * TODO(#7370) The verification keys should be supplied separately
96
88
  * @param pathToBB - The full path to the bb binary
97
89
  * @param targetPath - The path to the folder with the proof, accumulator, and verification keys
98
- * @param log - A logging function
90
+ * @param logger - A logger
99
91
  * @param concurrency - The number of threads to use for the verification
100
92
  * @returns An object containing a result indication and duration taken
101
93
  */
102
- export declare function verifyClientIvcProof(pathToBB: string, proofPath: string, keyPath: string, log: LogFn, concurrency?: number): Promise<BBFailure | BBSuccess>;
94
+ export declare function verifyChonkProof(pathToBB: string, proofPath: string, keyPath: string, logger: Logger, concurrency?: number): Promise<BBFailure | BBSuccess>;
103
95
  export declare function generateContractForVerificationKey(pathToBB: string, vkFilePath: string, contractPath: string, log: LogFn): Promise<BBFailure | BBSuccess>;
104
96
  /**
105
97
  * Compute bb gate count for a given circuit
@@ -112,4 +104,4 @@ export declare function generateContractForVerificationKey(pathToBB: string, vkF
112
104
  */
113
105
  export declare function computeGateCountForCircuit(pathToBB: string, workingDirectory: string, circuitName: string, bytecode: Buffer, flavor: UltraHonkFlavor | 'mega_honk', log: LogFn): Promise<BBFailure | BBSuccess>;
114
106
  export {};
115
- //# sourceMappingURL=execute.d.ts.map
107
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXhlY3V0ZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2JiL2V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,EAAE,KAAK,GACT,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CA8ChC;AAED;;;;;;;;GAQG;AACH,wBAAsB,0BAA0B,CAC9C,QAAQ,EAAE,MAAM,EAChB,gBAAgB,EAAE,MAAM,EACxB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,eAAe,GAAG,WAAW,EACrC,GAAG,EAAE,KAAK,GACT,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CA0DhC"}
@@ -1,15 +1,15 @@
1
- import { sha256 } from '@aztec/foundation/crypto';
1
+ import { sha256 } from '@aztec/foundation/crypto/sha256';
2
2
  import { Timer } from '@aztec/foundation/timer';
3
3
  import * as proc from 'child_process';
4
4
  import { promises as fs } from 'fs';
5
5
  import { basename, dirname, join } from 'path';
6
+ import readline from 'readline';
6
7
  export const VK_FILENAME = 'vk';
7
8
  export const PUBLIC_INPUTS_FILENAME = 'public_inputs';
8
9
  export const PROOF_FILENAME = 'proof';
9
10
  export const AVM_INPUTS_FILENAME = 'avm_inputs.bin';
10
11
  export const AVM_BYTECODE_FILENAME = 'avm_bytecode.bin';
11
12
  export const AVM_PUBLIC_INPUTS_FILENAME = 'avm_public_inputs.bin';
12
- export const CLIENT_IVC_PROOF_FILE_NAME = 'proof';
13
13
  export var BB_RESULT = /*#__PURE__*/ function(BB_RESULT) {
14
14
  BB_RESULT[BB_RESULT["SUCCESS"] = 0] = "SUCCESS";
15
15
  BB_RESULT[BB_RESULT["FAILURE"] = 1] = "FAILURE";
@@ -42,6 +42,11 @@ export var BB_RESULT = /*#__PURE__*/ function(BB_RESULT) {
42
42
  command,
43
43
  ...args
44
44
  ], {
45
+ stdio: [
46
+ 'ignore',
47
+ 'pipe',
48
+ 'pipe'
49
+ ],
45
50
  env
46
51
  });
47
52
  let timeoutId;
@@ -58,14 +63,12 @@ export var BB_RESULT = /*#__PURE__*/ function(BB_RESULT) {
58
63
  });
59
64
  }, timeout);
60
65
  }
61
- bb.stdout.on('data', (data)=>{
62
- const message = data.toString('utf-8').replace(/\n$/, '');
63
- logger(message);
64
- });
65
- bb.stderr.on('data', (data)=>{
66
- const message = data.toString('utf-8').replace(/\n$/, '');
67
- logger(message);
68
- });
66
+ readline.createInterface({
67
+ input: bb.stdout
68
+ }).on('line', logger);
69
+ readline.createInterface({
70
+ input: bb.stderr
71
+ }).on('line', logger);
69
72
  bb.on('close', (exitCode, signal)=>{
70
73
  if (timeoutId) {
71
74
  clearTimeout(timeoutId);
@@ -90,7 +93,7 @@ export var BB_RESULT = /*#__PURE__*/ function(BB_RESULT) {
90
93
  signal: undefined
91
94
  }));
92
95
  }
93
- export async function executeBbClientIvcProof(pathToBB, workingDirectory, inputsPath, log, writeVk = false) {
96
+ export async function executeBbChonkProof(pathToBB, workingDirectory, inputsPath, log, writeVk = false) {
94
97
  // Check that the working directory exists
95
98
  try {
96
99
  await fs.access(workingDirectory);
@@ -123,7 +126,7 @@ export async function executeBbClientIvcProof(pathToBB, workingDirectory, inputs
123
126
  inputsPath,
124
127
  '-v',
125
128
  '--scheme',
126
- 'client_ivc'
129
+ 'chonk'
127
130
  ];
128
131
  if (writeVk) {
129
132
  args.push('--write_vk');
@@ -203,7 +206,7 @@ function getArgs(flavor) {
203
206
  * @param inputWitnessFile - The circuit input witness
204
207
  * @param log - A logging function
205
208
  * @returns An object containing a result indication, the location of the proof and the duration taken
206
- */ export async function generateProof(pathToBB, workingDirectory, circuitName, bytecode, inputWitnessFile, flavor, log) {
209
+ */ export async function generateProof(pathToBB, workingDirectory, circuitName, bytecode, verificationKey, inputWitnessFile, flavor, log) {
207
210
  // Check that the working directory exists
208
211
  try {
209
212
  await fs.access(workingDirectory);
@@ -213,8 +216,9 @@ function getArgs(flavor) {
213
216
  reason: `Working directory ${workingDirectory} does not exist`
214
217
  };
215
218
  }
216
- // The bytecode is written to e.g. /workingDirectory/BaseParityArtifact-bytecode
219
+ // The bytecode is written to e.g. /workingDirectory/ParityBaseArtifact-bytecode
217
220
  const bytecodePath = `${workingDirectory}/${circuitName}-bytecode`;
221
+ const vkPath = `${workingDirectory}/${circuitName}-vk`;
218
222
  // The proof is written to e.g. /workingDirectory/ultra_honk/proof
219
223
  const outputPath = `${workingDirectory}`;
220
224
  const binaryPresent = await fs.access(pathToBB, fs.constants.R_OK).then((_)=>true).catch((_)=>false);
@@ -225,16 +229,19 @@ function getArgs(flavor) {
225
229
  };
226
230
  }
227
231
  try {
228
- // Write the bytecode to the working directory
229
- await fs.writeFile(bytecodePath, bytecode);
230
- // TODO(#15043): Avoid write_vk flag here.
232
+ // Write the bytecode and vk to the working directory
233
+ await Promise.all([
234
+ fs.writeFile(bytecodePath, bytecode),
235
+ fs.writeFile(vkPath, verificationKey)
236
+ ]);
231
237
  const args = getArgs(flavor).concat([
232
238
  '--disable_zk',
233
- '--write_vk',
234
239
  '-o',
235
240
  outputPath,
236
241
  '-b',
237
242
  bytecodePath,
243
+ '-k',
244
+ vkPath,
238
245
  '-w',
239
246
  inputWitnessFile,
240
247
  '-v'
@@ -271,75 +278,6 @@ function getArgs(flavor) {
271
278
  };
272
279
  }
273
280
  }
274
- /**
275
- * Used for generating proofs of the tube circuit
276
- * It is assumed that the working directory is a temporary and/or random directory used solely for generating this proof.
277
- *
278
- * @returns An object containing a result indication, the location of the proof and the duration taken
279
- */ export async function generateTubeProof(pathToBB, workingDirectory, vkPath, log) {
280
- // Check that the working directory exists
281
- try {
282
- await fs.access(workingDirectory);
283
- } catch {
284
- return {
285
- status: 1,
286
- reason: `Working directory ${workingDirectory} does not exist`
287
- };
288
- }
289
- // Paths for the inputs
290
- const proofPath = join(workingDirectory, CLIENT_IVC_PROOF_FILE_NAME);
291
- // The proof is written to e.g. /workingDirectory/proof
292
- const outputPath = workingDirectory;
293
- const filePresent = async (file)=>await fs.access(file, fs.constants.R_OK).then((_)=>true).catch((_)=>false);
294
- const binaryPresent = await filePresent(pathToBB);
295
- if (!binaryPresent) {
296
- return {
297
- status: 1,
298
- reason: `Failed to find bb binary at ${pathToBB}`
299
- };
300
- }
301
- try {
302
- if (!await filePresent(proofPath)) {
303
- return {
304
- status: 1,
305
- reason: `Client IVC input files not present in ${workingDirectory}`
306
- };
307
- }
308
- const args = [
309
- '-o',
310
- outputPath,
311
- '-k',
312
- vkPath,
313
- '-v'
314
- ];
315
- const timer = new Timer();
316
- const logFunction = (message)=>{
317
- log(`TubeCircuit (prove) BB out - ${message}`);
318
- };
319
- const result = await executeBB(pathToBB, 'prove_tube', args, logFunction);
320
- const durationMs = timer.ms();
321
- if (result.status == 0) {
322
- return {
323
- status: 0,
324
- durationMs,
325
- proofPath: outputPath,
326
- pkPath: undefined,
327
- vkDirectoryPath: outputPath
328
- };
329
- }
330
- // Not a great error message here but it is difficult to decipher what comes from bb
331
- return {
332
- status: 1,
333
- reason: `Failed to generate proof. Exit code ${result.exitCode}. Signal ${result.signal}.`,
334
- retry: !!result.signal
335
- };
336
- } catch (error) {
337
- return {
338
- status: 1,
339
- reason: `${error}`
340
- };
341
- }
342
- }
343
281
  /**
344
282
  * Used for generating AVM proofs.
345
283
  * It is assumed that the working directory is a temporary and/or random directory used solely for generating this proof.
@@ -406,7 +344,7 @@ function getArgs(flavor) {
406
344
  durationMs: duration,
407
345
  proofPath: join(outputPath, PROOF_FILENAME),
408
346
  pkPath: undefined,
409
- vkDirectoryPath: outputPath
347
+ vkDirectoryPath: undefined
410
348
  };
411
349
  }
412
350
  // Not a great error message here but it is difficult to decipher what comes from bb
@@ -427,12 +365,27 @@ function getArgs(flavor) {
427
365
  * @param pathToBB - The full path to the bb binary
428
366
  * @param proofFullPath - The full path to the proof to be verified
429
367
  * @param verificationKeyPath - The full path to the circuit verification key
430
- * @param log - A logging function
368
+ * @param logger - A logger
431
369
  * @returns An object containing a result indication and duration taken
432
- */ export async function verifyProof(pathToBB, proofFullPath, verificationKeyPath, ultraHonkFlavor, log) {
433
- return await verifyProofInternal(pathToBB, proofFullPath, verificationKeyPath, `verify`, log, getArgs(ultraHonkFlavor));
370
+ */ export async function verifyProof(pathToBB, proofFullPath, verificationKeyPath, ultraHonkFlavor, logger) {
371
+ // Specify the public inputs path in the case of UH verification.
372
+ // Take proofFullPath and remove the suffix past the / to get the directory.
373
+ const proofDir = proofFullPath.substring(0, proofFullPath.lastIndexOf('/'));
374
+ const publicInputsFullPath = join(proofDir, '/public_inputs');
375
+ logger.debug(`public inputs path: ${publicInputsFullPath}`);
376
+ const args = [
377
+ '-p',
378
+ proofFullPath,
379
+ '-k',
380
+ verificationKeyPath,
381
+ '-i',
382
+ publicInputsFullPath,
383
+ '--disable_zk',
384
+ ...getArgs(ultraHonkFlavor)
385
+ ];
386
+ return await verifyProofInternal(pathToBB, `verify`, args, logger);
434
387
  }
435
- export async function verifyAvmProof(pathToBB, workingDirectory, proofFullPath, publicInputs, verificationKeyPath, logger) {
388
+ export async function verifyAvmProof(pathToBB, workingDirectory, proofFullPath, publicInputs, logger) {
436
389
  const inputsBuffer = publicInputs.serializeWithMessagePack();
437
390
  // Write the inputs to the working directory.
438
391
  const filePresent = async (file)=>await fs.access(file, fs.constants.R_OK).then((_)=>true).catch((_)=>false);
@@ -444,20 +397,23 @@ export async function verifyAvmProof(pathToBB, workingDirectory, proofFullPath,
444
397
  reason: `Could not write avm inputs to ${avmInputsPath}`
445
398
  };
446
399
  }
447
- return await verifyProofInternal(pathToBB, proofFullPath, verificationKeyPath, 'avm_verify', logger, [
400
+ const args = [
401
+ '-p',
402
+ proofFullPath,
448
403
  '--avm-public-inputs',
449
404
  avmInputsPath
450
- ]);
405
+ ];
406
+ return await verifyProofInternal(pathToBB, 'avm_verify', args, logger);
451
407
  }
452
408
  /**
453
- * Verifies a ClientIvcProof
409
+ * Verifies a ChonkProof
454
410
  * TODO(#7370) The verification keys should be supplied separately
455
411
  * @param pathToBB - The full path to the bb binary
456
412
  * @param targetPath - The path to the folder with the proof, accumulator, and verification keys
457
- * @param log - A logging function
413
+ * @param logger - A logger
458
414
  * @param concurrency - The number of threads to use for the verification
459
415
  * @returns An object containing a result indication and duration taken
460
- */ export async function verifyClientIvcProof(pathToBB, proofPath, keyPath, log, concurrency = 1) {
416
+ */ export async function verifyChonkProof(pathToBB, proofPath, keyPath, logger, concurrency = 1) {
461
417
  const binaryPresent = await fs.access(pathToBB, fs.constants.R_OK).then((_)=>true).catch((_)=>false);
462
418
  if (!binaryPresent) {
463
419
  return {
@@ -465,48 +421,26 @@ export async function verifyAvmProof(pathToBB, workingDirectory, proofFullPath,
465
421
  reason: `Failed to find bb binary at ${pathToBB}`
466
422
  };
467
423
  }
468
- try {
469
- const args = [
470
- '--scheme',
471
- 'client_ivc',
472
- '-p',
473
- proofPath,
474
- '-k',
475
- keyPath,
476
- '-v'
477
- ];
478
- const timer = new Timer();
479
- const command = 'verify';
480
- const result = await executeBB(pathToBB, command, args, log, concurrency);
481
- const duration = timer.ms();
482
- if (result.status == 0) {
483
- return {
484
- status: 0,
485
- durationMs: duration
486
- };
487
- }
488
- // Not a great error message here but it is difficult to decipher what comes from bb
489
- return {
490
- status: 1,
491
- reason: `Failed to verify proof. Exit code ${result.exitCode}. Signal ${result.signal}.`,
492
- retry: !!result.signal
493
- };
494
- } catch (error) {
495
- return {
496
- status: 1,
497
- reason: `${error}`
498
- };
499
- }
424
+ const args = [
425
+ '--scheme',
426
+ 'chonk',
427
+ '-p',
428
+ proofPath,
429
+ '-k',
430
+ keyPath,
431
+ '-v'
432
+ ];
433
+ return await verifyProofInternal(pathToBB, 'verify', args, logger, concurrency);
500
434
  }
501
435
  /**
502
436
  * Used for verifying proofs with BB
503
437
  * @param pathToBB - The full path to the bb binary
504
- * @param proofFullPath - The full path to the proof to be verified
505
- * @param verificationKeyPath - The full path to the circuit verification key
506
438
  * @param command - The BB command to execute (verify/avm_verify)
507
- * @param log - A logging function
439
+ * @param args - The arguments to pass to the command
440
+ * @param logger - A logger
441
+ * @param concurrency - The number of threads to use for the verification
508
442
  * @returns An object containing a result indication and duration taken
509
- */ async function verifyProofInternal(pathToBB, proofFullPath, verificationKeyPath, command, logger, extraArgs = []) {
443
+ */ async function verifyProofInternal(pathToBB, command, args, logger, concurrency) {
510
444
  const binaryPresent = await fs.access(pathToBB, fs.constants.R_OK).then((_)=>true).catch((_)=>false);
511
445
  if (!binaryPresent) {
512
446
  return {
@@ -518,38 +452,13 @@ export async function verifyAvmProof(pathToBB, workingDirectory, proofFullPath,
518
452
  logger.verbose(`bb-prover (verify) BB out - ${message}`);
519
453
  };
520
454
  try {
521
- let args;
522
- if (command == 'verify') {
523
- // Specify the public inputs path in the case of UH verification.
524
- // Take proofFullPath and remove the suffix past the / to get the directory.
525
- const proofDir = proofFullPath.substring(0, proofFullPath.lastIndexOf('/'));
526
- const publicInputsFullPath = join(proofDir, '/public_inputs');
527
- logger.debug(`public inputs path: ${publicInputsFullPath}`);
528
- args = [
529
- '-p',
530
- proofFullPath,
531
- '-k',
532
- verificationKeyPath,
533
- '-i',
534
- publicInputsFullPath,
535
- '--disable_zk',
536
- ...extraArgs
537
- ];
538
- } else {
539
- args = [
540
- '-p',
541
- proofFullPath,
542
- '-k',
543
- verificationKeyPath,
544
- ...extraArgs
545
- ];
546
- }
547
455
  const loggingArg = logger.level === 'debug' || logger.level === 'trace' ? '-d' : logger.level === 'verbose' ? '-v' : '';
548
- if (loggingArg !== '') {
549
- args.push(loggingArg);
550
- }
456
+ const finalArgs = loggingArg !== '' ? [
457
+ ...args,
458
+ loggingArg
459
+ ] : args;
551
460
  const timer = new Timer();
552
- const result = await executeBB(pathToBB, command, args, logFunction);
461
+ const result = await executeBB(pathToBB, command, finalArgs, logFunction, concurrency);
553
462
  const duration = timer.ms();
554
463
  if (result.status == 0) {
555
464
  return {
@@ -649,7 +558,7 @@ export async function generateContractForVerificationKey(pathToBB, vkFilePath, c
649
558
  reason: `Working directory ${workingDirectory} does not exist`
650
559
  };
651
560
  }
652
- // The bytecode is written to e.g. /workingDirectory/BaseParityArtifact-bytecode
561
+ // The bytecode is written to e.g. /workingDirectory/ParityBaseArtifact-bytecode
653
562
  const bytecodePath = `${workingDirectory}/${circuitName}-bytecode`;
654
563
  const binaryPresent = await fs.access(pathToBB, fs.constants.R_OK).then((_)=>true).catch((_)=>false);
655
564
  if (!binaryPresent) {
@@ -670,7 +579,7 @@ export async function generateContractForVerificationKey(pathToBB, vkFilePath, c
670
579
  const timer = new Timer();
671
580
  const result = await executeBB(pathToBB, 'gates', [
672
581
  '--scheme',
673
- flavor === 'mega_honk' ? 'client_ivc' : 'ultra_honk',
582
+ flavor === 'mega_honk' ? 'chonk' : 'ultra_honk',
674
583
  '-b',
675
584
  bytecodePath,
676
585
  '-v'
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env -S node --no-warnings
2
2
  import 'source-map-support/register.js';
3
- //# sourceMappingURL=index.d.ts.map
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9iYi9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBR0EsT0FBTyxnQ0FBZ0MsQ0FBQyJ9