@aztec/bb-prover 0.0.0-test.0 → 0.0.1-commit.001888fc

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 (112) hide show
  1. package/dest/avm_proving_tests/avm_proving_tester.d.ts +15 -18
  2. package/dest/avm_proving_tests/avm_proving_tester.d.ts.map +1 -1
  3. package/dest/avm_proving_tests/avm_proving_tester.js +146 -79
  4. package/dest/bb/cli.d.ts +1 -1
  5. package/dest/bb/execute.d.ts +18 -50
  6. package/dest/bb/execute.d.ts.map +1 -1
  7. package/dest/bb/execute.js +150 -278
  8. package/dest/bb/index.d.ts +1 -1
  9. package/dest/config.d.ts +3 -1
  10. package/dest/config.d.ts.map +1 -1
  11. package/dest/honk.d.ts +3 -3
  12. package/dest/honk.d.ts.map +1 -1
  13. package/dest/honk.js +3 -2
  14. package/dest/index.d.ts +2 -1
  15. package/dest/index.d.ts.map +1 -1
  16. package/dest/index.js +1 -0
  17. package/dest/instrumentation.d.ts +3 -3
  18. package/dest/instrumentation.d.ts.map +1 -1
  19. package/dest/instrumentation.js +22 -46
  20. package/dest/prover/client/bb_private_kernel_prover.d.ts +38 -0
  21. package/dest/prover/client/bb_private_kernel_prover.d.ts.map +1 -0
  22. package/dest/prover/{bb_private_kernel_prover.js → client/bb_private_kernel_prover.js} +55 -21
  23. package/dest/prover/client/bundle.d.ts +6 -0
  24. package/dest/prover/client/bundle.d.ts.map +1 -0
  25. package/dest/prover/client/bundle.js +7 -0
  26. package/dest/prover/client/lazy.d.ts +6 -0
  27. package/dest/prover/client/lazy.d.ts.map +1 -0
  28. package/dest/prover/client/lazy.js +7 -0
  29. package/dest/prover/index.d.ts +3 -4
  30. package/dest/prover/index.d.ts.map +1 -1
  31. package/dest/prover/index.js +2 -3
  32. package/dest/prover/proof_utils.d.ts +19 -0
  33. package/dest/prover/proof_utils.d.ts.map +1 -0
  34. package/dest/prover/proof_utils.js +72 -0
  35. package/dest/prover/server/bb_prover.d.ts +97 -0
  36. package/dest/prover/server/bb_prover.d.ts.map +1 -0
  37. package/dest/prover/server/bb_prover.js +712 -0
  38. package/dest/test/delay_values.d.ts +1 -1
  39. package/dest/test/delay_values.d.ts.map +1 -1
  40. package/dest/test/delay_values.js +37 -23
  41. package/dest/test/index.d.ts +2 -1
  42. package/dest/test/index.d.ts.map +1 -1
  43. package/dest/test/index.js +1 -0
  44. package/dest/test/test_circuit_prover.d.ts +27 -36
  45. package/dest/test/test_circuit_prover.d.ts.map +1 -1
  46. package/dest/test/test_circuit_prover.js +517 -88
  47. package/dest/test/test_verifier.d.ts +6 -3
  48. package/dest/test/test_verifier.d.ts.map +1 -1
  49. package/dest/test/test_verifier.js +23 -1
  50. package/dest/verification_key/verification_key_data.d.ts +1 -2
  51. package/dest/verification_key/verification_key_data.d.ts.map +1 -1
  52. package/dest/verification_key/verification_key_data.js +9 -34
  53. package/dest/verifier/bb_verifier.d.ts +6 -5
  54. package/dest/verifier/bb_verifier.d.ts.map +1 -1
  55. package/dest/verifier/bb_verifier.js +45 -27
  56. package/dest/verifier/index.d.ts +2 -1
  57. package/dest/verifier/index.d.ts.map +1 -1
  58. package/dest/verifier/index.js +1 -0
  59. package/dest/verifier/queued_chonk_verifier.d.ts +15 -0
  60. package/dest/verifier/queued_chonk_verifier.d.ts.map +1 -0
  61. package/dest/verifier/queued_chonk_verifier.js +101 -0
  62. package/package.json +35 -33
  63. package/src/avm_proving_tests/avm_proving_tester.ts +231 -113
  64. package/src/bb/execute.ts +125 -291
  65. package/src/config.ts +2 -0
  66. package/src/honk.ts +3 -2
  67. package/src/index.ts +1 -0
  68. package/src/instrumentation.ts +22 -47
  69. package/src/prover/{bb_private_kernel_prover.ts → client/bb_private_kernel_prover.ts} +95 -33
  70. package/src/prover/client/bundle.ts +10 -0
  71. package/src/prover/client/lazy.ts +10 -0
  72. package/src/prover/index.ts +2 -3
  73. package/src/prover/proof_utils.ts +115 -0
  74. package/src/prover/server/bb_prover.ts +718 -0
  75. package/src/test/delay_values.ts +38 -22
  76. package/src/test/index.ts +1 -0
  77. package/src/test/test_circuit_prover.ts +264 -154
  78. package/src/test/test_verifier.ts +15 -3
  79. package/src/verification_key/verification_key_data.ts +11 -31
  80. package/src/verifier/bb_verifier.ts +62 -35
  81. package/src/verifier/index.ts +1 -0
  82. package/src/verifier/queued_chonk_verifier.ts +109 -0
  83. package/dest/prover/bb_native_private_kernel_prover.d.ts +0 -25
  84. package/dest/prover/bb_native_private_kernel_prover.d.ts.map +0 -1
  85. package/dest/prover/bb_native_private_kernel_prover.js +0 -69
  86. package/dest/prover/bb_private_kernel_prover.d.ts +0 -32
  87. package/dest/prover/bb_private_kernel_prover.d.ts.map +0 -1
  88. package/dest/prover/bb_prover.d.ts +0 -120
  89. package/dest/prover/bb_prover.d.ts.map +0 -1
  90. package/dest/prover/bb_prover.js +0 -423
  91. package/dest/prover/client_ivc_proof_utils.d.ts +0 -25
  92. package/dest/prover/client_ivc_proof_utils.d.ts.map +0 -1
  93. package/dest/prover/client_ivc_proof_utils.js +0 -43
  94. package/dest/stats.d.ts +0 -5
  95. package/dest/stats.d.ts.map +0 -1
  96. package/dest/stats.js +0 -62
  97. package/dest/wasm/bb_wasm_private_kernel_prover.d.ts +0 -17
  98. package/dest/wasm/bb_wasm_private_kernel_prover.d.ts.map +0 -1
  99. package/dest/wasm/bb_wasm_private_kernel_prover.js +0 -46
  100. package/dest/wasm/bundle.d.ts +0 -6
  101. package/dest/wasm/bundle.d.ts.map +0 -1
  102. package/dest/wasm/bundle.js +0 -8
  103. package/dest/wasm/lazy.d.ts +0 -6
  104. package/dest/wasm/lazy.d.ts.map +0 -1
  105. package/dest/wasm/lazy.js +0 -8
  106. package/src/prover/bb_native_private_kernel_prover.ts +0 -119
  107. package/src/prover/bb_prover.ts +0 -781
  108. package/src/prover/client_ivc_proof_utils.ts +0 -42
  109. package/src/stats.ts +0 -64
  110. package/src/wasm/bb_wasm_private_kernel_prover.ts +0 -55
  111. package/src/wasm/bundle.ts +0 -11
  112. package/src/wasm/lazy.ts +0 -11
