@aztec/txe 3.0.3 → 3.9.9-nightly.20260312

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 (75) hide show
  1. package/dest/constants.d.ts +3 -0
  2. package/dest/constants.d.ts.map +1 -0
  3. package/dest/constants.js +2 -0
  4. package/dest/index.d.ts +1 -1
  5. package/dest/index.d.ts.map +1 -1
  6. package/dest/index.js +85 -52
  7. package/dest/oracle/interfaces.d.ts +9 -6
  8. package/dest/oracle/interfaces.d.ts.map +1 -1
  9. package/dest/oracle/txe_oracle_public_context.d.ts +4 -4
  10. package/dest/oracle/txe_oracle_public_context.d.ts.map +1 -1
  11. package/dest/oracle/txe_oracle_public_context.js +9 -11
  12. package/dest/oracle/txe_oracle_top_level_context.d.ts +21 -13
  13. package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -1
  14. package/dest/oracle/txe_oracle_top_level_context.js +180 -72
  15. package/dest/rpc_translator.d.ts +29 -17
  16. package/dest/rpc_translator.d.ts.map +1 -1
  17. package/dest/rpc_translator.js +124 -57
  18. package/dest/state_machine/archiver.d.ts +20 -55
  19. package/dest/state_machine/archiver.d.ts.map +1 -1
  20. package/dest/state_machine/archiver.js +67 -108
  21. package/dest/state_machine/dummy_p2p_client.d.ts +20 -15
  22. package/dest/state_machine/dummy_p2p_client.d.ts.map +1 -1
  23. package/dest/state_machine/dummy_p2p_client.js +42 -25
  24. package/dest/state_machine/global_variable_builder.d.ts +4 -3
  25. package/dest/state_machine/global_variable_builder.d.ts.map +1 -1
  26. package/dest/state_machine/global_variable_builder.js +13 -1
  27. package/dest/state_machine/index.d.ts +7 -7
  28. package/dest/state_machine/index.d.ts.map +1 -1
  29. package/dest/state_machine/index.js +41 -24
  30. package/dest/state_machine/mock_epoch_cache.d.ts +9 -6
  31. package/dest/state_machine/mock_epoch_cache.d.ts.map +1 -1
  32. package/dest/state_machine/mock_epoch_cache.js +14 -7
  33. package/dest/state_machine/synchronizer.d.ts +3 -3
  34. package/dest/state_machine/synchronizer.d.ts.map +1 -1
  35. package/dest/txe_session.d.ts +22 -11
  36. package/dest/txe_session.d.ts.map +1 -1
  37. package/dest/txe_session.js +154 -49
  38. package/dest/util/encoding.d.ts +617 -18
  39. package/dest/util/encoding.d.ts.map +1 -1
  40. package/dest/util/txe_account_store.d.ts +10 -0
  41. package/dest/util/txe_account_store.d.ts.map +1 -0
  42. package/dest/util/{txe_account_data_provider.js → txe_account_store.js} +1 -1
  43. package/dest/util/txe_public_contract_data_source.d.ts +5 -6
  44. package/dest/util/txe_public_contract_data_source.d.ts.map +1 -1
  45. package/dest/util/txe_public_contract_data_source.js +12 -29
  46. package/dest/utils/block_creation.d.ts +18 -4
  47. package/dest/utils/block_creation.d.ts.map +1 -1
  48. package/dest/utils/block_creation.js +37 -3
  49. package/dest/utils/tx_effect_creation.d.ts +2 -3
  50. package/dest/utils/tx_effect_creation.d.ts.map +1 -1
  51. package/dest/utils/tx_effect_creation.js +3 -6
  52. package/package.json +16 -16
  53. package/src/constants.ts +3 -0
  54. package/src/index.ts +97 -60
  55. package/src/oracle/interfaces.ts +11 -4
  56. package/src/oracle/txe_oracle_public_context.ts +9 -16
  57. package/src/oracle/txe_oracle_top_level_context.ts +223 -110
  58. package/src/rpc_translator.ts +141 -58
  59. package/src/state_machine/archiver.ts +61 -129
  60. package/src/state_machine/dummy_p2p_client.ts +58 -33
  61. package/src/state_machine/global_variable_builder.ts +19 -2
  62. package/src/state_machine/index.ts +61 -22
  63. package/src/state_machine/mock_epoch_cache.ts +15 -11
  64. package/src/state_machine/synchronizer.ts +2 -2
  65. package/src/txe_session.ts +213 -94
  66. package/src/util/{txe_account_data_provider.ts → txe_account_store.ts} +1 -1
  67. package/src/util/txe_public_contract_data_source.ts +16 -42
  68. package/src/utils/block_creation.ts +47 -14
  69. package/src/utils/tx_effect_creation.ts +3 -11
  70. package/dest/util/txe_account_data_provider.d.ts +0 -10
  71. package/dest/util/txe_account_data_provider.d.ts.map +0 -1
  72. package/dest/util/txe_contract_data_provider.d.ts +0 -12
  73. package/dest/util/txe_contract_data_provider.d.ts.map +0 -1
  74. package/dest/util/txe_contract_data_provider.js +0 -22
  75. package/src/util/txe_contract_data_provider.ts +0 -36
