@aztec/txe 0.0.1-commit.ec5f612 → 0.0.1-commit.ef17749e1

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.
@@ -61,59 +61,69 @@ export class RPCTranslator {
61
61
  return this.oracleHandler;
62
62
  }
63
63
  // TXE session state transition functions - these get handled by the state handler
64
- async txeSetTopLevelTXEContext() {
64
+ // eslint-disable-next-line camelcase
65
+ async aztec_txe_setTopLevelTXEContext() {
65
66
  await this.stateHandler.enterTopLevelState();
66
67
  return toForeignCallResult([]);
67
68
  }
68
- async txeSetPrivateTXEContext(foreignContractAddressIsSome, foreignContractAddressValue, foreignAnchorBlockNumberIsSome, foreignAnchorBlockNumberValue) {
69
+ // eslint-disable-next-line camelcase
70
+ async aztec_txe_setPrivateTXEContext(foreignContractAddressIsSome, foreignContractAddressValue, foreignAnchorBlockNumberIsSome, foreignAnchorBlockNumberValue) {
69
71
  const contractAddress = fromSingle(foreignContractAddressIsSome).toBool() ? AztecAddress.fromField(fromSingle(foreignContractAddressValue)) : undefined;
70
72
  const anchorBlockNumber = fromSingle(foreignAnchorBlockNumberIsSome).toBool() ? BlockNumber(fromSingle(foreignAnchorBlockNumberValue).toNumber()) : undefined;
71
73
  const privateContextInputs = await this.stateHandler.enterPrivateState(contractAddress, anchorBlockNumber);
72
74
  return toForeignCallResult(privateContextInputs.toFields().map(toSingle));
73
75
  }
74
- async txeSetPublicTXEContext(foreignContractAddressIsSome, foreignContractAddressValue) {
76
+ // eslint-disable-next-line camelcase
77
+ async aztec_txe_setPublicTXEContext(foreignContractAddressIsSome, foreignContractAddressValue) {
75
78
  const contractAddress = fromSingle(foreignContractAddressIsSome).toBool() ? AztecAddress.fromField(fromSingle(foreignContractAddressValue)) : undefined;
76
79
  await this.stateHandler.enterPublicState(contractAddress);
77
80
  return toForeignCallResult([]);
78
81
  }
79
- async txeSetUtilityTXEContext(foreignContractAddressIsSome, foreignContractAddressValue) {
82
+ // eslint-disable-next-line camelcase
83
+ async aztec_txe_setUtilityTXEContext(foreignContractAddressIsSome, foreignContractAddressValue) {
80
84
  const contractAddress = fromSingle(foreignContractAddressIsSome).toBool() ? AztecAddress.fromField(fromSingle(foreignContractAddressValue)) : undefined;
81
85
  await this.stateHandler.enterUtilityState(contractAddress);
82
86
  return toForeignCallResult([]);
83
87
  }
84
88
  // Other oracles - these get handled by the oracle handler
85
89
  // TXE-specific oracles
86
- txeGetDefaultAddress() {
87
- const defaultAddress = this.handlerAsTxe().txeGetDefaultAddress();
90
+ // eslint-disable-next-line camelcase
91
+ aztec_txe_getDefaultAddress() {
92
+ const defaultAddress = this.handlerAsTxe().getDefaultAddress();
88
93
  return toForeignCallResult([
89
94
  toSingle(defaultAddress)
90
95
  ]);
91
96
  }
92
- async txeGetNextBlockNumber() {
93
- const nextBlockNumber = await this.handlerAsTxe().txeGetNextBlockNumber();
97
+ // eslint-disable-next-line camelcase
98
+ async aztec_txe_getNextBlockNumber() {
99
+ const nextBlockNumber = await this.handlerAsTxe().getNextBlockNumber();
94
100
  return toForeignCallResult([
95
101
  toSingle(nextBlockNumber)
96
102
  ]);
97
103
  }
98
- async txeGetNextBlockTimestamp() {
99
- const nextBlockTimestamp = await this.handlerAsTxe().txeGetNextBlockTimestamp();
104
+ // eslint-disable-next-line camelcase
105
+ async aztec_txe_getNextBlockTimestamp() {
106
+ const nextBlockTimestamp = await this.handlerAsTxe().getNextBlockTimestamp();
100
107
  return toForeignCallResult([
101
108
  toSingle(nextBlockTimestamp)
102
109
  ]);
103
110
  }
104
- async txeAdvanceBlocksBy(foreignBlocks) {
111
+ // eslint-disable-next-line camelcase
112
+ async aztec_txe_advanceBlocksBy(foreignBlocks) {
105
113
  const blocks = fromSingle(foreignBlocks).toNumber();
106
- await this.handlerAsTxe().txeAdvanceBlocksBy(blocks);
114
+ await this.handlerAsTxe().advanceBlocksBy(blocks);
107
115
  return toForeignCallResult([]);
108
116
  }
109
- txeAdvanceTimestampBy(foreignDuration) {
117
+ // eslint-disable-next-line camelcase
118
+ aztec_txe_advanceTimestampBy(foreignDuration) {
110
119
  const duration = fromSingle(foreignDuration).toBigInt();
111
- this.handlerAsTxe().txeAdvanceTimestampBy(duration);
120
+ this.handlerAsTxe().advanceTimestampBy(duration);
112
121
  return toForeignCallResult([]);
113
122
  }
114
- async txeDeploy(artifact, instance, foreignSecret) {
123
+ // eslint-disable-next-line camelcase
124
+ async aztec_txe_deploy(artifact, instance, foreignSecret) {
115
125
  const secret = fromSingle(foreignSecret);
116
- await this.handlerAsTxe().txeDeploy(artifact, instance, secret);
126
+ await this.handlerAsTxe().deploy(artifact, instance, secret);
117
127
  return toForeignCallResult([
118
128
  toArray([
119
129
  instance.salt,
@@ -124,55 +134,63 @@ export class RPCTranslator {
124
134
  ])
125
135
  ]);
126
136
  }
127
- async txeCreateAccount(foreignSecret) {
137
+ // eslint-disable-next-line camelcase
138
+ async aztec_txe_createAccount(foreignSecret) {
128
139
  const secret = fromSingle(foreignSecret);
129
- const completeAddress = await this.handlerAsTxe().txeCreateAccount(secret);
140
+ const completeAddress = await this.handlerAsTxe().createAccount(secret);
130
141
  return toForeignCallResult([
131
142
  toSingle(completeAddress.address),
132
143
  ...completeAddress.publicKeys.toFields().map(toSingle)
133
144
  ]);
134
145
  }
135
- async txeAddAccount(artifact, instance, foreignSecret) {
146
+ // eslint-disable-next-line camelcase
147
+ async aztec_txe_addAccount(artifact, instance, foreignSecret) {
136
148
  const secret = fromSingle(foreignSecret);
137
- const completeAddress = await this.handlerAsTxe().txeAddAccount(artifact, instance, secret);
149
+ const completeAddress = await this.handlerAsTxe().addAccount(artifact, instance, secret);
138
150
  return toForeignCallResult([
139
151
  toSingle(completeAddress.address),
140
152
  ...completeAddress.publicKeys.toFields().map(toSingle)
141
153
  ]);
142
154
  }
143
- async txeAddAuthWitness(foreignAddress, foreignMessageHash) {
155
+ // eslint-disable-next-line camelcase
156
+ async aztec_txe_addAuthWitness(foreignAddress, foreignMessageHash) {
144
157
  const address = addressFromSingle(foreignAddress);
145
158
  const messageHash = fromSingle(foreignMessageHash);
146
- await this.handlerAsTxe().txeAddAuthWitness(address, messageHash);
159
+ await this.handlerAsTxe().addAuthWitness(address, messageHash);
147
160
  return toForeignCallResult([]);
148
161
  }
149
162
  // PXE oracles
150
- utilityAssertCompatibleOracleVersion(foreignVersion) {
163
+ // eslint-disable-next-line camelcase
164
+ aztec_utl_assertCompatibleOracleVersion(foreignVersion) {
151
165
  const version = fromSingle(foreignVersion).toNumber();
152
- this.handlerAsMisc().utilityAssertCompatibleOracleVersion(version);
166
+ this.handlerAsMisc().assertCompatibleOracleVersion(version);
153
167
  return toForeignCallResult([]);
154
168
  }
155
- utilityGetRandomField() {
156
- const randomField = this.handlerAsMisc().utilityGetRandomField();
169
+ // eslint-disable-next-line camelcase
170
+ aztec_utl_getRandomField() {
171
+ const randomField = this.handlerAsMisc().getRandomField();
157
172
  return toForeignCallResult([
158
173
  toSingle(randomField)
159
174
  ]);
160
175
  }
161
- async txeGetLastBlockTimestamp() {
162
- const timestamp = await this.handlerAsTxe().txeGetLastBlockTimestamp();
176
+ // eslint-disable-next-line camelcase
177
+ async aztec_txe_getLastBlockTimestamp() {
178
+ const timestamp = await this.handlerAsTxe().getLastBlockTimestamp();
163
179
  return toForeignCallResult([
164
180
  toSingle(new Fr(timestamp))
165
181
  ]);
166
182
  }
167
- async txeGetLastTxEffects() {
168
- const { txHash, noteHashes, nullifiers } = await this.handlerAsTxe().txeGetLastTxEffects();
183
+ // eslint-disable-next-line camelcase
184
+ async aztec_txe_getLastTxEffects() {
185
+ const { txHash, noteHashes, nullifiers } = await this.handlerAsTxe().getLastTxEffects();
169
186
  return toForeignCallResult([
170
187
  toSingle(txHash.hash),
171
188
  ...arrayToBoundedVec(toArray(noteHashes), MAX_NOTE_HASHES_PER_TX),
172
189
  ...arrayToBoundedVec(toArray(nullifiers), MAX_NULLIFIERS_PER_TX)
173
190
  ]);
174
191
  }
175
- async txeGetPrivateEvents(foreignSelector, foreignContractAddress, foreignScope) {
192
+ // eslint-disable-next-line camelcase
193
+ async aztec_txe_getPrivateEvents(foreignSelector, foreignContractAddress, foreignScope) {
176
194
  const selector = EventSelector.fromField(fromSingle(foreignSelector));
177
195
  const contractAddress = addressFromSingle(foreignContractAddress);
178
196
  const scope = addressFromSingle(foreignScope);
@@ -182,7 +200,7 @@ export class RPCTranslator {
182
200
  // We cycle job to commit the stores after the contract sync.
183
201
  await this.stateHandler.cycleJob();
184
202
  }
185
- const events = await this.handlerAsTxe().txeGetPrivateEvents(selector, contractAddress, scope);
203
+ const events = await this.handlerAsTxe().getPrivateEvents(selector, contractAddress, scope);
186
204
  if (events.length > MAX_PRIVATE_EVENTS_PER_TXE_QUERY) {
187
205
  throw new Error(`Array of length ${events.length} larger than maxLen ${MAX_PRIVATE_EVENTS_PER_TXE_QUERY}`);
188
206
  }
@@ -200,48 +218,54 @@ export class RPCTranslator {
200
218
  toSingle(queryLength)
201
219
  ]);
202
220
  }
203
- privateStoreInExecutionCache(foreignValues, foreignHash) {
221
+ // eslint-disable-next-line camelcase
222
+ aztec_prv_storeInExecutionCache(foreignValues, foreignHash) {
204
223
  const values = fromArray(foreignValues);
205
224
  const hash = fromSingle(foreignHash);
206
- this.handlerAsPrivate().privateStoreInExecutionCache(values, hash);
225
+ this.handlerAsPrivate().storeInExecutionCache(values, hash);
207
226
  return toForeignCallResult([]);
208
227
  }
209
- async privateLoadFromExecutionCache(foreignHash) {
228
+ // eslint-disable-next-line camelcase
229
+ async aztec_prv_loadFromExecutionCache(foreignHash) {
210
230
  const hash = fromSingle(foreignHash);
211
- const returns = await this.handlerAsPrivate().privateLoadFromExecutionCache(hash);
231
+ const returns = await this.handlerAsPrivate().loadFromExecutionCache(hash);
212
232
  return toForeignCallResult([
213
233
  toArray(returns)
214
234
  ]);
215
235
  }
216
236
  // When the argument is a slice, noir automatically adds a length field to oracle call.
217
237
  // When the argument is an array, we add the field length manually to the signature.
218
- async utilityLog(foreignLevel, foreignMessage, _foreignLength, foreignFields) {
238
+ // eslint-disable-next-line camelcase
239
+ async aztec_utl_log(foreignLevel, foreignMessage, _foreignLength, foreignFields) {
219
240
  const level = fromSingle(foreignLevel).toNumber();
220
241
  const message = fromArray(foreignMessage).map((field)=>String.fromCharCode(field.toNumber())).join('');
221
242
  const fields = fromArray(foreignFields);
222
- await this.handlerAsMisc().utilityLog(level, message, fields);
243
+ await this.handlerAsMisc().log(level, message, fields);
223
244
  return toForeignCallResult([]);
224
245
  }
225
- async utilityStorageRead(foreignBlockHash, foreignContractAddress, foreignStartStorageSlot, foreignNumberOfElements) {
246
+ // eslint-disable-next-line camelcase
247
+ async aztec_utl_storageRead(foreignBlockHash, foreignContractAddress, foreignStartStorageSlot, foreignNumberOfElements) {
226
248
  const blockHash = new BlockHash(fromSingle(foreignBlockHash));
227
249
  const contractAddress = addressFromSingle(foreignContractAddress);
228
250
  const startStorageSlot = fromSingle(foreignStartStorageSlot);
229
251
  const numberOfElements = fromSingle(foreignNumberOfElements).toNumber();
230
- const values = await this.handlerAsUtility().utilityStorageRead(blockHash, contractAddress, startStorageSlot, numberOfElements);
252
+ const values = await this.handlerAsUtility().storageRead(blockHash, contractAddress, startStorageSlot, numberOfElements);
231
253
  return toForeignCallResult([
232
254
  toArray(values)
233
255
  ]);
234
256
  }
235
- async utilityGetPublicDataWitness(foreignBlockHash, foreignLeafSlot) {
257
+ // eslint-disable-next-line camelcase
258
+ async aztec_utl_getPublicDataWitness(foreignBlockHash, foreignLeafSlot) {
236
259
  const blockHash = new BlockHash(fromSingle(foreignBlockHash));
237
260
  const leafSlot = fromSingle(foreignLeafSlot);
238
- const witness = await this.handlerAsUtility().utilityGetPublicDataWitness(blockHash, leafSlot);
261
+ const witness = await this.handlerAsUtility().getPublicDataWitness(blockHash, leafSlot);
239
262
  if (!witness) {
240
263
  throw new Error(`Public data witness not found for slot ${leafSlot} at block ${blockHash.toString()}.`);
241
264
  }
242
265
  return toForeignCallResult(witness.toNoirRepresentation());
243
266
  }
244
- async utilityGetNotes(foreignOwnerIsSome, foreignOwnerValue, foreignStorageSlot, foreignNumSelects, foreignSelectByIndexes, foreignSelectByOffsets, foreignSelectByLengths, foreignSelectValues, foreignSelectComparators, foreignSortByIndexes, foreignSortByOffsets, foreignSortByLengths, foreignSortOrder, foreignLimit, foreignOffset, foreignStatus, foreignMaxNotes, foreignPackedHintedNoteLength) {
267
+ // eslint-disable-next-line camelcase
268
+ async aztec_utl_getNotes(foreignOwnerIsSome, foreignOwnerValue, foreignStorageSlot, foreignNumSelects, foreignSelectByIndexes, foreignSelectByOffsets, foreignSelectByLengths, foreignSelectValues, foreignSelectComparators, foreignSortByIndexes, foreignSortByOffsets, foreignSortByLengths, foreignSortOrder, foreignLimit, foreignOffset, foreignStatus, foreignMaxNotes, foreignPackedHintedNoteLength) {
245
269
  // Parse Option<AztecAddress>: ownerIsSome is 0 for None, 1 for Some
246
270
  const owner = fromSingle(foreignOwnerIsSome).toBool() ? AztecAddress.fromField(fromSingle(foreignOwnerValue)) : undefined;
247
271
  const storageSlot = fromSingle(foreignStorageSlot);
@@ -260,7 +284,7 @@ export class RPCTranslator {
260
284
  const status = fromSingle(foreignStatus).toNumber();
261
285
  const maxNotes = fromSingle(foreignMaxNotes).toNumber();
262
286
  const packedHintedNoteLength = fromSingle(foreignPackedHintedNoteLength).toNumber();
263
- const noteDatas = await this.handlerAsUtility().utilityGetNotes(owner, storageSlot, numSelects, selectByIndexes, selectByOffsets, selectByLengths, selectValues, selectComparators, sortByIndexes, sortByOffsets, sortByLengths, sortOrder, limit, offset, status);
287
+ const noteDatas = await this.handlerAsUtility().getNotes(owner, storageSlot, numSelects, selectByIndexes, selectByOffsets, selectByLengths, selectValues, selectComparators, sortByIndexes, sortByOffsets, sortByLengths, sortOrder, limit, offset, status);
264
288
  const returnDataAsArrayOfArrays = noteDatas.map((noteData)=>packAsHintedNote({
265
289
  contractAddress: noteData.contractAddress,
266
290
  owner: noteData.owner,
@@ -275,7 +299,8 @@ export class RPCTranslator {
275
299
  // At last we convert the array of arrays to a bounded vec of arrays
276
300
  return toForeignCallResult(arrayOfArraysToBoundedVecOfArrays(returnDataAsArrayOfForeignCallSingleArrays, maxNotes, packedHintedNoteLength));
277
301
  }
278
- privateNotifyCreatedNote(foreignOwner, foreignStorageSlot, foreignRandomness, foreignNoteTypeId, foreignNote, foreignNoteHash, foreignCounter) {
302
+ // eslint-disable-next-line camelcase
303
+ aztec_prv_notifyCreatedNote(foreignOwner, foreignStorageSlot, foreignRandomness, foreignNoteTypeId, foreignNote, foreignNoteHash, foreignCounter) {
279
304
  const owner = addressFromSingle(foreignOwner);
280
305
  const storageSlot = fromSingle(foreignStorageSlot);
281
306
  const randomness = fromSingle(foreignRandomness);
@@ -283,39 +308,44 @@ export class RPCTranslator {
283
308
  const note = fromArray(foreignNote);
284
309
  const noteHash = fromSingle(foreignNoteHash);
285
310
  const counter = fromSingle(foreignCounter).toNumber();
286
- this.handlerAsPrivate().privateNotifyCreatedNote(owner, storageSlot, randomness, noteTypeId, note, noteHash, counter);
311
+ this.handlerAsPrivate().notifyCreatedNote(owner, storageSlot, randomness, noteTypeId, note, noteHash, counter);
287
312
  return toForeignCallResult([]);
288
313
  }
289
- async privateNotifyNullifiedNote(foreignInnerNullifier, foreignNoteHash, foreignCounter) {
314
+ // eslint-disable-next-line camelcase
315
+ async aztec_prv_notifyNullifiedNote(foreignInnerNullifier, foreignNoteHash, foreignCounter) {
290
316
  const innerNullifier = fromSingle(foreignInnerNullifier);
291
317
  const noteHash = fromSingle(foreignNoteHash);
292
318
  const counter = fromSingle(foreignCounter).toNumber();
293
- await this.handlerAsPrivate().privateNotifyNullifiedNote(innerNullifier, noteHash, counter);
319
+ await this.handlerAsPrivate().notifyNullifiedNote(innerNullifier, noteHash, counter);
294
320
  return toForeignCallResult([]);
295
321
  }
296
- async privateNotifyCreatedNullifier(foreignInnerNullifier) {
322
+ // eslint-disable-next-line camelcase
323
+ async aztec_prv_notifyCreatedNullifier(foreignInnerNullifier) {
297
324
  const innerNullifier = fromSingle(foreignInnerNullifier);
298
- await this.handlerAsPrivate().privateNotifyCreatedNullifier(innerNullifier);
325
+ await this.handlerAsPrivate().notifyCreatedNullifier(innerNullifier);
299
326
  return toForeignCallResult([]);
300
327
  }
301
- async privateIsNullifierPending(foreignInnerNullifier, foreignContractAddress) {
328
+ // eslint-disable-next-line camelcase
329
+ async aztec_prv_isNullifierPending(foreignInnerNullifier, foreignContractAddress) {
302
330
  const innerNullifier = fromSingle(foreignInnerNullifier);
303
331
  const contractAddress = addressFromSingle(foreignContractAddress);
304
- const isPending = await this.handlerAsPrivate().privateIsNullifierPending(innerNullifier, contractAddress);
332
+ const isPending = await this.handlerAsPrivate().isNullifierPending(innerNullifier, contractAddress);
305
333
  return toForeignCallResult([
306
334
  toSingle(new Fr(isPending))
307
335
  ]);
308
336
  }
309
- async utilityCheckNullifierExists(foreignInnerNullifier) {
337
+ // eslint-disable-next-line camelcase
338
+ async aztec_utl_checkNullifierExists(foreignInnerNullifier) {
310
339
  const innerNullifier = fromSingle(foreignInnerNullifier);
311
- const exists = await this.handlerAsUtility().utilityCheckNullifierExists(innerNullifier);
340
+ const exists = await this.handlerAsUtility().checkNullifierExists(innerNullifier);
312
341
  return toForeignCallResult([
313
342
  toSingle(new Fr(exists))
314
343
  ]);
315
344
  }
316
- async utilityGetContractInstance(foreignAddress) {
345
+ // eslint-disable-next-line camelcase
346
+ async aztec_utl_getContractInstance(foreignAddress) {
317
347
  const address = addressFromSingle(foreignAddress);
318
- const instance = await this.handlerAsUtility().utilityGetContractInstance(address);
348
+ const instance = await this.handlerAsUtility().getContractInstance(address);
319
349
  return toForeignCallResult([
320
350
  instance.salt,
321
351
  instance.deployer.toField(),
@@ -324,9 +354,10 @@ export class RPCTranslator {
324
354
  ...instance.publicKeys.toFields()
325
355
  ].map(toSingle));
326
356
  }
327
- async utilityTryGetPublicKeysAndPartialAddress(foreignAddress) {
357
+ // eslint-disable-next-line camelcase
358
+ async aztec_utl_tryGetPublicKeysAndPartialAddress(foreignAddress) {
328
359
  const address = addressFromSingle(foreignAddress);
329
- const result = await this.handlerAsUtility().utilityTryGetPublicKeysAndPartialAddress(address);
360
+ const result = await this.handlerAsUtility().tryGetPublicKeysAndPartialAddress(address);
330
361
  // We are going to return a Noir Option struct to represent the possibility of null values. Options are a struct
331
362
  // with two fields: `some` (a boolean) and `value` (a field array in this case).
332
363
  if (result === undefined) {
@@ -346,26 +377,30 @@ export class RPCTranslator {
346
377
  ]);
347
378
  }
348
379
  }
349
- async utilityGetKeyValidationRequest(foreignPkMHash) {
380
+ // eslint-disable-next-line camelcase
381
+ async aztec_utl_getKeyValidationRequest(foreignPkMHash) {
350
382
  const pkMHash = fromSingle(foreignPkMHash);
351
- const keyValidationRequest = await this.handlerAsUtility().utilityGetKeyValidationRequest(pkMHash);
383
+ const keyValidationRequest = await this.handlerAsUtility().getKeyValidationRequest(pkMHash);
352
384
  return toForeignCallResult(keyValidationRequest.toFields().map(toSingle));
353
385
  }
354
- privateCallPrivateFunction(_foreignTargetContractAddress, _foreignFunctionSelector, _foreignArgsHash, _foreignSideEffectCounter, _foreignIsStaticCall) {
386
+ // eslint-disable-next-line camelcase
387
+ aztec_prv_callPrivateFunction(_foreignTargetContractAddress, _foreignFunctionSelector, _foreignArgsHash, _foreignSideEffectCounter, _foreignIsStaticCall) {
355
388
  throw new Error('Contract calls are forbidden inside a `TestEnvironment::private_context`, use `private_call` instead');
356
389
  }
357
- async utilityGetNullifierMembershipWitness(foreignBlockHash, foreignNullifier) {
390
+ // eslint-disable-next-line camelcase
391
+ async aztec_utl_getNullifierMembershipWitness(foreignBlockHash, foreignNullifier) {
358
392
  const blockHash = new BlockHash(fromSingle(foreignBlockHash));
359
393
  const nullifier = fromSingle(foreignNullifier);
360
- const witness = await this.handlerAsUtility().utilityGetNullifierMembershipWitness(blockHash, nullifier);
394
+ const witness = await this.handlerAsUtility().getNullifierMembershipWitness(blockHash, nullifier);
361
395
  if (!witness) {
362
396
  throw new Error(`Nullifier membership witness not found at block ${blockHash}.`);
363
397
  }
364
398
  return toForeignCallResult(witness.toNoirRepresentation());
365
399
  }
366
- async utilityGetAuthWitness(foreignMessageHash) {
400
+ // eslint-disable-next-line camelcase
401
+ async aztec_utl_getAuthWitness(foreignMessageHash) {
367
402
  const messageHash = fromSingle(foreignMessageHash);
368
- const authWitness = await this.handlerAsUtility().utilityGetAuthWitness(messageHash);
403
+ const authWitness = await this.handlerAsUtility().getAuthWitness(messageHash);
369
404
  if (!authWitness) {
370
405
  throw new Error(`Auth witness not found for message hash ${messageHash}.`);
371
406
  }
@@ -373,92 +408,106 @@ export class RPCTranslator {
373
408
  toArray(authWitness)
374
409
  ]);
375
410
  }
376
- privateNotifyEnqueuedPublicFunctionCall(_foreignTargetContractAddress, _foreignCalldataHash, _foreignSideEffectCounter, _foreignIsStaticCall) {
411
+ // eslint-disable-next-line camelcase
412
+ aztec_prv_notifyEnqueuedPublicFunctionCall(_foreignTargetContractAddress, _foreignCalldataHash, _foreignSideEffectCounter, _foreignIsStaticCall) {
377
413
  throw new Error('Enqueueing public calls is not supported in TestEnvironment::private_context');
378
414
  }
379
- privateNotifySetPublicTeardownFunctionCall(_foreignTargetContractAddress, _foreignCalldataHash, _foreignSideEffectCounter, _foreignIsStaticCall) {
415
+ // eslint-disable-next-line camelcase
416
+ aztec_prv_notifySetPublicTeardownFunctionCall(_foreignTargetContractAddress, _foreignCalldataHash, _foreignSideEffectCounter, _foreignIsStaticCall) {
380
417
  throw new Error('Enqueueing public calls is not supported in TestEnvironment::private_context');
381
418
  }
382
- privateNotifySetMinRevertibleSideEffectCounter(_foreignMinRevertibleSideEffectCounter) {
419
+ // eslint-disable-next-line camelcase
420
+ aztec_prv_notifySetMinRevertibleSideEffectCounter(_foreignMinRevertibleSideEffectCounter) {
383
421
  throw new Error('Enqueueing public calls is not supported in TestEnvironment::private_context');
384
422
  }
385
- async privateIsSideEffectCounterRevertible(foreignSideEffectCounter) {
423
+ // eslint-disable-next-line camelcase
424
+ async aztec_prv_isSideEffectCounterRevertible(foreignSideEffectCounter) {
386
425
  const sideEffectCounter = fromSingle(foreignSideEffectCounter).toNumber();
387
- const isRevertible = await this.handlerAsPrivate().privateIsSideEffectCounterRevertible(sideEffectCounter);
426
+ const isRevertible = await this.handlerAsPrivate().isSideEffectCounterRevertible(sideEffectCounter);
388
427
  return toForeignCallResult([
389
428
  toSingle(new Fr(isRevertible))
390
429
  ]);
391
430
  }
392
- utilityGetUtilityContext() {
393
- const context = this.handlerAsUtility().utilityGetUtilityContext();
431
+ // eslint-disable-next-line camelcase
432
+ aztec_utl_getUtilityContext() {
433
+ const context = this.handlerAsUtility().getUtilityContext();
394
434
  return toForeignCallResult(context.toNoirRepresentation());
395
435
  }
396
- async utilityGetBlockHeader(foreignBlockNumber) {
436
+ // eslint-disable-next-line camelcase
437
+ async aztec_utl_getBlockHeader(foreignBlockNumber) {
397
438
  const blockNumber = BlockNumber(fromSingle(foreignBlockNumber).toNumber());
398
- const header = await this.handlerAsUtility().utilityGetBlockHeader(blockNumber);
439
+ const header = await this.handlerAsUtility().getBlockHeader(blockNumber);
399
440
  if (!header) {
400
441
  throw new Error(`Block header not found for block ${blockNumber}.`);
401
442
  }
402
443
  return toForeignCallResult(header.toFields().map(toSingle));
403
444
  }
404
- async utilityGetNoteHashMembershipWitness(foreignAnchorBlockHash, foreignNoteHash) {
445
+ // eslint-disable-next-line camelcase
446
+ async aztec_utl_getNoteHashMembershipWitness(foreignAnchorBlockHash, foreignNoteHash) {
405
447
  const blockHash = new BlockHash(fromSingle(foreignAnchorBlockHash));
406
448
  const noteHash = fromSingle(foreignNoteHash);
407
- const witness = await this.handlerAsUtility().utilityGetNoteHashMembershipWitness(blockHash, noteHash);
449
+ const witness = await this.handlerAsUtility().getNoteHashMembershipWitness(blockHash, noteHash);
408
450
  if (!witness) {
409
451
  throw new Error(`Note hash ${noteHash} not found in the note hash tree at block ${blockHash.toString()}.`);
410
452
  }
411
453
  return toForeignCallResult(witness.toNoirRepresentation());
412
454
  }
413
- async utilityGetBlockHashMembershipWitness(foreignAnchorBlockHash, foreignBlockHash) {
455
+ // eslint-disable-next-line camelcase
456
+ async aztec_utl_getBlockHashMembershipWitness(foreignAnchorBlockHash, foreignBlockHash) {
414
457
  const anchorBlockHash = new BlockHash(fromSingle(foreignAnchorBlockHash));
415
458
  const blockHash = new BlockHash(fromSingle(foreignBlockHash));
416
- const witness = await this.handlerAsUtility().utilityGetBlockHashMembershipWitness(anchorBlockHash, blockHash);
459
+ const witness = await this.handlerAsUtility().getBlockHashMembershipWitness(anchorBlockHash, blockHash);
417
460
  if (!witness) {
418
461
  throw new Error(`Block hash ${blockHash.toString()} not found in the archive tree at anchor block ${anchorBlockHash.toString()}.`);
419
462
  }
420
463
  return toForeignCallResult(witness.toNoirRepresentation());
421
464
  }
422
- async utilityGetLowNullifierMembershipWitness(foreignBlockHash, foreignNullifier) {
465
+ // eslint-disable-next-line camelcase
466
+ async aztec_utl_getLowNullifierMembershipWitness(foreignBlockHash, foreignNullifier) {
423
467
  const blockHash = new BlockHash(fromSingle(foreignBlockHash));
424
468
  const nullifier = fromSingle(foreignNullifier);
425
- const witness = await this.handlerAsUtility().utilityGetLowNullifierMembershipWitness(blockHash, nullifier);
469
+ const witness = await this.handlerAsUtility().getLowNullifierMembershipWitness(blockHash, nullifier);
426
470
  if (!witness) {
427
471
  throw new Error(`Low nullifier witness not found for nullifier ${nullifier} at block ${blockHash}.`);
428
472
  }
429
473
  return toForeignCallResult(witness.toNoirRepresentation());
430
474
  }
431
- async utilityFetchTaggedLogs(foreignPendingTaggedLogArrayBaseSlot) {
475
+ // eslint-disable-next-line camelcase
476
+ async aztec_utl_fetchTaggedLogs(foreignPendingTaggedLogArrayBaseSlot) {
432
477
  const pendingTaggedLogArrayBaseSlot = fromSingle(foreignPendingTaggedLogArrayBaseSlot);
433
- await this.handlerAsUtility().utilityFetchTaggedLogs(pendingTaggedLogArrayBaseSlot);
478
+ await this.handlerAsUtility().fetchTaggedLogs(pendingTaggedLogArrayBaseSlot);
434
479
  return toForeignCallResult([]);
435
480
  }
436
- async utilityValidateAndStoreEnqueuedNotesAndEvents(foreignContractAddress, foreignNoteValidationRequestsArrayBaseSlot, foreignEventValidationRequestsArrayBaseSlot) {
481
+ // eslint-disable-next-line camelcase
482
+ async aztec_utl_validateAndStoreEnqueuedNotesAndEvents(foreignContractAddress, foreignNoteValidationRequestsArrayBaseSlot, foreignEventValidationRequestsArrayBaseSlot) {
437
483
  const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
438
484
  const noteValidationRequestsArrayBaseSlot = fromSingle(foreignNoteValidationRequestsArrayBaseSlot);
439
485
  const eventValidationRequestsArrayBaseSlot = fromSingle(foreignEventValidationRequestsArrayBaseSlot);
440
- await this.handlerAsUtility().utilityValidateAndStoreEnqueuedNotesAndEvents(contractAddress, noteValidationRequestsArrayBaseSlot, eventValidationRequestsArrayBaseSlot);
486
+ await this.handlerAsUtility().validateAndStoreEnqueuedNotesAndEvents(contractAddress, noteValidationRequestsArrayBaseSlot, eventValidationRequestsArrayBaseSlot);
441
487
  return toForeignCallResult([]);
442
488
  }
443
- async utilityBulkRetrieveLogs(foreignContractAddress, foreignLogRetrievalRequestsArrayBaseSlot, foreignLogRetrievalResponsesArrayBaseSlot) {
489
+ // eslint-disable-next-line camelcase
490
+ async aztec_utl_bulkRetrieveLogs(foreignContractAddress, foreignLogRetrievalRequestsArrayBaseSlot, foreignLogRetrievalResponsesArrayBaseSlot) {
444
491
  const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
445
492
  const logRetrievalRequestsArrayBaseSlot = fromSingle(foreignLogRetrievalRequestsArrayBaseSlot);
446
493
  const logRetrievalResponsesArrayBaseSlot = fromSingle(foreignLogRetrievalResponsesArrayBaseSlot);
447
- await this.handlerAsUtility().utilityBulkRetrieveLogs(contractAddress, logRetrievalRequestsArrayBaseSlot, logRetrievalResponsesArrayBaseSlot);
494
+ await this.handlerAsUtility().bulkRetrieveLogs(contractAddress, logRetrievalRequestsArrayBaseSlot, logRetrievalResponsesArrayBaseSlot);
448
495
  return toForeignCallResult([]);
449
496
  }
450
- async utilityStoreCapsule(foreignContractAddress, foreignSlot, foreignCapsule) {
497
+ // eslint-disable-next-line camelcase
498
+ async aztec_utl_storeCapsule(foreignContractAddress, foreignSlot, foreignCapsule) {
451
499
  const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
452
500
  const slot = fromSingle(foreignSlot);
453
501
  const capsule = fromArray(foreignCapsule);
454
- await this.handlerAsUtility().utilityStoreCapsule(contractAddress, slot, capsule);
502
+ await this.handlerAsUtility().storeCapsule(contractAddress, slot, capsule);
455
503
  return toForeignCallResult([]);
456
504
  }
457
- async utilityLoadCapsule(foreignContractAddress, foreignSlot, foreignTSize) {
505
+ // eslint-disable-next-line camelcase
506
+ async aztec_utl_loadCapsule(foreignContractAddress, foreignSlot, foreignTSize) {
458
507
  const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
459
508
  const slot = fromSingle(foreignSlot);
460
509
  const tSize = fromSingle(foreignTSize).toNumber();
461
- const values = await this.handlerAsUtility().utilityLoadCapsule(contractAddress, slot);
510
+ const values = await this.handlerAsUtility().loadCapsule(contractAddress, slot);
462
511
  // We are going to return a Noir Option struct to represent the possibility of null values. Options are a struct
463
512
  // with two fields: `some` (a boolean) and `value` (a field array in this case).
464
513
  if (values === null) {
@@ -475,203 +524,233 @@ export class RPCTranslator {
475
524
  ]);
476
525
  }
477
526
  }
478
- async utilityDeleteCapsule(foreignContractAddress, foreignSlot) {
527
+ // eslint-disable-next-line camelcase
528
+ async aztec_utl_deleteCapsule(foreignContractAddress, foreignSlot) {
479
529
  const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
480
530
  const slot = fromSingle(foreignSlot);
481
- await this.handlerAsUtility().utilityDeleteCapsule(contractAddress, slot);
531
+ await this.handlerAsUtility().deleteCapsule(contractAddress, slot);
482
532
  return toForeignCallResult([]);
483
533
  }
484
- async utilityCopyCapsule(foreignContractAddress, foreignSrcSlot, foreignDstSlot, foreignNumEntries) {
534
+ // eslint-disable-next-line camelcase
535
+ async aztec_utl_copyCapsule(foreignContractAddress, foreignSrcSlot, foreignDstSlot, foreignNumEntries) {
485
536
  const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
486
537
  const srcSlot = fromSingle(foreignSrcSlot);
487
538
  const dstSlot = fromSingle(foreignDstSlot);
488
539
  const numEntries = fromSingle(foreignNumEntries).toNumber();
489
- await this.handlerAsUtility().utilityCopyCapsule(contractAddress, srcSlot, dstSlot, numEntries);
540
+ await this.handlerAsUtility().copyCapsule(contractAddress, srcSlot, dstSlot, numEntries);
490
541
  return toForeignCallResult([]);
491
542
  }
492
543
  // TODO: I forgot to add a corresponding function here, when I introduced an oracle method to txe_oracle.ts.
493
544
  // 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
494
545
  // to implement this function here. Isn't there a way to programmatically identify that this is missing, given the
495
546
  // existence of a txe_oracle method?
496
- async utilityAes128Decrypt(foreignCiphertextBVecStorage, foreignCiphertextLength, foreignIv, foreignSymKey) {
547
+ // eslint-disable-next-line camelcase
548
+ async aztec_utl_aes128Decrypt(foreignCiphertextBVecStorage, foreignCiphertextLength, foreignIv, foreignSymKey) {
497
549
  const ciphertext = fromUintBoundedVec(foreignCiphertextBVecStorage, foreignCiphertextLength, 8);
498
550
  const iv = fromUintArray(foreignIv, 8);
499
551
  const symKey = fromUintArray(foreignSymKey, 8);
500
- const plaintextBuffer = await this.handlerAsUtility().utilityAes128Decrypt(ciphertext, iv, symKey);
552
+ const plaintextBuffer = await this.handlerAsUtility().aes128Decrypt(ciphertext, iv, symKey);
501
553
  return toForeignCallResult(arrayToBoundedVec(bufferToU8Array(plaintextBuffer), foreignCiphertextBVecStorage.length));
502
554
  }
503
- async utilityGetSharedSecret(foreignAddress, foreignEphPKField0, foreignEphPKField1, foreignEphPKField2) {
555
+ // eslint-disable-next-line camelcase
556
+ async aztec_utl_getSharedSecret(foreignAddress, foreignEphPKField0, foreignEphPKField1, foreignEphPKField2) {
504
557
  const address = AztecAddress.fromField(fromSingle(foreignAddress));
505
558
  const ephPK = Point.fromFields([
506
559
  fromSingle(foreignEphPKField0),
507
560
  fromSingle(foreignEphPKField1),
508
561
  fromSingle(foreignEphPKField2)
509
562
  ]);
510
- const secret = await this.handlerAsUtility().utilityGetSharedSecret(address, ephPK);
563
+ const secret = await this.handlerAsUtility().getSharedSecret(address, ephPK);
511
564
  return toForeignCallResult(secret.toFields().map(toSingle));
512
565
  }
513
- emitOffchainEffect(_foreignData) {
566
+ // eslint-disable-next-line camelcase
567
+ aztec_utl_emitOffchainEffect(_foreignData) {
514
568
  throw new Error('Offchain effects are not yet supported in the TestEnvironment');
515
569
  }
516
570
  // AVM opcodes
517
- avmOpcodeEmitPublicLog(_foreignMessage) {
571
+ // eslint-disable-next-line camelcase
572
+ aztec_avm_emitPublicLog(_foreignMessage) {
518
573
  // TODO(#8811): Implement
519
574
  return toForeignCallResult([]);
520
575
  }
521
- async avmOpcodeStorageRead(foreignSlot, foreignContractAddress) {
576
+ // eslint-disable-next-line camelcase
577
+ async aztec_avm_storageRead(foreignSlot, foreignContractAddress) {
522
578
  const slot = fromSingle(foreignSlot);
523
579
  const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
524
- const value = (await this.handlerAsAvm().avmOpcodeStorageRead(slot, contractAddress)).value;
580
+ const value = (await this.handlerAsAvm().storageRead(slot, contractAddress)).value;
525
581
  return toForeignCallResult([
526
582
  toSingle(new Fr(value))
527
583
  ]);
528
584
  }
529
- async avmOpcodeStorageWrite(foreignSlot, foreignValue) {
585
+ // eslint-disable-next-line camelcase
586
+ async aztec_avm_storageWrite(foreignSlot, foreignValue) {
530
587
  const slot = fromSingle(foreignSlot);
531
588
  const value = fromSingle(foreignValue);
532
- await this.handlerAsAvm().avmOpcodeStorageWrite(slot, value);
589
+ await this.handlerAsAvm().storageWrite(slot, value);
533
590
  return toForeignCallResult([]);
534
591
  }
535
- async avmOpcodeGetContractInstanceDeployer(foreignAddress) {
592
+ // eslint-disable-next-line camelcase
593
+ async aztec_avm_getContractInstanceDeployer(foreignAddress) {
536
594
  const address = addressFromSingle(foreignAddress);
537
- const instance = await this.handlerAsUtility().utilityGetContractInstance(address);
595
+ const instance = await this.handlerAsUtility().getContractInstance(address);
538
596
  return toForeignCallResult([
539
597
  toSingle(instance.deployer),
540
598
  // AVM requires an extra boolean indicating the instance was found
541
599
  toSingle(new Fr(1))
542
600
  ]);
543
601
  }
544
- async avmOpcodeGetContractInstanceClassId(foreignAddress) {
602
+ // eslint-disable-next-line camelcase
603
+ async aztec_avm_getContractInstanceClassId(foreignAddress) {
545
604
  const address = addressFromSingle(foreignAddress);
546
- const instance = await this.handlerAsUtility().utilityGetContractInstance(address);
605
+ const instance = await this.handlerAsUtility().getContractInstance(address);
547
606
  return toForeignCallResult([
548
607
  toSingle(instance.currentContractClassId),
549
608
  // AVM requires an extra boolean indicating the instance was found
550
609
  toSingle(new Fr(1))
551
610
  ]);
552
611
  }
553
- async avmOpcodeGetContractInstanceInitializationHash(foreignAddress) {
612
+ // eslint-disable-next-line camelcase
613
+ async aztec_avm_getContractInstanceInitializationHash(foreignAddress) {
554
614
  const address = addressFromSingle(foreignAddress);
555
- const instance = await this.handlerAsUtility().utilityGetContractInstance(address);
615
+ const instance = await this.handlerAsUtility().getContractInstance(address);
556
616
  return toForeignCallResult([
557
617
  toSingle(instance.initializationHash),
558
618
  // AVM requires an extra boolean indicating the instance was found
559
619
  toSingle(new Fr(1))
560
620
  ]);
561
621
  }
562
- async avmOpcodeSender() {
563
- const sender = await this.handlerAsAvm().avmOpcodeSender();
622
+ // eslint-disable-next-line camelcase
623
+ async aztec_avm_sender() {
624
+ const sender = await this.handlerAsAvm().sender();
564
625
  return toForeignCallResult([
565
626
  toSingle(sender)
566
627
  ]);
567
628
  }
568
- async avmOpcodeEmitNullifier(foreignNullifier) {
629
+ // eslint-disable-next-line camelcase
630
+ async aztec_avm_emitNullifier(foreignNullifier) {
569
631
  const nullifier = fromSingle(foreignNullifier);
570
- await this.handlerAsAvm().avmOpcodeEmitNullifier(nullifier);
632
+ await this.handlerAsAvm().emitNullifier(nullifier);
571
633
  return toForeignCallResult([]);
572
634
  }
573
- async avmOpcodeEmitNoteHash(foreignNoteHash) {
635
+ // eslint-disable-next-line camelcase
636
+ async aztec_avm_emitNoteHash(foreignNoteHash) {
574
637
  const noteHash = fromSingle(foreignNoteHash);
575
- await this.handlerAsAvm().avmOpcodeEmitNoteHash(noteHash);
638
+ await this.handlerAsAvm().emitNoteHash(noteHash);
576
639
  return toForeignCallResult([]);
577
640
  }
578
- async avmOpcodeNullifierExists(foreignSiloedNullifier) {
641
+ // eslint-disable-next-line camelcase
642
+ async aztec_avm_nullifierExists(foreignSiloedNullifier) {
579
643
  const siloedNullifier = fromSingle(foreignSiloedNullifier);
580
- const exists = await this.handlerAsAvm().avmOpcodeNullifierExists(siloedNullifier);
644
+ const exists = await this.handlerAsAvm().nullifierExists(siloedNullifier);
581
645
  return toForeignCallResult([
582
646
  toSingle(new Fr(exists))
583
647
  ]);
584
648
  }
585
- async avmOpcodeAddress() {
586
- const contractAddress = await this.handlerAsAvm().avmOpcodeAddress();
649
+ // eslint-disable-next-line camelcase
650
+ async aztec_avm_address() {
651
+ const contractAddress = await this.handlerAsAvm().address();
587
652
  return toForeignCallResult([
588
653
  toSingle(contractAddress.toField())
589
654
  ]);
590
655
  }
591
- async avmOpcodeBlockNumber() {
592
- const blockNumber = await this.handlerAsAvm().avmOpcodeBlockNumber();
656
+ // eslint-disable-next-line camelcase
657
+ async aztec_avm_blockNumber() {
658
+ const blockNumber = await this.handlerAsAvm().blockNumber();
593
659
  return toForeignCallResult([
594
660
  toSingle(new Fr(blockNumber))
595
661
  ]);
596
662
  }
597
- async avmOpcodeTimestamp() {
598
- const timestamp = await this.handlerAsAvm().avmOpcodeTimestamp();
663
+ // eslint-disable-next-line camelcase
664
+ async aztec_avm_timestamp() {
665
+ const timestamp = await this.handlerAsAvm().timestamp();
599
666
  return toForeignCallResult([
600
667
  toSingle(new Fr(timestamp))
601
668
  ]);
602
669
  }
603
- async avmOpcodeIsStaticCall() {
604
- const isStaticCall = await this.handlerAsAvm().avmOpcodeIsStaticCall();
670
+ // eslint-disable-next-line camelcase
671
+ async aztec_avm_isStaticCall() {
672
+ const isStaticCall = await this.handlerAsAvm().isStaticCall();
605
673
  return toForeignCallResult([
606
674
  toSingle(new Fr(isStaticCall ? 1 : 0))
607
675
  ]);
608
676
  }
609
- async avmOpcodeChainId() {
610
- const chainId = await this.handlerAsAvm().avmOpcodeChainId();
677
+ // eslint-disable-next-line camelcase
678
+ async aztec_avm_chainId() {
679
+ const chainId = await this.handlerAsAvm().chainId();
611
680
  return toForeignCallResult([
612
681
  toSingle(chainId)
613
682
  ]);
614
683
  }
615
- async avmOpcodeVersion() {
616
- const version = await this.handlerAsAvm().avmOpcodeVersion();
684
+ // eslint-disable-next-line camelcase
685
+ async aztec_avm_version() {
686
+ const version = await this.handlerAsAvm().version();
617
687
  return toForeignCallResult([
618
688
  toSingle(version)
619
689
  ]);
620
690
  }
621
- avmOpcodeReturndataSize() {
691
+ // eslint-disable-next-line camelcase
692
+ aztec_avm_returndataSize() {
622
693
  throw new Error('Contract calls are forbidden inside a `TestEnvironment::public_context`, use `public_call` instead');
623
694
  }
624
- avmOpcodeReturndataCopy(_foreignRdOffset, _foreignCopySize) {
695
+ // eslint-disable-next-line camelcase
696
+ aztec_avm_returndataCopy(_foreignRdOffset, _foreignCopySize) {
625
697
  throw new Error('Contract calls are forbidden inside a `TestEnvironment::public_context`, use `public_call` instead');
626
698
  }
627
- avmOpcodeCall(_foreignL2Gas, _foreignDaGas, _foreignAddress, _foreignLength, _foreignArgs) {
699
+ // eslint-disable-next-line camelcase
700
+ aztec_avm_call(_foreignL2Gas, _foreignDaGas, _foreignAddress, _foreignLength, _foreignArgs) {
628
701
  throw new Error('Contract calls are forbidden inside a `TestEnvironment::public_context`, use `public_call` instead');
629
702
  }
630
- avmOpcodeStaticCall(_foreignL2Gas, _foreignDaGas, _foreignAddress, _foreignLength, _foreignArgs) {
703
+ // eslint-disable-next-line camelcase
704
+ aztec_avm_staticCall(_foreignL2Gas, _foreignDaGas, _foreignAddress, _foreignLength, _foreignArgs) {
631
705
  throw new Error('Contract calls are forbidden inside a `TestEnvironment::public_context`, use `public_call` instead');
632
706
  }
633
- avmOpcodeSuccessCopy() {
707
+ // eslint-disable-next-line camelcase
708
+ aztec_avm_successCopy() {
634
709
  throw new Error('Contract calls are forbidden inside a `TestEnvironment::public_context`, use `public_call` instead');
635
710
  }
636
- async txePrivateCallNewFlow(foreignFrom, foreignTargetContractAddress, foreignFunctionSelector, foreignArgs, foreignArgsHash, foreignIsStaticCall) {
711
+ // eslint-disable-next-line camelcase
712
+ async aztec_txe_privateCallNewFlow(foreignFrom, foreignTargetContractAddress, foreignFunctionSelector, foreignArgs, foreignArgsHash, foreignIsStaticCall) {
637
713
  const from = addressFromSingle(foreignFrom);
638
714
  const targetContractAddress = addressFromSingle(foreignTargetContractAddress);
639
715
  const functionSelector = FunctionSelector.fromField(fromSingle(foreignFunctionSelector));
640
716
  const args = fromArray(foreignArgs);
641
717
  const argsHash = fromSingle(foreignArgsHash);
642
718
  const isStaticCall = fromSingle(foreignIsStaticCall).toBool();
643
- const returnValues = await this.handlerAsTxe().txePrivateCallNewFlow(from, targetContractAddress, functionSelector, args, argsHash, isStaticCall, this.stateHandler.getCurrentJob());
719
+ const returnValues = await this.handlerAsTxe().privateCallNewFlow(from, targetContractAddress, functionSelector, args, argsHash, isStaticCall, this.stateHandler.getCurrentJob());
644
720
  // TODO(F-335): Avoid doing the following call here.
645
721
  await this.stateHandler.cycleJob();
646
722
  return toForeignCallResult([
647
723
  toArray(returnValues)
648
724
  ]);
649
725
  }
650
- async txeExecuteUtilityFunction(foreignTargetContractAddress, foreignFunctionSelector, foreignArgs) {
726
+ // eslint-disable-next-line camelcase
727
+ async aztec_txe_executeUtilityFunction(foreignTargetContractAddress, foreignFunctionSelector, foreignArgs) {
651
728
  const targetContractAddress = addressFromSingle(foreignTargetContractAddress);
652
729
  const functionSelector = FunctionSelector.fromField(fromSingle(foreignFunctionSelector));
653
730
  const args = fromArray(foreignArgs);
654
- const returnValues = await this.handlerAsTxe().txeExecuteUtilityFunction(targetContractAddress, functionSelector, args, this.stateHandler.getCurrentJob());
731
+ const returnValues = await this.handlerAsTxe().executeUtilityFunction(targetContractAddress, functionSelector, args, this.stateHandler.getCurrentJob());
655
732
  // TODO(F-335): Avoid doing the following call here.
656
733
  await this.stateHandler.cycleJob();
657
734
  return toForeignCallResult([
658
735
  toArray(returnValues)
659
736
  ]);
660
737
  }
661
- async txePublicCallNewFlow(foreignFrom, foreignAddress, foreignCalldata, foreignIsStaticCall) {
738
+ // eslint-disable-next-line camelcase
739
+ async aztec_txe_publicCallNewFlow(foreignFrom, foreignAddress, foreignCalldata, foreignIsStaticCall) {
662
740
  const from = addressFromSingle(foreignFrom);
663
741
  const address = addressFromSingle(foreignAddress);
664
742
  const calldata = fromArray(foreignCalldata);
665
743
  const isStaticCall = fromSingle(foreignIsStaticCall).toBool();
666
- const returnValues = await this.handlerAsTxe().txePublicCallNewFlow(from, address, calldata, isStaticCall);
744
+ const returnValues = await this.handlerAsTxe().publicCallNewFlow(from, address, calldata, isStaticCall);
667
745
  // TODO(F-335): Avoid doing the following call here.
668
746
  await this.stateHandler.cycleJob();
669
747
  return toForeignCallResult([
670
748
  toArray(returnValues)
671
749
  ]);
672
750
  }
673
- async privateGetSenderForTags() {
674
- const sender = await this.handlerAsPrivate().privateGetSenderForTags();
751
+ // eslint-disable-next-line camelcase
752
+ async aztec_prv_getSenderForTags() {
753
+ const sender = await this.handlerAsPrivate().getSenderForTags();
675
754
  // Return a Noir Option struct with `some` and `value` fields
676
755
  if (sender === undefined) {
677
756
  // No sender found, return Option with some=0 and value=0
@@ -687,15 +766,17 @@ export class RPCTranslator {
687
766
  ]);
688
767
  }
689
768
  }
690
- async privateSetSenderForTags(foreignSenderForTags) {
769
+ // eslint-disable-next-line camelcase
770
+ async aztec_prv_setSenderForTags(foreignSenderForTags) {
691
771
  const senderForTags = AztecAddress.fromField(fromSingle(foreignSenderForTags));
692
- await this.handlerAsPrivate().privateSetSenderForTags(senderForTags);
772
+ await this.handlerAsPrivate().setSenderForTags(senderForTags);
693
773
  return toForeignCallResult([]);
694
774
  }
695
- async privateGetNextAppTagAsSender(foreignSender, foreignRecipient) {
775
+ // eslint-disable-next-line camelcase
776
+ async aztec_prv_getNextAppTagAsSender(foreignSender, foreignRecipient) {
696
777
  const sender = AztecAddress.fromField(fromSingle(foreignSender));
697
778
  const recipient = AztecAddress.fromField(fromSingle(foreignRecipient));
698
- const nextAppTag = await this.handlerAsPrivate().privateGetNextAppTagAsSender(sender, recipient);
779
+ const nextAppTag = await this.handlerAsPrivate().getNextAppTagAsSender(sender, recipient);
699
780
  return toForeignCallResult([
700
781
  toSingle(nextAppTag.value)
701
782
  ]);