@@ -1,78 +1,205 @@
1
- import { PublicTxSimulationTester, type TestEnqueuedCall } from '@aztec/simulator/public/fixtures';
2
- import { SimpleContractDataSource, WorldStateDB } from '@aztec/simulator/server';
3
- import type { AvmCircuitInputs } from '@aztec/stdlib/avm';
1
+ import type { LogFn, LogLevel, Logger } from '@aztec/foundation/log';
2
+ import { Timer } from '@aztec/foundation/timer';
3
+ import {
4
+ PublicTxSimulationTester,
5
+ SimpleContractDataSource,
6
+ type TestEnqueuedCall,
7
+ type TestExecutorMetrics,
8
+ type TestPrivateInsertions,
9
+ } from '@aztec/simulator/public/fixtures';
10
+ import type { PublicTxResult } from '@aztec/simulator/server';
11
+ import { AvmCircuitInputs, AvmCircuitPublicInputs, PublicSimulatorConfig } from '@aztec/stdlib/avm';
4
12
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
13
+ import type { Gas } from '@aztec/stdlib/gas';
5
14
  import type { MerkleTreeWriteOperations } from '@aztec/stdlib/interfaces/server';
6
- import { makeAvmCircuitInputs } from '@aztec/stdlib/testing';
7
- import { VerificationKeyData } from '@aztec/stdlib/vks';
15
+ import type { GlobalVariables } from '@aztec/stdlib/tx';
8
16
  import { NativeWorldStateService } from '@aztec/world-state';
