@aztec/txe 0.0.1-commit.dbf9cec → 0.0.1-commit.e0f15ab9b

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 (46) hide show
  1. package/dest/index.d.ts +1 -1
  2. package/dest/index.d.ts.map +1 -1
  3. package/dest/index.js +8 -6
  4. package/dest/oracle/interfaces.d.ts +28 -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 +22 -21
  10. package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -1
  11. package/dest/oracle/txe_oracle_top_level_context.js +31 -26
  12. package/dest/rpc_translator.d.ts +87 -82
  13. package/dest/rpc_translator.d.ts.map +1 -1
  14. package/dest/rpc_translator.js +261 -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/index.d.ts +4 -2
  19. package/dest/state_machine/index.d.ts.map +1 -1
  20. package/dest/state_machine/index.js +7 -3
  21. package/dest/state_machine/mock_epoch_cache.d.ts +17 -3
  22. package/dest/state_machine/mock_epoch_cache.d.ts.map +1 -1
  23. package/dest/state_machine/mock_epoch_cache.js +32 -2
  24. package/dest/state_machine/synchronizer.d.ts +5 -5
  25. package/dest/state_machine/synchronizer.d.ts.map +1 -1
  26. package/dest/state_machine/synchronizer.js +3 -3
  27. package/dest/txe_session.d.ts +4 -3
  28. package/dest/txe_session.d.ts.map +1 -1
  29. package/dest/txe_session.js +18 -9
  30. package/dest/util/encoding.d.ts +69 -1
  31. package/dest/util/encoding.d.ts.map +1 -1
  32. package/dest/util/txe_public_contract_data_source.d.ts +1 -1
  33. package/dest/util/txe_public_contract_data_source.d.ts.map +1 -1
  34. package/dest/util/txe_public_contract_data_source.js +1 -3
  35. package/package.json +15 -15
  36. package/src/index.ts +8 -5
  37. package/src/oracle/interfaces.ts +27 -31
  38. package/src/oracle/txe_oracle_public_context.ts +12 -12
  39. package/src/oracle/txe_oracle_top_level_context.ts +29 -24
  40. package/src/rpc_translator.ts +290 -173
  41. package/src/state_machine/archiver.ts +5 -5
  42. package/src/state_machine/index.ts +6 -1
  43. package/src/state_machine/mock_epoch_cache.ts +42 -3
  44. package/src/state_machine/synchronizer.ts +4 -4
  45. package/src/txe_session.ts +17 -4
  46. package/src/util/txe_public_contract_data_source.ts +0 -2
@@ -30,7 +30,7 @@ import {
30
30
  toSingle,
31
31
  } from './util/encoding.js';
32
32
 
33
- 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
34
34
  const MAX_PRIVATE_EVENTS_PER_TXE_QUERY = 5;
35
35
 
