@aztec/simulator 0.59.0 → 0.61.0

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 (190) hide show
  1. package/dest/acvm/acvm.d.ts +1 -0
  2. package/dest/acvm/acvm.d.ts.map +1 -1
  3. package/dest/acvm/oracle/oracle.d.ts +5 -3
  4. package/dest/acvm/oracle/oracle.d.ts.map +1 -1
  5. package/dest/acvm/oracle/oracle.js +15 -7
  6. package/dest/acvm/oracle/typed_oracle.d.ts +7 -4
  7. package/dest/acvm/oracle/typed_oracle.d.ts.map +1 -1
  8. package/dest/acvm/oracle/typed_oracle.js +10 -4
  9. package/dest/acvm/serialize.d.ts +1 -0
  10. package/dest/acvm/serialize.d.ts.map +1 -1
  11. package/dest/avm/avm_context.d.ts +1 -1
  12. package/dest/avm/avm_context.js +1 -1
  13. package/dest/avm/avm_execution_environment.d.ts +2 -5
  14. package/dest/avm/avm_execution_environment.d.ts.map +1 -1
  15. package/dest/avm/avm_execution_environment.js +7 -15
  16. package/dest/avm/avm_gas.d.ts.map +1 -1
  17. package/dest/avm/avm_gas.js +6 -10
  18. package/dest/avm/avm_machine_state.d.ts +2 -0
  19. package/dest/avm/avm_machine_state.d.ts.map +1 -1
  20. package/dest/avm/avm_machine_state.js +3 -1
  21. package/dest/avm/avm_memory_types.d.ts +1 -0
  22. package/dest/avm/avm_memory_types.d.ts.map +1 -1
  23. package/dest/avm/avm_simulator.d.ts +16 -0
  24. package/dest/avm/avm_simulator.d.ts.map +1 -1
  25. package/dest/avm/avm_simulator.js +45 -4
  26. package/dest/avm/bytecode_utils.d.ts +1 -0
  27. package/dest/avm/bytecode_utils.d.ts.map +1 -1
  28. package/dest/avm/fixtures/index.d.ts +3 -0
  29. package/dest/avm/fixtures/index.d.ts.map +1 -1
  30. package/dest/avm/fixtures/index.js +8 -2
  31. package/dest/avm/journal/journal.d.ts +19 -19
  32. package/dest/avm/journal/journal.d.ts.map +1 -1
  33. package/dest/avm/journal/journal.js +73 -48
  34. package/dest/avm/journal/nullifiers.d.ts +9 -9
  35. package/dest/avm/journal/nullifiers.d.ts.map +1 -1
  36. package/dest/avm/journal/nullifiers.js +24 -24
  37. package/dest/avm/journal/public_storage.d.ts +10 -10
  38. package/dest/avm/journal/public_storage.d.ts.map +1 -1
  39. package/dest/avm/journal/public_storage.js +21 -21
  40. package/dest/avm/opcodes/accrued_substate.d.ts.map +1 -1
  41. package/dest/avm/opcodes/accrued_substate.js +5 -5
  42. package/dest/avm/opcodes/contract.d.ts +8 -1
  43. package/dest/avm/opcodes/contract.d.ts.map +1 -1
  44. package/dest/avm/opcodes/contract.js +41 -21
  45. package/dest/avm/opcodes/conversion.d.ts +1 -1
  46. package/dest/avm/opcodes/conversion.d.ts.map +1 -1
  47. package/dest/avm/opcodes/conversion.js +12 -9
  48. package/dest/avm/opcodes/environment_getters.d.ts +13 -14
  49. package/dest/avm/opcodes/environment_getters.d.ts.map +1 -1
  50. package/dest/avm/opcodes/environment_getters.js +17 -16
  51. package/dest/avm/opcodes/external_calls.d.ts +3 -6
  52. package/dest/avm/opcodes/external_calls.d.ts.map +1 -1
  53. package/dest/avm/opcodes/external_calls.js +23 -43
  54. package/dest/avm/opcodes/hashing.d.ts +2 -26
  55. package/dest/avm/opcodes/hashing.d.ts.map +1 -1
  56. package/dest/avm/opcodes/hashing.js +11 -95
  57. package/dest/avm/opcodes/index.d.ts +0 -1
  58. package/dest/avm/opcodes/index.d.ts.map +1 -1
  59. package/dest/avm/opcodes/index.js +1 -2
  60. package/dest/avm/opcodes/instruction.d.ts +1 -0
  61. package/dest/avm/opcodes/instruction.d.ts.map +1 -1
  62. package/dest/avm/opcodes/memory.d.ts +20 -0
  63. package/dest/avm/opcodes/memory.d.ts.map +1 -1
  64. package/dest/avm/opcodes/memory.js +59 -3
  65. package/dest/avm/opcodes/storage.js +3 -3
  66. package/dest/avm/serialization/buffer_cursor.d.ts +1 -0
  67. package/dest/avm/serialization/buffer_cursor.d.ts.map +1 -1
  68. package/dest/avm/serialization/bytecode_serialization.d.ts +1 -0
  69. package/dest/avm/serialization/bytecode_serialization.d.ts.map +1 -1
  70. package/dest/avm/serialization/bytecode_serialization.js +5 -7
  71. package/dest/avm/serialization/instruction_serialization.d.ts +34 -35
  72. package/dest/avm/serialization/instruction_serialization.d.ts.map +1 -1
  73. package/dest/avm/serialization/instruction_serialization.js +34 -36
  74. package/dest/avm/test_utils.d.ts +3 -1
  75. package/dest/avm/test_utils.d.ts.map +1 -1
  76. package/dest/avm/test_utils.js +4 -1
  77. package/dest/client/client_execution_context.d.ts +9 -18
  78. package/dest/client/client_execution_context.d.ts.map +1 -1
  79. package/dest/client/client_execution_context.js +30 -50
  80. package/dest/client/db_oracle.d.ts +17 -1
  81. package/dest/client/db_oracle.d.ts.map +1 -1
  82. package/dest/client/db_oracle.js +1 -1
  83. package/dest/client/private_execution.d.ts.map +1 -1
  84. package/dest/client/private_execution.js +3 -4
  85. package/dest/client/simulator.d.ts.map +1 -1
  86. package/dest/client/simulator.js +3 -3
  87. package/dest/client/view_data_oracle.d.ts +17 -1
  88. package/dest/client/view_data_oracle.d.ts.map +1 -1
  89. package/dest/client/view_data_oracle.js +21 -1
  90. package/dest/common/index.d.ts +0 -1
  91. package/dest/common/index.d.ts.map +1 -1
  92. package/dest/common/index.js +1 -2
  93. package/dest/mocks/fixtures.js +2 -2
  94. package/dest/providers/acvm_native.d.ts +1 -0
  95. package/dest/providers/acvm_native.d.ts.map +1 -1
  96. package/dest/public/db_interfaces.d.ts +1 -0
  97. package/dest/public/db_interfaces.d.ts.map +1 -1
  98. package/dest/public/dual_side_effect_trace.d.ts +10 -11
  99. package/dest/public/dual_side_effect_trace.d.ts.map +1 -1
  100. package/dest/public/dual_side_effect_trace.js +26 -22
  101. package/dest/public/enqueued_call_side_effect_trace.d.ts +11 -12
  102. package/dest/public/enqueued_call_side_effect_trace.d.ts.map +1 -1
  103. package/dest/public/enqueued_call_side_effect_trace.js +33 -23
  104. package/dest/public/enqueued_call_simulator.d.ts +3 -3
  105. package/dest/public/enqueued_call_simulator.d.ts.map +1 -1
  106. package/dest/public/enqueued_call_simulator.js +30 -39
  107. package/dest/public/enqueued_calls_processor.d.ts +2 -3
  108. package/dest/public/enqueued_calls_processor.d.ts.map +1 -1
  109. package/dest/public/enqueued_calls_processor.js +19 -26
  110. package/dest/public/execution.d.ts +1 -0
  111. package/dest/public/execution.d.ts.map +1 -1
  112. package/dest/public/execution.js +2 -2
  113. package/dest/public/executor.d.ts.map +1 -1
  114. package/dest/public/executor.js +6 -5
  115. package/dest/public/public_db_sources.d.ts +1 -0
  116. package/dest/public/public_db_sources.d.ts.map +1 -1
  117. package/dest/public/public_kernel.d.ts +0 -1
  118. package/dest/public/public_kernel.d.ts.map +1 -1
  119. package/dest/public/public_kernel.js +5 -8
  120. package/dest/public/public_kernel_tail_simulator.d.ts +1 -5
  121. package/dest/public/public_kernel_tail_simulator.d.ts.map +1 -1
  122. package/dest/public/public_kernel_tail_simulator.js +6 -12
  123. package/dest/public/public_processor.js +4 -4
  124. package/dest/public/side_effect_trace.d.ts +11 -9
  125. package/dest/public/side_effect_trace.d.ts.map +1 -1
  126. package/dest/public/side_effect_trace.js +40 -30
  127. package/dest/public/side_effect_trace_interface.d.ts +10 -9
  128. package/dest/public/side_effect_trace_interface.d.ts.map +1 -1
  129. package/package.json +9 -9
  130. package/src/acvm/oracle/oracle.ts +13 -6
  131. package/src/acvm/oracle/typed_oracle.ts +9 -3
  132. package/src/avm/avm_context.ts +1 -1
  133. package/src/avm/avm_execution_environment.ts +0 -15
  134. package/src/avm/avm_gas.ts +5 -9
  135. package/src/avm/avm_machine_state.ts +2 -0
  136. package/src/avm/avm_simulator.ts +69 -6
  137. package/src/avm/fixtures/index.ts +7 -2
  138. package/src/avm/journal/journal.ts +93 -50
  139. package/src/avm/journal/nullifiers.ts +23 -23
  140. package/src/avm/journal/public_storage.ts +20 -20
  141. package/src/avm/opcodes/accrued_substate.ts +4 -8
  142. package/src/avm/opcodes/contract.ts +45 -21
  143. package/src/avm/opcodes/conversion.ts +9 -6
  144. package/src/avm/opcodes/environment_getters.ts +7 -5
  145. package/src/avm/opcodes/external_calls.ts +21 -45
  146. package/src/avm/opcodes/hashing.ts +9 -122
  147. package/src/avm/opcodes/index.ts +0 -1
  148. package/src/avm/opcodes/memory.ts +69 -2
  149. package/src/avm/opcodes/storage.ts +2 -2
  150. package/src/avm/serialization/bytecode_serialization.ts +6 -9
  151. package/src/avm/serialization/instruction_serialization.ts +3 -5
  152. package/src/avm/test_utils.ts +5 -1
  153. package/src/client/client_execution_context.ts +21 -71
  154. package/src/client/db_oracle.ts +26 -0
  155. package/src/client/private_execution.ts +1 -9
  156. package/src/client/simulator.ts +0 -2
  157. package/src/client/view_data_oracle.ts +31 -1
  158. package/src/common/index.ts +0 -1
  159. package/src/mocks/fixtures.ts +1 -1
  160. package/src/public/dual_side_effect_trace.ts +38 -24
  161. package/src/public/enqueued_call_side_effect_trace.ts +60 -28
  162. package/src/public/enqueued_call_simulator.ts +52 -49
  163. package/src/public/enqueued_calls_processor.ts +27 -41
  164. package/src/public/execution.ts +1 -1
  165. package/src/public/executor.ts +11 -5
  166. package/src/public/public_kernel.ts +9 -12
  167. package/src/public/public_kernel_tail_simulator.ts +6 -15
  168. package/src/public/public_processor.ts +3 -3
  169. package/src/public/side_effect_trace.ts +73 -29
  170. package/src/public/side_effect_trace_interface.ts +15 -10
  171. package/dest/avm/opcodes/commitment.d.ts +0 -16
  172. package/dest/avm/opcodes/commitment.d.ts.map +0 -1
  173. package/dest/avm/opcodes/commitment.js +0 -51
  174. package/dest/client/test_utils.d.ts +0 -9
  175. package/dest/client/test_utils.d.ts.map +0 -1
  176. package/dest/client/test_utils.js +0 -27
  177. package/dest/common/side_effect_counter.d.ts +0 -10
  178. package/dest/common/side_effect_counter.d.ts.map +0 -1
  179. package/dest/common/side_effect_counter.js +0 -18
  180. package/dest/rollup/index.d.ts +0 -2
  181. package/dest/rollup/index.d.ts.map +0 -1
  182. package/dest/rollup/index.js +0 -2
  183. package/dest/rollup/rollup.d.ts +0 -101
  184. package/dest/rollup/rollup.d.ts.map +0 -1
  185. package/dest/rollup/rollup.js +0 -100
  186. package/src/avm/opcodes/commitment.ts +0 -65
  187. package/src/client/test_utils.ts +0 -57
  188. package/src/common/side_effect_counter.ts +0 -17
  189. package/src/rollup/index.ts +0 -1
  190. package/src/rollup/rollup.ts +0 -228