9
17
 
10
18
  import fs from 'node:fs/promises';
11
19
  import { tmpdir } from 'node:os';
12
20
  import path from 'path';
13
21
 
14
- import {
15
- type BBResult,
16
- type BBSuccess,
17
- BB_RESULT,
18
- generateAvmProof,
19
- generateAvmProofV2,
20
- verifyAvmProof,
21
- verifyAvmProofV2,
22
- } from '../bb/execute.js';
23
- import { extractAvmVkData } from '../verification_key/verification_key_data.js';
24
-
25
- const BB_PATH = path.resolve('../../barretenberg/cpp/build/bin/bb');
22
+ import { type BBResult, type BBSuccess, BB_RESULT, generateAvmProof, verifyAvmProof } from '../bb/execute.js';
23
+
24
+ const BB_PATH = path.resolve('../../barretenberg/cpp/build/bin/bb-avm');
25
+
26
+ // An InterceptingLogger that records all log messages and forwards them to a wrapped logger.
27
+ class InterceptingLogger implements Logger {
28
+ public readonly logs: string[] = [];
29
+ public level: LogLevel;
30
+ public module: string;
31
+
32
+ private logger: Logger;
33
+
34
+ constructor(logger: Logger) {
35
+ this.logger = logger;
36
+ this.level = logger.level;
37
+ this.module = logger.module;
38
+ }
39
+
40
+ isLevelEnabled(level: LogLevel): boolean {
41
+ return this.logger.isLevelEnabled(level);
42
+ }
43
+
44
+ createChild(_childModule: string): Logger {
45
+ throw new Error('Not implemented');
46
+ }
47
+
48
+ getBindings() {
49
+ return this.logger.getBindings();
50
+ }
51
+
52
+ private intercept(level: LogLevel, msg: string, ...args: any[]) {
53
+ this.logs.push(...msg.split('\n'));
54
+ // Forward to the wrapped logger
55
+ (this.logger[level] as LogFn)(msg, ...args);
56
+ }
57
+
58
+ // Log methods for each level
59
+ silent(msg: string, ...args: any[]) {
60
+ this.intercept('silent', msg, ...args);
61
+ }
62
+ fatal(msg: string, ...args: any[]) {
63
+ this.intercept('fatal', msg, ...args);
64
+ }
65
+ warn(msg: string, ...args: any[]) {
66
+ this.intercept('warn', msg, ...args);
67
+ }
68
+ info(msg: string, ...args: any[]) {
69
+ this.intercept('info', msg, ...args);
70
+ }
71
+ verbose(msg: string, ...args: any[]) {
72
+ this.intercept('verbose', msg, ...args);
73
+ }
74
+ debug(msg: string, ...args: any[]) {
75
+ this.intercept('debug', msg, ...args);
76
+ }
77
+ trace(msg: string, ...args: any[]) {
78
+ this.intercept('trace', msg, ...args);
79
+ }
80
+
81
+ // Error log function can be string or Error
82
+ error(err: Error | string, ...args: any[]) {
83
+ const msg = typeof err === 'string' ? err : err.message;
84
+ this.logs.push(msg);
85
+ this.logger.error(msg, err, ...args);
86
+ }
87
+ }
88
+
89
+ // Config with collectHints enabled for proving tests
90
+ const provingConfig: PublicSimulatorConfig = PublicSimulatorConfig.from({
91
+ skipFeeEnforcement: false,
92
+ collectCallMetadata: true, // For results.
93
+ collectDebugLogs: false,
94
+ collectHints: true, // Required for proving!
95
+ collectPublicInputs: true, // Required for proving!
96
+ collectStatistics: false,
97
+ });
26
98
 
