@aztec/txe 0.0.1-commit.d431d1c → 0.0.1-commit.d939eb5aa

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 (64) 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 +15 -15
  7. package/dest/oracle/txe_oracle_public_context.d.ts.map +1 -1
  8. package/dest/oracle/txe_oracle_public_context.js +16 -16
  9. package/dest/oracle/txe_oracle_top_level_context.d.ts +28 -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 +151 -63
  12. package/dest/rpc_translator.d.ts +125 -81
  13. package/dest/rpc_translator.d.ts.map +1 -1
  14. package/dest/rpc_translator.js +418 -172
  15. package/dest/state_machine/archiver.d.ts +4 -4
  16. package/dest/state_machine/archiver.d.ts.map +1 -1
  17. package/dest/state_machine/archiver.js +10 -10
  18. package/dest/state_machine/dummy_p2p_client.d.ts +18 -13
  19. package/dest/state_machine/dummy_p2p_client.d.ts.map +1 -1
  20. package/dest/state_machine/dummy_p2p_client.js +33 -18
  21. package/dest/state_machine/global_variable_builder.d.ts +9 -4
  22. package/dest/state_machine/global_variable_builder.d.ts.map +1 -1
  23. package/dest/state_machine/global_variable_builder.js +9 -3
  24. package/dest/state_machine/index.d.ts +9 -7
  25. package/dest/state_machine/index.d.ts.map +1 -1
  26. package/dest/state_machine/index.js +36 -18
  27. package/dest/state_machine/mock_epoch_cache.d.ts +23 -4
  28. package/dest/state_machine/mock_epoch_cache.d.ts.map +1 -1
  29. package/dest/state_machine/mock_epoch_cache.js +41 -3
  30. package/dest/state_machine/synchronizer.d.ts +6 -6
  31. package/dest/state_machine/synchronizer.d.ts.map +1 -1
  32. package/dest/state_machine/synchronizer.js +3 -3
  33. package/dest/txe_session.d.ts +10 -6
  34. package/dest/txe_session.d.ts.map +1 -1
  35. package/dest/txe_session.js +100 -28
  36. package/dest/util/encoding.d.ts +71 -1
  37. package/dest/util/encoding.d.ts.map +1 -1
  38. package/dest/util/encoding.js +4 -0
  39. package/dest/util/txe_public_contract_data_source.d.ts +2 -3
  40. package/dest/util/txe_public_contract_data_source.d.ts.map +1 -1
  41. package/dest/util/txe_public_contract_data_source.js +6 -25
  42. package/dest/utils/block_creation.d.ts +5 -5
  43. package/dest/utils/block_creation.d.ts.map +1 -1
  44. package/dest/utils/block_creation.js +7 -5
  45. package/package.json +15 -15
  46. package/src/index.ts +89 -52
  47. package/src/oracle/interfaces.ts +32 -31
  48. package/src/oracle/txe_oracle_public_context.ts +18 -20
  49. package/src/oracle/txe_oracle_top_level_context.ts +190 -114
  50. package/src/rpc_translator.ts +482 -187
  51. package/src/state_machine/archiver.ts +10 -11
  52. package/src/state_machine/dummy_p2p_client.ts +46 -24
  53. package/src/state_machine/global_variable_builder.ts +18 -3
  54. package/src/state_machine/index.ts +56 -20
  55. package/src/state_machine/mock_epoch_cache.ts +53 -4
  56. package/src/state_machine/synchronizer.ts +5 -5
  57. package/src/txe_session.ts +118 -86
  58. package/src/util/encoding.ts +5 -0
  59. package/src/util/txe_public_contract_data_source.ts +10 -38
  60. package/src/utils/block_creation.ts +8 -6
  61. package/dest/util/txe_contract_store.d.ts +0 -12
  62. package/dest/util/txe_contract_store.d.ts.map +0 -1
  63. package/dest/util/txe_contract_store.js +0 -22
  64. package/src/util/txe_contract_store.ts +0 -36
@@ -10,8 +10,6 @@ import {
10
10
  } from '@aztec/pxe/simulator';
11
11
  import { type ContractArtifact, EventSelector, FunctionSelector, NoteSelector } from '@aztec/stdlib/abi';
12
12
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
13
- import { L2BlockHash } from '@aztec/stdlib/block';
14
- import { MerkleTreeId } from '@aztec/stdlib/trees';
15
13
 
16
14
  import type { IAvmExecutionOracle, ITxeExecutionOracle } from './oracle/interfaces.js';
17
15
  import type { TXESessionStateHandler } from './txe_session.js';