@@ -1,5 +1,6 @@
1
1
  import { UnencryptedL2Log } from '@aztec/circuit-types';
2
2
  import {
3
+ AvmContractBytecodeHints,
3
4
  AvmContractInstanceHint,
4
5
  AvmExecutionHints,
5
6
  AvmExternalCallHint,
@@ -7,7 +8,7 @@ import {
7
8
  AztecAddress,
8
9
  CallContext,
9
10
  type CombinedConstantData,
10
- type ContractInstanceWithAddress,
11
+ type ContractClassIdPreimage,
11
12
  ContractStorageRead,
12
13
  ContractStorageUpdateRequest,
13
14
  EthAddress,
@@ -44,6 +45,7 @@ import {
44
45
  ScopedNoteHash,
45
46
  type ScopedNullifier,
46
47
  ScopedReadRequest,
48
+ SerializableContractInstance,
47
49
  TreeLeafReadRequest,
48
50
  VMCircuitPublicInputs,
49
51
  } from '@aztec/circuits.js';
@@ -58,8 +60,6 @@ import { type AvmExecutionEnvironment } from '../avm/avm_execution_environment.j
58
60
  import { SideEffectLimitReachedError } from './side_effect_errors.js';
59
61
  import { type PublicSideEffectTraceInterface } from './side_effect_trace_interface.js';
60
62
 
61
- export type TracedContractInstance = { exists: boolean } & ContractInstanceWithAddress;
62
-
63
63
  /**
64
64
  * A struct containing just the side effects as regular arrays
65
65
  * as opposed to "Tuple" arrays used by circuit public inputs.
@@ -157,7 +157,7 @@ export class PublicEnqueuedCallSideEffectTrace implements PublicSideEffectTraceI
157
157
  this.sideEffectCounter++;
158
158
  }
159
159
 
160
- public tracePublicStorageRead(storageAddress: Fr, slot: Fr, value: Fr, _exists: boolean, _cached: boolean) {
160
+ public tracePublicStorageRead(contractAddress: Fr, slot: Fr, value: Fr, _exists: boolean, _cached: boolean) {
161
161
  // NOTE: exists and cached are unused for now but may be used for optimizations or kernel hints later
162
162
  if (
163
163
  this.contractStorageReads.length + this.previousValidationRequestArrayLengths.publicDataReads >=
@@ -167,7 +167,7 @@ export class PublicEnqueuedCallSideEffectTrace implements PublicSideEffectTraceI
167
167
  }
168
168
 
169
169
  this.contractStorageReads.push(
170
- new ContractStorageRead(slot, value, this.sideEffectCounter, AztecAddress.fromField(storageAddress)),
170
+ new ContractStorageRead(slot, value, this.sideEffectCounter, AztecAddress.fromField(contractAddress)),
171
171
  );
172
172
  this.avmCircuitHints.storageValues.items.push(
173
173
  new AvmKeyValueHint(/*key=*/ new Fr(this.sideEffectCounter), /*value=*/ value),
@@ -176,7 +176,7 @@ export class PublicEnqueuedCallSideEffectTrace implements PublicSideEffectTraceI
176
176
  this.incrementSideEffectCounter();
177
177
  }