@@ -3,25 +3,25 @@ import { Fr } from '@aztec/foundation/curves/bn254';
3
3
  import { createLogger } from '@aztec/foundation/log';
4
4
  import { KeyStore } from '@aztec/key-store';
5
5
  import { openTmpStore } from '@aztec/kv-store/lmdb-v2';
6
- import { AddressDataProvider, CapsuleDataProvider, NoteDataProvider, PXEOracleInterface, PrivateEventDataProvider, TaggingDataProvider } from '@aztec/pxe/server';
7
- import { ExecutionNoteCache, ExecutionTaggingIndexCache, HashedValuesCache, PrivateExecutionOracle, UtilityExecutionOracle } from '@aztec/pxe/simulator';
8
- import { FunctionSelector } from '@aztec/stdlib/abi';
6
+ import { AddressStore, AnchorBlockStore, CapsuleStore, JobCoordinator, NoteService, NoteStore, PrivateEventStore, RecipientTaggingStore, SenderAddressBookStore, SenderTaggingStore } from '@aztec/pxe/server';
7
+ import { ExecutionNoteCache, ExecutionTaggingIndexCache, HashedValuesCache, Oracle, PrivateExecutionOracle, UtilityExecutionOracle } from '@aztec/pxe/simulator';
8
+ import { ExecutionError, WASMSimulator, createSimulationError, extractCallStack, resolveAssertionMessageFromError, toACVMWitness } from '@aztec/simulator/client';
9
+ import { FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
9
10
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
10
- import { Body, L2Block } from '@aztec/stdlib/block';
11
11
  import { GasSettings } from '@aztec/stdlib/gas';
12
12
  import { computeProtocolNullifier } from '@aztec/stdlib/hash';
13
- import { makeAppendOnlyTreeSnapshot, makeGlobalVariables } from '@aztec/stdlib/testing';
13
+ import { makeGlobalVariables } from '@aztec/stdlib/testing';
14
14
  import { CallContext, TxContext } from '@aztec/stdlib/tx';
15
15
  import { z } from 'zod';
16
+ import { DEFAULT_ADDRESS } from './constants.js';
16
17
  import { TXEOraclePublicContext } from './oracle/txe_oracle_public_context.js';
17
18
  import { TXEOracleTopLevelContext } from './oracle/txe_oracle_top_level_context.js';
18
19
  import { RPCTranslator } from './rpc_translator.js';
20
+ import { TXEArchiver } from './state_machine/archiver.js';
19
21
  import { TXEStateMachine } from './state_machine/index.js';
20
- import { TXEAccountDataProvider } from './util/txe_account_data_provider.js';
21
- import { TXEContractDataProvider } from './util/txe_contract_data_provider.js';
22
- import { getSingleTxBlockRequestHash, insertTxEffectIntoWorldTrees, makeTXEBlockHeader } from './utils/block_creation.js';
22
+ import { TXEAccountStore } from './util/txe_account_store.js';
23
+ import { getSingleTxBlockRequestHash, insertTxEffectIntoWorldTrees, makeTXEBlock } from './utils/block_creation.js';
23
24
  import { makeTxEffect } from './utils/tx_effect_creation.js';
24
- const DEFAULT_ADDRESS = AztecAddress.fromNumber(42);
25
25
  /**
26
26
  * A `TXESession` corresponds to a Noir `#[test]` function, and handles all of its oracle calls, stores test-specific
27
27
  * state, etc., independent of all other tests running in parallel.
@@ -29,56 +29,77 @@ const DEFAULT_ADDRESS = AztecAddress.fromNumber(42);
29
29
  logger;
30
30
  stateMachine;
31
31
  oracleHandler;
32
- contractDataProvider;
32
+ contractStore;
33
+ noteStore;
33
34
  keyStore;
34
- addressDataProvider;
35
- accountDataProvider;
35
+ addressStore;
36
+ accountStore;
37
+ senderTaggingStore;
38
+ recipientTaggingStore;
39
+ senderAddressBookStore;
40
+ capsuleStore;
41
+ privateEventStore;
42
+ jobCoordinator;
43
+ currentJobId;
36
44
  chainId;
37
45
  version;
38
46
  nextBlockTimestamp;
39
- pxeOracleInterface;
40
47
  state;
41
48
  authwits;
42
- constructor(logger, stateMachine, oracleHandler, contractDataProvider, keyStore, addressDataProvider, accountDataProvider, chainId, version, nextBlockTimestamp, pxeOracleInterface){
49
+ constructor(logger, stateMachine, oracleHandler, contractStore, noteStore, keyStore, addressStore, accountStore, senderTaggingStore, recipientTaggingStore, senderAddressBookStore, capsuleStore, privateEventStore, jobCoordinator, currentJobId, chainId, version, nextBlockTimestamp){
43
50
  this.logger = logger;
44
51
  this.stateMachine = stateMachine;
45
52
  this.oracleHandler = oracleHandler;
46
- this.contractDataProvider = contractDataProvider;
53
+ this.contractStore = contractStore;
54
+ this.noteStore = noteStore;
47
55
  this.keyStore = keyStore;
48
- this.addressDataProvider = addressDataProvider;
49
- this.accountDataProvider = accountDataProvider;
56
+ this.addressStore = addressStore;
57
+ this.accountStore = accountStore;
58
+ this.senderTaggingStore = senderTaggingStore;
59
+ this.recipientTaggingStore = recipientTaggingStore;
60
+ this.senderAddressBookStore = senderAddressBookStore;
61
+ this.capsuleStore = capsuleStore;
62
+ this.privateEventStore = privateEventStore;
63
+ this.jobCoordinator = jobCoordinator;
64
+ this.currentJobId = currentJobId;
50
65
  this.chainId = chainId;
51
66
  this.version = version;
52
67
  this.nextBlockTimestamp = nextBlockTimestamp;
53
- this.pxeOracleInterface = pxeOracleInterface;
54
68
  this.state = {
55
69
  name: 'TOP_LEVEL'
56
70
  };
57
71
  this.authwits = new Map();
58
72
  }
59
- static async init(protocolContracts) {
73
+ static async init(contractStore) {
60
74
  const store = await openTmpStore('txe-session');
61
- const addressDataProvider = new AddressDataProvider(store);
62
- const privateEventDataProvider = new PrivateEventDataProvider(store);
63
- const contractDataProvider = new TXEContractDataProvider(store);
64
- const noteDataProvider = await NoteDataProvider.create(store);
65
- const taggingDataProvider = new TaggingDataProvider(store);
66
- const capsuleDataProvider = new CapsuleDataProvider(store);
75
+ const addressStore = new AddressStore(store);
76
+ const privateEventStore = new PrivateEventStore(store);
77
+ const noteStore = new NoteStore(store);
78
+ const senderTaggingStore = new SenderTaggingStore(store);
79
+ const recipientTaggingStore = new RecipientTaggingStore(store);
80
+ const senderAddressBookStore = new SenderAddressBookStore(store);
81
+ const capsuleStore = new CapsuleStore(store);
67
82
  const keyStore = new KeyStore(store);
68
- const accountDataProvider = new TXEAccountDataProvider(store);
69
- // Register protocol contracts.
70
- for (const { contractClass, instance, artifact } of protocolContracts){
71
- await contractDataProvider.addContractArtifact(contractClass.id, artifact);
72
- await contractDataProvider.addContractInstance(instance);
73
- }
74
- const stateMachine = await TXEStateMachine.create(store);
83
+ const accountStore = new TXEAccountStore(store);
84
+ // Create job coordinator and register staged stores
85
+ const jobCoordinator = new JobCoordinator(store);
86
+ jobCoordinator.registerStores([
87
+ capsuleStore,
88
+ senderTaggingStore,
89
+ recipientTaggingStore,
90
+ privateEventStore,
91
+ noteStore
92
+ ]);
93
+ const archiver = new TXEArchiver(store);
94
+ const anchorBlockStore = new AnchorBlockStore(store);
95
+ const stateMachine = await TXEStateMachine.create(archiver, anchorBlockStore, contractStore, noteStore);
75
96
  const nextBlockTimestamp = BigInt(Math.floor(new Date().getTime() / 1000));
76
97
  const version = new Fr(await stateMachine.node.getVersion());
77
98
  const chainId = new Fr(await stateMachine.node.getChainId());
78
- const pxeOracleInterface = new PXEOracleInterface(stateMachine.node, keyStore, contractDataProvider, noteDataProvider, capsuleDataProvider, stateMachine.syncDataProvider, taggingDataProvider, addressDataProvider, privateEventDataProvider);
79
- const topLevelOracleHandler = new TXEOracleTopLevelContext(stateMachine, contractDataProvider, keyStore, addressDataProvider, accountDataProvider, pxeOracleInterface, nextBlockTimestamp, version, chainId, new Map());
99
+ const initialJobId = jobCoordinator.beginJob();
100
+ const topLevelOracleHandler = new TXEOracleTopLevelContext(stateMachine, contractStore, noteStore, keyStore, addressStore, accountStore, senderTaggingStore, recipientTaggingStore, senderAddressBookStore, capsuleStore, privateEventStore, nextBlockTimestamp, version, chainId, new Map());
80
101
  await topLevelOracleHandler.txeAdvanceBlocksBy(1);
81
- return new TXESession(createLogger('txe:session'), stateMachine, topLevelOracleHandler, contractDataProvider, keyStore, addressDataProvider, accountDataProvider, version, chainId, nextBlockTimestamp, pxeOracleInterface);
102
+ return new TXESession(createLogger('txe:session'), stateMachine, topLevelOracleHandler, contractStore, noteStore, keyStore, addressStore, accountStore, senderTaggingStore, recipientTaggingStore, senderAddressBookStore, capsuleStore, privateEventStore, jobCoordinator, initialJobId, version, chainId, nextBlockTimestamp);
82
103
  }
83
104
  /**
84
105
  * Processes an oracle function invoked by the Noir test associated to this session.
@@ -101,6 +122,14 @@ const DEFAULT_ADDRESS = AztecAddress.fromNumber(42);
101
122
  }
102
123
  }
103
124
  }
125
+ getCurrentJob() {
126
+ return this.currentJobId;
127
+ }
128
+ /** Commits the current job and begins a new one. Returns the new job ID. */ async cycleJob() {
129
+ await this.jobCoordinator.commitJob(this.currentJobId);
130
+ this.currentJobId = this.jobCoordinator.beginJob();
131
+ return this.currentJobId;
132
+ }
104
133
  async enterTopLevelState() {
105
134
  switch(this.state.name){
106
135
  case 'PRIVATE':
@@ -127,7 +156,9 @@ const DEFAULT_ADDRESS = AztecAddress.fromNumber(42);
127
156
  this.state;
128
157
  }
129
158
  }
130
- this.oracleHandler = new TXEOracleTopLevelContext(this.stateMachine, this.contractDataProvider, this.keyStore, this.addressDataProvider, this.accountDataProvider, this.pxeOracleInterface, this.nextBlockTimestamp, this.version, this.chainId, this.authwits);
159
+ // Commit all staged stores from the job that was just completed, then begin a new job
160
+ await this.cycleJob();
161
+ this.oracleHandler = new TXEOracleTopLevelContext(this.stateMachine, this.contractStore, this.noteStore, this.keyStore, this.addressStore, this.accountStore, this.senderTaggingStore, this.recipientTaggingStore, this.senderAddressBookStore, this.capsuleStore, this.privateEventStore, this.nextBlockTimestamp, this.version, this.chainId, this.authwits);
131
162
  this.state = {
132
163
  name: 'TOP_LEVEL'
133
164
  };
@@ -135,16 +166,11 @@ const DEFAULT_ADDRESS = AztecAddress.fromNumber(42);
135
166
  }