36
36
  export class UnavailableOracleError extends Error {
@@ -104,13 +104,15 @@ export class RPCTranslator {
104
104
 
105
105
  // TXE session state transition functions - these get handled by the state handler
106
106
 
107
- async txeSetTopLevelTXEContext() {
107
+ // eslint-disable-next-line camelcase
108
+ async aztec_txe_setTopLevelTXEContext() {
108
109
  await this.stateHandler.enterTopLevelState();
109
110
 
110
111
  return toForeignCallResult([]);
111
112
  }
112
113
 
113
- async txeSetPrivateTXEContext(
114
+ // eslint-disable-next-line camelcase
115
+ async aztec_txe_setPrivateTXEContext(
114
116
  foreignContractAddressIsSome: ForeignCallSingle,
115
117
  foreignContractAddressValue: ForeignCallSingle,
116
118
  foreignAnchorBlockNumberIsSome: ForeignCallSingle,
@@ -129,7 +131,8 @@ export class RPCTranslator {
129
131
  return toForeignCallResult(privateContextInputs.toFields().map(toSingle));
130
132
  }
131
133
 
132
- async txeSetPublicTXEContext(
134
+ // eslint-disable-next-line camelcase
135
+ async aztec_txe_setPublicTXEContext(
133
136
  foreignContractAddressIsSome: ForeignCallSingle,
134
137
  foreignContractAddressValue: ForeignCallSingle,
135
138
  ) {
@@ -142,7 +145,8 @@ export class RPCTranslator {
142
145
  return toForeignCallResult([]);
143
146
  }
144
147
 
145
- async txeSetUtilityTXEContext(
148
+ // eslint-disable-next-line camelcase
149
+ async aztec_txe_setUtilityTXEContext(
146
150
  foreignContractAddressIsSome: ForeignCallSingle,
147
151
  foreignContractAddressValue: ForeignCallSingle,
148
152
  ) {
@@ -159,44 +163,54 @@ export class RPCTranslator {
159
163
 
160
164
  // TXE-specific oracles
161
165
 
162
- txeGetDefaultAddress() {
163
- const defaultAddress = this.handlerAsTxe().txeGetDefaultAddress();
166
+ // eslint-disable-next-line camelcase
167
+ aztec_txe_getDefaultAddress() {
168
+ const defaultAddress = this.handlerAsTxe().getDefaultAddress();
164
169
 
165
170
  return toForeignCallResult([toSingle(defaultAddress)]);
166
171
  }
167
172
 
168
- async txeGetNextBlockNumber() {
169
- const nextBlockNumber = await this.handlerAsTxe().txeGetNextBlockNumber();
173
+ // eslint-disable-next-line camelcase
174
+ async aztec_txe_getNextBlockNumber() {
175
+ const nextBlockNumber = await this.handlerAsTxe().getNextBlockNumber();
170
176
 
171
177
  return toForeignCallResult([toSingle(nextBlockNumber)]);
172
178
  }
173
179
 
174
- async txeGetNextBlockTimestamp() {
175
- const nextBlockTimestamp = await this.handlerAsTxe().txeGetNextBlockTimestamp();
180
+ // eslint-disable-next-line camelcase
181
+ async aztec_txe_getNextBlockTimestamp() {
182
+ const nextBlockTimestamp = await this.handlerAsTxe().getNextBlockTimestamp();
176
183
 
177
184
  return toForeignCallResult([toSingle(nextBlockTimestamp)]);
178
185
  }
179
186
 
180
- async txeAdvanceBlocksBy(foreignBlocks: ForeignCallSingle) {
187
+ // eslint-disable-next-line camelcase
188
+ async aztec_txe_advanceBlocksBy(foreignBlocks: ForeignCallSingle) {
181
189
  const blocks = fromSingle(foreignBlocks).toNumber();
182
190
 
183
- await this.handlerAsTxe().txeAdvanceBlocksBy(blocks);
191
+ await this.handlerAsTxe().advanceBlocksBy(blocks);
184
192
 
185
193
  return toForeignCallResult([]);
186
194
  }
187
195
 
188
- txeAdvanceTimestampBy(foreignDuration: ForeignCallSingle) {
196
+ // eslint-disable-next-line camelcase
197
+ aztec_txe_advanceTimestampBy(foreignDuration: ForeignCallSingle) {
189
198
  const duration = fromSingle(foreignDuration).toBigInt();
190
199
 
191
- this.handlerAsTxe().txeAdvanceTimestampBy(duration);
200
+ this.handlerAsTxe().advanceTimestampBy(duration);
192
201
 
193
202
  return toForeignCallResult([]);
194
203
  }
195
204
 
196
- 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
+ ) {
197
211
  const secret = fromSingle(foreignSecret);
198
212
 
199
- await this.handlerAsTxe().txeDeploy(artifact, instance, secret);
213
+ await this.handlerAsTxe().deploy(artifact, instance, secret);
200
214
 
201
215
  return toForeignCallResult([
202
216
  toArray([
@@ -209,10 +223,11 @@ export class RPCTranslator {
209
223
  ]);
210
224
  }
211
225
 
212
- async txeCreateAccount(foreignSecret: ForeignCallSingle) {
226
+ // eslint-disable-next-line camelcase
227
+ async aztec_txe_createAccount(foreignSecret: ForeignCallSingle) {
213
228
  const secret = fromSingle(foreignSecret);
214
229
 
215
- const completeAddress = await this.handlerAsTxe().txeCreateAccount(secret);
230
+ const completeAddress = await this.handlerAsTxe().createAccount(secret);
216
231
 
217
232
  return toForeignCallResult([
218
233
  toSingle(completeAddress.address),
@@ -220,14 +235,15 @@ export class RPCTranslator {
220
235
  ]);
221
236
  }
222
237
 
223
- async txeAddAccount(
238
+ // eslint-disable-next-line camelcase
239
+ async aztec_txe_addAccount(
224
240
  artifact: ContractArtifact,
225
241
  instance: ContractInstanceWithAddress,
226
242
  foreignSecret: ForeignCallSingle,
227
243
  ) {
228
244
  const secret = fromSingle(foreignSecret);
229
245
 
230
- const completeAddress = await this.handlerAsTxe().txeAddAccount(artifact, instance, secret);
246
+ const completeAddress = await this.handlerAsTxe().addAccount(artifact, instance, secret);
231
247
 
232
248
  return toForeignCallResult([
233
249
  toSingle(completeAddress.address),
@@ -235,39 +251,44 @@ export class RPCTranslator {
235
251
  ]);
236
252
  }
237
253
 
238
- async txeAddAuthWitness(foreignAddress: ForeignCallSingle, foreignMessageHash: ForeignCallSingle) {
254
+ // eslint-disable-next-line camelcase
255
+ async aztec_txe_addAuthWitness(foreignAddress: ForeignCallSingle, foreignMessageHash: ForeignCallSingle) {
239
256
  const address = addressFromSingle(foreignAddress);
240
257
  const messageHash = fromSingle(foreignMessageHash);
241
258
 
242
- await this.handlerAsTxe().txeAddAuthWitness(address, messageHash);
259
+ await this.handlerAsTxe().addAuthWitness(address, messageHash);
243
260
 
244
261
  return toForeignCallResult([]);
245
262
  }
246
263
 
247
264
  // PXE oracles
248
265
 
249
- utilityAssertCompatibleOracleVersion(foreignVersion: ForeignCallSingle) {
266
+ // eslint-disable-next-line camelcase
267
+ aztec_utl_assertCompatibleOracleVersion(foreignVersion: ForeignCallSingle) {
250
268
  const version = fromSingle(foreignVersion).toNumber();
251
269
 
252
- this.handlerAsMisc().utilityAssertCompatibleOracleVersion(version);
270
+ this.handlerAsMisc().assertCompatibleOracleVersion(version);
253
271
 
254
272
  return toForeignCallResult([]);
255
273
  }
256
274
 
257
- utilityGetRandomField() {
258
- const randomField = this.handlerAsMisc().utilityGetRandomField();
275
+ // eslint-disable-next-line camelcase
276
+ aztec_utl_getRandomField() {
277
+ const randomField = this.handlerAsMisc().getRandomField();
259
278
 
260
279
  return toForeignCallResult([toSingle(randomField)]);
261
280
  }
262
281
 
263
- async txeGetLastBlockTimestamp() {
264
- const timestamp = await this.handlerAsTxe().txeGetLastBlockTimestamp();
282
+ // eslint-disable-next-line camelcase
283
+ async aztec_txe_getLastBlockTimestamp() {
284
+ const timestamp = await this.handlerAsTxe().getLastBlockTimestamp();
265
285
 
266
286
  return toForeignCallResult([toSingle(new Fr(timestamp))]);
267
287
  }
268
288
 
269
- async txeGetLastTxEffects() {
270
- const { txHash, noteHashes, nullifiers } = await this.handlerAsTxe().txeGetLastTxEffects();
289
+ // eslint-disable-next-line camelcase
290
+ async aztec_txe_getLastTxEffects() {
291
+ const { txHash, noteHashes, nullifiers } = await this.handlerAsTxe().getLastTxEffects();
271
292
 
272
293
  return toForeignCallResult([
273
294
  toSingle(txHash.hash),
@@ -276,7 +297,8 @@ export class RPCTranslator {
276
297
  ]);
277
298
  }
278
299
 
279
- async txeGetPrivateEvents(
300
+ // eslint-disable-next-line camelcase
301
+ async aztec_txe_getPrivateEvents(
280
302
  foreignSelector: ForeignCallSingle,
281
303
  foreignContractAddress: ForeignCallSingle,
282
304
  foreignScope: ForeignCallSingle,
@@ -292,7 +314,7 @@ export class RPCTranslator {
292
314
  await this.stateHandler.cycleJob();
293
315
  }
294
316
 
295
- const events = await this.handlerAsTxe().txeGetPrivateEvents(selector, contractAddress, scope);
317
+ const events = await this.handlerAsTxe().getPrivateEvents(selector, contractAddress, scope);
296
318
 
297
319
  if (events.length > MAX_PRIVATE_EVENTS_PER_TXE_QUERY) {
298
320
  throw new Error(`Array of length ${events.length} larger than maxLen ${MAX_PRIVATE_EVENTS_PER_TXE_QUERY}`);
@@ -316,26 +338,29 @@ export class RPCTranslator {
316
338
  return toForeignCallResult([toArray(rawArrayStorage), toArray(eventLengths), toSingle(queryLength)]);
317
339
  }
318
340
 
319
- privateStoreInExecutionCache(foreignValues: ForeignCallArray, foreignHash: ForeignCallSingle) {
341
+ // eslint-disable-next-line camelcase
342
+ aztec_prv_storeInExecutionCache(foreignValues: ForeignCallArray, foreignHash: ForeignCallSingle) {
320
343
  const values = fromArray(foreignValues);
321
344
  const hash = fromSingle(foreignHash);
322
345
 
323
- this.handlerAsPrivate().privateStoreInExecutionCache(values, hash);
346
+ this.handlerAsPrivate().storeInExecutionCache(values, hash);
324
347
 
325
348
  return toForeignCallResult([]);
326
349
  }
327
350
 
328
- async privateLoadFromExecutionCache(foreignHash: ForeignCallSingle) {
351
+ // eslint-disable-next-line camelcase
352
+ async aztec_prv_loadFromExecutionCache(foreignHash: ForeignCallSingle) {
329
353
  const hash = fromSingle(foreignHash);
330
354
 
331
- const returns = await this.handlerAsPrivate().privateLoadFromExecutionCache(hash);
355
+ const returns = await this.handlerAsPrivate().loadFromExecutionCache(hash);
332
356
 
333
357
  return toForeignCallResult([toArray(returns)]);
334
358
  }
335
359
 
336
360
  // When the argument is a slice, noir automatically adds a length field to oracle call.
337
361
  // When the argument is an array, we add the field length manually to the signature.
338
- async utilityLog(
362
+ // eslint-disable-next-line camelcase
363
+ async aztec_utl_log(
339
364
  foreignLevel: ForeignCallSingle,
340
365
  foreignMessage: ForeignCallArray,
341
366
  _foreignLength: ForeignCallSingle,
@@ -347,12 +372,13 @@ export class RPCTranslator {
347
372
  .join('');
348
373
  const fields = fromArray(foreignFields);
349
374
 
350
- await this.handlerAsMisc().utilityLog(level, message, fields);
375
+ await this.handlerAsMisc().log(level, message, fields);
351
376
 
352
377
  return toForeignCallResult([]);
353
378
  }
354
379
 
355
- async utilityStorageRead(
380
+ // eslint-disable-next-line camelcase
381
+ async aztec_utl_storageRead(
356
382
  foreignBlockHash: ForeignCallSingle,
357
383
  foreignContractAddress: ForeignCallSingle,
358
384
  foreignStartStorageSlot: ForeignCallSingle,
@@ -363,7 +389,7 @@ export class RPCTranslator {
363
389
  const startStorageSlot = fromSingle(foreignStartStorageSlot);
364
390
  const numberOfElements = fromSingle(foreignNumberOfElements).toNumber();
365
391
 
366
- const values = await this.handlerAsUtility().utilityStorageRead(
392
+ const values = await this.handlerAsUtility().storageRead(
367
393
  blockHash,
368
394
  contractAddress,
369
395
  startStorageSlot,
@@ -373,11 +399,12 @@ export class RPCTranslator {
373
399
  return toForeignCallResult([toArray(values)]);
374
400
  }
375
401
 
376
- async utilityGetPublicDataWitness(foreignBlockHash: ForeignCallSingle, foreignLeafSlot: ForeignCallSingle) {
402
+ // eslint-disable-next-line camelcase
403
+ async aztec_utl_getPublicDataWitness(foreignBlockHash: ForeignCallSingle, foreignLeafSlot: ForeignCallSingle) {
377
404
  const blockHash = new BlockHash(fromSingle(foreignBlockHash));
378
405
  const leafSlot = fromSingle(foreignLeafSlot);
379
406
 
380
- const witness = await this.handlerAsUtility().utilityGetPublicDataWitness(blockHash, leafSlot);
407
+ const witness = await this.handlerAsUtility().getPublicDataWitness(blockHash, leafSlot);
381
408
 
382
409
  if (!witness) {
383
410
  throw new Error(`Public data witness not found for slot ${leafSlot} at block ${blockHash.toString()}.`);
@@ -385,7 +412,8 @@ export class RPCTranslator {
385
412
  return toForeignCallResult(witness.toNoirRepresentation());
386
413
  }
387
414
 
388
- async utilityGetNotes(
415
+ // eslint-disable-next-line camelcase
416
+ async aztec_utl_getNotes(
389
417
  foreignOwnerIsSome: ForeignCallSingle,
390
418
  foreignOwnerValue: ForeignCallSingle,
391
419
  foreignStorageSlot: ForeignCallSingle,
@@ -426,7 +454,7 @@ export class RPCTranslator {
426
454
  const maxNotes = fromSingle(foreignMaxNotes).toNumber();
427
455
  const packedHintedNoteLength = fromSingle(foreignPackedHintedNoteLength).toNumber();
428
456
 
429
- const noteDatas = await this.handlerAsUtility().utilityGetNotes(
457
+ const noteDatas = await this.handlerAsUtility().getNotes(
430
458
  owner,
431
459
  storageSlot,
432
460
  numSelects,
@@ -467,7 +495,8 @@ export class RPCTranslator {
467
495
  );
468
496
  }
469
497
 
470
- privateNotifyCreatedNote(
498
+ // eslint-disable-next-line camelcase
499
+ aztec_prv_notifyCreatedNote(
471
500
  foreignOwner: ForeignCallSingle,
472
501
  foreignStorageSlot: ForeignCallSingle,
473
502
  foreignRandomness: ForeignCallSingle,
@@ -484,20 +513,13 @@ export class RPCTranslator {
484
513
  const noteHash = fromSingle(foreignNoteHash);
485
514
  const counter = fromSingle(foreignCounter).toNumber();
486
515
 
487
- this.handlerAsPrivate().privateNotifyCreatedNote(
488
- owner,
489
- storageSlot,
490
- randomness,
491
- noteTypeId,
492
- note,
493
- noteHash,
494
- counter,
495
- );
516
+ this.handlerAsPrivate().notifyCreatedNote(owner, storageSlot, randomness, noteTypeId, note, noteHash, counter);
496
517
 
497
518
  return toForeignCallResult([]);
498
519
  }
499
520
 
500
- async privateNotifyNullifiedNote(
521
+ // eslint-disable-next-line camelcase
522
+ async aztec_prv_notifyNullifiedNote(
501
523
  foreignInnerNullifier: ForeignCallSingle,
502
524
  foreignNoteHash: ForeignCallSingle,
503
525
  foreignCounter: ForeignCallSingle,
@@ -506,40 +528,47 @@ export class RPCTranslator {
506
528
  const noteHash = fromSingle(foreignNoteHash);
507
529
  const counter = fromSingle(foreignCounter).toNumber();
508
530
 
509
- await this.handlerAsPrivate().privateNotifyNullifiedNote(innerNullifier, noteHash, counter);
531
+ await this.handlerAsPrivate().notifyNullifiedNote(innerNullifier, noteHash, counter);
510
532
 
511
533
  return toForeignCallResult([]);
512
534
  }
513
535
 
514
- async privateNotifyCreatedNullifier(foreignInnerNullifier: ForeignCallSingle) {
536
+ // eslint-disable-next-line camelcase
537
+ async aztec_prv_notifyCreatedNullifier(foreignInnerNullifier: ForeignCallSingle) {
515
538
  const innerNullifier = fromSingle(foreignInnerNullifier);
516
539
 
517
- await this.handlerAsPrivate().privateNotifyCreatedNullifier(innerNullifier);
540
+ await this.handlerAsPrivate().notifyCreatedNullifier(innerNullifier);
518
541
 
519
542
  return toForeignCallResult([]);
520
543
  }
521
544
 
522
- async privateIsNullifierPending(foreignInnerNullifier: ForeignCallSingle, foreignContractAddress: ForeignCallSingle) {
545
+ // eslint-disable-next-line camelcase
546
+ async aztec_prv_isNullifierPending(
547
+ foreignInnerNullifier: ForeignCallSingle,
548
+ foreignContractAddress: ForeignCallSingle,
549
+ ) {
523
550
  const innerNullifier = fromSingle(foreignInnerNullifier);
524
551
  const contractAddress = addressFromSingle(foreignContractAddress);
525
552
 
526
- const isPending = await this.handlerAsPrivate().privateIsNullifierPending(innerNullifier, contractAddress);
553
+ const isPending = await this.handlerAsPrivate().isNullifierPending(innerNullifier, contractAddress);
527
554
 
528
555
  return toForeignCallResult([toSingle(new Fr(isPending))]);
529
556
  }
530
557
 
531
- async utilityCheckNullifierExists(foreignInnerNullifier: ForeignCallSingle) {
558
+ // eslint-disable-next-line camelcase
559
+ async aztec_utl_checkNullifierExists(foreignInnerNullifier: ForeignCallSingle) {
532
560
  const innerNullifier = fromSingle(foreignInnerNullifier);
533
561
 
534
- const exists = await this.handlerAsUtility().utilityCheckNullifierExists(innerNullifier);
562
+ const exists = await this.handlerAsUtility().checkNullifierExists(innerNullifier);
535
563
 
536
564
  return toForeignCallResult([toSingle(new Fr(exists))]);
537
565
  }
538
566
 
539
- async utilityGetContractInstance(foreignAddress: ForeignCallSingle) {
567
+ // eslint-disable-next-line camelcase
568
+ async aztec_utl_getContractInstance(foreignAddress: ForeignCallSingle) {
540
569
  const address = addressFromSingle(foreignAddress);
541
570
 
542
- const instance = await this.handlerAsUtility().utilityGetContractInstance(address);
571
+ const instance = await this.handlerAsUtility().getContractInstance(address);
543
572
 
544
573
  return toForeignCallResult(
545
574
  [
@@ -552,10 +581,11 @@ export class RPCTranslator {
552
581
  );
553
582
  }
554
583
 
555
- async utilityTryGetPublicKeysAndPartialAddress(foreignAddress: ForeignCallSingle) {
584
+ // eslint-disable-next-line camelcase
585
+ async aztec_utl_tryGetPublicKeysAndPartialAddress(foreignAddress: ForeignCallSingle) {
556
586
  const address = addressFromSingle(foreignAddress);
557
587
 
558
- const result = await this.handlerAsUtility().utilityTryGetPublicKeysAndPartialAddress(address);
588
+ const result = await this.handlerAsUtility().tryGetPublicKeysAndPartialAddress(address);
559
589
 
560
590
  // We are going to return a Noir Option struct to represent the possibility of null values. Options are a struct
561
591
  // with two fields: `some` (a boolean) and `value` (a field array in this case).
@@ -571,15 +601,17 @@ export class RPCTranslator {
571
601
  }
572
602
  }
573
603
 
574
- async utilityGetKeyValidationRequest(foreignPkMHash: ForeignCallSingle) {
604
+ // eslint-disable-next-line camelcase
605
+ async aztec_utl_getKeyValidationRequest(foreignPkMHash: ForeignCallSingle) {
575
606
  const pkMHash = fromSingle(foreignPkMHash);
576
607
 
577
- const keyValidationRequest = await this.handlerAsUtility().utilityGetKeyValidationRequest(pkMHash);
608
+ const keyValidationRequest = await this.handlerAsUtility().getKeyValidationRequest(pkMHash);
578
609
 
579
610
  return toForeignCallResult(keyValidationRequest.toFields().map(toSingle));
580
611
  }
581
612
 
582
- privateCallPrivateFunction(
613
+ // eslint-disable-next-line camelcase
614
+ aztec_prv_callPrivateFunction(
583
615
  _foreignTargetContractAddress: ForeignCallSingle,
584
616
  _foreignFunctionSelector: ForeignCallSingle,
585
617
  _foreignArgsHash: ForeignCallSingle,
@@ -591,11 +623,15 @@ export class RPCTranslator {
591
623
  );
592
624
  }
593
625
 
594
- async utilityGetNullifierMembershipWitness(foreignBlockHash: ForeignCallSingle, foreignNullifier: ForeignCallSingle) {
626
+ // eslint-disable-next-line camelcase
627
+ async aztec_utl_getNullifierMembershipWitness(
628
+ foreignBlockHash: ForeignCallSingle,
629
+ foreignNullifier: ForeignCallSingle,
630
+ ) {
595
631
  const blockHash = new BlockHash(fromSingle(foreignBlockHash));
596
632
  const nullifier = fromSingle(foreignNullifier);
597
633
 
598
- const witness = await this.handlerAsUtility().utilityGetNullifierMembershipWitness(blockHash, nullifier);
634
+ const witness = await this.handlerAsUtility().getNullifierMembershipWitness(blockHash, nullifier);
599
635
 
600
636
  if (!witness) {
601
637
  throw new Error(`Nullifier membership witness not found at block ${blockHash}.`);
@@ -603,10 +639,11 @@ export class RPCTranslator {
603
639
  return toForeignCallResult(witness.toNoirRepresentation());
604
640
  }
605
641
 
606
- async utilityGetAuthWitness(foreignMessageHash: ForeignCallSingle) {
642
+ // eslint-disable-next-line camelcase
643
+ async aztec_utl_getAuthWitness(foreignMessageHash: ForeignCallSingle) {
607
644
  const messageHash = fromSingle(foreignMessageHash);
608
645
 
609
- const authWitness = await this.handlerAsUtility().utilityGetAuthWitness(messageHash);
646
+ const authWitness = await this.handlerAsUtility().getAuthWitness(messageHash);
610
647
 
611
648
  if (!authWitness) {
612
649
  throw new Error(`Auth witness not found for message hash ${messageHash}.`);
@@ -614,44 +651,35 @@ export class RPCTranslator {
614
651
  return toForeignCallResult([toArray(authWitness)]);
615
652
  }
616
653
 
617
- public privateNotifyEnqueuedPublicFunctionCall(
618
- _foreignTargetContractAddress: ForeignCallSingle,
619
- _foreignCalldataHash: ForeignCallSingle,
620
- _foreignSideEffectCounter: ForeignCallSingle,
621
- _foreignIsStaticCall: ForeignCallSingle,
622
- ) {
623
- throw new Error('Enqueueing public calls is not supported in TestEnvironment::private_context');
624
- }
625
-
626
- public privateNotifySetPublicTeardownFunctionCall(
627
- _foreignTargetContractAddress: ForeignCallSingle,
628
- _foreignCalldataHash: ForeignCallSingle,
629
- _foreignSideEffectCounter: ForeignCallSingle,
630
- _foreignIsStaticCall: ForeignCallSingle,
631
- ) {
654
+ // eslint-disable-next-line camelcase
655
+ public aztec_prv_validatePublicCalldata(_foreignCalldataHash: ForeignCallSingle) {
632
656
  throw new Error('Enqueueing public calls is not supported in TestEnvironment::private_context');
633
657
  }
634
658
 
635
- public privateNotifySetMinRevertibleSideEffectCounter(_foreignMinRevertibleSideEffectCounter: ForeignCallSingle) {
659
+ // eslint-disable-next-line camelcase
660
+ public aztec_prv_notifyRevertiblePhaseStart(_foreignMinRevertibleSideEffectCounter: ForeignCallSingle) {
636
661
  throw new Error('Enqueueing public calls is not supported in TestEnvironment::private_context');
637
662
  }
638
663
 
639
- public async privateIsSideEffectCounterRevertible(foreignSideEffectCounter: ForeignCallSingle) {
664
+ // eslint-disable-next-line camelcase
665
+ public async aztec_prv_inRevertiblePhase(foreignSideEffectCounter: ForeignCallSingle) {
640
666
  const sideEffectCounter = fromSingle(foreignSideEffectCounter).toNumber();
641
- const isRevertible = await this.handlerAsPrivate().privateIsSideEffectCounterRevertible(sideEffectCounter);
667
+ const isRevertible = await this.handlerAsPrivate().inRevertiblePhase(sideEffectCounter);
642
668
  return toForeignCallResult([toSingle(new Fr(isRevertible))]);
643
669
  }
644
670
 
645
- utilityGetUtilityContext() {
646
- const context = this.handlerAsUtility().utilityGetUtilityContext();
671
+ // eslint-disable-next-line camelcase
672
+ aztec_utl_getUtilityContext() {
673
+ const context = this.handlerAsUtility().getUtilityContext();
647
674
 
648
675
  return toForeignCallResult(context.toNoirRepresentation());
649
676
  }
650
677
 
651
- async utilityGetBlockHeader(foreignBlockNumber: ForeignCallSingle) {
678
+ // eslint-disable-next-line camelcase
679
+ async aztec_utl_getBlockHeader(foreignBlockNumber: ForeignCallSingle) {
652
680
  const blockNumber = BlockNumber(fromSingle(foreignBlockNumber).toNumber());
653
681
 
654
- const header = await this.handlerAsUtility().utilityGetBlockHeader(blockNumber);
682
+ const header = await this.handlerAsUtility().getBlockHeader(blockNumber);
655
683
 
656
684
  if (!header) {
657
685
  throw new Error(`Block header not found for block ${blockNumber}.`);
@@ -659,14 +687,15 @@ export class RPCTranslator {
659
687
  return toForeignCallResult(header.toFields().map(toSingle));
660
688
  }
661
689
 
662
- async utilityGetNoteHashMembershipWitness(
690
+ // eslint-disable-next-line camelcase
691
+ async aztec_utl_getNoteHashMembershipWitness(
663
692
  foreignAnchorBlockHash: ForeignCallSingle,
664
693
  foreignNoteHash: ForeignCallSingle,
665
694
  ) {
666
695
  const blockHash = new BlockHash(fromSingle(foreignAnchorBlockHash));
667
696
  const noteHash = fromSingle(foreignNoteHash);
668
697
 
669
- const witness = await this.handlerAsUtility().utilityGetNoteHashMembershipWitness(blockHash, noteHash);
698
+ const witness = await this.handlerAsUtility().getNoteHashMembershipWitness(blockHash, noteHash);
670
699
 
671
700
  if (!witness) {
672
701
  throw new Error(`Note hash ${noteHash} not found in the note hash tree at block ${blockHash.toString()}.`);
@@ -674,14 +703,15 @@ export class RPCTranslator {
674
703
  return toForeignCallResult(witness.toNoirRepresentation());
675
704
  }
676
705
 
677
- async utilityGetBlockHashMembershipWitness(
706
+ // eslint-disable-next-line camelcase
707
+ async aztec_utl_getBlockHashMembershipWitness(
678
708
  foreignAnchorBlockHash: ForeignCallSingle,
679
709
  foreignBlockHash: ForeignCallSingle,
680
710
  ) {
681
711
  const anchorBlockHash = new BlockHash(fromSingle(foreignAnchorBlockHash));
682
712
  const blockHash = new BlockHash(fromSingle(foreignBlockHash));
683
713
 
684
- const witness = await this.handlerAsUtility().utilityGetBlockHashMembershipWitness(anchorBlockHash, blockHash);
714
+ const witness = await this.handlerAsUtility().getBlockHashMembershipWitness(anchorBlockHash, blockHash);
685
715
 
686
716
  if (!witness) {
687
717
  throw new Error(
@@ -691,14 +721,15 @@ export class RPCTranslator {
691
721
  return toForeignCallResult(witness.toNoirRepresentation());
692
722
  }
693
723
 
694
- async utilityGetLowNullifierMembershipWitness(
724
+ // eslint-disable-next-line camelcase
725
+ async aztec_utl_getLowNullifierMembershipWitness(
695
726
  foreignBlockHash: ForeignCallSingle,
696
727
  foreignNullifier: ForeignCallSingle,
697
728
  ) {
698
729
  const blockHash = new BlockHash(fromSingle(foreignBlockHash));
699
730
  const nullifier = fromSingle(foreignNullifier);
700
731
 
701
- const witness = await this.handlerAsUtility().utilityGetLowNullifierMembershipWitness(blockHash, nullifier);
732
+ const witness = await this.handlerAsUtility().getLowNullifierMembershipWitness(blockHash, nullifier);
702
733
 
703
734
  if (!witness) {
704
735
  throw new Error(`Low nullifier witness not found for nullifier ${nullifier} at block ${blockHash}.`);
@@ -706,33 +737,42 @@ export class RPCTranslator {
706
737
  return toForeignCallResult(witness.toNoirRepresentation());
707
738
  }
708
739
 
709
- async utilityFetchTaggedLogs(foreignPendingTaggedLogArrayBaseSlot: ForeignCallSingle) {
740
+ // eslint-disable-next-line camelcase
741
+ async aztec_utl_fetchTaggedLogs(foreignPendingTaggedLogArrayBaseSlot: ForeignCallSingle) {
710
742
  const pendingTaggedLogArrayBaseSlot = fromSingle(foreignPendingTaggedLogArrayBaseSlot);
711
743
 
712
- await this.handlerAsUtility().utilityFetchTaggedLogs(pendingTaggedLogArrayBaseSlot);
744
+ await this.handlerAsUtility().fetchTaggedLogs(pendingTaggedLogArrayBaseSlot);
713
745
 
714
746
  return toForeignCallResult([]);
715
747
  }
716
748
 
717
- public async utilityValidateAndStoreEnqueuedNotesAndEvents(
749
+ // eslint-disable-next-line camelcase
750
+ public async aztec_utl_validateAndStoreEnqueuedNotesAndEvents(
718
751
  foreignContractAddress: ForeignCallSingle,
719
752
  foreignNoteValidationRequestsArrayBaseSlot: ForeignCallSingle,
720
753
  foreignEventValidationRequestsArrayBaseSlot: ForeignCallSingle,
754
+ foreignMaxNotePackedLen: ForeignCallSingle,
755
+ foreignMaxEventSerializedLen: ForeignCallSingle,
721
756
  ) {
722
757
  const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
723
758
  const noteValidationRequestsArrayBaseSlot = fromSingle(foreignNoteValidationRequestsArrayBaseSlot);
724
759
  const eventValidationRequestsArrayBaseSlot = fromSingle(foreignEventValidationRequestsArrayBaseSlot);
760
+ const maxNotePackedLen = fromSingle(foreignMaxNotePackedLen).toNumber();
761
+ const maxEventSerializedLen = fromSingle(foreignMaxEventSerializedLen).toNumber();
725
762
 
726
- await this.handlerAsUtility().utilityValidateAndStoreEnqueuedNotesAndEvents(
763
+ await this.handlerAsUtility().validateAndStoreEnqueuedNotesAndEvents(
727
764
  contractAddress,
728
765
  noteValidationRequestsArrayBaseSlot,
729
766
  eventValidationRequestsArrayBaseSlot,
767
+ maxNotePackedLen,
768
+ maxEventSerializedLen,
730
769
  );
731
770
 
732
771
  return toForeignCallResult([]);
733
772
  }
734
773
 
735
- public async utilityBulkRetrieveLogs(
774
+ // eslint-disable-next-line camelcase
775
+ public async aztec_utl_bulkRetrieveLogs(
736
776
  foreignContractAddress: ForeignCallSingle,
737
777
  foreignLogRetrievalRequestsArrayBaseSlot: ForeignCallSingle,
738
778
  foreignLogRetrievalResponsesArrayBaseSlot: ForeignCallSingle,
@@ -741,7 +781,7 @@ export class RPCTranslator {
741
781
  const logRetrievalRequestsArrayBaseSlot = fromSingle(foreignLogRetrievalRequestsArrayBaseSlot);
742
782
  const logRetrievalResponsesArrayBaseSlot = fromSingle(foreignLogRetrievalResponsesArrayBaseSlot);
743
783
 
744
- await this.handlerAsUtility().utilityBulkRetrieveLogs(
784
+ await this.handlerAsUtility().bulkRetrieveLogs(
745
785
  contractAddress,
746
786
  logRetrievalRequestsArrayBaseSlot,
747
787
  logRetrievalResponsesArrayBaseSlot,
@@ -750,7 +790,27 @@ export class RPCTranslator {
750
790
  return toForeignCallResult([]);
751
791
  }
752
792
 
753
- async utilityStoreCapsule(
793
+ // eslint-disable-next-line camelcase
794
+ public async aztec_utl_utilityResolveMessageContexts(
795
+ foreignContractAddress: ForeignCallSingle,
796
+ foreignMessageContextRequestsArrayBaseSlot: ForeignCallSingle,
797
+ foreignMessageContextResponsesArrayBaseSlot: ForeignCallSingle,
798
+ ) {
799
+ const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
800
+ const messageContextRequestsArrayBaseSlot = fromSingle(foreignMessageContextRequestsArrayBaseSlot);
801
+ const messageContextResponsesArrayBaseSlot = fromSingle(foreignMessageContextResponsesArrayBaseSlot);
802
+
803
+ await this.handlerAsUtility().utilityResolveMessageContexts(
804
+ contractAddress,
805
+ messageContextRequestsArrayBaseSlot,
806
+ messageContextResponsesArrayBaseSlot,
807
+ );
808
+
809
+ return toForeignCallResult([]);
810
+ }
811
+
812
+ // eslint-disable-next-line camelcase
813
+ async aztec_utl_storeCapsule(
754
814
  foreignContractAddress: ForeignCallSingle,
755
815
  foreignSlot: ForeignCallSingle,
756
816
  foreignCapsule: ForeignCallArray,
@@ -759,12 +819,13 @@ export class RPCTranslator {
759
819
  const slot = fromSingle(foreignSlot);
760
820
  const capsule = fromArray(foreignCapsule);
761
821
 
762
- await this.handlerAsUtility().utilityStoreCapsule(contractAddress, slot, capsule);
822
+ await this.handlerAsUtility().storeCapsule(contractAddress, slot, capsule);
763
823
 
764
824
  return toForeignCallResult([]);
765
825
  }
766
826
 
767
- async utilityLoadCapsule(
827
+ // eslint-disable-next-line camelcase
828
+ async aztec_utl_loadCapsule(
768
829
  foreignContractAddress: ForeignCallSingle,
769
830
  foreignSlot: ForeignCallSingle,
770
831
  foreignTSize: ForeignCallSingle,
@@ -773,7 +834,7 @@ export class RPCTranslator {
773
834
  const slot = fromSingle(foreignSlot);
774
835
  const tSize = fromSingle(foreignTSize).toNumber();
775
836
 
776
- const values = await this.handlerAsUtility().utilityLoadCapsule(contractAddress, slot);
837
+ const values = await this.handlerAsUtility().loadCapsule(contractAddress, slot);
777
838
 
778
839
  // We are going to return a Noir Option struct to represent the possibility of null values. Options are a struct
779
840
  // with two fields: `some` (a boolean) and `value` (a field array in this case).
@@ -786,16 +847,18 @@ export class RPCTranslator {
786
847
  }
787
848
  }
788
849
 
789
- async utilityDeleteCapsule(foreignContractAddress: ForeignCallSingle, foreignSlot: ForeignCallSingle) {
850
+ // eslint-disable-next-line camelcase
851
+ async aztec_utl_deleteCapsule(foreignContractAddress: ForeignCallSingle, foreignSlot: ForeignCallSingle) {
790
852
  const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
791
853
  const slot = fromSingle(foreignSlot);
792
854
 
793
- await this.handlerAsUtility().utilityDeleteCapsule(contractAddress, slot);
855
+ await this.handlerAsUtility().deleteCapsule(contractAddress, slot);
794
856
 
795
857
  return toForeignCallResult([]);
796
858
  }
797
859
 
798
- async utilityCopyCapsule(
860
+ // eslint-disable-next-line camelcase
861
+ async aztec_utl_copyCapsule(
799
862
  foreignContractAddress: ForeignCallSingle,
800
863
  foreignSrcSlot: ForeignCallSingle,
801
864
  foreignDstSlot: ForeignCallSingle,
@@ -806,7 +869,7 @@ export class RPCTranslator {
806
869
  const dstSlot = fromSingle(foreignDstSlot);
807
870
  const numEntries = fromSingle(foreignNumEntries).toNumber();
808
871
 
809
- await this.handlerAsUtility().utilityCopyCapsule(contractAddress, srcSlot, dstSlot, numEntries);
872
+ await this.handlerAsUtility().copyCapsule(contractAddress, srcSlot, dstSlot, numEntries);
810
873
 
811
874
  return toForeignCallResult([]);
812
875
  }
@@ -815,7 +878,8 @@ export class RPCTranslator {
815
878
  // 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
816
879
  // to implement this function here. Isn't there a way to programmatically identify that this is missing, given the
817
880
  // existence of a txe_oracle method?
818
- async utilityAes128Decrypt(
881
+ // eslint-disable-next-line camelcase
882
+ async aztec_utl_tryAes128Decrypt(
819
883
  foreignCiphertextBVecStorage: ForeignCallArray,
820
884
  foreignCiphertextLength: ForeignCallSingle,
821
885
  foreignIv: ForeignCallArray,
@@ -825,14 +889,22 @@ export class RPCTranslator {
825
889
  const iv = fromUintArray(foreignIv, 8);
826
890
  const symKey = fromUintArray(foreignSymKey, 8);
827
891
 
828
- const plaintextBuffer = await this.handlerAsUtility().utilityAes128Decrypt(ciphertext, iv, symKey);
829
-
830
- return toForeignCallResult(
831
- arrayToBoundedVec(bufferToU8Array(plaintextBuffer), foreignCiphertextBVecStorage.length),
832
- );
892
+ // Noir Option<BoundedVec> is encoded as [is_some: Field, storage: Field[], length: Field].
893
+ try {
894
+ const plaintextBuffer = await this.handlerAsUtility().aes128Decrypt(ciphertext, iv, symKey);
895
+ const [storage, length] = arrayToBoundedVec(
896
+ bufferToU8Array(plaintextBuffer),
897
+ foreignCiphertextBVecStorage.length,
898
+ );
899
+ return toForeignCallResult([toSingle(new Fr(1)), storage, length]);
900
+ } catch {
901
+ const zeroStorage = toArray(Array(foreignCiphertextBVecStorage.length).fill(new Fr(0)));
902
+ return toForeignCallResult([toSingle(new Fr(0)), zeroStorage, toSingle(new Fr(0))]);
903
+ }
833
904
  }
834
905
 
835
- async utilityGetSharedSecret(
906
+ // eslint-disable-next-line camelcase
907
+ async aztec_utl_getSharedSecret(
836
908
  foreignAddress: ForeignCallSingle,
837
909
  foreignEphPKField0: ForeignCallSingle,
838
910
  foreignEphPKField1: ForeignCallSingle,
@@ -845,44 +917,66 @@ export class RPCTranslator {
845
917
  fromSingle(foreignEphPKField2),
846
918
  ]);
847
919
 
848
- const secret = await this.handlerAsUtility().utilityGetSharedSecret(address, ephPK);
920
+ const secret = await this.handlerAsUtility().getSharedSecret(address, ephPK);
849
921
 
850
922
  return toForeignCallResult(secret.toFields().map(toSingle));
851
923
  }
852
924
 
853
- emitOffchainEffect(_foreignData: ForeignCallArray) {
925
+ // eslint-disable-next-line camelcase
926
+ aztec_utl_invalidateContractSyncCache(
927
+ foreignContractAddress: ForeignCallSingle,
928
+ foreignScopes: ForeignCallArray,
929
+ foreignScopeCount: ForeignCallSingle,
930
+ ) {
931
+ const contractAddress = addressFromSingle(foreignContractAddress);
932
+ const count = fromSingle(foreignScopeCount).toNumber();
933
+ const scopes = fromArray(foreignScopes)
934
+ .slice(0, count)
935
+ .map(f => new AztecAddress(f));
936
+
937
+ this.handlerAsUtility().invalidateContractSyncCache(contractAddress, scopes);
938
+
939
+ return Promise.resolve(toForeignCallResult([]));
940
+ }
941
+
942
+ // eslint-disable-next-line camelcase
943
+ aztec_utl_emitOffchainEffect(_foreignData: ForeignCallArray) {
854
944
  throw new Error('Offchain effects are not yet supported in the TestEnvironment');
855
945
  }
856
946
 
857
947
  // AVM opcodes
858
948
 
859
- avmOpcodeEmitPublicLog(_foreignMessage: ForeignCallArray) {
949
+ // eslint-disable-next-line camelcase
950
+ aztec_avm_emitPublicLog(_foreignMessage: ForeignCallArray) {
860
951
  // TODO(#8811): Implement
861
952
  return toForeignCallResult([]);
862
953
  }
863
954
 
864
- async avmOpcodeStorageRead(foreignSlot: ForeignCallSingle, foreignContractAddress: ForeignCallSingle) {
955
+ // eslint-disable-next-line camelcase
956
+ async aztec_avm_storageRead(foreignSlot: ForeignCallSingle, foreignContractAddress: ForeignCallSingle) {
865
957
  const slot = fromSingle(foreignSlot);
866
958
  const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
867
959
 
868
- const value = (await this.handlerAsAvm().avmOpcodeStorageRead(slot, contractAddress)).value;
960
+ const value = (await this.handlerAsAvm().storageRead(slot, contractAddress)).value;
869
961
 
870
962
  return toForeignCallResult([toSingle(new Fr(value))]);
871
963
  }
872
964
 
873
- async avmOpcodeStorageWrite(foreignSlot: ForeignCallSingle, foreignValue: ForeignCallSingle) {
965
+ // eslint-disable-next-line camelcase
966
+ async aztec_avm_storageWrite(foreignSlot: ForeignCallSingle, foreignValue: ForeignCallSingle) {
874
967
  const slot = fromSingle(foreignSlot);
875
968
  const value = fromSingle(foreignValue);
876
969
 
877
- await this.handlerAsAvm().avmOpcodeStorageWrite(slot, value);
970
+ await this.handlerAsAvm().storageWrite(slot, value);
878
971
 
879
972
  return toForeignCallResult([]);
880
973
  }
881
974
 
882
- async avmOpcodeGetContractInstanceDeployer(foreignAddress: ForeignCallSingle) {
975
+ // eslint-disable-next-line camelcase
976
+ async aztec_avm_getContractInstanceDeployer(foreignAddress: ForeignCallSingle) {
883
977
  const address = addressFromSingle(foreignAddress);
884
978
 
885
- const instance = await this.handlerAsUtility().utilityGetContractInstance(address);
979
+ const instance = await this.handlerAsUtility().getContractInstance(address);
886
980
 
887
981
  return toForeignCallResult([
888
982
  toSingle(instance.deployer),
@@ -891,10 +985,11 @@ export class RPCTranslator {
891
985
  ]);
892
986
  }
893
987
 
894
- async avmOpcodeGetContractInstanceClassId(foreignAddress: ForeignCallSingle) {
988
+ // eslint-disable-next-line camelcase
989
+ async aztec_avm_getContractInstanceClassId(foreignAddress: ForeignCallSingle) {
895
990
  const address = addressFromSingle(foreignAddress);
896
991
 
897
- const instance = await this.handlerAsUtility().utilityGetContractInstance(address);
992
+ const instance = await this.handlerAsUtility().getContractInstance(address);
898
993
 
899
994
  return toForeignCallResult([
900
995
  toSingle(instance.currentContractClassId),
@@ -903,10 +998,11 @@ export class RPCTranslator {
903
998
  ]);
904
999
  }
905
1000
 
906
- async avmOpcodeGetContractInstanceInitializationHash(foreignAddress: ForeignCallSingle) {
1001
+ // eslint-disable-next-line camelcase
1002
+ async aztec_avm_getContractInstanceInitializationHash(foreignAddress: ForeignCallSingle) {
907
1003
  const address = addressFromSingle(foreignAddress);
908
1004
 
909
- const instance = await this.handlerAsUtility().utilityGetContractInstance(address);
1005
+ const instance = await this.handlerAsUtility().getContractInstance(address);
910
1006
 
911
1007
  return toForeignCallResult([
912
1008
  toSingle(instance.initializationHash),
@@ -915,85 +1011,98 @@ export class RPCTranslator {
915
1011
  ]);
916
1012
  }
917
1013
 
918
- async avmOpcodeSender() {
919
- const sender = await this.handlerAsAvm().avmOpcodeSender();
1014
+ // eslint-disable-next-line camelcase
1015
+ async aztec_avm_sender() {
1016
+ const sender = await this.handlerAsAvm().sender();
920
1017
 
921
1018
  return toForeignCallResult([toSingle(sender)]);
922
1019
  }
923
1020
 
924
- async avmOpcodeEmitNullifier(foreignNullifier: ForeignCallSingle) {
1021
+ // eslint-disable-next-line camelcase
1022
+ async aztec_avm_emitNullifier(foreignNullifier: ForeignCallSingle) {
925
1023
  const nullifier = fromSingle(foreignNullifier);
926
1024
 
927
- await this.handlerAsAvm().avmOpcodeEmitNullifier(nullifier);
1025
+ await this.handlerAsAvm().emitNullifier(nullifier);
928
1026
 
929
1027
  return toForeignCallResult([]);
930
1028
  }
931
1029
 
932
- async avmOpcodeEmitNoteHash(foreignNoteHash: ForeignCallSingle) {
1030
+ // eslint-disable-next-line camelcase
1031
+ async aztec_avm_emitNoteHash(foreignNoteHash: ForeignCallSingle) {
933
1032
  const noteHash = fromSingle(foreignNoteHash);
934
1033
 
935
- await this.handlerAsAvm().avmOpcodeEmitNoteHash(noteHash);
1034
+ await this.handlerAsAvm().emitNoteHash(noteHash);
936
1035
 
937
1036
  return toForeignCallResult([]);
938
1037
  }
939
1038
 
940
- async avmOpcodeNullifierExists(foreignSiloedNullifier: ForeignCallSingle) {
1039
+ // eslint-disable-next-line camelcase
1040
+ async aztec_avm_nullifierExists(foreignSiloedNullifier: ForeignCallSingle) {
941
1041
  const siloedNullifier = fromSingle(foreignSiloedNullifier);
942
1042
 
943
- const exists = await this.handlerAsAvm().avmOpcodeNullifierExists(siloedNullifier);
1043
+ const exists = await this.handlerAsAvm().nullifierExists(siloedNullifier);
944
1044
 
945
1045
  return toForeignCallResult([toSingle(new Fr(exists))]);
946
1046
  }
947
1047
 
948
- async avmOpcodeAddress() {
949
- const contractAddress = await this.handlerAsAvm().avmOpcodeAddress();
1048
+ // eslint-disable-next-line camelcase
1049
+ async aztec_avm_address() {
1050
+ const contractAddress = await this.handlerAsAvm().address();
950
1051
 
951
1052
  return toForeignCallResult([toSingle(contractAddress.toField())]);
952
1053
  }
953
1054
 
954
- async avmOpcodeBlockNumber() {
955
- const blockNumber = await this.handlerAsAvm().avmOpcodeBlockNumber();
1055
+ // eslint-disable-next-line camelcase
1056
+ async aztec_avm_blockNumber() {
1057
+ const blockNumber = await this.handlerAsAvm().blockNumber();
956
1058
 
957
1059
  return toForeignCallResult([toSingle(new Fr(blockNumber))]);
958
1060
  }
959
1061
 
960
- async avmOpcodeTimestamp() {
961
- const timestamp = await this.handlerAsAvm().avmOpcodeTimestamp();
1062
+ // eslint-disable-next-line camelcase
1063
+ async aztec_avm_timestamp() {
1064
+ const timestamp = await this.handlerAsAvm().timestamp();
962
1065
 
963
1066
  return toForeignCallResult([toSingle(new Fr(timestamp))]);
964
1067
  }
965
1068
 
966
- async avmOpcodeIsStaticCall() {
967
- const isStaticCall = await this.handlerAsAvm().avmOpcodeIsStaticCall();
1069
+ // eslint-disable-next-line camelcase
1070
+ async aztec_avm_isStaticCall() {
1071
+ const isStaticCall = await this.handlerAsAvm().isStaticCall();
968
1072
 
969
1073
  return toForeignCallResult([toSingle(new Fr(isStaticCall ? 1 : 0))]);
970
1074
  }
971
1075
 
972
- async avmOpcodeChainId() {
973
- const chainId = await this.handlerAsAvm().avmOpcodeChainId();
1076
+ // eslint-disable-next-line camelcase
1077
+ async aztec_avm_chainId() {
1078
+ const chainId = await this.handlerAsAvm().chainId();
974
1079
 
975
1080
  return toForeignCallResult([toSingle(chainId)]);
976
1081
  }
977
1082
 
978
- async avmOpcodeVersion() {
979
- const version = await this.handlerAsAvm().avmOpcodeVersion();
1083
+ // eslint-disable-next-line camelcase
1084
+ async aztec_avm_version() {
1085
+ const version = await this.handlerAsAvm().version();
980
1086
 
981
1087
  return toForeignCallResult([toSingle(version)]);
982
1088
  }
983
1089
 
984
- avmOpcodeReturndataSize() {
1090
+ // eslint-disable-next-line camelcase
1091
+ aztec_avm_returndataSize() {
985
1092
  throw new Error(
986
1093
  'Contract calls are forbidden inside a `TestEnvironment::public_context`, use `public_call` instead',
987
1094
  );
988
1095
  }
989
1096
 
990
- avmOpcodeReturndataCopy(_foreignRdOffset: ForeignCallSingle, _foreignCopySize: ForeignCallSingle) {
1097
+ // eslint-disable-next-line camelcase
1098
+ aztec_avm_returndataCopy(_foreignRdOffset: ForeignCallSingle, _foreignCopySize: ForeignCallSingle) {
991
1099
  throw new Error(
992
1100
  'Contract calls are forbidden inside a `TestEnvironment::public_context`, use `public_call` instead',
993
1101
  );
994
1102
  }
995
1103
 
996
- avmOpcodeCall(
1104
+ // eslint-disable-next-line camelcase
1105
+ aztec_avm_call(
997
1106
  _foreignL2Gas: ForeignCallSingle,
998
1107
  _foreignDaGas: ForeignCallSingle,
999
1108
  _foreignAddress: ForeignCallSingle,
@@ -1005,7 +1114,8 @@ export class RPCTranslator {
1005
1114
  );
1006
1115
  }
1007
1116
 
1008
- avmOpcodeStaticCall(
1117
+ // eslint-disable-next-line camelcase
1118
+ aztec_avm_staticCall(
1009
1119
  _foreignL2Gas: ForeignCallSingle,
1010
1120
  _foreignDaGas: ForeignCallSingle,
1011
1121
  _foreignAddress: ForeignCallSingle,
@@ -1017,13 +1127,15 @@ export class RPCTranslator {
1017
1127
  );
1018
1128
  }
1019
1129
 
1020
- avmOpcodeSuccessCopy() {
1130
+ // eslint-disable-next-line camelcase
1131
+ aztec_avm_successCopy() {
1021
1132
  throw new Error(
1022
1133
  'Contract calls are forbidden inside a `TestEnvironment::public_context`, use `public_call` instead',
1023
1134
  );
1024
1135
  }
1025
1136
 
1026
- async txePrivateCallNewFlow(
1137
+ // eslint-disable-next-line camelcase
1138
+ async aztec_txe_privateCallNewFlow(
1027
1139
  foreignFrom: ForeignCallSingle,
1028
1140
  foreignTargetContractAddress: ForeignCallSingle,
1029
1141
  foreignFunctionSelector: ForeignCallSingle,
@@ -1038,7 +1150,7 @@ export class RPCTranslator {
1038
1150
  const argsHash = fromSingle(foreignArgsHash);
1039
1151
  const isStaticCall = fromSingle(foreignIsStaticCall).toBool();
1040
1152
 
1041
- const returnValues = await this.handlerAsTxe().txePrivateCallNewFlow(
1153
+ const returnValues = await this.handlerAsTxe().privateCallNewFlow(
1042
1154
  from,
1043
1155
  targetContractAddress,
1044
1156
  functionSelector,
@@ -1053,7 +1165,8 @@ export class RPCTranslator {
1053
1165
  return toForeignCallResult([toArray(returnValues)]);
1054
1166
  }
1055
1167
 
1056
- async txeExecuteUtilityFunction(
1168
+ // eslint-disable-next-line camelcase
1169
+ async aztec_txe_executeUtilityFunction(
1057
1170
  foreignTargetContractAddress: ForeignCallSingle,
1058
1171
  foreignFunctionSelector: ForeignCallSingle,
1059
1172
  foreignArgs: ForeignCallArray,
@@ -1062,7 +1175,7 @@ export class RPCTranslator {
1062
1175
  const functionSelector = FunctionSelector.fromField(fromSingle(foreignFunctionSelector));
1063
1176
  const args = fromArray(foreignArgs);
1064
1177
 
1065
- const returnValues = await this.handlerAsTxe().txeExecuteUtilityFunction(
1178
+ const returnValues = await this.handlerAsTxe().executeUtilityFunction(
1066
1179
  targetContractAddress,
1067
1180
  functionSelector,
1068
1181
  args,
@@ -1074,7 +1187,8 @@ export class RPCTranslator {
1074
1187
  return toForeignCallResult([toArray(returnValues)]);
1075
1188
  }
1076
1189
 
1077
- async txePublicCallNewFlow(
1190
+ // eslint-disable-next-line camelcase
1191
+ async aztec_txe_publicCallNewFlow(
1078
1192
  foreignFrom: ForeignCallSingle,
1079
1193
  foreignAddress: ForeignCallSingle,
1080
1194
  foreignCalldata: ForeignCallArray,
@@ -1085,15 +1199,16 @@ export class RPCTranslator {
1085
1199
  const calldata = fromArray(foreignCalldata);
1086
1200
  const isStaticCall = fromSingle(foreignIsStaticCall).toBool();
1087
1201
 
1088
- const returnValues = await this.handlerAsTxe().txePublicCallNewFlow(from, address, calldata, isStaticCall);
1202
+ const returnValues = await this.handlerAsTxe().publicCallNewFlow(from, address, calldata, isStaticCall);
1089
1203
 
1090
1204
  // TODO(F-335): Avoid doing the following call here.
1091
1205
  await this.stateHandler.cycleJob();
1092
1206
  return toForeignCallResult([toArray(returnValues)]);
1093
1207
  }
1094
1208
 
1095
- async privateGetSenderForTags() {
1096
- const sender = await this.handlerAsPrivate().privateGetSenderForTags();
1209
+ // eslint-disable-next-line camelcase
1210
+ async aztec_prv_getSenderForTags() {
1211
+ const sender = await this.handlerAsPrivate().getSenderForTags();
1097
1212
 
1098
1213
  // Return a Noir Option struct with `some` and `value` fields
1099
1214
  if (sender === undefined) {
@@ -1105,19 +1220,21 @@ export class RPCTranslator {
1105
1220
  }
1106
1221
  }
1107
1222
 
1108
- async privateSetSenderForTags(foreignSenderForTags: ForeignCallSingle) {
1223
+ // eslint-disable-next-line camelcase
1224
+ async aztec_prv_setSenderForTags(foreignSenderForTags: ForeignCallSingle) {
1109
1225
  const senderForTags = AztecAddress.fromField(fromSingle(foreignSenderForTags));
1110
1226
 
1111
- await this.handlerAsPrivate().privateSetSenderForTags(senderForTags);
1227
+ await this.handlerAsPrivate().setSenderForTags(senderForTags);
1112
1228
 
1113
1229
  return toForeignCallResult([]);
1114
1230
  }
1115
1231
 
1116
- async privateGetNextAppTagAsSender(foreignSender: ForeignCallSingle, foreignRecipient: ForeignCallSingle) {
1232
+ // eslint-disable-next-line camelcase
1233
+ async aztec_prv_getNextAppTagAsSender(foreignSender: ForeignCallSingle, foreignRecipient: ForeignCallSingle) {
1117
1234
  const sender = AztecAddress.fromField(fromSingle(foreignSender));
1118
1235
  const recipient = AztecAddress.fromField(fromSingle(foreignRecipient));
1119
1236
 
1120
- const nextAppTag = await this.handlerAsPrivate().privateGetNextAppTagAsSender(sender, recipient);
1237
+ const nextAppTag = await this.handlerAsPrivate().getNextAppTagAsSender(sender, recipient);
1121
1238
 
1122
1239
  return toForeignCallResult([toSingle(nextAppTag.value)]);
1123
1240
  }