@@ -21,6 +19,7 @@ import {
21
19
  addressFromSingle,
22
20
  arrayOfArraysToBoundedVecOfArrays,
23
21
  arrayToBoundedVec,
22
+ blockHashFromSingle,
24
23
  bufferToU8Array,
25
24
  fromArray,
26
25
  fromSingle,
@@ -31,7 +30,7 @@ import {
31
30
  toSingle,
32
31
  } from './util/encoding.js';
33
32
 
34
- const MAX_EVENT_LEN = 12; // This is MAX_MESSAGE_CONTENT_LEN - PRIVATE_EVENT_RESERVED_FIELDS
33
+ const MAX_EVENT_LEN = 10; // This is MAX_MESSAGE_CONTENT_LEN - PRIVATE_EVENT_MSG_PLAINTEXT_RESERVED_FIELDS_LEN
35
34
  const MAX_PRIVATE_EVENTS_PER_TXE_QUERY = 5;
36
35
 
37
36
  export class UnavailableOracleError extends Error {
@@ -105,13 +104,15 @@ export class RPCTranslator {
105
104
 
106
105
  // TXE session state transition functions - these get handled by the state handler
107
106
 
108
- async txeSetTopLevelTXEContext() {
107
+ // eslint-disable-next-line camelcase
108
+ async aztec_txe_setTopLevelTXEContext() {
109
109
  await this.stateHandler.enterTopLevelState();
110
110
 
111
111
  return toForeignCallResult([]);
112
112
  }
113
113
 
114
- async txeSetPrivateTXEContext(
114
+ // eslint-disable-next-line camelcase
115
+ async aztec_txe_setPrivateTXEContext(
115
116
  foreignContractAddressIsSome: ForeignCallSingle,
116
117
  foreignContractAddressValue: ForeignCallSingle,
117
118
  foreignAnchorBlockNumberIsSome: ForeignCallSingle,
@@ -130,7 +131,8 @@ export class RPCTranslator {
130
131
  return toForeignCallResult(privateContextInputs.toFields().map(toSingle));
131
132
  }
132
133
 
133
- async txeSetPublicTXEContext(
134
+ // eslint-disable-next-line camelcase
135
+ async aztec_txe_setPublicTXEContext(
134
136
  foreignContractAddressIsSome: ForeignCallSingle,
135
137
  foreignContractAddressValue: ForeignCallSingle,
136
138
  ) {
@@ -143,7 +145,8 @@ export class RPCTranslator {
143
145
  return toForeignCallResult([]);
144
146
  }
145
147
 
146
- async txeSetUtilityTXEContext(
148
+ // eslint-disable-next-line camelcase
149
+ async aztec_txe_setUtilityTXEContext(
147
150
  foreignContractAddressIsSome: ForeignCallSingle,
148
151
  foreignContractAddressValue: ForeignCallSingle,
149
152
  ) {
@@ -160,44 +163,54 @@ export class RPCTranslator {
160
163
 
161
164
  // TXE-specific oracles
162
165
 
163
- txeGetDefaultAddress() {
164
- const defaultAddress = this.handlerAsTxe().txeGetDefaultAddress();
166
+ // eslint-disable-next-line camelcase
167
+ aztec_txe_getDefaultAddress() {
168
+ const defaultAddress = this.handlerAsTxe().getDefaultAddress();
165
169
 
166
170
  return toForeignCallResult([toSingle(defaultAddress)]);
167
171
  }
168
172
 
169
- async txeGetNextBlockNumber() {
170
- const nextBlockNumber = await this.handlerAsTxe().txeGetNextBlockNumber();
173
+ // eslint-disable-next-line camelcase
174
+ async aztec_txe_getNextBlockNumber() {
175
+ const nextBlockNumber = await this.handlerAsTxe().getNextBlockNumber();
171
176
 
172
177
  return toForeignCallResult([toSingle(nextBlockNumber)]);
173
178
  }
174
179
 
175
- async txeGetNextBlockTimestamp() {
176
- const nextBlockTimestamp = await this.handlerAsTxe().txeGetNextBlockTimestamp();
180
+ // eslint-disable-next-line camelcase
181
+ async aztec_txe_getNextBlockTimestamp() {
182
+ const nextBlockTimestamp = await this.handlerAsTxe().getNextBlockTimestamp();
177
183
 
178
184
  return toForeignCallResult([toSingle(nextBlockTimestamp)]);
179
185
  }
180
186
 
181
- async txeAdvanceBlocksBy(foreignBlocks: ForeignCallSingle) {
187
+ // eslint-disable-next-line camelcase
188
+ async aztec_txe_advanceBlocksBy(foreignBlocks: ForeignCallSingle) {
182
189
  const blocks = fromSingle(foreignBlocks).toNumber();
183
190
 
184
- await this.handlerAsTxe().txeAdvanceBlocksBy(blocks);
191
+ await this.handlerAsTxe().advanceBlocksBy(blocks);
185
192
 
186
193
  return toForeignCallResult([]);
187
194
  }
188
195
 
189
- txeAdvanceTimestampBy(foreignDuration: ForeignCallSingle) {
196
+ // eslint-disable-next-line camelcase
197
+ aztec_txe_advanceTimestampBy(foreignDuration: ForeignCallSingle) {
190
198
  const duration = fromSingle(foreignDuration).toBigInt();
191
199
 
192
- this.handlerAsTxe().txeAdvanceTimestampBy(duration);
200
+ this.handlerAsTxe().advanceTimestampBy(duration);
193
201
 
194
202
  return toForeignCallResult([]);
195
203
  }
196
204
 
197
- async txeDeploy(artifact: ContractArtifact, instance: ContractInstanceWithAddress, foreignSecret: ForeignCallSingle) {
205
+ // eslint-disable-next-line camelcase
206
+ async aztec_txe_deploy(
207
+ artifact: ContractArtifact,
208
+ instance: ContractInstanceWithAddress,
209
+ foreignSecret: ForeignCallSingle,
210
+ ) {
198
211
  const secret = fromSingle(foreignSecret);
199
212
 
200
- await this.handlerAsTxe().txeDeploy(artifact, instance, secret);
213
+ await this.handlerAsTxe().deploy(artifact, instance, secret);
201
214
 
202
215
  return toForeignCallResult([
203
216
  toArray([
@@ -210,10 +223,11 @@ export class RPCTranslator {
210
223
  ]);
211
224
  }
212
225
 
213
- async txeCreateAccount(foreignSecret: ForeignCallSingle) {
226
+ // eslint-disable-next-line camelcase
227
+ async aztec_txe_createAccount(foreignSecret: ForeignCallSingle) {
214
228
  const secret = fromSingle(foreignSecret);
215
229
 
216
- const completeAddress = await this.handlerAsTxe().txeCreateAccount(secret);
230
+ const completeAddress = await this.handlerAsTxe().createAccount(secret);
217
231
 
218
232
  return toForeignCallResult([
219
233
  toSingle(completeAddress.address),
@@ -221,14 +235,15 @@ export class RPCTranslator {
221
235
  ]);
222
236
  }
223
237
 
224
- async txeAddAccount(
238
+ // eslint-disable-next-line camelcase
239
+ async aztec_txe_addAccount(
225
240
  artifact: ContractArtifact,
226
241
  instance: ContractInstanceWithAddress,
227
242
  foreignSecret: ForeignCallSingle,
228
243
  ) {
229
244
  const secret = fromSingle(foreignSecret);
230
245
 
231
- const completeAddress = await this.handlerAsTxe().txeAddAccount(artifact, instance, secret);
246
+ const completeAddress = await this.handlerAsTxe().addAccount(artifact, instance, secret);
232
247
 
233
248
  return toForeignCallResult([
234
249
  toSingle(completeAddress.address),
@@ -236,39 +251,45 @@ export class RPCTranslator {
236
251
  ]);
237
252
  }
238
253
 
239
- async txeAddAuthWitness(foreignAddress: ForeignCallSingle, foreignMessageHash: ForeignCallSingle) {
254
+ // eslint-disable-next-line camelcase
255
+ async aztec_txe_addAuthWitness(foreignAddress: ForeignCallSingle, foreignMessageHash: ForeignCallSingle) {
240
256
  const address = addressFromSingle(foreignAddress);
241
257
  const messageHash = fromSingle(foreignMessageHash);
242
258
 
243
- await this.handlerAsTxe().txeAddAuthWitness(address, messageHash);
259
+ await this.handlerAsTxe().addAuthWitness(address, messageHash);
244
260
 
245
261
  return toForeignCallResult([]);
246
262
  }
247
263
 
248
264
  // PXE oracles
249
265
 
250
- utilityAssertCompatibleOracleVersion(foreignVersion: ForeignCallSingle) {
251
- const version = fromSingle(foreignVersion).toNumber();
266
+ // eslint-disable-next-line camelcase
267
+ aztec_utl_assertCompatibleOracleVersionV2(foreignMajor: ForeignCallSingle, foreignMinor: ForeignCallSingle) {
268
+ const major = fromSingle(foreignMajor).toNumber();
269
+ const minor = fromSingle(foreignMinor).toNumber();
252
270
 
253
- this.handlerAsMisc().utilityAssertCompatibleOracleVersion(version);
271
+ this.handlerAsMisc().assertCompatibleOracleVersion(major, minor);
254
272
 
255
273
  return toForeignCallResult([]);
256
274
  }
257
275
 
258
- utilityGetRandomField() {
259
- const randomField = this.handlerAsMisc().utilityGetRandomField();
276
+ // eslint-disable-next-line camelcase
277
+ aztec_utl_getRandomField() {
278
+ const randomField = this.handlerAsMisc().getRandomField();
260
279
 
261
280
  return toForeignCallResult([toSingle(randomField)]);
262
281
  }
263
282
 
264
- async txeGetLastBlockTimestamp() {
265
- const timestamp = await this.handlerAsTxe().txeGetLastBlockTimestamp();
283
+ // eslint-disable-next-line camelcase
284
+ async aztec_txe_getLastBlockTimestamp() {
285
+ const timestamp = await this.handlerAsTxe().getLastBlockTimestamp();
266
286
 
267
287
  return toForeignCallResult([toSingle(new Fr(timestamp))]);
268
288
  }
269
289
 
270
- async txeGetLastTxEffects() {
271
- const { txHash, noteHashes, nullifiers } = await this.handlerAsTxe().txeGetLastTxEffects();
290
+ // eslint-disable-next-line camelcase
291
+ async aztec_txe_getLastTxEffects() {
292
+ const { txHash, noteHashes, nullifiers } = await this.handlerAsTxe().getLastTxEffects();
272
293
 
273
294
  return toForeignCallResult([
274
295
  toSingle(txHash.hash),
@@ -277,7 +298,8 @@ export class RPCTranslator {
277
298
  ]);
278
299
  }
279
300
 
280
- async txeGetPrivateEvents(
301
+ // eslint-disable-next-line camelcase
302
+ async aztec_txe_getPrivateEvents(
281
303
  foreignSelector: ForeignCallSingle,
282
304
  foreignContractAddress: ForeignCallSingle,
283
305
  foreignScope: ForeignCallSingle,
@@ -286,7 +308,14 @@ export class RPCTranslator {
286
308
  const contractAddress = addressFromSingle(foreignContractAddress);
287
309
  const scope = addressFromSingle(foreignScope);
288
310
 
289
- const events = await this.handlerAsTxe().txeGetPrivateEvents(selector, contractAddress, scope);
311
+ // TODO(F-335): Avoid doing the following 2 calls here.
312
+ {
313
+ await this.handlerAsTxe().syncContractNonOracleMethod(contractAddress, scope, this.stateHandler.getCurrentJob());
314
+ // We cycle job to commit the stores after the contract sync.
315
+ await this.stateHandler.cycleJob();
316
+ }
317
+
318
+ const events = await this.handlerAsTxe().getPrivateEvents(selector, contractAddress, scope);
290
319
 
291
320
  if (events.length > MAX_PRIVATE_EVENTS_PER_TXE_QUERY) {
292
321
  throw new Error(`Array of length ${events.length} larger than maxLen ${MAX_PRIVATE_EVENTS_PER_TXE_QUERY}`);
@@ -310,26 +339,29 @@ export class RPCTranslator {
310
339
  return toForeignCallResult([toArray(rawArrayStorage), toArray(eventLengths), toSingle(queryLength)]);
311
340
  }
312
341
 
313
- privateStoreInExecutionCache(foreignValues: ForeignCallArray, foreignHash: ForeignCallSingle) {
342
+ // eslint-disable-next-line camelcase
343
+ aztec_prv_setHashPreimage(foreignValues: ForeignCallArray, foreignHash: ForeignCallSingle) {
314
344
  const values = fromArray(foreignValues);
315
345
  const hash = fromSingle(foreignHash);
316
346
 
317
- this.handlerAsPrivate().privateStoreInExecutionCache(values, hash);
347
+ this.handlerAsPrivate().setHashPreimage(values, hash);
318
348
 
319
349
  return toForeignCallResult([]);
320
350
  }
321
351
 
322
- async privateLoadFromExecutionCache(foreignHash: ForeignCallSingle) {
352
+ // eslint-disable-next-line camelcase
353
+ async aztec_prv_getHashPreimage(foreignHash: ForeignCallSingle) {
323
354
  const hash = fromSingle(foreignHash);
324
355
 
325
- const returns = await this.handlerAsPrivate().privateLoadFromExecutionCache(hash);
356
+ const returns = await this.handlerAsPrivate().getHashPreimage(hash);
326
357
 
327
358
  return toForeignCallResult([toArray(returns)]);
328
359
  }
329
360
 
330
361
  // When the argument is a slice, noir automatically adds a length field to oracle call.
331
362
  // When the argument is an array, we add the field length manually to the signature.
332
- utilityDebugLog(
363
+ // eslint-disable-next-line camelcase
364
+ async aztec_utl_log(
333
365
  foreignLevel: ForeignCallSingle,
334
366
  foreignMessage: ForeignCallArray,
335
367
  _foreignLength: ForeignCallSingle,
@@ -341,23 +373,24 @@ export class RPCTranslator {
341
373
  .join('');
342
374
  const fields = fromArray(foreignFields);
343
375
 
344
- this.handlerAsMisc().utilityDebugLog(level, message, fields);
376
+ await this.handlerAsMisc().log(level, message, fields);
345
377
 
346
378
  return toForeignCallResult([]);
347
379
  }
348
380
 
349
- async utilityStorageRead(
381
+ // eslint-disable-next-line camelcase
382
+ async aztec_utl_getFromPublicStorage(
350
383
  foreignBlockHash: ForeignCallSingle,
351
384
  foreignContractAddress: ForeignCallSingle,
352
385
  foreignStartStorageSlot: ForeignCallSingle,
353
386
  foreignNumberOfElements: ForeignCallSingle,
354
387
  ) {
355
- const blockHash = L2BlockHash.fromString(foreignBlockHash);
388
+ const blockHash = blockHashFromSingle(foreignBlockHash);
356
389
  const contractAddress = addressFromSingle(foreignContractAddress);
357
390
  const startStorageSlot = fromSingle(foreignStartStorageSlot);
358
391
  const numberOfElements = fromSingle(foreignNumberOfElements).toNumber();
359
392
 
360
- const values = await this.handlerAsUtility().utilityStorageRead(
393
+ const values = await this.handlerAsUtility().getFromPublicStorage(
361
394
  blockHash,
362
395
  contractAddress,
363
396
  startStorageSlot,
@@ -367,11 +400,12 @@ export class RPCTranslator {
367
400
  return toForeignCallResult([toArray(values)]);
368
401
  }
369
402
 
370
- async utilityGetPublicDataWitness(foreignBlockHash: ForeignCallSingle, foreignLeafSlot: ForeignCallSingle) {
371
- const blockHash = L2BlockHash.fromString(foreignBlockHash);
403
+ // eslint-disable-next-line camelcase
404
+ async aztec_utl_getPublicDataWitness(foreignBlockHash: ForeignCallSingle, foreignLeafSlot: ForeignCallSingle) {
405
+ const blockHash = blockHashFromSingle(foreignBlockHash);
372
406
  const leafSlot = fromSingle(foreignLeafSlot);
373
407
 
374
- const witness = await this.handlerAsUtility().utilityGetPublicDataWitness(blockHash, leafSlot);
408
+ const witness = await this.handlerAsUtility().getPublicDataWitness(blockHash, leafSlot);
375
409
 
376
410
  if (!witness) {
377
411
  throw new Error(`Public data witness not found for slot ${leafSlot} at block ${blockHash.toString()}.`);
@@ -379,7 +413,8 @@ export class RPCTranslator {
379
413
  return toForeignCallResult(witness.toNoirRepresentation());
380
414
  }
381
415
 
382
- async utilityGetNotes(
416
+ // eslint-disable-next-line camelcase
417
+ async aztec_utl_getNotes(
383
418
  foreignOwnerIsSome: ForeignCallSingle,
384
419
  foreignOwnerValue: ForeignCallSingle,
385
420
  foreignStorageSlot: ForeignCallSingle,
@@ -420,7 +455,7 @@ export class RPCTranslator {
420
455
  const maxNotes = fromSingle(foreignMaxNotes).toNumber();
421
456
  const packedHintedNoteLength = fromSingle(foreignPackedHintedNoteLength).toNumber();
422
457
 
423
- const noteDatas = await this.handlerAsUtility().utilityGetNotes(
458
+ const noteDatas = await this.handlerAsUtility().getNotes(
424
459
  owner,
425
460
  storageSlot,
426
461
  numSelects,
@@ -461,7 +496,8 @@ export class RPCTranslator {
461
496
  );
462
497
  }
463
498
 
464
- privateNotifyCreatedNote(
499
+ // eslint-disable-next-line camelcase
500
+ aztec_prv_notifyCreatedNote(
465
501
  foreignOwner: ForeignCallSingle,
466
502
  foreignStorageSlot: ForeignCallSingle,
467
503
  foreignRandomness: ForeignCallSingle,
@@ -478,20 +514,13 @@ export class RPCTranslator {
478
514
  const noteHash = fromSingle(foreignNoteHash);
479
515
  const counter = fromSingle(foreignCounter).toNumber();
480
516
 
481
- this.handlerAsPrivate().privateNotifyCreatedNote(
482
- owner,
483
- storageSlot,
484
- randomness,
485
- noteTypeId,
486
- note,
487
- noteHash,
488
- counter,
489
- );
517
+ this.handlerAsPrivate().notifyCreatedNote(owner, storageSlot, randomness, noteTypeId, note, noteHash, counter);
490
518
 
491
519
  return toForeignCallResult([]);
492
520
  }
493
521
 
494
- async privateNotifyNullifiedNote(
522
+ // eslint-disable-next-line camelcase
523
+ async aztec_prv_notifyNullifiedNote(
495
524
  foreignInnerNullifier: ForeignCallSingle,
496
525
  foreignNoteHash: ForeignCallSingle,
497
526
  foreignCounter: ForeignCallSingle,
@@ -500,31 +529,47 @@ export class RPCTranslator {
500
529
  const noteHash = fromSingle(foreignNoteHash);
501
530
  const counter = fromSingle(foreignCounter).toNumber();
502
531
 
503
- await this.handlerAsPrivate().privateNotifyNullifiedNote(innerNullifier, noteHash, counter);
532
+ await this.handlerAsPrivate().notifyNullifiedNote(innerNullifier, noteHash, counter);
504
533
 
505
534
  return toForeignCallResult([]);
506
535
  }
507
536
 
508
- async privateNotifyCreatedNullifier(foreignInnerNullifier: ForeignCallSingle) {
537
+ // eslint-disable-next-line camelcase
538
+ async aztec_prv_notifyCreatedNullifier(foreignInnerNullifier: ForeignCallSingle) {
509
539
  const innerNullifier = fromSingle(foreignInnerNullifier);
510
540
 
511
- await this.handlerAsPrivate().privateNotifyCreatedNullifier(innerNullifier);
541
+ await this.handlerAsPrivate().notifyCreatedNullifier(innerNullifier);
512
542
 
513
543
  return toForeignCallResult([]);
514
544
  }
515
545
 
516
- async utilityCheckNullifierExists(foreignInnerNullifier: ForeignCallSingle) {
546
+ // eslint-disable-next-line camelcase
547
+ async aztec_prv_isNullifierPending(
548
+ foreignInnerNullifier: ForeignCallSingle,
549
+ foreignContractAddress: ForeignCallSingle,
550
+ ) {
551
+ const innerNullifier = fromSingle(foreignInnerNullifier);
552
+ const contractAddress = addressFromSingle(foreignContractAddress);
553
+
554
+ const isPending = await this.handlerAsPrivate().isNullifierPending(innerNullifier, contractAddress);
555
+
556
+ return toForeignCallResult([toSingle(new Fr(isPending))]);
557
+ }
558
+
559
+ // eslint-disable-next-line camelcase
560
+ async aztec_utl_doesNullifierExist(foreignInnerNullifier: ForeignCallSingle) {
517
561
  const innerNullifier = fromSingle(foreignInnerNullifier);
518
562
 
519
- const exists = await this.handlerAsUtility().utilityCheckNullifierExists(innerNullifier);
563
+ const exists = await this.handlerAsUtility().doesNullifierExist(innerNullifier);
520
564
 
521
565
  return toForeignCallResult([toSingle(new Fr(exists))]);
522
566
  }
523
567
 
524
- async utilityGetContractInstance(foreignAddress: ForeignCallSingle) {
568
+ // eslint-disable-next-line camelcase
569
+ async aztec_utl_getContractInstance(foreignAddress: ForeignCallSingle) {
525
570
  const address = addressFromSingle(foreignAddress);
526
571
 
527
- const instance = await this.handlerAsUtility().utilityGetContractInstance(address);
572
+ const instance = await this.handlerAsUtility().getContractInstance(address);
528
573
 
529
574
  return toForeignCallResult(
530
575
  [
@@ -537,23 +582,37 @@ export class RPCTranslator {
537
582
  );
538
583
  }
539
584
 
540
- async utilityGetPublicKeysAndPartialAddress(foreignAddress: ForeignCallSingle) {
585
+ // eslint-disable-next-line camelcase
586
+ async aztec_utl_getPublicKeysAndPartialAddress(foreignAddress: ForeignCallSingle) {
541
587
  const address = addressFromSingle(foreignAddress);
542
588
 
543
- const { publicKeys, partialAddress } = await this.handlerAsUtility().utilityGetPublicKeysAndPartialAddress(address);
589
+ const result = await this.handlerAsUtility().getPublicKeysAndPartialAddress(address);
544
590
 
545
- return toForeignCallResult([toArray([...publicKeys.toFields(), partialAddress])]);
591
+ // We are going to return a Noir Option struct to represent the possibility of null values. Options are a struct
592
+ // with two fields: `some` (a boolean) and `value` (a field array in this case).
593
+ if (result === undefined) {
594
+ // No data was found so we set `some` to 0 and pad `value` with zeros get the correct return size.
595
+ return toForeignCallResult([toSingle(new Fr(0)), toArray(Array(13).fill(new Fr(0)))]);
596
+ } else {
597
+ // Data was found so we set `some` to 1 and return it along with `value`.
598
+ return toForeignCallResult([
599
+ toSingle(new Fr(1)),
600
+ toArray([...result.publicKeys.toFields(), result.partialAddress]),
601
+ ]);
602
+ }
546
603
  }
547
604
 
548
- async utilityGetKeyValidationRequest(foreignPkMHash: ForeignCallSingle) {
605
+ // eslint-disable-next-line camelcase
606
+ async aztec_utl_getKeyValidationRequest(foreignPkMHash: ForeignCallSingle) {
549
607
  const pkMHash = fromSingle(foreignPkMHash);
550
608
 
551
- const keyValidationRequest = await this.handlerAsUtility().utilityGetKeyValidationRequest(pkMHash);
609
+ const keyValidationRequest = await this.handlerAsUtility().getKeyValidationRequest(pkMHash);
552
610
 
553
611
  return toForeignCallResult(keyValidationRequest.toFields().map(toSingle));
554
612
  }
555
613
 
556
- privateCallPrivateFunction(
614
+ // eslint-disable-next-line camelcase
615
+ aztec_prv_callPrivateFunction(
557
616
  _foreignTargetContractAddress: ForeignCallSingle,
558
617
  _foreignFunctionSelector: ForeignCallSingle,
559
618
  _foreignArgsHash: ForeignCallSingle,
@@ -565,11 +624,15 @@ export class RPCTranslator {
565
624
  );
566
625
  }
567
626
 
568
- async utilityGetNullifierMembershipWitness(foreignBlockHash: ForeignCallSingle, foreignNullifier: ForeignCallSingle) {
569
- const blockHash = L2BlockHash.fromString(foreignBlockHash);
627
+ // eslint-disable-next-line camelcase
628
+ async aztec_utl_getNullifierMembershipWitness(
629
+ foreignBlockHash: ForeignCallSingle,
630
+ foreignNullifier: ForeignCallSingle,
631
+ ) {
632
+ const blockHash = blockHashFromSingle(foreignBlockHash);
570
633
  const nullifier = fromSingle(foreignNullifier);
571
634
 
572
- const witness = await this.handlerAsUtility().utilityGetNullifierMembershipWitness(blockHash, nullifier);
635
+ const witness = await this.handlerAsUtility().getNullifierMembershipWitness(blockHash, nullifier);
573
636
 
574
637
  if (!witness) {
575
638
  throw new Error(`Nullifier membership witness not found at block ${blockHash}.`);
@@ -577,10 +640,11 @@ export class RPCTranslator {
577
640
  return toForeignCallResult(witness.toNoirRepresentation());
578
641
  }
579
642
 
580
- async utilityGetAuthWitness(foreignMessageHash: ForeignCallSingle) {
643
+ // eslint-disable-next-line camelcase
644
+ async aztec_utl_getAuthWitness(foreignMessageHash: ForeignCallSingle) {
581
645
  const messageHash = fromSingle(foreignMessageHash);
582
646
 
583
- const authWitness = await this.handlerAsUtility().utilityGetAuthWitness(messageHash);
647
+ const authWitness = await this.handlerAsUtility().getAuthWitness(messageHash);
584
648
 
585
649
  if (!authWitness) {
586
650
  throw new Error(`Auth witness not found for message hash ${messageHash}.`);
@@ -588,44 +652,35 @@ export class RPCTranslator {
588
652
  return toForeignCallResult([toArray(authWitness)]);
589
653
  }
590
654
 
591
- public privateNotifyEnqueuedPublicFunctionCall(
592
- _foreignTargetContractAddress: ForeignCallSingle,
593
- _foreignCalldataHash: ForeignCallSingle,
594
- _foreignSideEffectCounter: ForeignCallSingle,
595
- _foreignIsStaticCall: ForeignCallSingle,
596
- ) {
655
+ // eslint-disable-next-line camelcase
656
+ public aztec_prv_assertValidPublicCalldata(_foreignCalldataHash: ForeignCallSingle) {
597
657
  throw new Error('Enqueueing public calls is not supported in TestEnvironment::private_context');
598
658
  }
599
659
 
600
- public privateNotifySetPublicTeardownFunctionCall(
601
- _foreignTargetContractAddress: ForeignCallSingle,
602
- _foreignCalldataHash: ForeignCallSingle,
603
- _foreignSideEffectCounter: ForeignCallSingle,
604
- _foreignIsStaticCall: ForeignCallSingle,
605
- ) {
660
+ // eslint-disable-next-line camelcase
661
+ public aztec_prv_notifyRevertiblePhaseStart(_foreignMinRevertibleSideEffectCounter: ForeignCallSingle) {
606
662
  throw new Error('Enqueueing public calls is not supported in TestEnvironment::private_context');
607
663
  }
608
664
 
609
- public privateNotifySetMinRevertibleSideEffectCounter(_foreignMinRevertibleSideEffectCounter: ForeignCallSingle) {
610
- throw new Error('Enqueueing public calls is not supported in TestEnvironment::private_context');
611
- }
612
-
613
- public async privateIsSideEffectCounterRevertible(foreignSideEffectCounter: ForeignCallSingle) {
665
+ // eslint-disable-next-line camelcase
666
+ public async aztec_prv_isExecutionInRevertiblePhase(foreignSideEffectCounter: ForeignCallSingle) {
614
667
  const sideEffectCounter = fromSingle(foreignSideEffectCounter).toNumber();
615
- const isRevertible = await this.handlerAsPrivate().privateIsSideEffectCounterRevertible(sideEffectCounter);
668
+ const isRevertible = await this.handlerAsPrivate().isExecutionInRevertiblePhase(sideEffectCounter);
616
669
  return toForeignCallResult([toSingle(new Fr(isRevertible))]);
617
670
  }
618
671
 
619
- utilityGetUtilityContext() {
620
- const context = this.handlerAsUtility().utilityGetUtilityContext();
672
+ // eslint-disable-next-line camelcase
673
+ aztec_utl_getUtilityContext() {
674
+ const context = this.handlerAsUtility().getUtilityContext();
621
675
 
622
676
  return toForeignCallResult(context.toNoirRepresentation());
623
677
  }
624
678
 
625
- async utilityGetBlockHeader(foreignBlockNumber: ForeignCallSingle) {
679
+ // eslint-disable-next-line camelcase
680
+ async aztec_utl_getBlockHeader(foreignBlockNumber: ForeignCallSingle) {
626
681
  const blockNumber = BlockNumber(fromSingle(foreignBlockNumber).toNumber());
627
682
 
628
- const header = await this.handlerAsUtility().utilityGetBlockHeader(blockNumber);
683
+ const header = await this.handlerAsUtility().getBlockHeader(blockNumber);
629
684
 
630
685
  if (!header) {
631
686
  throw new Error(`Block header not found for block ${blockNumber}.`);
@@ -633,33 +688,49 @@ export class RPCTranslator {
633
688
  return toForeignCallResult(header.toFields().map(toSingle));
634
689
  }
635
690
 
636
- async utilityGetMembershipWitness(
691
+ // eslint-disable-next-line camelcase
692
+ async aztec_utl_getNoteHashMembershipWitness(
693
+ foreignAnchorBlockHash: ForeignCallSingle,
694
+ foreignNoteHash: ForeignCallSingle,
695
+ ) {
696
+ const blockHash = blockHashFromSingle(foreignAnchorBlockHash);
697
+ const noteHash = fromSingle(foreignNoteHash);
698
+
699
+ const witness = await this.handlerAsUtility().getNoteHashMembershipWitness(blockHash, noteHash);
700
+
701
+ if (!witness) {
702
+ throw new Error(`Note hash ${noteHash} not found in the note hash tree at block ${blockHash.toString()}.`);
703
+ }
704
+ return toForeignCallResult(witness.toNoirRepresentation());
705
+ }
706
+
707
+ // eslint-disable-next-line camelcase
708
+ async aztec_utl_getBlockHashMembershipWitness(
709
+ foreignAnchorBlockHash: ForeignCallSingle,
637
710
  foreignBlockHash: ForeignCallSingle,
638
- foreignTreeId: ForeignCallSingle,
639
- foreignLeafValue: ForeignCallSingle,
640
711
  ) {
641
- const blockHash = L2BlockHash.fromString(foreignBlockHash);
642
- const treeId = fromSingle(foreignTreeId).toNumber();
643
- const leafValue = fromSingle(foreignLeafValue);
712
+ const anchorBlockHash = blockHashFromSingle(foreignAnchorBlockHash);
713
+ const blockHash = blockHashFromSingle(foreignBlockHash);
644
714
 
645
- const witness = await this.handlerAsUtility().utilityGetMembershipWitness(blockHash, treeId, leafValue);
715
+ const witness = await this.handlerAsUtility().getBlockHashMembershipWitness(anchorBlockHash, blockHash);
646
716
 
647
717
  if (!witness) {
648
718
  throw new Error(
649
- `Membership witness in tree ${MerkleTreeId[treeId]} not found for value ${leafValue} at block ${blockHash}.`,
719
+ `Block hash ${blockHash.toString()} not found in the archive tree at anchor block ${anchorBlockHash.toString()}.`,
650
720
  );
651
721
  }
652
- return toForeignCallResult([toSingle(witness[0]), toArray(witness.slice(1))]);
722
+ return toForeignCallResult(witness.toNoirRepresentation());
653
723
  }
654
724
 
655
- async utilityGetLowNullifierMembershipWitness(
725
+ // eslint-disable-next-line camelcase
726
+ async aztec_utl_getLowNullifierMembershipWitness(
656
727
  foreignBlockHash: ForeignCallSingle,
657
728
  foreignNullifier: ForeignCallSingle,
658
729
  ) {
659
- const blockHash = L2BlockHash.fromString(foreignBlockHash);
730
+ const blockHash = blockHashFromSingle(foreignBlockHash);
660
731
  const nullifier = fromSingle(foreignNullifier);
661
732
 
662
- const witness = await this.handlerAsUtility().utilityGetLowNullifierMembershipWitness(blockHash, nullifier);
733
+ const witness = await this.handlerAsUtility().getLowNullifierMembershipWitness(blockHash, nullifier);
663
734
 
664
735
  if (!witness) {
665
736
  throw new Error(`Low nullifier witness not found for nullifier ${nullifier} at block ${blockHash}.`);
@@ -667,74 +738,167 @@ export class RPCTranslator {
667
738
  return toForeignCallResult(witness.toNoirRepresentation());
668
739
  }
669
740
 
670
- async utilityFetchTaggedLogs(foreignPendingTaggedLogArrayBaseSlot: ForeignCallSingle) {
741
+ // eslint-disable-next-line camelcase
742
+ async aztec_utl_getPendingTaggedLogs(
743
+ foreignPendingTaggedLogArrayBaseSlot: ForeignCallSingle,
744
+ foreignScope: ForeignCallSingle,
745
+ ) {
671
746
  const pendingTaggedLogArrayBaseSlot = fromSingle(foreignPendingTaggedLogArrayBaseSlot);
747
+ const scope = AztecAddress.fromField(fromSingle(foreignScope));
672
748
 
673
- await this.handlerAsUtility().utilityFetchTaggedLogs(pendingTaggedLogArrayBaseSlot);
749
+ await this.handlerAsUtility().getPendingTaggedLogs(pendingTaggedLogArrayBaseSlot, scope);
674
750
 
675
751
  return toForeignCallResult([]);
676
752
  }
677
753
 
678
- public async utilityValidateEnqueuedNotesAndEvents(
754
+ // eslint-disable-next-line camelcase
755
+ async aztec_utl_getPendingTaggedLogs_v2(foreignScope: ForeignCallSingle) {
756
+ const scope = AztecAddress.fromField(fromSingle(foreignScope));
757
+ const slot = await this.handlerAsUtility().getPendingTaggedLogsV2(scope);
758
+ return toForeignCallResult([toSingle(slot)]);
759
+ }
760
+
761
+ // eslint-disable-next-line camelcase
762
+ public async aztec_utl_validateAndStoreEnqueuedNotesAndEvents(
679
763
  foreignContractAddress: ForeignCallSingle,
680
764
  foreignNoteValidationRequestsArrayBaseSlot: ForeignCallSingle,
681
765
  foreignEventValidationRequestsArrayBaseSlot: ForeignCallSingle,
766
+ foreignMaxNotePackedLen: ForeignCallSingle,
767
+ foreignMaxEventSerializedLen: ForeignCallSingle,
768
+ foreignScope: ForeignCallSingle,
682
769
  ) {
683
770
  const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
684
771
  const noteValidationRequestsArrayBaseSlot = fromSingle(foreignNoteValidationRequestsArrayBaseSlot);
685
772
  const eventValidationRequestsArrayBaseSlot = fromSingle(foreignEventValidationRequestsArrayBaseSlot);
773
+ const maxNotePackedLen = fromSingle(foreignMaxNotePackedLen).toNumber();
774
+ const maxEventSerializedLen = fromSingle(foreignMaxEventSerializedLen).toNumber();
775
+ const scope = AztecAddress.fromField(fromSingle(foreignScope));
686
776
 
687
- await this.handlerAsUtility().utilityValidateEnqueuedNotesAndEvents(
777
+ await this.handlerAsUtility().validateAndStoreEnqueuedNotesAndEvents(
688
778
  contractAddress,
689
779
  noteValidationRequestsArrayBaseSlot,
690
780
  eventValidationRequestsArrayBaseSlot,
781
+ maxNotePackedLen,
782
+ maxEventSerializedLen,
783
+ scope,
691
784
  );
692
785
 
693
786
  return toForeignCallResult([]);
694
787
  }
695
788
 
696
- public async utilityBulkRetrieveLogs(
789
+ // eslint-disable-next-line camelcase
790
+ public async aztec_utl_validateAndStoreEnqueuedNotesAndEvents_v2(
791
+ foreignNoteValidationRequestsArrayBaseSlot: ForeignCallSingle,
792
+ foreignEventValidationRequestsArrayBaseSlot: ForeignCallSingle,
793
+ foreignMaxNotePackedLen: ForeignCallSingle,
794
+ foreignMaxEventSerializedLen: ForeignCallSingle,
795
+ foreignScope: ForeignCallSingle,
796
+ ) {
797
+ const noteValidationRequestsArrayBaseSlot = fromSingle(foreignNoteValidationRequestsArrayBaseSlot);
798
+ const eventValidationRequestsArrayBaseSlot = fromSingle(foreignEventValidationRequestsArrayBaseSlot);
799
+ const maxNotePackedLen = fromSingle(foreignMaxNotePackedLen).toNumber();
800
+ const maxEventSerializedLen = fromSingle(foreignMaxEventSerializedLen).toNumber();
801
+ const scope = AztecAddress.fromField(fromSingle(foreignScope));
802
+
803
+ await this.handlerAsUtility().validateAndStoreEnqueuedNotesAndEventsV2(
804
+ noteValidationRequestsArrayBaseSlot,
805
+ eventValidationRequestsArrayBaseSlot,
806
+ maxNotePackedLen,
807
+ maxEventSerializedLen,
808
+ scope,
809
+ );
810
+
811
+ return toForeignCallResult([]);
812
+ }
813
+
814
+ // eslint-disable-next-line camelcase
815
+ public async aztec_utl_getLogsByTag(
697
816
  foreignContractAddress: ForeignCallSingle,
698
817
  foreignLogRetrievalRequestsArrayBaseSlot: ForeignCallSingle,
699
818
  foreignLogRetrievalResponsesArrayBaseSlot: ForeignCallSingle,
819
+ foreignScope: ForeignCallSingle,
700
820
  ) {
701
821
  const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
702
822
  const logRetrievalRequestsArrayBaseSlot = fromSingle(foreignLogRetrievalRequestsArrayBaseSlot);
703
823
  const logRetrievalResponsesArrayBaseSlot = fromSingle(foreignLogRetrievalResponsesArrayBaseSlot);
824
+ const scope = AztecAddress.fromField(fromSingle(foreignScope));
704
825
 
705
- await this.handlerAsUtility().utilityBulkRetrieveLogs(
826
+ await this.handlerAsUtility().getLogsByTag(
706
827
  contractAddress,
707
828
  logRetrievalRequestsArrayBaseSlot,
708
829
  logRetrievalResponsesArrayBaseSlot,
830
+ scope,
709
831
  );
710
832
 
711
833
  return toForeignCallResult([]);
712
834
  }
713
835
 
714
- async utilityStoreCapsule(
836
+ // eslint-disable-next-line camelcase
837
+ public async aztec_utl_getMessageContextsByTxHash(
838
+ foreignContractAddress: ForeignCallSingle,
839
+ foreignMessageContextRequestsArrayBaseSlot: ForeignCallSingle,
840
+ foreignMessageContextResponsesArrayBaseSlot: ForeignCallSingle,
841
+ foreignScope: ForeignCallSingle,
842
+ ) {
843
+ const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
844
+ const messageContextRequestsArrayBaseSlot = fromSingle(foreignMessageContextRequestsArrayBaseSlot);
845
+ const messageContextResponsesArrayBaseSlot = fromSingle(foreignMessageContextResponsesArrayBaseSlot);
846
+ const scope = AztecAddress.fromField(fromSingle(foreignScope));
847
+
848
+ await this.handlerAsUtility().getMessageContextsByTxHash(
849
+ contractAddress,
850
+ messageContextRequestsArrayBaseSlot,
851
+ messageContextResponsesArrayBaseSlot,
852
+ scope,
853
+ );
854
+
855
+ return toForeignCallResult([]);
856
+ }
857
+
858
+ // eslint-disable-next-line camelcase
859
+ async aztec_utl_getLogsByTag_v2(foreignRequestArrayBaseSlot: ForeignCallSingle) {
860
+ const requestArrayBaseSlot = fromSingle(foreignRequestArrayBaseSlot);
861
+ const responseSlot = await this.handlerAsUtility().getLogsByTagV2(requestArrayBaseSlot);
862
+ return toForeignCallResult([toSingle(responseSlot)]);
863
+ }
864
+
865
+ // eslint-disable-next-line camelcase
866
+ async aztec_utl_getMessageContextsByTxHash_v2(foreignRequestArrayBaseSlot: ForeignCallSingle) {
867
+ const requestArrayBaseSlot = fromSingle(foreignRequestArrayBaseSlot);
868
+ const responseSlot = await this.handlerAsUtility().getMessageContextsByTxHashV2(requestArrayBaseSlot);
869
+ return toForeignCallResult([toSingle(responseSlot)]);
870
+ }
871
+
872
+ // eslint-disable-next-line camelcase
873
+ aztec_utl_setCapsule(
715
874
  foreignContractAddress: ForeignCallSingle,
716
875
  foreignSlot: ForeignCallSingle,
717
876
  foreignCapsule: ForeignCallArray,
877
+ foreignScope: ForeignCallSingle,
718
878
  ) {
719
879
  const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
720
880
  const slot = fromSingle(foreignSlot);
721
881
  const capsule = fromArray(foreignCapsule);
882
+ const scope = AztecAddress.fromField(fromSingle(foreignScope));
722
883
 
723
- await this.handlerAsUtility().utilityStoreCapsule(contractAddress, slot, capsule);
884
+ this.handlerAsUtility().setCapsule(contractAddress, slot, capsule, scope);
724
885
 
725
886
  return toForeignCallResult([]);
726
887
  }
727
888
 
728
- async utilityLoadCapsule(
889
+ // eslint-disable-next-line camelcase
890
+ async aztec_utl_getCapsule(
729
891
  foreignContractAddress: ForeignCallSingle,
730
892
  foreignSlot: ForeignCallSingle,
731
893
  foreignTSize: ForeignCallSingle,
894
+ foreignScope: ForeignCallSingle,
732
895
  ) {
733
896
  const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
734
897
  const slot = fromSingle(foreignSlot);
735
898
  const tSize = fromSingle(foreignTSize).toNumber();
899
+ const scope = AztecAddress.fromField(fromSingle(foreignScope));
736
900
 
737
- const values = await this.handlerAsUtility().utilityLoadCapsule(contractAddress, slot);
901
+ const values = await this.handlerAsUtility().getCapsule(contractAddress, slot, scope);
738
902
 
739
903
  // We are going to return a Noir Option struct to represent the possibility of null values. Options are a struct
740
904
  // with two fields: `some` (a boolean) and `value` (a field array in this case).
@@ -747,28 +911,95 @@ export class RPCTranslator {
747
911
  }
748
912
  }
749
913
 
750
- async utilityDeleteCapsule(foreignContractAddress: ForeignCallSingle, foreignSlot: ForeignCallSingle) {
914
+ // eslint-disable-next-line camelcase
915
+ aztec_utl_deleteCapsule(
916
+ foreignContractAddress: ForeignCallSingle,
917
+ foreignSlot: ForeignCallSingle,
918
+ foreignScope: ForeignCallSingle,
919
+ ) {
751
920
  const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
752
921
  const slot = fromSingle(foreignSlot);
922
+ const scope = AztecAddress.fromField(fromSingle(foreignScope));
753
923
 
754
- await this.handlerAsUtility().utilityDeleteCapsule(contractAddress, slot);
924
+ this.handlerAsUtility().deleteCapsule(contractAddress, slot, scope);
755
925
 
756
926
  return toForeignCallResult([]);
757
927
  }
758
928
 
759
- async utilityCopyCapsule(
929
+ // eslint-disable-next-line camelcase
930
+ async aztec_utl_copyCapsule(
760
931
  foreignContractAddress: ForeignCallSingle,
761
932
  foreignSrcSlot: ForeignCallSingle,
762
933
  foreignDstSlot: ForeignCallSingle,
763
934
  foreignNumEntries: ForeignCallSingle,
935
+ foreignScope: ForeignCallSingle,
764
936
  ) {
765
937
  const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
766
938
  const srcSlot = fromSingle(foreignSrcSlot);
767
939
  const dstSlot = fromSingle(foreignDstSlot);
768
940
  const numEntries = fromSingle(foreignNumEntries).toNumber();
941
+ const scope = AztecAddress.fromField(fromSingle(foreignScope));
942
+
943
+ await this.handlerAsUtility().copyCapsule(contractAddress, srcSlot, dstSlot, numEntries, scope);
944
+
945
+ return toForeignCallResult([]);
946
+ }
947
+
948
+ // eslint-disable-next-line camelcase
949
+ aztec_utl_pushEphemeral(foreignSlot: ForeignCallSingle, foreignElements: ForeignCallArray) {
950
+ const slot = fromSingle(foreignSlot);
951
+ const elements = fromArray(foreignElements);
952
+ const newLen = this.handlerAsUtility().pushEphemeral(slot, elements);
953
+ return toForeignCallResult([toSingle(new Fr(newLen))]);
954
+ }
955
+
956
+ // eslint-disable-next-line camelcase
957
+ aztec_utl_popEphemeral(foreignSlot: ForeignCallSingle) {
958
+ const slot = fromSingle(foreignSlot);
959
+ const element = this.handlerAsUtility().popEphemeral(slot);
960
+ return toForeignCallResult([toArray(element)]);
961
+ }
769
962
 
770
- await this.handlerAsUtility().utilityCopyCapsule(contractAddress, srcSlot, dstSlot, numEntries);
963
+ // eslint-disable-next-line camelcase
964
+ aztec_utl_getEphemeral(foreignSlot: ForeignCallSingle, foreignIndex: ForeignCallSingle) {
965
+ const slot = fromSingle(foreignSlot);
966
+ const index = fromSingle(foreignIndex).toNumber();
967
+ const element = this.handlerAsUtility().getEphemeral(slot, index);
968
+ return toForeignCallResult([toArray(element)]);
969
+ }
970
+
971
+ // eslint-disable-next-line camelcase
972
+ aztec_utl_setEphemeral(
973
+ foreignSlot: ForeignCallSingle,
974
+ foreignIndex: ForeignCallSingle,
975
+ foreignElements: ForeignCallArray,
976
+ ) {
977
+ const slot = fromSingle(foreignSlot);
978
+ const index = fromSingle(foreignIndex).toNumber();
979
+ const elements = fromArray(foreignElements);
980
+ this.handlerAsUtility().setEphemeral(slot, index, elements);
981
+ return toForeignCallResult([]);
982
+ }
771
983
 
984
+ // eslint-disable-next-line camelcase
985
+ aztec_utl_getEphemeralLen(foreignSlot: ForeignCallSingle) {
986
+ const slot = fromSingle(foreignSlot);
987
+ const len = this.handlerAsUtility().getEphemeralLen(slot);
988
+ return toForeignCallResult([toSingle(new Fr(len))]);
989
+ }
990
+
991
+ // eslint-disable-next-line camelcase
992
+ aztec_utl_removeEphemeral(foreignSlot: ForeignCallSingle, foreignIndex: ForeignCallSingle) {
993
+ const slot = fromSingle(foreignSlot);
994
+ const index = fromSingle(foreignIndex).toNumber();
995
+ this.handlerAsUtility().removeEphemeral(slot, index);
996
+ return toForeignCallResult([]);
997
+ }
998
+
999
+ // eslint-disable-next-line camelcase
1000
+ aztec_utl_clearEphemeral(foreignSlot: ForeignCallSingle) {
1001
+ const slot = fromSingle(foreignSlot);
1002
+ this.handlerAsUtility().clearEphemeral(slot);
772
1003
  return toForeignCallResult([]);
773
1004
  }
774
1005
 
@@ -776,7 +1007,8 @@ export class RPCTranslator {
776
1007
  // The compiler didn't throw an error, so it took me a while to learn of the existence of this file, and that I need
777
1008
  // to implement this function here. Isn't there a way to programmatically identify that this is missing, given the
778
1009
  // existence of a txe_oracle method?
779
- async utilityAes128Decrypt(
1010
+ // eslint-disable-next-line camelcase
1011
+ async aztec_utl_decryptAes128(
780
1012
  foreignCiphertextBVecStorage: ForeignCallArray,
781
1013
  foreignCiphertextLength: ForeignCallSingle,
782
1014
  foreignIv: ForeignCallArray,
@@ -786,18 +1018,27 @@ export class RPCTranslator {
786
1018
  const iv = fromUintArray(foreignIv, 8);
787
1019
  const symKey = fromUintArray(foreignSymKey, 8);
788
1020
 
789
- const plaintextBuffer = await this.handlerAsUtility().utilityAes128Decrypt(ciphertext, iv, symKey);
790
-
791
- return toForeignCallResult(
792
- arrayToBoundedVec(bufferToU8Array(plaintextBuffer), foreignCiphertextBVecStorage.length),
793
- );
1021
+ // Noir Option<BoundedVec> is encoded as [is_some: Field, storage: Field[], length: Field].
1022
+ try {
1023
+ const plaintextBuffer = await this.handlerAsUtility().decryptAes128(ciphertext, iv, symKey);
1024
+ const [storage, length] = arrayToBoundedVec(
1025
+ bufferToU8Array(plaintextBuffer),
1026
+ foreignCiphertextBVecStorage.length,
1027
+ );
1028
+ return toForeignCallResult([toSingle(new Fr(1)), storage, length]);
1029
+ } catch {
1030
+ const zeroStorage = toArray(Array(foreignCiphertextBVecStorage.length).fill(new Fr(0)));
1031
+ return toForeignCallResult([toSingle(new Fr(0)), zeroStorage, toSingle(new Fr(0))]);
1032
+ }
794
1033
  }
795
1034
 
796
- async utilityGetSharedSecret(
1035
+ // eslint-disable-next-line camelcase
1036
+ async aztec_utl_getSharedSecret(
797
1037
  foreignAddress: ForeignCallSingle,
798
1038
  foreignEphPKField0: ForeignCallSingle,
799
1039
  foreignEphPKField1: ForeignCallSingle,
800
1040
  foreignEphPKField2: ForeignCallSingle,
1041
+ foreignContractAddress: ForeignCallSingle,
801
1042
  ) {
802
1043
  const address = AztecAddress.fromField(fromSingle(foreignAddress));
803
1044
  const ephPK = Point.fromFields([
@@ -805,44 +1046,68 @@ export class RPCTranslator {
805
1046
  fromSingle(foreignEphPKField1),
806
1047
  fromSingle(foreignEphPKField2),
807
1048
  ]);
1049
+ const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
1050
+
1051
+ const secret = await this.handlerAsUtility().getSharedSecret(address, ephPK, contractAddress);
808
1052
 
809
- const secret = await this.handlerAsUtility().utilityGetSharedSecret(address, ephPK);
1053
+ return toForeignCallResult([toSingle(secret)]);
1054
+ }
1055
+
1056
+ // eslint-disable-next-line camelcase
1057
+ aztec_utl_setContractSyncCacheInvalid(
1058
+ foreignContractAddress: ForeignCallSingle,
1059
+ foreignScopes: ForeignCallArray,
1060
+ foreignScopeCount: ForeignCallSingle,
1061
+ ) {
1062
+ const contractAddress = addressFromSingle(foreignContractAddress);
1063
+ const count = fromSingle(foreignScopeCount).toNumber();
1064
+ const scopes = fromArray(foreignScopes)
1065
+ .slice(0, count)
1066
+ .map(f => new AztecAddress(f));
1067
+
1068
+ this.handlerAsUtility().setContractSyncCacheInvalid(contractAddress, scopes);
810
1069
 
811
- return toForeignCallResult(secret.toFields().map(toSingle));
1070
+ return Promise.resolve(toForeignCallResult([]));
812
1071
  }
813
1072
 
814
- emitOffchainEffect(_foreignData: ForeignCallArray) {
1073
+ // eslint-disable-next-line camelcase
1074
+ aztec_utl_emitOffchainEffect(_foreignData: ForeignCallArray) {
815
1075
  throw new Error('Offchain effects are not yet supported in the TestEnvironment');
816
1076
  }
817
1077
 
818
1078
  // AVM opcodes
819
1079
 
820
- avmOpcodeEmitUnencryptedLog(_foreignMessage: ForeignCallArray) {
1080
+ // eslint-disable-next-line camelcase
1081
+ aztec_avm_emitPublicLog(_foreignMessage: ForeignCallArray) {
821
1082
  // TODO(#8811): Implement
822
1083
  return toForeignCallResult([]);
823
1084
  }
824
1085
 
825
- async avmOpcodeStorageRead(foreignSlot: ForeignCallSingle) {
1086
+ // eslint-disable-next-line camelcase
1087
+ async aztec_avm_storageRead(foreignSlot: ForeignCallSingle, foreignContractAddress: ForeignCallSingle) {
826
1088
  const slot = fromSingle(foreignSlot);
1089
+ const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
827
1090
 
828
- const value = (await this.handlerAsAvm().avmOpcodeStorageRead(slot)).value;
1091
+ const value = (await this.handlerAsAvm().storageRead(slot, contractAddress)).value;
829
1092
 
830
1093
  return toForeignCallResult([toSingle(new Fr(value))]);
831
1094
  }
832
1095
 
833
- async avmOpcodeStorageWrite(foreignSlot: ForeignCallSingle, foreignValue: ForeignCallSingle) {
1096
+ // eslint-disable-next-line camelcase
1097
+ async aztec_avm_storageWrite(foreignSlot: ForeignCallSingle, foreignValue: ForeignCallSingle) {
834
1098
  const slot = fromSingle(foreignSlot);
835
1099
  const value = fromSingle(foreignValue);
836
1100
 
837
- await this.handlerAsAvm().avmOpcodeStorageWrite(slot, value);
1101
+ await this.handlerAsAvm().storageWrite(slot, value);
838
1102
 
839
1103
  return toForeignCallResult([]);
840
1104
  }
841
1105
 
842
- async avmOpcodeGetContractInstanceDeployer(foreignAddress: ForeignCallSingle) {
1106
+ // eslint-disable-next-line camelcase
1107
+ async aztec_avm_getContractInstanceDeployer(foreignAddress: ForeignCallSingle) {
843
1108
  const address = addressFromSingle(foreignAddress);
844
1109
 
845
- const instance = await this.handlerAsUtility().utilityGetContractInstance(address);
1110
+ const instance = await this.handlerAsUtility().getContractInstance(address);
846
1111
 
847
1112
  return toForeignCallResult([
848
1113
  toSingle(instance.deployer),
@@ -851,10 +1116,11 @@ export class RPCTranslator {
851
1116
  ]);
852
1117
  }
853
1118
 
854
- async avmOpcodeGetContractInstanceClassId(foreignAddress: ForeignCallSingle) {
1119
+ // eslint-disable-next-line camelcase
1120
+ async aztec_avm_getContractInstanceClassId(foreignAddress: ForeignCallSingle) {
855
1121
  const address = addressFromSingle(foreignAddress);
856
1122
 
857
- const instance = await this.handlerAsUtility().utilityGetContractInstance(address);
1123
+ const instance = await this.handlerAsUtility().getContractInstance(address);
858
1124
 
859
1125
  return toForeignCallResult([
860
1126
  toSingle(instance.currentContractClassId),
@@ -863,10 +1129,11 @@ export class RPCTranslator {
863
1129
  ]);
864
1130
  }
865
1131
 
866
- async avmOpcodeGetContractInstanceInitializationHash(foreignAddress: ForeignCallSingle) {
1132
+ // eslint-disable-next-line camelcase
1133
+ async aztec_avm_getContractInstanceInitializationHash(foreignAddress: ForeignCallSingle) {
867
1134
  const address = addressFromSingle(foreignAddress);
868
1135
 
869
- const instance = await this.handlerAsUtility().utilityGetContractInstance(address);
1136
+ const instance = await this.handlerAsUtility().getContractInstance(address);
870
1137
 
871
1138
  return toForeignCallResult([
872
1139
  toSingle(instance.initializationHash),
@@ -875,86 +1142,98 @@ export class RPCTranslator {
875
1142
  ]);
876
1143
  }
877
1144
 
878
- async avmOpcodeSender() {
879
- const sender = await this.handlerAsAvm().avmOpcodeSender();
1145
+ // eslint-disable-next-line camelcase
1146
+ async aztec_avm_sender() {
1147
+ const sender = await this.handlerAsAvm().sender();
880
1148
 
881
1149
  return toForeignCallResult([toSingle(sender)]);
882
1150
  }
883
1151
 
884
- async avmOpcodeEmitNullifier(foreignNullifier: ForeignCallSingle) {
1152
+ // eslint-disable-next-line camelcase
1153
+ async aztec_avm_emitNullifier(foreignNullifier: ForeignCallSingle) {
885
1154
  const nullifier = fromSingle(foreignNullifier);
886
1155
 
887
- await this.handlerAsAvm().avmOpcodeEmitNullifier(nullifier);
1156
+ await this.handlerAsAvm().emitNullifier(nullifier);
888
1157
 
889
1158
  return toForeignCallResult([]);
890
1159
  }
891
1160
 
892
- async avmOpcodeEmitNoteHash(foreignNoteHash: ForeignCallSingle) {
1161
+ // eslint-disable-next-line camelcase
1162
+ async aztec_avm_emitNoteHash(foreignNoteHash: ForeignCallSingle) {
893
1163
  const noteHash = fromSingle(foreignNoteHash);
894
1164
 
895
- await this.handlerAsAvm().avmOpcodeEmitNoteHash(noteHash);
1165
+ await this.handlerAsAvm().emitNoteHash(noteHash);
896
1166
 
897
1167
  return toForeignCallResult([]);
898
1168
  }
899
1169
 
900
- async avmOpcodeNullifierExists(foreignInnerNullifier: ForeignCallSingle, foreignTargetAddress: ForeignCallSingle) {
901
- const innerNullifier = fromSingle(foreignInnerNullifier);
902
- const targetAddress = AztecAddress.fromField(fromSingle(foreignTargetAddress));
1170
+ // eslint-disable-next-line camelcase
1171
+ async aztec_avm_nullifierExists(foreignSiloedNullifier: ForeignCallSingle) {
1172
+ const siloedNullifier = fromSingle(foreignSiloedNullifier);
903
1173
 
904
- const exists = await this.handlerAsAvm().avmOpcodeNullifierExists(innerNullifier, targetAddress);
1174
+ const exists = await this.handlerAsAvm().nullifierExists(siloedNullifier);
905
1175
 
906
1176
  return toForeignCallResult([toSingle(new Fr(exists))]);
907
1177
  }
908
1178
 
909
- async avmOpcodeAddress() {
910
- const contractAddress = await this.handlerAsAvm().avmOpcodeAddress();
1179
+ // eslint-disable-next-line camelcase
1180
+ async aztec_avm_address() {
1181
+ const contractAddress = await this.handlerAsAvm().address();
911
1182
 
912
1183
  return toForeignCallResult([toSingle(contractAddress.toField())]);
913
1184
  }
914
1185
 
915
- async avmOpcodeBlockNumber() {
916
- const blockNumber = await this.handlerAsAvm().avmOpcodeBlockNumber();
1186
+ // eslint-disable-next-line camelcase
1187
+ async aztec_avm_blockNumber() {
1188
+ const blockNumber = await this.handlerAsAvm().blockNumber();
917
1189
 
918
1190
  return toForeignCallResult([toSingle(new Fr(blockNumber))]);
919
1191
  }
920
1192
 
921
- async avmOpcodeTimestamp() {
922
- const timestamp = await this.handlerAsAvm().avmOpcodeTimestamp();
1193
+ // eslint-disable-next-line camelcase
1194
+ async aztec_avm_timestamp() {
1195
+ const timestamp = await this.handlerAsAvm().timestamp();
923
1196
 
924
1197
  return toForeignCallResult([toSingle(new Fr(timestamp))]);
925
1198
  }
926
1199
 
927
- async avmOpcodeIsStaticCall() {
928
- const isStaticCall = await this.handlerAsAvm().avmOpcodeIsStaticCall();
1200
+ // eslint-disable-next-line camelcase
1201
+ async aztec_avm_isStaticCall() {
1202
+ const isStaticCall = await this.handlerAsAvm().isStaticCall();
929
1203
 
930
1204
  return toForeignCallResult([toSingle(new Fr(isStaticCall ? 1 : 0))]);
931
1205
  }
932
1206
 
933
- async avmOpcodeChainId() {
934
- const chainId = await this.handlerAsAvm().avmOpcodeChainId();
1207
+ // eslint-disable-next-line camelcase
1208
+ async aztec_avm_chainId() {
1209
+ const chainId = await this.handlerAsAvm().chainId();
935
1210
 
936
1211
  return toForeignCallResult([toSingle(chainId)]);
937
1212
  }
938
1213
 
939
- async avmOpcodeVersion() {
940
- const version = await this.handlerAsAvm().avmOpcodeVersion();
1214
+ // eslint-disable-next-line camelcase
1215
+ async aztec_avm_version() {
1216
+ const version = await this.handlerAsAvm().version();
941
1217
 
942
1218
  return toForeignCallResult([toSingle(version)]);
943
1219
  }
944
1220
 
945
- avmOpcodeReturndataSize() {
1221
+ // eslint-disable-next-line camelcase
1222
+ aztec_avm_returndataSize() {
946
1223
  throw new Error(
947
1224
  'Contract calls are forbidden inside a `TestEnvironment::public_context`, use `public_call` instead',
948
1225
  );
949
1226
  }
950
1227
 
951
- avmOpcodeReturndataCopy(_foreignRdOffset: ForeignCallSingle, _foreignCopySize: ForeignCallSingle) {
1228
+ // eslint-disable-next-line camelcase
1229
+ aztec_avm_returndataCopy(_foreignRdOffset: ForeignCallSingle, _foreignCopySize: ForeignCallSingle) {
952
1230
  throw new Error(
953
1231
  'Contract calls are forbidden inside a `TestEnvironment::public_context`, use `public_call` instead',
954
1232
  );
955
1233
  }
956
1234
 
957
- avmOpcodeCall(
1235
+ // eslint-disable-next-line camelcase
1236
+ aztec_avm_call(
958
1237
  _foreignL2Gas: ForeignCallSingle,
959
1238
  _foreignDaGas: ForeignCallSingle,
960
1239
  _foreignAddress: ForeignCallSingle,
@@ -966,7 +1245,8 @@ export class RPCTranslator {
966
1245
  );
967
1246
  }
968
1247
 
969
- avmOpcodeStaticCall(
1248
+ // eslint-disable-next-line camelcase
1249
+ aztec_avm_staticCall(
970
1250
  _foreignL2Gas: ForeignCallSingle,
971
1251
  _foreignDaGas: ForeignCallSingle,
972
1252
  _foreignAddress: ForeignCallSingle,
@@ -978,13 +1258,15 @@ export class RPCTranslator {
978
1258
  );
979
1259
  }
980
1260
 
981
- avmOpcodeSuccessCopy() {
1261
+ // eslint-disable-next-line camelcase
1262
+ aztec_avm_successCopy() {
982
1263
  throw new Error(
983
1264
  'Contract calls are forbidden inside a `TestEnvironment::public_context`, use `public_call` instead',
984
1265
  );
985
1266
  }
986
1267
 
987
- async txePrivateCallNewFlow(
1268
+ // eslint-disable-next-line camelcase
1269
+ async aztec_txe_privateCallNewFlow(
988
1270
  foreignFrom: ForeignCallSingle,
989
1271
  foreignTargetContractAddress: ForeignCallSingle,
990
1272
  foreignFunctionSelector: ForeignCallSingle,
@@ -999,19 +1281,23 @@ export class RPCTranslator {
999
1281
  const argsHash = fromSingle(foreignArgsHash);
1000
1282
  const isStaticCall = fromSingle(foreignIsStaticCall).toBool();
1001
1283
 
1002
- const returnValues = await this.handlerAsTxe().txePrivateCallNewFlow(
1284
+ const returnValues = await this.handlerAsTxe().privateCallNewFlow(
1003
1285
  from,
1004
1286
  targetContractAddress,
1005
1287
  functionSelector,
1006
1288
  args,
1007
1289
  argsHash,
1008
1290
  isStaticCall,
1291
+ this.stateHandler.getCurrentJob(),
1009
1292
  );
1010
1293
 
1294
+ // TODO(F-335): Avoid doing the following call here.
1295
+ await this.stateHandler.cycleJob();
1011
1296
  return toForeignCallResult([toArray(returnValues)]);
1012
1297
  }
1013
1298
 
1014
- async txeSimulateUtilityFunction(
1299
+ // eslint-disable-next-line camelcase
1300
+ async aztec_txe_executeUtilityFunction(
1015
1301
  foreignTargetContractAddress: ForeignCallSingle,
1016
1302
  foreignFunctionSelector: ForeignCallSingle,
1017
1303
  foreignArgs: ForeignCallArray,
@@ -1020,16 +1306,20 @@ export class RPCTranslator {
1020
1306
  const functionSelector = FunctionSelector.fromField(fromSingle(foreignFunctionSelector));
1021
1307
  const args = fromArray(foreignArgs);
1022
1308
 
1023
- const returnValues = await this.handlerAsTxe().txeSimulateUtilityFunction(
1309
+ const returnValues = await this.handlerAsTxe().executeUtilityFunction(
1024
1310
  targetContractAddress,
1025
1311
  functionSelector,
1026
1312
  args,
1313
+ this.stateHandler.getCurrentJob(),
1027
1314
  );
1028
1315
 
1316
+ // TODO(F-335): Avoid doing the following call here.
1317
+ await this.stateHandler.cycleJob();
1029
1318
  return toForeignCallResult([toArray(returnValues)]);
1030
1319
  }
1031
1320
 
1032
- async txePublicCallNewFlow(
1321
+ // eslint-disable-next-line camelcase
1322
+ async aztec_txe_publicCallNewFlow(
1033
1323
  foreignFrom: ForeignCallSingle,
1034
1324
  foreignAddress: ForeignCallSingle,
1035
1325
  foreignCalldata: ForeignCallArray,
@@ -1040,13 +1330,16 @@ export class RPCTranslator {
1040
1330
  const calldata = fromArray(foreignCalldata);
1041
1331
  const isStaticCall = fromSingle(foreignIsStaticCall).toBool();
1042
1332
 
1043
- const returnValues = await this.handlerAsTxe().txePublicCallNewFlow(from, address, calldata, isStaticCall);
1333
+ const returnValues = await this.handlerAsTxe().publicCallNewFlow(from, address, calldata, isStaticCall);
1044
1334
 
1335
+ // TODO(F-335): Avoid doing the following call here.
1336
+ await this.stateHandler.cycleJob();
1045
1337
  return toForeignCallResult([toArray(returnValues)]);
1046
1338
  }
1047
1339
 
1048
- async privateGetSenderForTags() {
1049
- const sender = await this.handlerAsPrivate().privateGetSenderForTags();
1340
+ // eslint-disable-next-line camelcase
1341
+ async aztec_prv_getSenderForTags() {
1342
+ const sender = await this.handlerAsPrivate().getSenderForTags();
1050
1343
 
1051
1344
  // Return a Noir Option struct with `some` and `value` fields
1052
1345
  if (sender === undefined) {
@@ -1058,19 +1351,21 @@ export class RPCTranslator {
1058
1351
  }
1059
1352
  }
1060
1353
 
1061
- async privateSetSenderForTags(foreignSenderForTags: ForeignCallSingle) {
1354
+ // eslint-disable-next-line camelcase
1355
+ async aztec_prv_setSenderForTags(foreignSenderForTags: ForeignCallSingle) {
1062
1356
  const senderForTags = AztecAddress.fromField(fromSingle(foreignSenderForTags));
1063
1357
 
1064
- await this.handlerAsPrivate().privateSetSenderForTags(senderForTags);
1358
+ await this.handlerAsPrivate().setSenderForTags(senderForTags);
1065
1359
 
1066
1360
  return toForeignCallResult([]);
1067
1361
  }
1068
1362
 
1069
- async privateGetNextAppTagAsSender(foreignSender: ForeignCallSingle, foreignRecipient: ForeignCallSingle) {
1363
+ // eslint-disable-next-line camelcase
1364
+ async aztec_prv_getNextAppTagAsSender(foreignSender: ForeignCallSingle, foreignRecipient: ForeignCallSingle) {
1070
1365
  const sender = AztecAddress.fromField(fromSingle(foreignSender));
1071
1366
  const recipient = AztecAddress.fromField(fromSingle(foreignRecipient));
1072
1367
 
1073
- const nextAppTag = await this.handlerAsPrivate().privateGetNextAppTagAsSender(sender, recipient);
1368
+ const nextAppTag = await this.handlerAsPrivate().getNextAppTagAsSender(sender, recipient);
1074
1369
 
1075
1370
  return toForeignCallResult([toSingle(nextAppTag.value)]);
1076
1371
  }