@aztec/txe 0.0.1-commit.87a0206 → 0.0.1-commit.88e6f9396

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 (54) hide show
  1. package/dest/index.d.ts +1 -1
  2. package/dest/index.d.ts.map +1 -1
  3. package/dest/index.js +88 -54
  4. package/dest/oracle/interfaces.d.ts +29 -28
  5. package/dest/oracle/interfaces.d.ts.map +1 -1
  6. package/dest/oracle/txe_oracle_public_context.d.ts +13 -13
  7. package/dest/oracle/txe_oracle_public_context.d.ts.map +1 -1
  8. package/dest/oracle/txe_oracle_public_context.js +12 -12
  9. package/dest/oracle/txe_oracle_top_level_context.d.ts +23 -23
  10. package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -1
  11. package/dest/oracle/txe_oracle_top_level_context.js +110 -52
  12. package/dest/rpc_translator.d.ts +88 -83
  13. package/dest/rpc_translator.d.ts.map +1 -1
  14. package/dest/rpc_translator.js +273 -151
  15. package/dest/state_machine/archiver.d.ts +3 -3
  16. package/dest/state_machine/archiver.d.ts.map +1 -1
  17. package/dest/state_machine/archiver.js +5 -7
  18. package/dest/state_machine/dummy_p2p_client.d.ts +14 -11
  19. package/dest/state_machine/dummy_p2p_client.d.ts.map +1 -1
  20. package/dest/state_machine/dummy_p2p_client.js +23 -14
  21. package/dest/state_machine/index.d.ts +4 -2
  22. package/dest/state_machine/index.d.ts.map +1 -1
  23. package/dest/state_machine/index.js +7 -3
  24. package/dest/state_machine/mock_epoch_cache.d.ts +19 -3
  25. package/dest/state_machine/mock_epoch_cache.d.ts.map +1 -1
  26. package/dest/state_machine/mock_epoch_cache.js +36 -2
  27. package/dest/state_machine/synchronizer.d.ts +5 -5
  28. package/dest/state_machine/synchronizer.d.ts.map +1 -1
  29. package/dest/state_machine/synchronizer.js +3 -3
  30. package/dest/txe_session.d.ts +10 -6
  31. package/dest/txe_session.d.ts.map +1 -1
  32. package/dest/txe_session.js +89 -24
  33. package/dest/util/encoding.d.ts +69 -1
  34. package/dest/util/encoding.d.ts.map +1 -1
  35. package/dest/util/txe_public_contract_data_source.d.ts +2 -3
  36. package/dest/util/txe_public_contract_data_source.d.ts.map +1 -1
  37. package/dest/util/txe_public_contract_data_source.js +5 -22
  38. package/package.json +15 -15
  39. package/src/index.ts +89 -52
  40. package/src/oracle/interfaces.ts +32 -31
  41. package/src/oracle/txe_oracle_public_context.ts +12 -12
  42. package/src/oracle/txe_oracle_top_level_context.ts +113 -91
  43. package/src/rpc_translator.ts +305 -173
  44. package/src/state_machine/archiver.ts +5 -5
  45. package/src/state_machine/dummy_p2p_client.ts +33 -20
  46. package/src/state_machine/index.ts +6 -1
  47. package/src/state_machine/mock_epoch_cache.ts +47 -3
  48. package/src/state_machine/synchronizer.ts +4 -4
  49. package/src/txe_session.ts +94 -72
  50. package/src/util/txe_public_contract_data_source.ts +10 -36
  51. package/dest/util/txe_contract_store.d.ts +0 -12
  52. package/dest/util/txe_contract_store.d.ts.map +0 -1
  53. package/dest/util/txe_contract_store.js +0 -22
  54. package/src/util/txe_contract_store.ts +0 -36
@@ -12,9 +12,12 @@ import { Fr } from '@aztec/foundation/curves/bn254';
12
12
  import { LogLevels, type Logger, applyStringFormatting, createLogger } from '@aztec/foundation/log';
13
13
  import { TestDateProvider } from '@aztec/foundation/timer';
14
14
  import type { KeyStore } from '@aztec/key-store';