136
167
  async enterPrivateState(contractAddress = DEFAULT_ADDRESS, anchorBlockNumber) {
137
168
  this.exitTopLevelState();
138
- // There is no automatic message discovery and contract-driven syncing process in inlined private or utility
139
- // contexts, which means that known nullifiers are also not searched for, since it is during the tagging sync that
140
- // we perform this. We therefore search for known nullifiers now, as otherwise notes that were nullified would not
141
- // be removed from the database.
142
- // TODO(#12553): make the synchronizer sync here instead and remove this
143
- await this.pxeOracleInterface.syncNoteNullifiers(contractAddress);
144
169
  // Private execution has two associated block numbers: the anchor block (i.e. the historical block that is used to
145
170
  // build the proof), and the *next* block, i.e. the one we'll create once the execution ends, and which will contain
146
171
  // a single transaction with the effects of what was done in the test.
147
172
  const anchorBlock = await this.stateMachine.node.getBlockHeader(anchorBlockNumber ?? 'latest');
173
+ await new NoteService(this.noteStore, this.stateMachine.node, anchorBlock, this.currentJobId).syncNoteNullifiers(contractAddress, 'ALL_SCOPES');
148
174
  const latestBlock = await this.stateMachine.node.getBlockHeader('latest');
149
175
  const nextBlockGlobalVariables = makeGlobalVariables(undefined, {
150
176
  blockNumber: BlockNumber(latestBlock.globalVariables.blockNumber + 1),
@@ -156,7 +182,32 @@ const DEFAULT_ADDRESS = AztecAddress.fromNumber(42);
156
182
  const protocolNullifier = await computeProtocolNullifier(txRequestHash);
157
183
  const noteCache = new ExecutionNoteCache(protocolNullifier);
158
184
  const taggingIndexCache = new ExecutionTaggingIndexCache();
159
- this.oracleHandler = new PrivateExecutionOracle(Fr.ZERO, new TxContext(this.chainId, this.version, GasSettings.empty()), new CallContext(AztecAddress.ZERO, contractAddress, FunctionSelector.empty(), false), anchorBlock, [], [], new HashedValuesCache(), noteCache, taggingIndexCache, this.pxeOracleInterface);
185
+ const utilityExecutor = this.utilityExecutorForContractSync(anchorBlock);
186
+ this.oracleHandler = new PrivateExecutionOracle({
187
+ argsHash: Fr.ZERO,
188
+ txContext: new TxContext(this.chainId, this.version, GasSettings.empty()),
189
+ callContext: new CallContext(AztecAddress.ZERO, contractAddress, FunctionSelector.empty(), false),
190
+ anchorBlockHeader: anchorBlock,
191
+ utilityExecutor,
192
+ authWitnesses: [],
193
+ capsules: [],
194
+ executionCache: new HashedValuesCache(),
195
+ noteCache,
196
+ taggingIndexCache,
197
+ contractStore: this.contractStore,
198
+ noteStore: this.noteStore,
199
+ keyStore: this.keyStore,
200
+ addressStore: this.addressStore,
201
+ aztecNode: this.stateMachine.node,
202
+ senderTaggingStore: this.senderTaggingStore,
203
+ recipientTaggingStore: this.recipientTaggingStore,
204
+ senderAddressBookStore: this.senderAddressBookStore,
205
+ capsuleStore: this.capsuleStore,
206
+ privateEventStore: this.privateEventStore,
207
+ contractSyncService: this.stateMachine.contractSyncService,
208
+ jobId: this.currentJobId,
209
+ scopes: 'ALL_SCOPES'
210
+ });
160
211
  // We store the note and tagging index caches fed into the PrivateExecutionOracle (along with some other auxiliary
161
212
  // data) in order to refer to it later, mimicking the way this object is used by the ContractFunctionSimulator. The
162
213
  // difference resides in that the simulator has all information needed in order to run the simulation, while ours
@@ -165,7 +216,6 @@ const DEFAULT_ADDRESS = AztecAddress.fromNumber(42);
165
216
  this.state = {
166
217
  name: 'PRIVATE',
167
218
  nextBlockGlobalVariables,
168
- protocolNullifier,
169
219
  noteCache,
170
220
  taggingIndexCache
171
221
  };
@@ -191,13 +241,30 @@ const DEFAULT_ADDRESS = AztecAddress.fromNumber(42);
191
241
  }
192
242
  async enterUtilityState(contractAddress = DEFAULT_ADDRESS) {
193
243
  this.exitTopLevelState();
244
+ const anchorBlockHeader = await this.stateMachine.anchorBlockStore.getBlockHeader();
194
245
  // There is no automatic message discovery and contract-driven syncing process in inlined private or utility
195
246
  // contexts, which means that known nullifiers are also not searched for, since it is during the tagging sync that
196
247
  // we perform this. We therefore search for known nullifiers now, as otherwise notes that were nullified would not
197
248
  // be removed from the database.
198
249
  // TODO(#12553): make the synchronizer sync here instead and remove this
199
- await this.pxeOracleInterface.syncNoteNullifiers(contractAddress);
200
- this.oracleHandler = new UtilityExecutionOracle(contractAddress, [], [], this.pxeOracleInterface);
250
+ await new NoteService(this.noteStore, this.stateMachine.node, anchorBlockHeader, this.currentJobId).syncNoteNullifiers(contractAddress, 'ALL_SCOPES');
251
+ this.oracleHandler = new UtilityExecutionOracle({
252
+ contractAddress,
253
+ authWitnesses: [],
254
+ capsules: [],
255
+ anchorBlockHeader,
256
+ contractStore: this.contractStore,
257
+ noteStore: this.noteStore,
258
+ keyStore: this.keyStore,
259
+ addressStore: this.addressStore,
260
+ aztecNode: this.stateMachine.node,
261
+ recipientTaggingStore: this.recipientTaggingStore,
262
+ senderAddressBookStore: this.senderAddressBookStore,
263
+ capsuleStore: this.capsuleStore,
264
+ privateEventStore: this.privateEventStore,
265
+ jobId: this.currentJobId,
266
+ scopes: 'ALL_SCOPES'
267
+ });
201
268
  this.state = {
202
269
  name: 'UTILITY'
203
270
  };
@@ -227,13 +294,13 @@ const DEFAULT_ADDRESS = AztecAddress.fromNumber(42);
227
294
  });
228
295
  // We rely on the note cache to determine the effects of the transaction. This is incomplete as it doesn't private
229
296
  // logs (other effects like enqueued public calls don't need to be considered since those are not allowed).
230
- const txEffect = await makeTxEffect(this.state.noteCache, this.state.protocolNullifier, this.state.nextBlockGlobalVariables.blockNumber);
297
+ const txEffect = await makeTxEffect(this.state.noteCache, this.state.nextBlockGlobalVariables.blockNumber);
231
298
  // We build a block holding just this transaction
232
299
  const forkedWorldTrees = await this.stateMachine.synchronizer.nativeWorldStateService.fork();
233
300
  await insertTxEffectIntoWorldTrees(txEffect, forkedWorldTrees);
234
- const block = new L2Block(makeAppendOnlyTreeSnapshot(), await makeTXEBlockHeader(forkedWorldTrees, this.state.nextBlockGlobalVariables), new Body([
301
+ const block = await makeTXEBlock(forkedWorldTrees, this.state.nextBlockGlobalVariables, [
235
302
  txEffect
236
- ]));
303
+ ]);
237
304
  await this.stateMachine.handleL2Block(block);
238
305
  await forkedWorldTrees.close();
239
306
  this.logger.debug('Exited PublicContext with built block', {
@@ -253,4 +320,42 @@ const DEFAULT_ADDRESS = AztecAddress.fromNumber(42);
253
320
  throw new Error(`Expected to be in state 'UTILITY', but got '${this.state.name}' instead`);
254
321
  }
255
322
  }
323
+ utilityExecutorForContractSync(anchorBlock) {
324
+ return async (call, scopes)=>{
325
+ const entryPointArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(call.to, call.selector);
326
+ if (entryPointArtifact.functionType !== FunctionType.UTILITY) {
327
+ throw new Error(`Cannot run ${entryPointArtifact.functionType} function as utility`);
328
+ }
329
+ try {
330
+ const oracle = new UtilityExecutionOracle({
331
+ contractAddress: call.to,
332
+ authWitnesses: [],
333
+ capsules: [],
334
+ anchorBlockHeader: anchorBlock,
335
+ contractStore: this.contractStore,
336
+ noteStore: this.noteStore,
337
+ keyStore: this.keyStore,
338
+ addressStore: this.addressStore,
339
+ aztecNode: this.stateMachine.node,
340
+ recipientTaggingStore: this.recipientTaggingStore,
341
+ senderAddressBookStore: this.senderAddressBookStore,
342
+ capsuleStore: this.capsuleStore,
343
+ privateEventStore: this.privateEventStore,
344
+ jobId: this.currentJobId,
345
+ scopes
346
+ });
347
+ await new WASMSimulator().executeUserCircuit(toACVMWitness(0, call.args), entryPointArtifact, new Oracle(oracle).toACIRCallback()).catch((err)=>{
348
+ err.message = resolveAssertionMessageFromError(err, entryPointArtifact);
349
+ throw new ExecutionError(err.message, {
350
+ contractAddress: call.to,
351
+ functionSelector: call.selector
352
+ }, extractCallStack(err, entryPointArtifact.debug), {
353
+ cause: err
354
+ });
355
+ });
356
+ } catch (err) {
357
+ throw createSimulationError(err instanceof Error ? err : new Error('Unknown error contract data sync'));
358
+ }
359
+ };
360
+ }
256
361
  }