178
178
 
179
- public tracePublicStorageWrite(storageAddress: Fr, slot: Fr, value: Fr) {
179
+ public tracePublicStorageWrite(contractAddress: Fr, slot: Fr, value: Fr) {
180
180
  if (
181
181
  this.contractStorageUpdateRequests.length + this.previousAccumulatedDataArrayLengths.publicDataUpdateRequests >=
182
182
  MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX
@@ -185,15 +185,15 @@ export class PublicEnqueuedCallSideEffectTrace implements PublicSideEffectTraceI
185
185
  }
186
186
 
187
187
  this.contractStorageUpdateRequests.push(
188
- new ContractStorageUpdateRequest(slot, value, this.sideEffectCounter, storageAddress),
188
+ new ContractStorageUpdateRequest(slot, value, this.sideEffectCounter, contractAddress),
189
189
  );
190
190
  this.log.debug(`SSTORE cnt: ${this.sideEffectCounter} val: ${value} slot: ${slot}`);
191
191
  this.incrementSideEffectCounter();
192
192
  }
193
193
 
194
194
  // TODO(8287): _exists can be removed once we have the vm properly handling the equality check
195
- public traceNoteHashCheck(_storageAddress: Fr, noteHash: Fr, leafIndex: Fr, exists: boolean) {
196
- // NOTE: storageAddress is unused because noteHash is an already-siloed leaf
195
+ public traceNoteHashCheck(_contractAddress: Fr, noteHash: Fr, leafIndex: Fr, exists: boolean) {
196
+ // NOTE: contractAddress is unused because noteHash is an already-siloed leaf
197
197
  if (
198
198
  this.noteHashReadRequests.length + this.previousValidationRequestArrayLengths.noteHashReadRequests >=
199
199
  MAX_NOTE_HASH_READ_REQUESTS_PER_TX
@@ -208,22 +208,22 @@ export class PublicEnqueuedCallSideEffectTrace implements PublicSideEffectTraceI
208
208
  // NOTE: counter does not increment for note hash checks (because it doesn't rely on pending note hashes)
209
209
  }
210
210
 
211
- public traceNewNoteHash(storageAddress: Fr, noteHash: Fr) {
211
+ public traceNewNoteHash(contractAddress: Fr, noteHash: Fr) {
212
212
  if (this.noteHashes.length + this.previousAccumulatedDataArrayLengths.noteHashes >= MAX_NOTE_HASHES_PER_TX) {
213
213
  throw new SideEffectLimitReachedError('note hash', MAX_NOTE_HASHES_PER_TX);
214
214
  }
215
215
 
216
- this.noteHashes.push(new NoteHash(noteHash, this.sideEffectCounter).scope(AztecAddress.fromField(storageAddress)));
216
+ this.noteHashes.push(new NoteHash(noteHash, this.sideEffectCounter).scope(AztecAddress.fromField(contractAddress)));
217
217
  this.log.debug(`NEW_NOTE_HASH cnt: ${this.sideEffectCounter}`);
218
218
  this.incrementSideEffectCounter();
219
219
  }
220
220
 
221
- public traceNullifierCheck(storageAddress: Fr, nullifier: Fr, _leafIndex: Fr, exists: boolean, _isPending: boolean) {
221
+ public traceNullifierCheck(contractAddress: Fr, nullifier: Fr, _leafIndex: Fr, exists: boolean, _isPending: boolean) {
222
222
  // NOTE: isPending and leafIndex are unused for now but may be used for optimizations or kernel hints later
223
223
  this.enforceLimitOnNullifierChecks();
224
224
 
225
225
  const readRequest = new ReadRequest(nullifier, this.sideEffectCounter).scope(
226
- AztecAddress.fromField(storageAddress),
226
+ AztecAddress.fromField(contractAddress),
227
227
  );
228
228
  if (exists) {
229
229
  this.nullifierReadRequests.push(readRequest);
@@ -237,14 +237,14 @@ export class PublicEnqueuedCallSideEffectTrace implements PublicSideEffectTraceI
237
237
  this.incrementSideEffectCounter();
238
238
  }
239
239
 
240
- public traceNewNullifier(storageAddress: Fr, nullifier: Fr) {
240
+ public traceNewNullifier(contractAddress: Fr, nullifier: Fr) {
241
241
  if (this.nullifiers.length + this.previousAccumulatedDataArrayLengths.nullifiers >= MAX_NULLIFIERS_PER_TX) {
242
242
  throw new SideEffectLimitReachedError('nullifier', MAX_NULLIFIERS_PER_TX);
243
243
  }
244
244
 
245
245
  this.nullifiers.push(
246
246
  new Nullifier(nullifier, this.sideEffectCounter, /*noteHash=*/ Fr.ZERO).scope(
247
- AztecAddress.fromField(storageAddress),
247
+ AztecAddress.fromField(contractAddress),
248
248
  ),
249
249
  );
250
250
  this.log.debug(`NEW_NULLIFIER cnt: ${this.sideEffectCounter}`);
@@ -307,14 +307,17 @@ export class PublicEnqueuedCallSideEffectTrace implements PublicSideEffectTraceI
307
307
  this.incrementSideEffectCounter();
308
308
  }
309
309
 
310
- public traceGetContractInstance(instance: TracedContractInstance) {
310
+ public traceGetContractInstance(
311
+ contractAddress: Fr,
312
+ exists: boolean,
313
+ instance: SerializableContractInstance = SerializableContractInstance.default(),
314
+ ) {
311
315
  this.enforceLimitOnNullifierChecks('(contract address nullifier from GETCONTRACTINSTANCE)');
312
- // TODO(dbanks12): should emit a nullifier read request
313
316
 
314
317
  this.avmCircuitHints.contractInstances.items.push(
315
318
  new AvmContractInstanceHint(
316
- instance.address,
317
- new Fr(instance.exists ? 1 : 0),
319
+ contractAddress,
320
+ exists,
318
321
  instance.salt,
319
322
  instance.deployer,
320
323
  instance.contractClassId,
@@ -326,6 +329,40 @@ export class PublicEnqueuedCallSideEffectTrace implements PublicSideEffectTraceI
326
329
  this.incrementSideEffectCounter();
327
330
  }
328
331
 
332
+ // This tracing function gets called everytime we start simulation/execution.
333
+ // This happens both when starting a new top-level trace and the start of every nested trace
334
+ // We use this to collect the AvmContractBytecodeHints
335
+ public traceGetBytecode(
336
+ contractAddress: Fr,
337
+ exists: boolean,
338
+ bytecode: Buffer = Buffer.alloc(0),
339
+ contractInstance: SerializableContractInstance = SerializableContractInstance.default(),
340
+ contractClass: ContractClassIdPreimage = {
341
+ artifactHash: Fr.zero(),
342
+ privateFunctionsRoot: Fr.zero(),
343
+ publicBytecodeCommitment: Fr.zero(),
344
+ },
345
+ ) {
346
+ const instance = new AvmContractInstanceHint(
347
+ contractAddress,
348
+ exists,
349
+ contractInstance.salt,
350
+ contractInstance.deployer,
351
+ contractInstance.contractClassId,
352
+ contractInstance.initializationHash,
353
+ contractInstance.publicKeys,
354
+ );
355
+ // We need to deduplicate the contract instances based on addresses
356
+ this.avmCircuitHints.contractBytecodeHints.items.push(
357
+ new AvmContractBytecodeHints(bytecode, instance, contractClass),
358
+ );
359
+ this.log.debug(
360
+ `Bytecode retrieval for contract execution traced: exists=${exists}, instance=${JSON.stringify(
361
+ contractInstance,
362
+ )}`,
363
+ );
364
+ }
365
+
329
366
  /**
330
367
  * Trace a nested call.
331
368
  * Accept some results from a finished nested call's trace into this one.
@@ -334,7 +371,7 @@ export class PublicEnqueuedCallSideEffectTrace implements PublicSideEffectTraceI
334
371
  /** The trace of the nested call. */
335
372
  nestedCallTrace: this,
336
373
  /** The execution environment of the nested call. */
337
- _nestedEnvironment: AvmExecutionEnvironment,
374
+ nestedEnvironment: AvmExecutionEnvironment,
338
375
  /** How much gas was available for this public execution. */
339
376
  startGasLeft: Gas,
340
377
  /** How much gas was left after this public execution. */
@@ -368,6 +405,7 @@ export class PublicEnqueuedCallSideEffectTrace implements PublicSideEffectTraceI
368
405
  avmCallResults.output,
369
406
  gasUsed,
370
407
  endSideEffectCounter,
408
+ nestedEnvironment.address,
371
409
  ),
372
410
  );
373
411
  }
@@ -538,15 +576,9 @@ export class PublicEnqueuedCallSideEffectTrace implements PublicSideEffectTraceI
538
576
  function createPublicCallRequest(avmEnvironment: AvmExecutionEnvironment): PublicCallRequest {
539
577
  const callContext = CallContext.from({
540
578
  msgSender: avmEnvironment.sender,
541
- storageContractAddress: avmEnvironment.storageAddress,
579
+ contractAddress: avmEnvironment.address,
542
580
  functionSelector: avmEnvironment.functionSelector,
543
- isDelegateCall: avmEnvironment.isDelegateCall,
544
581
  isStaticCall: avmEnvironment.isStaticCall,
545
582
  });
546
- return new PublicCallRequest(
547
- avmEnvironment.address,
548
- callContext,
549
- computeVarArgsHash(avmEnvironment.calldata),
550
- /*counter=*/ 0,
551
- );
583
+ return new PublicCallRequest(callContext, computeVarArgsHash(avmEnvironment.calldata), /*counter=*/ 0);
552
584
  }
@@ -1,22 +1,20 @@
1
1
  import {
2
- AVM_REQUEST,
3
2
  type AvmProvingRequest,
4
3
  MerkleTreeId,
5
4
  NestedProcessReturnValues,
6
5
  ProvingRequestType,
7
6
  type PublicExecutionRequest,
8
7
  PublicKernelPhase,
9
- type PublicProvingRequest,
10
8
  type SimulationError,
11
9
  type Tx,
12
10
  UnencryptedFunctionL2Logs,
13
11
  } from '@aztec/circuit-types';
14
12
  import {
13
+ AvmCircuitInputs,
15
14
  AztecAddress,
16
15
  ContractStorageRead,
17
16
  ContractStorageUpdateRequest,
18
17
  Fr,
19
- FunctionData,
20
18
  Gas,
21
19
  type GlobalVariables,
22
20
  type Header,
@@ -42,7 +40,6 @@ import {
42
40
  PublicAccumulatedDataArrayLengths,
43
41
  PublicCallData,
44
42
  type PublicCallRequest,
45
- PublicCallStackItem,
46
43
  PublicCircuitPublicInputs,
47
44
  PublicInnerCallRequest,
48
45
  type PublicKernelCircuitPublicInputs,
@@ -54,6 +51,7 @@ import {
54
51
  RevertCode,
55
52
  TreeLeafReadRequest,
56
53
  VMCircuitPublicInputs,
54
+ VerificationKeyData,
57
55
  makeEmptyProof,
58
56
  makeEmptyRecursiveProof,
59
57
  } from '@aztec/circuits.js';
@@ -61,33 +59,22 @@ import { computeVarArgsHash } from '@aztec/circuits.js/hash';
61
59
  import { makeTuple } from '@aztec/foundation/array';
62
60
  import { padArrayEnd } from '@aztec/foundation/collection';
63
61
  import { type DebugLogger, createDebugLogger } from '@aztec/foundation/log';
64
- import { ProtocolCircuitVks } from '@aztec/noir-protocol-circuits-types';
65
62
  import { type MerkleTreeReadOperations } from '@aztec/world-state';
66
63
 
67
64
  import { type PublicExecutionResult, accumulatePublicReturnValues, collectExecutionResults } from './execution.js';
68
65
  import { type PublicExecutor } from './executor.js';
69
66
  import { type PublicKernelCircuitSimulator } from './public_kernel_circuit_simulator.js';
70
67
 
71
- function makeAvmProvingRequest(
72
- inputs: PublicKernelInnerCircuitPrivateInputs,
73
- result: PublicExecutionResult,
74
- ): AvmProvingRequest {
68
+ function makeAvmProvingRequest(inputs: PublicCircuitPublicInputs, result: PublicExecutionResult): AvmProvingRequest {
75
69
  return {
76
- type: AVM_REQUEST,
77
- functionName: result.functionName,
78
- calldata: result.calldata,
79
- bytecode: result.bytecode!,
80
- avmHints: result.avmCircuitHints,
81
- kernelRequest: {
82
- type: ProvingRequestType.PUBLIC_KERNEL_INNER,
83
- inputs,
84
- },
70
+ type: ProvingRequestType.PUBLIC_VM,
71
+ inputs: new AvmCircuitInputs(result.functionName, result.calldata, inputs, result.avmCircuitHints),
85
72
  };
86
73
  }
87
74
 
88
75
  export type EnqueuedCallResult = {
89
76
  /** Inputs to be used for proving */
90
- provingRequests: PublicProvingRequest[];
77
+ avmProvingRequest: AvmProvingRequest;
91
78
  /** The public kernel output at the end of the enqueued call */
92
79
  kernelOutput: VMCircuitPublicInputs;
93
80
  /** Unencrypted logs generated during the execution of this enqueued call */
@@ -157,7 +144,7 @@ export class EnqueuedCallSimulator {
157
144
  );
158
145
 
159
146
  const callStack = makeTuple(MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX, PublicInnerCallRequest.empty);
160
- callStack[0].item.contractAddress = callRequest.contractAddress;
147
+ callStack[0].item.contractAddress = callRequest.callContext.contractAddress;
161
148
  callStack[0].item.callContext = callRequest.callContext;
162
149
  callStack[0].item.argsHash = callRequest.argsHash;
163
150
 
@@ -188,7 +175,7 @@ export class EnqueuedCallSimulator {
188
175
  ): Promise<EnqueuedCallResult> {
189
176
  const executionResults = collectExecutionResults(topResult);
190
177
 
191
- const provingRequests: AvmProvingRequest[] = [];
178
+ let avmProvingRequest: AvmProvingRequest;
192
179
  let gasUsed = Gas.empty();
193
180
  let revertReason;
194
181
  let kernelOutput = startVMCircuitOutput;
@@ -197,22 +184,19 @@ export class EnqueuedCallSimulator {
197
184
  // Accumulate gas used in this enqueued call.
198
185
  gasUsed = gasUsed.add(Gas.from(result.startGasLeft).sub(Gas.from(result.endGasLeft)));
199
186
 
187
+ const { contractAddress, functionSelector } = result.executionRequest.callContext;
188
+
200
189
  // Sanity check for a current upstream assumption.
201
190
  // Consumers of the result seem to expect "reverted <=> revertReason !== undefined".
202
- const functionSelector = result.executionRequest.callContext.functionSelector.toString();
203
191
  if (result.reverted && !result.revertReason) {
204
192
  throw new Error(
205
- `Simulation of ${result.executionRequest.contractAddress.toString()}:${functionSelector}(${
206
- result.functionName
207
- }) reverted with no reason.`,
193
+ `Simulation of ${contractAddress}:${functionSelector}(${result.functionName}) reverted with no reason.`,
208
194
  );
209
195
  }
210
196
 
211
197
  // Simulate the public kernel circuit.
212
198
  this.log.debug(
213
- `Running public kernel inner circuit for ${result.executionRequest.contractAddress.toString()}:${functionSelector}(${
214
- result.functionName
215
- })`,
199
+ `Running public kernel inner circuit for ${contractAddress}:${functionSelector}(${result.functionName})`,
216
200
  );
217
201
 
218
202
  const callData = await this.getPublicCallData(result);
@@ -220,20 +204,18 @@ export class EnqueuedCallSimulator {
220
204
  kernelOutput = output;
221
205
 
222
206
  // Capture the inputs for later proving in the AVM and kernel.
223
- provingRequests.push(makeAvmProvingRequest(inputs, result));
207
+ avmProvingRequest = makeAvmProvingRequest(inputs.publicCall.publicInputs, result);
224
208
 
225
209
  // Safely return the revert reason and the kernel output (which has had its revertible side effects dropped)
226
210
  // TODO(@leila) we shouldn't drop everything when it reverts. The tail kernel needs the data to prove that it's reverted for the correct reason.
227
211
  if (result.reverted) {
228
212
  this.log.debug(
229
- `Reverting on ${result.executionRequest.contractAddress.toString()}:${functionSelector}(${
230
- result.functionName
231
- }) with reason: ${result.revertReason}`,
213
+ `Reverting on ${contractAddress}:${functionSelector}(${result.functionName}) with reason: ${result.revertReason}`,
232
214
  );
233
215
  // TODO(@spalladino): Check gasUsed is correct. The AVM should take care of setting gasLeft to zero upon a revert.
234
216
 
235
217
  return {
236
- provingRequests,
218
+ avmProvingRequest,
237
219
  kernelOutput,
238
220
  newUnencryptedLogs: UnencryptedFunctionL2Logs.empty(),
239
221
  returnValues: NestedProcessReturnValues.empty(),
@@ -244,7 +226,7 @@ export class EnqueuedCallSimulator {
244
226
  }
245
227
 
246
228
  return {
247
- provingRequests,
229
+ avmProvingRequest: avmProvingRequest!,
248
230
  kernelOutput,
249
231
  newUnencryptedLogs: topResult.allUnencryptedLogs,
250
232
  returnValues: accumulatePublicReturnValues(topResult),
@@ -264,7 +246,7 @@ export class EnqueuedCallSimulator {
264
246
  ): Promise<{ inputs: PublicKernelInnerCircuitPrivateInputs; output: VMCircuitPublicInputs }> {
265
247
  // The proof is not used in simulation
266
248
  const proof = makeEmptyRecursiveProof(NESTED_RECURSIVE_PROOF_LENGTH);
267
- const vk = ProtocolCircuitVks.PublicKernelInnerArtifact;
249
+ const vk = VerificationKeyData.makeFakeHonk();
268
250
  const previousKernel = new PublicKernelInnerData(previousOutput, proof, vk);
269
251
  const inputs = new PublicKernelInnerCircuitPrivateInputs(previousKernel, callData);
270
252
  return { inputs, output: await this.publicKernelSimulator.publicKernelCircuitInner(inputs) };
@@ -278,21 +260,36 @@ export class EnqueuedCallSimulator {
278
260
  */
279
261
  private async getPublicCallData(result: PublicExecutionResult) {
280
262
  const bytecodeHash = await this.getBytecodeHash(result);
281
- const callStackItem = await this.getPublicCallStackItem(result);
282
- return new PublicCallData(callStackItem, makeEmptyProof(), bytecodeHash);
263
+ const publicInputs = await this.getPublicCircuitPublicInputs(result);
264
+ return new PublicCallData(publicInputs, makeEmptyProof(), bytecodeHash);
283
265
  }
284
266
 
285
- private async getPublicCallStackItem(result: PublicExecutionResult) {
267
+ private async getPublicCircuitPublicInputs(result: PublicExecutionResult) {
286
268
  const publicDataTreeInfo = await this.db.getTreeInfo(MerkleTreeId.PUBLIC_DATA_TREE);
287
269
  this.historicalHeader.state.partial.publicDataTree.root = Fr.fromBuffer(publicDataTreeInfo.root);
288
270
 
289
- const publicCircuitPublicInputs = PublicCircuitPublicInputs.from({
271
+ return PublicCircuitPublicInputs.from({
290
272
  callContext: result.executionRequest.callContext,
291
273
  proverAddress: AztecAddress.ZERO,
292
274
  argsHash: computeVarArgsHash(result.executionRequest.args),
293
- noteHashes: padArrayEnd(result.noteHashes, NoteHash.empty(), MAX_NOTE_HASHES_PER_CALL),
294
- nullifiers: padArrayEnd(result.nullifiers, Nullifier.empty(), MAX_NULLIFIERS_PER_CALL),
295
- l2ToL1Msgs: padArrayEnd(result.l2ToL1Messages, L2ToL1Message.empty(), MAX_L2_TO_L1_MSGS_PER_CALL),
275
+ noteHashes: padArrayEnd(
276
+ result.noteHashes,
277
+ NoteHash.empty(),
278
+ MAX_NOTE_HASHES_PER_CALL,
279
+ `Too many note hashes. Got ${result.noteHashes.length} with max being ${MAX_NOTE_HASHES_PER_CALL}`,
280
+ ),
281
+ nullifiers: padArrayEnd(
282
+ result.nullifiers,
283
+ Nullifier.empty(),
284
+ MAX_NULLIFIERS_PER_CALL,
285
+ `Too many nullifiers. Got ${result.nullifiers.length} with max being ${MAX_NULLIFIERS_PER_CALL}`,
286
+ ),
287
+ l2ToL1Msgs: padArrayEnd(
288
+ result.l2ToL1Messages,
289
+ L2ToL1Message.empty(),
290
+ MAX_L2_TO_L1_MSGS_PER_CALL,
291
+ `Too many L2 to L1 messages. Got ${result.l2ToL1Messages.length} with max being ${MAX_L2_TO_L1_MSGS_PER_CALL}`,
292
+ ),
296
293
  startSideEffectCounter: result.startSideEffectCounter,
297
294
  endSideEffectCounter: result.endSideEffectCounter,
298
295
  returnsHash: computeVarArgsHash(result.returnValues),
@@ -300,38 +297,50 @@ export class EnqueuedCallSimulator {
300
297
  result.noteHashReadRequests,
301
298
  TreeLeafReadRequest.empty(),
302
299
  MAX_NOTE_HASH_READ_REQUESTS_PER_CALL,
300
+ `Too many note hash read requests. Got ${result.noteHashReadRequests.length} with max being ${MAX_NOTE_HASH_READ_REQUESTS_PER_CALL}`,
303
301
  ),
304
302
  nullifierReadRequests: padArrayEnd(
305
303
  result.nullifierReadRequests,
306
304
  ReadRequest.empty(),
307
305
  MAX_NULLIFIER_READ_REQUESTS_PER_CALL,
306
+ `Too many nullifier read requests. Got ${result.nullifierReadRequests.length} with max being ${MAX_NULLIFIER_READ_REQUESTS_PER_CALL}`,
308
307
  ),
309
308
  nullifierNonExistentReadRequests: padArrayEnd(
310
309
  result.nullifierNonExistentReadRequests,
311
310
  ReadRequest.empty(),
312
311
  MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_CALL,
312
+ `Too many nullifier non-existent read requests. Got ${result.nullifierNonExistentReadRequests.length} with max being ${MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_CALL}`,
313
313
  ),
314
314
  l1ToL2MsgReadRequests: padArrayEnd(
315
315
  result.l1ToL2MsgReadRequests,
316
316
  TreeLeafReadRequest.empty(),
317
317
  MAX_L1_TO_L2_MSG_READ_REQUESTS_PER_CALL,
318
+ `Too many L1 to L2 message read requests. Got ${result.l1ToL2MsgReadRequests.length} with max being ${MAX_L1_TO_L2_MSG_READ_REQUESTS_PER_CALL}`,
318
319
  ),
319
320
  contractStorageReads: padArrayEnd(
320
321
  result.contractStorageReads,
321
322
  ContractStorageRead.empty(),
322
323
  MAX_PUBLIC_DATA_READS_PER_CALL,
324
+ `Too many public data reads. Got ${result.contractStorageReads.length} with max being ${MAX_PUBLIC_DATA_READS_PER_CALL}`,
323
325
  ),
324
326
  contractStorageUpdateRequests: padArrayEnd(
325
327
  result.contractStorageUpdateRequests,
326
328
  ContractStorageUpdateRequest.empty(),
327
329
  MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL,
330
+ `Too many public data update requests. Got ${result.contractStorageUpdateRequests.length} with max being ${MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL}`,
328
331
  ),
329
332
  publicCallRequests: padArrayEnd(
330
333
  result.publicCallRequests,
331
334
  PublicInnerCallRequest.empty(),
332
335
  MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL,
336
+ `Too many public call requests. Got ${result.publicCallRequests.length} with max being ${MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL}`,
337
+ ),
338
+ unencryptedLogsHashes: padArrayEnd(
339
+ result.unencryptedLogsHashes,
340
+ LogHash.empty(),
341
+ MAX_UNENCRYPTED_LOGS_PER_CALL,
342
+ `Too many unencrypted logs. Got ${result.unencryptedLogsHashes.length} with max being ${MAX_UNENCRYPTED_LOGS_PER_CALL}`,
333
343
  ),
334
- unencryptedLogsHashes: padArrayEnd(result.unencryptedLogsHashes, LogHash.empty(), MAX_UNENCRYPTED_LOGS_PER_CALL),
335
344
  historicalHeader: this.historicalHeader,
336
345
  globalVariables: this.globalVariables,
337
346
  startGasLeft: Gas.from(result.startGasLeft),
@@ -340,12 +349,6 @@ export class EnqueuedCallSimulator {
340
349
  // TODO(@just-mitch): need better mapping from simulator to revert code.
341
350
  revertCode: result.reverted ? RevertCode.APP_LOGIC_REVERTED : RevertCode.OK,
342
351
  });
343
-
344
- return new PublicCallStackItem(
345
- result.executionRequest.contractAddress,
346
- new FunctionData(result.executionRequest.callContext.functionSelector, false),
347
- publicCircuitPublicInputs,
348
- );
349
352
  }
350
353
 
351
354
  private getBytecodeHash(_result: PublicExecutionResult) {
@@ -1,12 +1,10 @@
1
1
  import {
2
+ type AvmProvingRequest,
2
3
  type MerkleTreeReadOperations,
3
4
  type NestedProcessReturnValues,
4
5
  type ProcessedTx,
5
- ProvingRequestType,
6
6
  type PublicExecutionRequest,
7
- type PublicKernelMergeRequest,
8
7
  PublicKernelPhase,
9
- type PublicProvingRequest,
10
8
  type SimulationError,
11
9
  type Tx,
12
10
  } from '@aztec/circuit-types';
@@ -23,12 +21,13 @@ import {
23
21
  type PublicKernelCircuitPublicInputs,
24
22
  PublicKernelData,
25
23
  type VMCircuitPublicInputs,
24
+ VerificationKeyData,
26
25
  makeEmptyProof,
27
26
  makeEmptyRecursiveProof,
28
27
  } from '@aztec/circuits.js';
29
28
  import { type DebugLogger, createDebugLogger } from '@aztec/foundation/log';
30
29
  import { Timer } from '@aztec/foundation/timer';
31
- import { ProtocolCircuitVks, TubeVk, getVKIndex, getVKSiblingPath } from '@aztec/noir-protocol-circuits-types';
30
+ import { getVKSiblingPath } from '@aztec/noir-protocol-circuits-types';
32
31
 
33
32
  import { inspect } from 'util';
34
33
 
@@ -45,10 +44,9 @@ const PhaseIsRevertible: Record<PublicKernelPhase, boolean> = {
45
44
  };
46
45
 
47
46
  type PublicPhaseResult = {
47
+ avmProvingRequest: AvmProvingRequest;
48
48
  /** The output of the public kernel circuit simulation for this phase */
49
49
  publicKernelOutput: PublicKernelCircuitPublicInputs;
50
- /** The collection of public proving requests */
51
- provingRequests: PublicProvingRequest[];
52
50
  /** Return values of simulating complete callstack */
53
51
  returnValues: NestedProcessReturnValues[];
54
52
  /** Gas used during the execution this phase */
@@ -66,8 +64,7 @@ export type ProcessedPhase = {
66
64
  };
67
65
 
68
66
  export type TxPublicCallsResult = {
69
- /** The collection of public proving requests */
70
- provingRequests: PublicProvingRequest[];
67
+ avmProvingRequest: AvmProvingRequest;
71
68
  /** The output of the public kernel tail circuit simulation for this tx */
72
69
  tailKernelOutput: KernelCircuitPublicInputs;
73
70
  /** Return values of simulating complete callstack */
@@ -158,8 +155,8 @@ export class EnqueuedCallsProcessor {
158
155
  PublicKernelPhase.TEARDOWN,
159
156
  ];
160
157
  const processedPhases: ProcessedPhase[] = [];
161
- const provingRequests: PublicProvingRequest[] = [];
162
158
  const gasUsed: ProcessedTx['gasUsed'] = {};
159
+ let avmProvingRequest: AvmProvingRequest;
163
160
  let publicKernelOutput = tx.data.toPublicKernelCircuitPublicInputs();
164
161
  let isFromPrivate = true;
165
162
  let returnValues: NestedProcessReturnValues[] = [];
@@ -184,7 +181,9 @@ export class EnqueuedCallsProcessor {
184
181
  publicKernelOutput = result.publicKernelOutput;
185
182
  isFromPrivate = false;
186
183
 
187
- provingRequests.push(...result.provingRequests);
184
+ // Propagate only one avmProvingRequest of a function call for now, so that we know it's still provable.
185
+ // Eventually this will be the proof for the entire public call stack.
186
+ avmProvingRequest = result.avmProvingRequest;
188
187
  if (phase === PublicKernelPhase.APP_LOGIC) {
189
188
  returnValues = result.returnValues;
190
189
  }
@@ -201,19 +200,16 @@ export class EnqueuedCallsProcessor {
201
200
  }
202
201
  }
203
202
 
204
- const { output: tailKernelOutput, provingRequest } = await this.publicKernelTailSimulator
205
- .simulate(publicKernelOutput)
206
- .catch(
207
- // the abstract phase manager throws if simulation gives error in non-revertible phase
208
- async err => {
209
- await this.worldStateDB.rollbackToCommit();
210
- throw err;
211
- },
212
- );
213
- provingRequests.push(provingRequest);
203
+ const tailKernelOutput = await this.publicKernelTailSimulator.simulate(publicKernelOutput).catch(
204
+ // the abstract phase manager throws if simulation gives error in non-revertible phase
205
+ async err => {
206
+ await this.worldStateDB.rollbackToCommit();
207
+ throw err;
208
+ },
209
+ );
214
210
 
215
211
  return {
216
- provingRequests: provingRequests,
212
+ avmProvingRequest: avmProvingRequest!,
217
213
  tailKernelOutput,
218
214
  returnValues,
219
215
  gasUsed,
@@ -233,8 +229,8 @@ export class EnqueuedCallsProcessor {
233
229
  this.log.debug(`Beginning processing in phase ${PublicKernelPhase[phase]} for tx ${tx.getTxHash()}`);
234
230
 
235
231
  const phaseTimer = new Timer();
236
- const provingRequests: PublicProvingRequest[] = [];
237
232
  const returnValues: NestedProcessReturnValues[] = [];
233
+ let avmProvingRequest: AvmProvingRequest;
238
234
  let publicKernelOutput = previousPublicKernelOutput;
239
235
  let gasUsed = Gas.empty();
240
236
  let revertReason: SimulationError | undefined;
@@ -265,14 +261,12 @@ export class EnqueuedCallsProcessor {
265
261
 
266
262
  if (enqueuedCallResult.revertReason && !PhaseIsRevertible[phase]) {
267
263
  this.log.debug(
268
- `Simulation error on ${executionRequest.contractAddress.toString()}:${
269
- executionRequest.callContext.functionSelector
270
- } with reason: ${enqueuedCallResult.revertReason}`,
264
+ `Simulation error on ${executionRequest.callContext.contractAddress}:${executionRequest.callContext.functionSelector} with reason: ${enqueuedCallResult.revertReason}`,
271
265
  );
272
266
  throw enqueuedCallResult.revertReason;
273
267
  }
274
268
 
275
- provingRequests.push(...enqueuedCallResult.provingRequests);
269
+ avmProvingRequest = enqueuedCallResult.avmProvingRequest;
276
270
  returnValues.push(enqueuedCallResult.returnValues);
277
271
  gasUsed = gasUsed.add(enqueuedCallResult.gasUsed);
278
272
  revertReason ??= enqueuedCallResult.revertReason;
@@ -288,14 +282,13 @@ export class EnqueuedCallsProcessor {
288
282
  tx.unencryptedLogs.addFunctionLogs([enqueuedCallResult.newUnencryptedLogs]);
289
283
  }
290
284
 
291
- const { output, provingRequest } = await this.runMergeKernelCircuit(
285
+ const output = await this.runMergeKernelCircuit(
292
286
  publicKernelOutput,
293
287
  enqueuedCallResult.kernelOutput,
294
288
  isFromPrivate,
295
289
  );
296
290
  publicKernelOutput = output;
297
291
  isFromPrivate = false;
298
- provingRequests.push(provingRequest);
299
292
  }
300
293
 
301
294
  if (phase === PublicKernelPhase.SETUP) {
@@ -303,8 +296,8 @@ export class EnqueuedCallsProcessor {
303
296
  }
304
297
 
305
298
  return {
299
+ avmProvingRequest: avmProvingRequest!,
306
300
  publicKernelOutput,
307
- provingRequests,
308
301
  durationMs: phaseTimer.ms(),
309
302
  gasUsed,
310
303
  returnValues: revertReason ? [] : returnValues,
@@ -351,7 +344,7 @@ export class EnqueuedCallsProcessor {
351
344
  previousOutput: PublicKernelCircuitPublicInputs,
352
345
  enqueuedCallData: VMCircuitPublicInputs,
353
346
  isFromPrivate: boolean,
354
- ): Promise<{ output: PublicKernelCircuitPublicInputs; provingRequest: PublicKernelMergeRequest }> {
347
+ ): Promise<PublicKernelCircuitPublicInputs> {
355
348
  const previousKernel = this.getPreviousKernelData(previousOutput, isFromPrivate);
356
349
 
357
350
  // The proof is not used in simulation.
@@ -360,25 +353,18 @@ export class EnqueuedCallsProcessor {
360
353
 
361
354
  const inputs = new PublicKernelCircuitPrivateInputs(previousKernel, callData);
362
355
 
363
- const output = await this.publicKernelSimulator.publicKernelCircuitMerge(inputs);
364
-
365
- const provingRequest: PublicKernelMergeRequest = {
366
- type: ProvingRequestType.PUBLIC_KERNEL_MERGE,
367
- inputs,
368
- };
369
-
370
- return { output, provingRequest };
356
+ return await this.publicKernelSimulator.publicKernelCircuitMerge(inputs);
371
357
  }
372
358
 
373
359
  private getPreviousKernelData(
374
360
  previousOutput: PublicKernelCircuitPublicInputs,
375
- isFromPrivate: boolean,
361
+ _isFromPrivate: boolean,
376
362
  ): PublicKernelData {
377
363
  // The proof is not used in simulation.
378
364
  const proof = makeEmptyRecursiveProof(NESTED_RECURSIVE_PROOF_LENGTH);
379
365
 
380
- const vk = isFromPrivate ? TubeVk : ProtocolCircuitVks.PublicKernelMergeArtifact;
381
- const vkIndex = getVKIndex(vk);
366
+ const vk = VerificationKeyData.makeFakeHonk();
367
+ const vkIndex = 0;
382
368
  const siblingPath = getVKSiblingPath(vkIndex);
383
369
 
384
370
  return new PublicKernelData(previousOutput, proof, vk, vkIndex, siblingPath);