15
+ import type { AccessScopes } from '@aztec/pxe/client/lazy';
15
16
  import {
16
17
  AddressStore,
17
18
  CapsuleStore,
19
+ type ContractStore,
20
+ type ContractSyncService,
18
21
  NoteStore,
19
22
  ORACLE_VERSION,
20
23
  PrivateEventStore,
@@ -83,7 +86,6 @@ import { ForkCheckpoint } from '@aztec/world-state';
83
86
  import { DEFAULT_ADDRESS } from '../constants.js';
84
87
  import type { TXEStateMachine } from '../state_machine/index.js';
85
88
  import type { TXEAccountStore } from '../util/txe_account_store.js';
86
- import type { TXEContractStore } from '../util/txe_contract_store.js';
87
89
  import { TXEPublicContractDataSource } from '../util/txe_public_contract_data_source.js';
88
90
  import { getSingleTxBlockRequestHash, insertTxEffectIntoWorldTrees, makeTXEBlock } from '../utils/block_creation.js';
89
91
  import type { ITxeExecutionOracle } from './interfaces.js';
@@ -96,7 +98,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
96
98
 
97
99
  constructor(
98
100
  private stateMachine: TXEStateMachine,
99
- private contractStore: TXEContractStore,
101
+ private contractStore: ContractStore,
100
102
  private noteStore: NoteStore,
101
103
  private keyStore: KeyStore,
102
104
  private addressStore: AddressStore,
@@ -106,17 +108,17 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
106
108
  private senderAddressBookStore: SenderAddressBookStore,
107
109
  private capsuleStore: CapsuleStore,
108
110
  private privateEventStore: PrivateEventStore,
109
- private jobId: string,
110
111
  private nextBlockTimestamp: bigint,
111
112
  private version: Fr,
112
113
  private chainId: Fr,
113
114
  private authwits: Map<string, AuthWitness>,
115
+ private readonly contractSyncService: ContractSyncService,
114
116
  ) {
115
117
  this.logger = createLogger('txe:top_level_context');
116
118
  this.logger.debug('Entering Top Level Context');
117
119
  }
118
120
 
119
- utilityAssertCompatibleOracleVersion(version: number): void {
121
+ assertCompatibleOracleVersion(version: number): void {
120
122
  if (version !== ORACLE_VERSION) {
121
123
  throw new Error(
122
124
  `Incompatible oracle version. TXE is using version '${ORACLE_VERSION}', but got a request for '${version}'.`,
@@ -126,37 +128,38 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
126
128
 
127
129
  // This is typically only invoked in private contexts, but it is convenient to also have it in top-level for testing
128
130
  // setup.
129
- utilityGetRandomField(): Fr {
131
+ getRandomField(): Fr {
130
132
  return Fr.random();
131
133
  }
132
134
 
133
135
  // We instruct users to debug contracts via this oracle, so it makes sense that they'd expect it to also work in tests
134
- utilityDebugLog(level: number, message: string, fields: Fr[]): void {
136
+ log(level: number, message: string, fields: Fr[]): Promise<void> {
135
137
  if (!LogLevels[level]) {
136
- throw new Error(`Invalid debug log level: ${level}`);
138
+ throw new Error(`Invalid log level: ${level}`);
137
139
  }
138
140
  const levelName = LogLevels[level];
139
141
 
140
142
  this.logger[levelName](`${applyStringFormatting(message, fields)}`, { module: `${this.logger.module}:debug_log` });
143
+ return Promise.resolve();
141
144
  }
142
145
 
143
- txeGetDefaultAddress(): AztecAddress {
146
+ getDefaultAddress(): AztecAddress {
144
147
  return DEFAULT_ADDRESS;
145
148
  }
146
149
 
147
- async txeGetNextBlockNumber(): Promise<BlockNumber> {
150
+ async getNextBlockNumber(): Promise<BlockNumber> {
148
151
  return BlockNumber((await this.getLastBlockNumber()) + 1);
149
152
  }
150
153
 
151
- txeGetNextBlockTimestamp(): Promise<bigint> {
154
+ getNextBlockTimestamp(): Promise<bigint> {
152
155
  return Promise.resolve(this.nextBlockTimestamp);
153
156
  }
154
157
 
155
- async txeGetLastBlockTimestamp() {
158
+ async getLastBlockTimestamp() {
156
159
  return (await this.stateMachine.node.getBlockHeader('latest'))!.globalVariables.timestamp;
157
160
  }
158
161
 
159
- async txeGetLastTxEffects() {
162
+ async getLastTxEffects() {
160
163
  const latestBlockNumber = await this.stateMachine.archiver.getBlockNumber();
161
164
  const block = await this.stateMachine.archiver.getBlock(latestBlockNumber);
162
165
 
@@ -170,7 +173,26 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
170
173
  return { txHash: txEffects.txHash, noteHashes: txEffects.noteHashes, nullifiers: txEffects.nullifiers };
171
174
  }
172
175
 
173
- async txeGetPrivateEvents(selector: EventSelector, contractAddress: AztecAddress, scope: AztecAddress) {
176
+ async syncContractNonOracleMethod(contractAddress: AztecAddress, scope: AztecAddress, jobId: string) {
177
+ if (contractAddress.equals(DEFAULT_ADDRESS)) {
178
+ this.logger.debug(`Skipping sync in getPrivateEvents because the events correspond to the default address.`);
179
+ return;
180
+ }
181
+
182
+ const blockHeader = await this.stateMachine.anchorBlockStore.getBlockHeader();
183
+ await this.stateMachine.contractSyncService.ensureContractSynced(
184
+ contractAddress,
185
+ null,
186
+ async (call, execScopes) => {
187
+ await this.executeUtilityCall(call, execScopes, jobId);
188
+ },
189
+ blockHeader,
190
+ jobId,
191
+ [scope],
192
+ );
193
+ }
194
+
195
+ async getPrivateEvents(selector: EventSelector, contractAddress: AztecAddress, scope: AztecAddress) {
174
196
  return (
175
197
  await this.privateEventStore.getPrivateEvents(selector, {
176
198
  contractAddress,
@@ -181,7 +203,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
181
203
  ).map(e => e.packedEvent);
182
204
  }
183
205
 
184
- async txeAdvanceBlocksBy(blocks: number) {
206
+ async advanceBlocksBy(blocks: number) {
185
207
  this.logger.debug(`time traveling ${blocks} blocks`);
186
208
 
187
209
  for (let i = 0; i < blocks; i++) {
@@ -189,12 +211,12 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
189
211
  }
190
212
  }
191
213
 
192
- txeAdvanceTimestampBy(duration: UInt64) {
214
+ advanceTimestampBy(duration: UInt64) {
193
215
  this.logger.debug(`time traveling ${duration} seconds`);
194
216
  this.nextBlockTimestamp += duration;
195
217
  }
196
218
 
197
- async txeDeploy(artifact: ContractArtifact, instance: ContractInstanceWithAddress, secret: Fr) {
219
+ async deploy(artifact: ContractArtifact, instance: ContractInstanceWithAddress, secret: Fr) {
198
220
  // Emit deployment nullifier
199
221
  await this.mineBlock({
200
222
  nullifiers: [
@@ -206,20 +228,20 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
206
228
  });
207
229
 
208
230
  if (!secret.equals(Fr.ZERO)) {
209
- await this.txeAddAccount(artifact, instance, secret);
231
+ await this.addAccount(artifact, instance, secret);
210
232
  } else {
211
233
  await this.contractStore.addContractInstance(instance);
212
- await this.contractStore.addContractArtifact(instance.currentContractClassId, artifact);
234
+ await this.contractStore.addContractArtifact(artifact);
213
235
  this.logger.debug(`Deployed ${artifact.name} at ${instance.address}`);
214
236
  }
215
237
  }
216
238
 
217
- async txeAddAccount(artifact: ContractArtifact, instance: ContractInstanceWithAddress, secret: Fr) {
239
+ async addAccount(artifact: ContractArtifact, instance: ContractInstanceWithAddress, secret: Fr) {
218
240
  const partialAddress = await computePartialAddress(instance);
219
241
 
220
242
  this.logger.debug(`Deployed ${artifact.name} at ${instance.address}`);
221
243
  await this.contractStore.addContractInstance(instance);
222
- await this.contractStore.addContractArtifact(instance.currentContractClassId, artifact);
244
+ await this.contractStore.addContractArtifact(artifact);
223
245
 
224
246
  const completeAddress = await this.keyStore.addAccount(secret, partialAddress);
225
247
  await this.accountStore.setAccount(completeAddress.address, completeAddress);
@@ -229,7 +251,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
229
251
  return completeAddress;
230
252
  }
231
253
 
232
- async txeCreateAccount(secret: Fr) {
254
+ async createAccount(secret: Fr) {
233
255
  // This is a foot gun !
234
256
  const completeAddress = await this.keyStore.addAccount(secret, secret);
235
257
  await this.accountStore.setAccount(completeAddress.address, completeAddress);
@@ -239,7 +261,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
239
261
  return completeAddress;
240
262
  }
241
263
 
242
- async txeAddAuthWitness(address: AztecAddress, messageHash: Fr) {
264
+ async addAuthWitness(address: AztecAddress, messageHash: Fr) {
243
265
  const account = await this.accountStore.getAccount(address);
244
266
  const privateKey = await this.keyStore.getMasterSecretKey(account.publicKeys.masterIncomingViewingPublicKey);
245
267
 
@@ -252,7 +274,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
252
274
  }
253
275
 
254
276
  async mineBlock(options: { nullifiers?: Fr[] } = {}) {
255
- const blockNumber = await this.txeGetNextBlockNumber();
277
+ const blockNumber = await this.getNextBlockNumber();
256
278
 
257
279
  const txEffect = TxEffect.empty();
258
280
  txEffect.nullifiers = [getSingleTxBlockRequestHash(blockNumber), ...(options.nullifiers ?? [])];
@@ -276,13 +298,14 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
276
298
  await this.stateMachine.handleL2Block(block);
277
299
  }
278
300
 
279
- async txePrivateCallNewFlow(
301
+ async privateCallNewFlow(
280
302
  from: AztecAddress,
281
303
  targetContractAddress: AztecAddress = AztecAddress.zero(),
282
304
  functionSelector: FunctionSelector = FunctionSelector.empty(),
283
305
  args: Fr[],
284
306
  argsHash: Fr = Fr.zero(),
285
307
  isStaticCall: boolean = false,
308
+ jobId: string,
286
309
  ) {
287
310
  this.logger.verbose(
288
311
  `Executing external function ${await this.contractStore.getDebugFunctionName(targetContractAddress, functionSelector)}@${targetContractAddress} isStaticCall=${isStaticCall}`,
@@ -296,14 +319,13 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
296
319
  throw new Error(message);
297
320
  }
298
321
 
299
- // When `from` is the zero address (used when creating a new contract account for example),
300
- // we disable scope filtering by setting effectiveScopes to undefined. This allows these operations
301
- // to proceed without requiring keys registered for the zero address.
302
- const effectiveScopes = from.isZero() ? undefined : [from];
322
+ // When `from` is the zero address (e.g. when deploying a new account contract), we return an
323
+ // empty scope list which acts as deny-all: no notes are visible and no keys are accessible.
324
+ const effectiveScopes = from.isZero() ? [] : [from];
303
325
 
304
326
  // Sync notes before executing private function to discover notes from previous transactions
305
- const utilityExecutor = async (call: FunctionCall) => {
306
- await this.executeUtilityCall(call, effectiveScopes);
327
+ const utilityExecutor = async (call: FunctionCall, execScopes: AccessScopes) => {
328
+ await this.executeUtilityCall(call, execScopes, jobId);
307
329
  };
308
330
 
309
331
  const blockHeader = await this.stateMachine.anchorBlockStore.getBlockHeader();
@@ -312,10 +334,11 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
312
334
  functionSelector,
313
335
  utilityExecutor,
314
336
  blockHeader,
315
- this.jobId,
337
+ jobId,
338
+ effectiveScopes,
316
339
  );
317
340
 
318
- const blockNumber = await this.txeGetNextBlockNumber();
341
+ const blockNumber = await this.getNextBlockNumber();
319
342
 
320
343
  const callContext = new CallContext(from, targetContractAddress, functionSelector, isStaticCall);
321
344
 
@@ -336,43 +359,38 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
336
359
 
337
360
  const simulator = new WASMSimulator();
338
361
 
339
- const privateExecutionOracle = new PrivateExecutionOracle(
362
+ const privateExecutionOracle = new PrivateExecutionOracle({
340
363
  argsHash,
341
364
  txContext,
342
365
  callContext,
343
- /** Header of a block whose state is used during private execution (not the block the transaction is included in). */
344
- blockHeader,
366
+ anchorBlockHeader: blockHeader,
345
367
  utilityExecutor,
346
- /** List of transient auth witnesses to be used during this simulation */
347
- Array.from(this.authwits.values()),
348
- /** List of transient auth witnesses to be used during this simulation */
349
- [],
350
- HashedValuesCache.create([new HashedValues(args, argsHash)]),
368
+ authWitnesses: Array.from(this.authwits.values()),
369
+ capsules: [],
370
+ executionCache: HashedValuesCache.create([new HashedValues(args, argsHash)]),
351
371
  noteCache,
352
372
  taggingIndexCache,
353
- this.contractStore,
354
- this.noteStore,
355
- this.keyStore,
356
- this.addressStore,
357
- this.stateMachine.node,
358
- this.senderTaggingStore,
359
- this.recipientTaggingStore,
360
- this.senderAddressBookStore,
361
- this.capsuleStore,
362
- this.privateEventStore,
363
- this.stateMachine.contractSyncService,
364
- this.jobId,
365
- 0, // totalPublicArgsCount
366
- minRevertibleSideEffectCounter, // (start) sideEffectCounter
367
- undefined, // log
368
- effectiveScopes, // scopes
369
- /**
370
- * In TXE, the typical transaction entrypoint is skipped, so we need to simulate the actions that such a
371
- * contract would perform, including setting senderForTags.
372
- */
373
- from,
373
+ contractStore: this.contractStore,
374
+ noteStore: this.noteStore,
375
+ keyStore: this.keyStore,
376
+ addressStore: this.addressStore,
377
+ aztecNode: this.stateMachine.node,
378
+ senderTaggingStore: this.senderTaggingStore,
379
+ recipientTaggingStore: this.recipientTaggingStore,
380
+ senderAddressBookStore: this.senderAddressBookStore,
381
+ capsuleStore: this.capsuleStore,
382
+ privateEventStore: this.privateEventStore,
383
+ contractSyncService: this.stateMachine.contractSyncService,
384
+ jobId,
385
+ totalPublicCalldataCount: 0,
386
+ sideEffectCounter: minRevertibleSideEffectCounter,
387
+ scopes: effectiveScopes,
388
+ // In TXE, the typical transaction entrypoint is skipped, so we need to simulate the actions that such a
389
+ // contract would perform, including setting senderForTags.
390
+ senderForTags: from,
374
391
  simulator,
375
- );
392
+ messageContextService: this.stateMachine.messageContextService,
393
+ });
376
394
 
377
395
  // Note: This is a slight modification of simulator.run without any of the checks. Maybe we should modify simulator.run with a boolean value to skip checks.
378
396
  let result: PrivateExecutionResult;
@@ -394,7 +412,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
394
412
  );
395
413
  const publicFunctionsCalldata = await Promise.all(
396
414
  publicCallRequests.map(async r => {
397
- const calldata = await privateExecutionOracle.privateLoadFromExecutionCache(r.calldataHash);
415
+ const calldata = await privateExecutionOracle.loadFromExecutionCache(r.calldataHash);
398
416
  return new HashedValues(calldata, r.calldataHash);
399
417
  }),
400
418
  );
@@ -412,6 +430,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
412
430
  const { publicInputs } = await generateSimulatedProvingResult(
413
431
  result,
414
432
  (addr, sel) => this.contractStore.getDebugFunctionName(addr, sel),
433
+ this.stateMachine.node,
415
434
  minRevertibleSideEffectCounter,
416
435
  );
417
436
 
@@ -507,7 +526,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
507
526
  return executionResult.returnValues ?? [];
508
527
  }
509
528
 
510
- async txePublicCallNewFlow(
529
+ async publicCallNewFlow(
511
530
  from: AztecAddress,
512
531
  targetContractAddress: AztecAddress,
513
532
  calldata: Fr[],
@@ -517,7 +536,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
517
536
  `Executing public function ${await this.contractStore.getDebugFunctionName(targetContractAddress, FunctionSelector.fromField(calldata[0]))}@${targetContractAddress} isStaticCall=${isStaticCall}`,
518
537
  );
519
538
 
520
- const blockNumber = await this.txeGetNextBlockNumber();
539
+ const blockNumber = await this.getNextBlockNumber();
521
540
 
522
541
  const gasLimits = new Gas(DEFAULT_DA_GAS_LIMIT, DEFAULT_L2_GAS_LIMIT);
523
542
 
@@ -594,7 +613,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
594
613
  constantData,
595
614
  /*gasUsed=*/ new Gas(0, 0),
596
615
  /*feePayer=*/ AztecAddress.zero(),
597
- /*includeByTimestamp=*/ 0n,
616
+ /*expirationTimestamp=*/ 0n,
598
617
  inputsForPublic,
599
618
  undefined,
600
619
  );
@@ -662,10 +681,11 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
662
681
  return returnValues ?? [];
663
682
  }
664
683
 
665
- async txeSimulateUtilityFunction(
684
+ async executeUtilityFunction(
666
685
  targetContractAddress: AztecAddress,
667
686
  functionSelector: FunctionSelector,
668
687
  args: Fr[],
688
+ jobId: string,
669
689
  ) {
670
690
  const artifact = await this.contractStore.getFunctionArtifact(targetContractAddress, functionSelector);
671
691
  if (!artifact) {
@@ -677,11 +697,12 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
677
697
  await this.stateMachine.contractSyncService.ensureContractSynced(
678
698
  targetContractAddress,
679
699
  functionSelector,
680
- async call => {
681
- await this.executeUtilityCall(call);
700
+ async (call, execScopes) => {
701
+ await this.executeUtilityCall(call, execScopes, jobId);
682
702
  },
683
703
  blockHeader,
684
- this.jobId,
704
+ jobId,
705
+ 'ALL_SCOPES',
685
706
  );
686
707
 
687
708
  const call = FunctionCall.from({
@@ -695,10 +716,10 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
695
716
  returnTypes: [],
696
717
  });
697
718
 
698
- return this.executeUtilityCall(call);
719
+ return this.executeUtilityCall(call, 'ALL_SCOPES', jobId);
699
720
  }
700
721
 
701
- private async executeUtilityCall(call: FunctionCall, scopes?: AztecAddress[]): Promise<Fr[]> {
722
+ private async executeUtilityCall(call: FunctionCall, scopes: AccessScopes, jobId: string): Promise<Fr[]> {
702
723
  const entryPointArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(call.to, call.selector);
703
724
  if (entryPointArtifact.functionType !== FunctionType.UTILITY) {
704
725
  throw new Error(`Cannot run ${entryPointArtifact.functionType} function as utility`);
@@ -711,24 +732,25 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
711
732
 
712
733
  try {
713
734
  const anchorBlockHeader = await this.stateMachine.anchorBlockStore.getBlockHeader();
714
- const oracle = new UtilityExecutionOracle(
715
- call.to,
716
- [],
717
- [],
735
+ const oracle = new UtilityExecutionOracle({
736
+ contractAddress: call.to,
737
+ authWitnesses: [],
738
+ capsules: [],
718
739
  anchorBlockHeader,
719
- this.contractStore,
720
- this.noteStore,
721
- this.keyStore,
722
- this.addressStore,
723
- this.stateMachine.node,
724
- this.recipientTaggingStore,
725
- this.senderAddressBookStore,
726
- this.capsuleStore,
727
- this.privateEventStore,
728
- this.jobId,
729
- undefined, // log
730
- scopes, // scopes - used to filter notes by account
731
- );
740
+ contractStore: this.contractStore,
741
+ noteStore: this.noteStore,
742
+ keyStore: this.keyStore,
743
+ addressStore: this.addressStore,
744
+ aztecNode: this.stateMachine.node,
745
+ recipientTaggingStore: this.recipientTaggingStore,
746
+ senderAddressBookStore: this.senderAddressBookStore,
747
+ capsuleStore: this.capsuleStore,
748
+ privateEventStore: this.privateEventStore,
749
+ messageContextService: this.stateMachine.messageContextService,
750
+ contractSyncService: this.contractSyncService,
751
+ jobId,
752
+ scopes,
753
+ });
732
754
  const acirExecutionResult = await new WASMSimulator()
733
755
  .executeUserCircuit(toACVMWitness(0, call.args), entryPointArtifact, new Oracle(oracle).toACIRCallback())
734
756
  .catch((err: Error) => {
@@ -744,10 +766,10 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
744
766
  );
745
767
  });
746
768
 
747
- this.logger.verbose(`Utility simulation for ${call.to}.${call.selector} completed`);
769
+ this.logger.verbose(`Utility execution for ${call.to}.${call.selector} completed`);
748
770
  return witnessMapToFields(acirExecutionResult.returnWitness);
749
771
  } catch (err) {
750
- throw createSimulationError(err instanceof Error ? err : new Error('Unknown error during utility simulation'));
772
+ throw createSimulationError(err instanceof Error ? err : new Error('Unknown error during utility execution'));
751
773
  }
752
774
  }
753
775