27
99
  export class AvmProvingTester extends PublicTxSimulationTester {
100
+ private bbWorkingDirectory: string = '';
101
+
28
102
  constructor(
29
- private bbWorkingDirectory: string,
30
103
  private checkCircuitOnly: boolean,
31
- worldStateDB: WorldStateDB,
32
104
  contractDataSource: SimpleContractDataSource,
33
105
  merkleTrees: MerkleTreeWriteOperations,
106
+ globals?: GlobalVariables,
107
+ metrics?: TestExecutorMetrics,
34
108
  ) {
35
- super(worldStateDB, contractDataSource, merkleTrees);
109
+ // simulator factory is undefined because for proving, we use the default C++ simulator
110
+ super(merkleTrees, contractDataSource, globals, metrics, /*simulatorFactory=*/ undefined, provingConfig);
36
111
  }
37
112
 
38
- static override async create(checkCircuitOnly: boolean = false) {
39
- const bbWorkingDirectory = await fs.mkdtemp(path.join(tmpdir(), 'bb-'));
40
-
113
+ static async new(
114
+ worldStateService: NativeWorldStateService, // make sure to close this later
115
+ checkCircuitOnly: boolean = false,
116
+ globals?: GlobalVariables,
117
+ metrics?: TestExecutorMetrics,
118
+ ) {
41
119
  const contractDataSource = new SimpleContractDataSource();
42
- const merkleTrees = await (await NativeWorldStateService.tmp()).fork();
43
- const worldStateDB = new WorldStateDB(merkleTrees, contractDataSource);
44
- return new AvmProvingTester(bbWorkingDirectory, checkCircuitOnly, worldStateDB, contractDataSource, merkleTrees);
120
+ const merkleTrees = await worldStateService.fork();
121
+ return new AvmProvingTester(checkCircuitOnly, contractDataSource, merkleTrees, globals, metrics);
45
122
  }
46
123
 
47
- async prove(avmCircuitInputs: AvmCircuitInputs): Promise<BBResult> {
124
+ async prove(avmCircuitInputs: AvmCircuitInputs, txLabel: string = 'unlabeledTx'): Promise<BBResult> {
125
+ // We use a new working directory for each proof.
126
+ this.bbWorkingDirectory = await fs.mkdtemp(path.join(tmpdir(), 'bb-'));
127
+
128
+ const interceptingLogger = new InterceptingLogger(this.logger);
129
+
48
130
  // Then we prove.
49
131
  const proofRes = await generateAvmProof(
50
132
  BB_PATH,
51
133
  this.bbWorkingDirectory,
52
134
  avmCircuitInputs,
53
- this.logger,
135
+ interceptingLogger,
54
136
  this.checkCircuitOnly,
55
137
  );
56
138
  if (proofRes.status === BB_RESULT.FAILURE) {
57
139
  this.logger.error(`Proof generation failed: ${proofRes.reason}`);
58
140
  }
59
- return proofRes;
141
+ expect(proofRes.status).toEqual(BB_RESULT.SUCCESS);
142
+
143
+ // Parse the logs into a structured format.
144
+ const logs = interceptingLogger.logs;
145
+ // const traceSizes: { name: string; size: number }[] = [];
146
+ // logs.forEach(log => {
147
+ // const match = log.match(/\b(\w+): (\d+) \(~2/);
148
+ // if (match) {
149
+ // traceSizes.push({
150
+ // name: match[1],
151
+ // size: parseInt(match[2]),
152
+ // });
153
+ // }
154
+ // });
155
+ const times: { [key: string]: number } = {};
156
+ logs.forEach(log => {
157
+ const match = log.match(/\b([\w/]+)_ms: (\d+)/);
158
+ if (match) {
159
+ times[match[1]] = parseInt(match[2]);
160
+ }
161
+ });
162
+
163
+ // Throw if logs did not contain any times.
164
+ if (Object.keys(times).length === 0) {
165
+ throw new Error('AVM stdout did not contain any proving times in the stats!');
166
+ }
167
+
168
+ // Hack to make labels match.
169
+ const txLabelWithCount = `${txLabel}/${this.txCount - 1}`;
170
+ // I need to cast because TS doesnt realize metrics is protected not private.
171
+ (this as any).metrics?.recordProverMetrics(txLabelWithCount, {
172
+ proverSimulationStepMs: times['simulation/all'],
173
+ proverProvingStepMs: times['proving/all'],
174
+ proverTraceGenerationStepMs: times['tracegen/all'],
175
+ traceGenerationInteractionsMs: times['tracegen/interactions'],
176
+ traceGenerationTracesMs: times['tracegen/traces'],
177
+ provingSumcheckMs: times['prove/sumcheck'],
178
+ provingPcsMs: times['prove/pcs_rounds'],
179
+ provingLogDerivativeInverseMs: times['prove/log_derivative_inverse_round'],
180
+ provingLogDerivativeInverseCommitmentsMs: times['prove/log_derivative_inverse_commitments_round'],
181
+ provingWireCommitmentsMs: times['prove/wire_commitments_round'],
182
+ });
183
+
184
+ return proofRes as BBSuccess;
60
185
  }
61
186
 
62
- async verify(proofRes: BBSuccess): Promise<BBResult> {
187
+ async verify(proofRes: BBSuccess, publicInputs: AvmCircuitPublicInputs): Promise<BBResult> {
63
188
  if (this.checkCircuitOnly) {
64
- // Skip verification if we're only checking the circuit.
65
- // Check-circuit doesn't generate a proof to verify.
189
+ // Skip verification if we are only checking the circuit.
190
+ // Check-circuit does not generate a proof to verify.
66
191
  return proofRes;
67
192
  }
68
- // Then we test VK extraction and serialization.
69
- const succeededRes = proofRes as BBSuccess;
70
- const vkData = await extractAvmVkData(succeededRes.vkPath!);
71
- VerificationKeyData.fromBuffer(vkData.toBuffer());
72
193
 
73
- // Then we verify.
74
- const rawVkPath = path.join(succeededRes.vkPath!, 'vk');
75
- return await verifyAvmProof(BB_PATH, succeededRes.proofPath!, rawVkPath, this.logger);
194
+ return await verifyAvmProof(BB_PATH, this.bbWorkingDirectory, proofRes.proofPath!, publicInputs, this.logger);
195
+ }
196
+
197
+ public async proveVerify(avmCircuitInputs: AvmCircuitInputs, txLabel: string = 'unlabeledTx') {
198
+ const provingRes = await this.prove(avmCircuitInputs, txLabel);
199
+ expect(provingRes.status).toEqual(BB_RESULT.SUCCESS);
200
+
201
+ const verificationRes = await this.verify(provingRes as BBSuccess, avmCircuitInputs.publicInputs);
202
+ expect(verificationRes.status).toBe(BB_RESULT.SUCCESS);
76
203
  }
77
204
 
78
205
  public async simProveVerify(
@@ -82,89 +209,80 @@ export class AvmProvingTester extends PublicTxSimulationTester {
82
209
  teardownCall: TestEnqueuedCall | undefined,
83
210
  expectRevert: boolean | undefined,
84
211
  feePayer = sender,
85
- ) {
86
- const simRes = await this.simulateTx(sender, setupCalls, appCalls, teardownCall, feePayer);
87
- expect(simRes.revertCode.isOK()).toBe(expectRevert ? false : true);
88
- const avmCircuitInputs = simRes.avmProvingRequest.inputs;
89
- const provingRes = await this.prove(avmCircuitInputs);
90
- expect(provingRes.status).toEqual(BB_RESULT.SUCCESS);
91
- const verificationRes = await this.verify(provingRes as BBSuccess);
92
- expect(verificationRes.status).toBe(BB_RESULT.SUCCESS);
93
- }
94
-
95
- public async simProveVerifyAppLogic(appCall: TestEnqueuedCall, expectRevert?: boolean) {
96
- const simRes = await this.simulateTx(/*sender=*/ AztecAddress.fromNumber(42), /*setupCalls=*/ [], [appCall]);
97
- expect(simRes.revertCode.isOK()).toBe(expectRevert ? false : true);
98
-
99
- const avmCircuitInputs = simRes.avmProvingRequest.inputs;
100
- const provingRes = await this.prove(avmCircuitInputs);
101
- expect(provingRes.status).toEqual(BB_RESULT.SUCCESS);
212
+ privateInsertions?: TestPrivateInsertions,
213
+ txLabel: string = 'unlabeledTx',
214
+ disableRevertCheck: boolean = false,
215
+ gasLimits?: Gas,
216
+ ): Promise<PublicTxResult> {
217
+ const simTimer = new Timer();
218
+ const simRes = await this.simulateTx(
219
+ sender,
220
+ setupCalls,
221
+ appCalls,
222
+ teardownCall,
223
+ feePayer,
224
+ privateInsertions,
225
+ txLabel,
226
+ gasLimits,
227
+ );
228
+ const simDuration = simTimer.ms();
229
+ this.logger.info(`Simulation took ${simDuration} ms for tx ${txLabel}`);
102
230
 
103
- const verificationRes = await this.verify(provingRes as BBSuccess);
104
- expect(verificationRes.status).toBe(BB_RESULT.SUCCESS);
105
- }
106
- }
231
+ if (!disableRevertCheck) {
232
+ expect(simRes.revertCode.isOK()).toBe(expectRevert ? false : true);
233
+ }
107
234
 
108
- export class AvmProvingTesterV2 extends PublicTxSimulationTester {
109
- constructor(
110
- private bbWorkingDirectory: string,
111
- worldStateDB: WorldStateDB,
112
- contractDataSource: SimpleContractDataSource,
113
- merkleTrees: MerkleTreeWriteOperations,
114
- ) {
115
- super(worldStateDB, contractDataSource, merkleTrees);
116
- }
235
+ const opString = this.checkCircuitOnly ? 'Check circuit' : 'Proving and verification';
117
236
 
118
- static override async create() {
119
- const bbWorkingDirectory = await fs.mkdtemp(path.join(tmpdir(), 'bb-'));
237
+ const avmCircuitInputs = new AvmCircuitInputs(simRes.hints!, simRes.publicInputs!);
238
+ const timer = new Timer();
239
+ await this.proveVerify(avmCircuitInputs, txLabel);
240
+ this.logger.info(`${opString} took ${timer.ms()} ms for tx ${txLabel}`);
120
241
 
121
- const contractDataSource = new SimpleContractDataSource();
122
- const merkleTrees = await (await NativeWorldStateService.tmp()).fork();
123
- const worldStateDB = new WorldStateDB(merkleTrees, contractDataSource);
124
- return new AvmProvingTesterV2(bbWorkingDirectory, worldStateDB, contractDataSource, merkleTrees);
242
+ return simRes;
125
243
  }
126
244
 
127
- async proveV2(avmCircuitInputs: AvmCircuitInputs): Promise<BBResult> {
128
- // Then we prove.
129
- const proofRes = await generateAvmProofV2(BB_PATH, this.bbWorkingDirectory, avmCircuitInputs, this.logger);
130
- if (proofRes.status === BB_RESULT.FAILURE) {
131
- this.logger.error(`Proof generation failed: ${proofRes.reason}`);
132
- }
133
- expect(proofRes.status).toEqual(BB_RESULT.SUCCESS);
134
- return proofRes as BBSuccess;
135
- }
136
-
137
- async verifyV2(proofRes: BBSuccess): Promise<BBResult> {
138
- // TODO: Placeholder for now. They get ignored in C++.
139
- const inputs = await makeAvmCircuitInputs();
140
-
141
- const rawVkPath = path.join(proofRes.vkPath!, 'vk');
142
- return await verifyAvmProofV2(
143
- BB_PATH,
144
- this.bbWorkingDirectory,
145
- proofRes.proofPath!,
146
- inputs.publicInputs,
147
- rawVkPath,
148
- this.logger,
245
+ public override async executeTxWithLabel(
246
+ txLabel: string,
247
+ sender: AztecAddress,
248
+ setupCalls?: TestEnqueuedCall[],
249
+ appCalls?: TestEnqueuedCall[],
250
+ teardownCall?: TestEnqueuedCall,
251
+ feePayer?: AztecAddress,
252
+ privateInsertions?: TestPrivateInsertions,
253
+ gasLimits?: Gas,
254
+ ) {
255
+ return await this.simProveVerify(
256
+ sender,
257
+ setupCalls ?? [],
258
+ appCalls ?? [],
259
+ teardownCall,
260
+ undefined,
261
+ feePayer,
262
+ privateInsertions,
263
+ txLabel,
264
+ true,
265
+ gasLimits,
149
266
  );
150
267
  }
151
268
 
152
- public async simProveVerifyV2(
153
- sender: AztecAddress,
154
- setupCalls: TestEnqueuedCall[],
155
- appCalls: TestEnqueuedCall[],
156
- teardownCall: TestEnqueuedCall | undefined,
157
- expectRevert: boolean | undefined,
158
- feePayer = sender,
269
+ public async simProveVerifyAppLogic(
270
+ appCall: TestEnqueuedCall,
271
+ expectRevert?: boolean,
272
+ txLabel: string = 'unlabeledTx',
273
+ gasLimits?: Gas,
159
274
  ) {
160
- const simRes = await this.simulateTx(sender, setupCalls, appCalls, teardownCall, feePayer);
161
- expect(simRes.revertCode.isOK()).toBe(expectRevert ? false : true);
162
-
163
- const avmCircuitInputs = simRes.avmProvingRequest.inputs;
164
- const provingRes = await this.proveV2(avmCircuitInputs);
165
- expect(provingRes.status).toEqual(BB_RESULT.SUCCESS);
166
-
167
- const verificationRes = await this.verifyV2(provingRes as BBSuccess);
168
- expect(verificationRes.status).toBe(BB_RESULT.SUCCESS);
275
+ await this.simProveVerify(
276
+ /*sender=*/ AztecAddress.fromNumber(42),
277
+ /*setupCalls=*/ [],
278
+ [appCall],
279
+ undefined,
280
+ expectRevert,
281
+ /*feePayer=*/ undefined,
282
+ /*privateInsertions=*/ undefined,
283
+ txLabel,
284
+ /*disableRevertCheck=*/ false,
285
+ gasLimits,
286
+ );
169
287
  }
170
288
  }