@aztec/txe 0.0.1-commit.9d2bcf6d → 0.0.1-commit.9ebd450e8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/dest/index.d.ts +1 -1
  2. package/dest/index.d.ts.map +1 -1
  3. package/dest/index.js +88 -54
  4. package/dest/oracle/interfaces.d.ts +32 -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 +30 -23
  10. package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -1
  11. package/dest/oracle/txe_oracle_top_level_context.js +156 -60
  12. package/dest/rpc_translator.d.ts +129 -83
  13. package/dest/rpc_translator.d.ts.map +1 -1
  14. package/dest/rpc_translator.js +464 -164
  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 +9 -8
  18. package/dest/state_machine/dummy_p2p_client.d.ts +18 -13
  19. package/dest/state_machine/dummy_p2p_client.d.ts.map +1 -1
  20. package/dest/state_machine/dummy_p2p_client.js +33 -18
  21. package/dest/state_machine/global_variable_builder.d.ts +9 -4
  22. package/dest/state_machine/global_variable_builder.d.ts.map +1 -1
  23. package/dest/state_machine/global_variable_builder.js +9 -3
  24. package/dest/state_machine/index.d.ts +7 -5
  25. package/dest/state_machine/index.d.ts.map +1 -1
  26. package/dest/state_machine/index.js +20 -11
  27. package/dest/state_machine/mock_epoch_cache.d.ts +20 -3
  28. package/dest/state_machine/mock_epoch_cache.d.ts.map +1 -1
  29. package/dest/state_machine/mock_epoch_cache.js +39 -2
  30. package/dest/state_machine/synchronizer.d.ts +5 -5
  31. package/dest/state_machine/synchronizer.d.ts.map +1 -1
  32. package/dest/state_machine/synchronizer.js +3 -3
  33. package/dest/txe_session.d.ts +54 -6
  34. package/dest/txe_session.d.ts.map +1 -1
  35. package/dest/txe_session.js +151 -27
  36. package/dest/util/encoding.d.ts +71 -1
  37. package/dest/util/encoding.d.ts.map +1 -1
  38. package/dest/util/encoding.js +4 -0
  39. package/dest/util/txe_public_contract_data_source.d.ts +2 -3
  40. package/dest/util/txe_public_contract_data_source.d.ts.map +1 -1
  41. package/dest/util/txe_public_contract_data_source.js +6 -25
  42. package/dest/utils/block_creation.d.ts +1 -1
  43. package/dest/utils/block_creation.d.ts.map +1 -1
  44. package/dest/utils/block_creation.js +3 -1
  45. package/package.json +15 -15
  46. package/src/index.ts +89 -52
  47. package/src/oracle/interfaces.ts +33 -32
  48. package/src/oracle/txe_oracle_public_context.ts +12 -12
  49. package/src/oracle/txe_oracle_top_level_context.ts +162 -117
  50. package/src/rpc_translator.ts +539 -196
  51. package/src/state_machine/archiver.ts +8 -5
  52. package/src/state_machine/dummy_p2p_client.ts +46 -24
  53. package/src/state_machine/global_variable_builder.ts +18 -3
  54. package/src/state_machine/index.ts +32 -10
  55. package/src/state_machine/mock_epoch_cache.ts +51 -3
  56. package/src/state_machine/synchronizer.ts +4 -4
  57. package/src/txe_session.ts +216 -75
  58. package/src/util/encoding.ts +5 -0
  59. package/src/util/txe_public_contract_data_source.ts +10 -38
  60. package/src/utils/block_creation.ts +3 -1
  61. package/dest/util/txe_contract_store.d.ts +0 -12
  62. package/dest/util/txe_contract_store.d.ts.map +0 -1
  63. package/dest/util/txe_contract_store.js +0 -22
  64. package/src/util/txe_contract_store.ts +0 -36
@@ -1,12 +1,11 @@
1
1
  import { Fr, Point } from '@aztec/aztec.js/fields';
2
- import { MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX } from '@aztec/constants';
2
+ import { MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX, PRIVATE_LOG_CIPHERTEXT_LEN } from '@aztec/constants';
3
3
  import { BlockNumber } from '@aztec/foundation/branded-types';
4
4
  import { packAsHintedNote } from '@aztec/pxe/simulator';
5
5
  import { EventSelector, FunctionSelector, NoteSelector } from '@aztec/stdlib/abi';
6
6
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
7
- import { BlockHash } from '@aztec/stdlib/block';
8
- import { addressFromSingle, arrayOfArraysToBoundedVecOfArrays, arrayToBoundedVec, bufferToU8Array, fromArray, fromSingle, fromUintArray, fromUintBoundedVec, toArray, toForeignCallResult, toSingle } from './util/encoding.js';
9
- const MAX_EVENT_LEN = 12; // This is MAX_MESSAGE_CONTENT_LEN - PRIVATE_EVENT_RESERVED_FIELDS
7
+ import { addressFromSingle, arrayOfArraysToBoundedVecOfArrays, arrayToBoundedVec, blockHashFromSingle, bufferToU8Array, fromArray, fromSingle, fromUintArray, fromUintBoundedVec, toArray, toForeignCallResult, toSingle } from './util/encoding.js';
8
+ const MAX_EVENT_LEN = 10; // This is MAX_MESSAGE_CONTENT_LEN - PRIVATE_EVENT_MSG_PLAINTEXT_RESERVED_FIELDS_LEN
10
9
  const MAX_PRIVATE_EVENTS_PER_TXE_QUERY = 5;
11
10
  export class UnavailableOracleError extends Error {
12
11
  constructor(oracleName){
@@ -61,59 +60,69 @@ export class RPCTranslator {
61
60
  return this.oracleHandler;
62
61
  }
63
62
  // TXE session state transition functions - these get handled by the state handler
64
- async txeSetTopLevelTXEContext() {
63
+ // eslint-disable-next-line camelcase
64
+ async aztec_txe_setTopLevelTXEContext() {
65
65
  await this.stateHandler.enterTopLevelState();
66
66
  return toForeignCallResult([]);
67
67
  }
68
- async txeSetPrivateTXEContext(foreignContractAddressIsSome, foreignContractAddressValue, foreignAnchorBlockNumberIsSome, foreignAnchorBlockNumberValue) {
68
+ // eslint-disable-next-line camelcase
69
+ async aztec_txe_setPrivateTXEContext(foreignContractAddressIsSome, foreignContractAddressValue, foreignAnchorBlockNumberIsSome, foreignAnchorBlockNumberValue) {
69
70
  const contractAddress = fromSingle(foreignContractAddressIsSome).toBool() ? AztecAddress.fromField(fromSingle(foreignContractAddressValue)) : undefined;
70
71
  const anchorBlockNumber = fromSingle(foreignAnchorBlockNumberIsSome).toBool() ? BlockNumber(fromSingle(foreignAnchorBlockNumberValue).toNumber()) : undefined;
71
72
  const privateContextInputs = await this.stateHandler.enterPrivateState(contractAddress, anchorBlockNumber);
72
73
  return toForeignCallResult(privateContextInputs.toFields().map(toSingle));
73
74
  }
74
- async txeSetPublicTXEContext(foreignContractAddressIsSome, foreignContractAddressValue) {
75
+ // eslint-disable-next-line camelcase
76
+ async aztec_txe_setPublicTXEContext(foreignContractAddressIsSome, foreignContractAddressValue) {
75
77
  const contractAddress = fromSingle(foreignContractAddressIsSome).toBool() ? AztecAddress.fromField(fromSingle(foreignContractAddressValue)) : undefined;
76
78
  await this.stateHandler.enterPublicState(contractAddress);
77
79
  return toForeignCallResult([]);
78
80
  }
79
- async txeSetUtilityTXEContext(foreignContractAddressIsSome, foreignContractAddressValue) {
81
+ // eslint-disable-next-line camelcase
82
+ async aztec_txe_setUtilityTXEContext(foreignContractAddressIsSome, foreignContractAddressValue) {
80
83
  const contractAddress = fromSingle(foreignContractAddressIsSome).toBool() ? AztecAddress.fromField(fromSingle(foreignContractAddressValue)) : undefined;
81
84
  await this.stateHandler.enterUtilityState(contractAddress);
82
85
  return toForeignCallResult([]);
83
86
  }
84
87
  // Other oracles - these get handled by the oracle handler
85
88
  // TXE-specific oracles
86
- txeGetDefaultAddress() {
87
- const defaultAddress = this.handlerAsTxe().txeGetDefaultAddress();
89
+ // eslint-disable-next-line camelcase
90
+ aztec_txe_getDefaultAddress() {
91
+ const defaultAddress = this.handlerAsTxe().getDefaultAddress();
88
92
  return toForeignCallResult([
89
93
  toSingle(defaultAddress)
90
94
  ]);
91
95
  }
92
- async txeGetNextBlockNumber() {
93
- const nextBlockNumber = await this.handlerAsTxe().txeGetNextBlockNumber();
96
+ // eslint-disable-next-line camelcase
97
+ async aztec_txe_getNextBlockNumber() {
98
+ const nextBlockNumber = await this.handlerAsTxe().getNextBlockNumber();
94
99
  return toForeignCallResult([
95
100
  toSingle(nextBlockNumber)
96
101
  ]);
97
102
  }
98
- async txeGetNextBlockTimestamp() {
99
- const nextBlockTimestamp = await this.handlerAsTxe().txeGetNextBlockTimestamp();
103
+ // eslint-disable-next-line camelcase
104
+ async aztec_txe_getNextBlockTimestamp() {
105
+ const nextBlockTimestamp = await this.handlerAsTxe().getNextBlockTimestamp();
100
106
  return toForeignCallResult([
101
107
  toSingle(nextBlockTimestamp)
102
108
  ]);
103
109
  }
104
- async txeAdvanceBlocksBy(foreignBlocks) {
110
+ // eslint-disable-next-line camelcase
111
+ async aztec_txe_advanceBlocksBy(foreignBlocks) {
105
112
  const blocks = fromSingle(foreignBlocks).toNumber();
106
- await this.handlerAsTxe().txeAdvanceBlocksBy(blocks);
113
+ await this.handlerAsTxe().advanceBlocksBy(blocks);
107
114
  return toForeignCallResult([]);
108
115
  }
109
- txeAdvanceTimestampBy(foreignDuration) {
116
+ // eslint-disable-next-line camelcase
117
+ aztec_txe_advanceTimestampBy(foreignDuration) {
110
118
  const duration = fromSingle(foreignDuration).toBigInt();
111
- this.handlerAsTxe().txeAdvanceTimestampBy(duration);
119
+ this.handlerAsTxe().advanceTimestampBy(duration);
112
120
  return toForeignCallResult([]);
113
121
  }
114
- async txeDeploy(artifact, instance, foreignSecret) {
122
+ // eslint-disable-next-line camelcase
123
+ async aztec_txe_deploy(artifact, instance, foreignSecret) {
115
124
  const secret = fromSingle(foreignSecret);
116
- await this.handlerAsTxe().txeDeploy(artifact, instance, secret);
125
+ await this.handlerAsTxe().deploy(artifact, instance, secret);
117
126
  return toForeignCallResult([
118
127
  toArray([
119
128
  instance.salt,
@@ -124,59 +133,107 @@ export class RPCTranslator {
124
133
  ])
125
134
  ]);
126
135
  }
127
- async txeCreateAccount(foreignSecret) {
136
+ // eslint-disable-next-line camelcase
137
+ async aztec_txe_createAccount(foreignSecret) {
128
138
  const secret = fromSingle(foreignSecret);
129
- const completeAddress = await this.handlerAsTxe().txeCreateAccount(secret);
139
+ const completeAddress = await this.handlerAsTxe().createAccount(secret);
130
140
  return toForeignCallResult([
131
141
  toSingle(completeAddress.address),
132
142
  ...completeAddress.publicKeys.toFields().map(toSingle)
133
143
  ]);
134
144
  }
135
- async txeAddAccount(artifact, instance, foreignSecret) {
145
+ // eslint-disable-next-line camelcase
146
+ async aztec_txe_addAccount(artifact, instance, foreignSecret) {
136
147
  const secret = fromSingle(foreignSecret);
137
- const completeAddress = await this.handlerAsTxe().txeAddAccount(artifact, instance, secret);
148
+ const completeAddress = await this.handlerAsTxe().addAccount(artifact, instance, secret);
138
149
  return toForeignCallResult([
139
150
  toSingle(completeAddress.address),
140
151
  ...completeAddress.publicKeys.toFields().map(toSingle)
141
152
  ]);
142
153
  }
143
- async txeAddAuthWitness(foreignAddress, foreignMessageHash) {
154
+ // eslint-disable-next-line camelcase
155
+ async aztec_txe_addAuthWitness(foreignAddress, foreignMessageHash) {
144
156
  const address = addressFromSingle(foreignAddress);
145
157
  const messageHash = fromSingle(foreignMessageHash);
146
- await this.handlerAsTxe().txeAddAuthWitness(address, messageHash);
158
+ await this.handlerAsTxe().addAuthWitness(address, messageHash);
147
159
  return toForeignCallResult([]);
148
160
  }
149
161
  // PXE oracles
150
- utilityAssertCompatibleOracleVersion(foreignVersion) {
151
- const version = fromSingle(foreignVersion).toNumber();
152
- this.handlerAsMisc().utilityAssertCompatibleOracleVersion(version);
162
+ // eslint-disable-next-line camelcase
163
+ aztec_utl_assertCompatibleOracleVersionV2(foreignMajor, foreignMinor) {
164
+ const major = fromSingle(foreignMajor).toNumber();
165
+ const minor = fromSingle(foreignMinor).toNumber();
166
+ this.handlerAsMisc().assertCompatibleOracleVersion(major, minor);
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
+ aztec_txe_getLastCallOffchainEffects() {
194
+ // This oracle returns all offchain effect payloads (messages, authwit requests, etc.) emitted by the last top-level call,
195
+ // MAX_OFFCHAIN_EFFECTS_PER_TXE_QUERY is arbitrarily set at 64 because we need a bound. Nothing inherent about it.
196
+ const MAX_OFFCHAIN_EFFECTS_PER_TXE_QUERY = 64;
197
+ // Must match MAX_OFFCHAIN_EFFECT_LEN in txe_oracles.nr.
198
+ const MAX_OFFCHAIN_EFFECT_LEN = 2 + PRIVATE_LOG_CIPHERTEXT_LEN;
199
+ const { effects } = this.stateHandler.getLastCallOffchainEffects();
200
+ if (effects.length > MAX_OFFCHAIN_EFFECTS_PER_TXE_QUERY) {
201
+ throw new Error(`${effects.length} offchain effects exceed max ${MAX_OFFCHAIN_EFFECTS_PER_TXE_QUERY}`);
202
+ }
203
+ if (effects.some((e)=>e.length > MAX_OFFCHAIN_EFFECT_LEN)) {
204
+ throw new Error(`Some offchain effect has length larger than max ${MAX_OFFCHAIN_EFFECT_LEN}`);
205
+ }
206
+ const rawArrayStorage = effects.map((e)=>e.concat(Array(MAX_OFFCHAIN_EFFECT_LEN - e.length).fill(new Fr(0)))).concat(Array(MAX_OFFCHAIN_EFFECTS_PER_TXE_QUERY - effects.length).fill(Array(MAX_OFFCHAIN_EFFECT_LEN).fill(new Fr(0)))).flat();
207
+ const effectLengths = effects.map((e)=>new Fr(e.length)).concat(Array(MAX_OFFCHAIN_EFFECTS_PER_TXE_QUERY - effects.length).fill(new Fr(0)));
208
+ const count = new Fr(effects.length);
209
+ return toForeignCallResult([
210
+ toArray(rawArrayStorage),
211
+ toArray(effectLengths),
212
+ toSingle(count)
213
+ ]);
214
+ }
215
+ // eslint-disable-next-line camelcase
216
+ aztec_txe_getLastCallContext() {
217
+ const { txHash, anchorBlockTimestamp } = this.stateHandler.getLastCallContext();
218
+ const isSome = txHash.isZero() ? 0 : 1;
219
+ return toForeignCallResult([
220
+ toSingle(isSome),
221
+ toSingle(txHash),
222
+ toSingle(new Fr(anchorBlockTimestamp))
223
+ ]);
224
+ }
225
+ // eslint-disable-next-line camelcase
226
+ async aztec_txe_getPrivateEvents(foreignSelector, foreignContractAddress, foreignScope) {
176
227
  const selector = EventSelector.fromField(fromSingle(foreignSelector));
177
228
  const contractAddress = addressFromSingle(foreignContractAddress);
178
229
  const scope = addressFromSingle(foreignScope);
179
- const events = await this.handlerAsTxe().txeGetPrivateEvents(selector, contractAddress, scope);
230
+ // TODO(F-335): Avoid doing the following 2 calls here.
231
+ {
232
+ await this.handlerAsTxe().syncContractNonOracleMethod(contractAddress, scope, this.stateHandler.getCurrentJob());
233
+ // We cycle job to commit the stores after the contract sync.
234
+ await this.stateHandler.cycleJob();
235
+ }
236
+ const events = await this.handlerAsTxe().getPrivateEvents(selector, contractAddress, scope);
180
237
  if (events.length > MAX_PRIVATE_EVENTS_PER_TXE_QUERY) {
181
238
  throw new Error(`Array of length ${events.length} larger than maxLen ${MAX_PRIVATE_EVENTS_PER_TXE_QUERY}`);
182
239
  }
@@ -194,48 +251,54 @@ export class RPCTranslator {
194
251
  toSingle(queryLength)
195
252
  ]);
196
253
  }
197
- privateStoreInExecutionCache(foreignValues, foreignHash) {
254
+ // eslint-disable-next-line camelcase
255
+ aztec_prv_setHashPreimage(foreignValues, foreignHash) {
198
256
  const values = fromArray(foreignValues);
199
257
  const hash = fromSingle(foreignHash);
200
- this.handlerAsPrivate().privateStoreInExecutionCache(values, hash);
258
+ this.handlerAsPrivate().setHashPreimage(values, hash);
201
259
  return toForeignCallResult([]);
202
260
  }
203
- async privateLoadFromExecutionCache(foreignHash) {
261
+ // eslint-disable-next-line camelcase
262
+ async aztec_prv_getHashPreimage(foreignHash) {
204
263
  const hash = fromSingle(foreignHash);
205
- const returns = await this.handlerAsPrivate().privateLoadFromExecutionCache(hash);
264
+ const returns = await this.handlerAsPrivate().getHashPreimage(hash);
206
265
  return toForeignCallResult([
207
266
  toArray(returns)
208
267
  ]);
209
268
  }
210
269
  // When the argument is a slice, noir automatically adds a length field to oracle call.
211
270
  // When the argument is an array, we add the field length manually to the signature.
212
- utilityDebugLog(foreignLevel, foreignMessage, _foreignLength, foreignFields) {
271
+ // eslint-disable-next-line camelcase
272
+ async aztec_utl_log(foreignLevel, foreignMessage, _foreignLength, foreignFields) {
213
273
  const level = fromSingle(foreignLevel).toNumber();
214
274
  const message = fromArray(foreignMessage).map((field)=>String.fromCharCode(field.toNumber())).join('');
215
275
  const fields = fromArray(foreignFields);
216
- this.handlerAsMisc().utilityDebugLog(level, message, fields);
276
+ await this.handlerAsMisc().log(level, message, fields);
217
277
  return toForeignCallResult([]);
218
278
  }
219
- async utilityStorageRead(foreignBlockHash, foreignContractAddress, foreignStartStorageSlot, foreignNumberOfElements) {
220
- const blockHash = new BlockHash(fromSingle(foreignBlockHash));
279
+ // eslint-disable-next-line camelcase
280
+ async aztec_utl_getFromPublicStorage(foreignBlockHash, foreignContractAddress, foreignStartStorageSlot, foreignNumberOfElements) {
281
+ const blockHash = blockHashFromSingle(foreignBlockHash);
221
282
  const contractAddress = addressFromSingle(foreignContractAddress);
222
283
  const startStorageSlot = fromSingle(foreignStartStorageSlot);
223
284
  const numberOfElements = fromSingle(foreignNumberOfElements).toNumber();
224
- const values = await this.handlerAsUtility().utilityStorageRead(blockHash, contractAddress, startStorageSlot, numberOfElements);
285
+ const values = await this.handlerAsUtility().getFromPublicStorage(blockHash, contractAddress, startStorageSlot, numberOfElements);
225
286
  return toForeignCallResult([
226
287
  toArray(values)
227
288
  ]);
228
289
  }
229
- async utilityGetPublicDataWitness(foreignBlockHash, foreignLeafSlot) {
230
- const blockHash = new BlockHash(fromSingle(foreignBlockHash));
290
+ // eslint-disable-next-line camelcase
291
+ async aztec_utl_getPublicDataWitness(foreignBlockHash, foreignLeafSlot) {
292
+ const blockHash = blockHashFromSingle(foreignBlockHash);
231
293
  const leafSlot = fromSingle(foreignLeafSlot);
232
- const witness = await this.handlerAsUtility().utilityGetPublicDataWitness(blockHash, leafSlot);
294
+ const witness = await this.handlerAsUtility().getPublicDataWitness(blockHash, leafSlot);
233
295
  if (!witness) {
234
296
  throw new Error(`Public data witness not found for slot ${leafSlot} at block ${blockHash.toString()}.`);
235
297
  }
236
298
  return toForeignCallResult(witness.toNoirRepresentation());
237
299
  }
238
- async utilityGetNotes(foreignOwnerIsSome, foreignOwnerValue, foreignStorageSlot, foreignNumSelects, foreignSelectByIndexes, foreignSelectByOffsets, foreignSelectByLengths, foreignSelectValues, foreignSelectComparators, foreignSortByIndexes, foreignSortByOffsets, foreignSortByLengths, foreignSortOrder, foreignLimit, foreignOffset, foreignStatus, foreignMaxNotes, foreignPackedHintedNoteLength) {
300
+ // eslint-disable-next-line camelcase
301
+ async aztec_utl_getNotes(foreignOwnerIsSome, foreignOwnerValue, foreignStorageSlot, foreignNumSelects, foreignSelectByIndexes, foreignSelectByOffsets, foreignSelectByLengths, foreignSelectValues, foreignSelectComparators, foreignSortByIndexes, foreignSortByOffsets, foreignSortByLengths, foreignSortOrder, foreignLimit, foreignOffset, foreignStatus, foreignMaxNotes, foreignPackedHintedNoteLength) {
239
302
  // Parse Option<AztecAddress>: ownerIsSome is 0 for None, 1 for Some
240
303
  const owner = fromSingle(foreignOwnerIsSome).toBool() ? AztecAddress.fromField(fromSingle(foreignOwnerValue)) : undefined;
241
304
  const storageSlot = fromSingle(foreignStorageSlot);
@@ -254,7 +317,7 @@ export class RPCTranslator {
254
317
  const status = fromSingle(foreignStatus).toNumber();
255
318
  const maxNotes = fromSingle(foreignMaxNotes).toNumber();
256
319
  const packedHintedNoteLength = fromSingle(foreignPackedHintedNoteLength).toNumber();
257
- const noteDatas = await this.handlerAsUtility().utilityGetNotes(owner, storageSlot, numSelects, selectByIndexes, selectByOffsets, selectByLengths, selectValues, selectComparators, sortByIndexes, sortByOffsets, sortByLengths, sortOrder, limit, offset, status);
320
+ const noteDatas = await this.handlerAsUtility().getNotes(owner, storageSlot, numSelects, selectByIndexes, selectByOffsets, selectByLengths, selectValues, selectComparators, sortByIndexes, sortByOffsets, sortByLengths, sortOrder, limit, offset, status);
258
321
  const returnDataAsArrayOfArrays = noteDatas.map((noteData)=>packAsHintedNote({
259
322
  contractAddress: noteData.contractAddress,
260
323
  owner: noteData.owner,
@@ -269,7 +332,8 @@ export class RPCTranslator {
269
332
  // At last we convert the array of arrays to a bounded vec of arrays
270
333
  return toForeignCallResult(arrayOfArraysToBoundedVecOfArrays(returnDataAsArrayOfForeignCallSingleArrays, maxNotes, packedHintedNoteLength));
271
334
  }
272
- privateNotifyCreatedNote(foreignOwner, foreignStorageSlot, foreignRandomness, foreignNoteTypeId, foreignNote, foreignNoteHash, foreignCounter) {
335
+ // eslint-disable-next-line camelcase
336
+ aztec_prv_notifyCreatedNote(foreignOwner, foreignStorageSlot, foreignRandomness, foreignNoteTypeId, foreignNote, foreignNoteHash, foreignCounter) {
273
337
  const owner = addressFromSingle(foreignOwner);
274
338
  const storageSlot = fromSingle(foreignStorageSlot);
275
339
  const randomness = fromSingle(foreignRandomness);
@@ -277,39 +341,44 @@ export class RPCTranslator {
277
341
  const note = fromArray(foreignNote);
278
342
  const noteHash = fromSingle(foreignNoteHash);
279
343
  const counter = fromSingle(foreignCounter).toNumber();
280
- this.handlerAsPrivate().privateNotifyCreatedNote(owner, storageSlot, randomness, noteTypeId, note, noteHash, counter);
344
+ this.handlerAsPrivate().notifyCreatedNote(owner, storageSlot, randomness, noteTypeId, note, noteHash, counter);
281
345
  return toForeignCallResult([]);
282
346
  }
283
- async privateNotifyNullifiedNote(foreignInnerNullifier, foreignNoteHash, foreignCounter) {
347
+ // eslint-disable-next-line camelcase
348
+ async aztec_prv_notifyNullifiedNote(foreignInnerNullifier, foreignNoteHash, foreignCounter) {
284
349
  const innerNullifier = fromSingle(foreignInnerNullifier);
285
350
  const noteHash = fromSingle(foreignNoteHash);
286
351
  const counter = fromSingle(foreignCounter).toNumber();
287
- await this.handlerAsPrivate().privateNotifyNullifiedNote(innerNullifier, noteHash, counter);
352
+ await this.handlerAsPrivate().notifyNullifiedNote(innerNullifier, noteHash, counter);
288
353
  return toForeignCallResult([]);
289
354
  }
290
- async privateNotifyCreatedNullifier(foreignInnerNullifier) {
355
+ // eslint-disable-next-line camelcase
356
+ async aztec_prv_notifyCreatedNullifier(foreignInnerNullifier) {
291
357
  const innerNullifier = fromSingle(foreignInnerNullifier);
292
- await this.handlerAsPrivate().privateNotifyCreatedNullifier(innerNullifier);
358
+ await this.handlerAsPrivate().notifyCreatedNullifier(innerNullifier);
293
359
  return toForeignCallResult([]);
294
360
  }
295
- async privateIsNullifierPending(foreignInnerNullifier, foreignContractAddress) {
361
+ // eslint-disable-next-line camelcase
362
+ async aztec_prv_isNullifierPending(foreignInnerNullifier, foreignContractAddress) {
296
363
  const innerNullifier = fromSingle(foreignInnerNullifier);
297
364
  const contractAddress = addressFromSingle(foreignContractAddress);
298
- const isPending = await this.handlerAsPrivate().privateIsNullifierPending(innerNullifier, contractAddress);
365
+ const isPending = await this.handlerAsPrivate().isNullifierPending(innerNullifier, contractAddress);
299
366
  return toForeignCallResult([
300
367
  toSingle(new Fr(isPending))
301
368
  ]);
302
369
  }
303
- async utilityCheckNullifierExists(foreignInnerNullifier) {
370
+ // eslint-disable-next-line camelcase
371
+ async aztec_utl_doesNullifierExist(foreignInnerNullifier) {
304
372
  const innerNullifier = fromSingle(foreignInnerNullifier);
305
- const exists = await this.handlerAsUtility().utilityCheckNullifierExists(innerNullifier);
373
+ const exists = await this.handlerAsUtility().doesNullifierExist(innerNullifier);
306
374
  return toForeignCallResult([
307
375
  toSingle(new Fr(exists))
308
376
  ]);
309
377
  }
310
- async utilityGetContractInstance(foreignAddress) {
378
+ // eslint-disable-next-line camelcase
379
+ async aztec_utl_getContractInstance(foreignAddress) {
311
380
  const address = addressFromSingle(foreignAddress);
312
- const instance = await this.handlerAsUtility().utilityGetContractInstance(address);
381
+ const instance = await this.handlerAsUtility().getContractInstance(address);
313
382
  return toForeignCallResult([
314
383
  instance.salt,
315
384
  instance.deployer.toField(),
@@ -318,9 +387,10 @@ export class RPCTranslator {
318
387
  ...instance.publicKeys.toFields()
319
388
  ].map(toSingle));
320
389
  }
321
- async utilityTryGetPublicKeysAndPartialAddress(foreignAddress) {
390
+ // eslint-disable-next-line camelcase
391
+ async aztec_utl_getPublicKeysAndPartialAddress(foreignAddress) {
322
392
  const address = addressFromSingle(foreignAddress);
323
- const result = await this.handlerAsUtility().utilityTryGetPublicKeysAndPartialAddress(address);
393
+ const result = await this.handlerAsUtility().getPublicKeysAndPartialAddress(address);
324
394
  // We are going to return a Noir Option struct to represent the possibility of null values. Options are a struct
325
395
  // with two fields: `some` (a boolean) and `value` (a field array in this case).
326
396
  if (result === undefined) {
@@ -340,26 +410,30 @@ export class RPCTranslator {
340
410
  ]);
341
411
  }
342
412
  }
343
- async utilityGetKeyValidationRequest(foreignPkMHash) {
413
+ // eslint-disable-next-line camelcase
414
+ async aztec_utl_getKeyValidationRequest(foreignPkMHash) {
344
415
  const pkMHash = fromSingle(foreignPkMHash);
345
- const keyValidationRequest = await this.handlerAsUtility().utilityGetKeyValidationRequest(pkMHash);
416
+ const keyValidationRequest = await this.handlerAsUtility().getKeyValidationRequest(pkMHash);
346
417
  return toForeignCallResult(keyValidationRequest.toFields().map(toSingle));
347
418
  }
348
- privateCallPrivateFunction(_foreignTargetContractAddress, _foreignFunctionSelector, _foreignArgsHash, _foreignSideEffectCounter, _foreignIsStaticCall) {
419
+ // eslint-disable-next-line camelcase
420
+ aztec_prv_callPrivateFunction(_foreignTargetContractAddress, _foreignFunctionSelector, _foreignArgsHash, _foreignSideEffectCounter, _foreignIsStaticCall) {
349
421
  throw new Error('Contract calls are forbidden inside a `TestEnvironment::private_context`, use `private_call` instead');
350
422
  }
351
- async utilityGetNullifierMembershipWitness(foreignBlockHash, foreignNullifier) {
352
- const blockHash = new BlockHash(fromSingle(foreignBlockHash));
423
+ // eslint-disable-next-line camelcase
424
+ async aztec_utl_getNullifierMembershipWitness(foreignBlockHash, foreignNullifier) {
425
+ const blockHash = blockHashFromSingle(foreignBlockHash);
353
426
  const nullifier = fromSingle(foreignNullifier);
354
- const witness = await this.handlerAsUtility().utilityGetNullifierMembershipWitness(blockHash, nullifier);
427
+ const witness = await this.handlerAsUtility().getNullifierMembershipWitness(blockHash, nullifier);
355
428
  if (!witness) {
356
429
  throw new Error(`Nullifier membership witness not found at block ${blockHash}.`);
357
430
  }
358
431
  return toForeignCallResult(witness.toNoirRepresentation());
359
432
  }
360
- async utilityGetAuthWitness(foreignMessageHash) {
433
+ // eslint-disable-next-line camelcase
434
+ async aztec_utl_getAuthWitness(foreignMessageHash) {
361
435
  const messageHash = fromSingle(foreignMessageHash);
362
- const authWitness = await this.handlerAsUtility().utilityGetAuthWitness(messageHash);
436
+ const authWitness = await this.handlerAsUtility().getAuthWitness(messageHash);
363
437
  if (!authWitness) {
364
438
  throw new Error(`Auth witness not found for message hash ${messageHash}.`);
365
439
  }
@@ -367,92 +441,152 @@ export class RPCTranslator {
367
441
  toArray(authWitness)
368
442
  ]);
369
443
  }
370
- privateNotifyEnqueuedPublicFunctionCall(_foreignTargetContractAddress, _foreignCalldataHash, _foreignSideEffectCounter, _foreignIsStaticCall) {
371
- throw new Error('Enqueueing public calls is not supported in TestEnvironment::private_context');
372
- }
373
- privateNotifySetPublicTeardownFunctionCall(_foreignTargetContractAddress, _foreignCalldataHash, _foreignSideEffectCounter, _foreignIsStaticCall) {
444
+ // eslint-disable-next-line camelcase
445
+ aztec_prv_assertValidPublicCalldata(_foreignCalldataHash) {
374
446
  throw new Error('Enqueueing public calls is not supported in TestEnvironment::private_context');
375
447
  }
376
- privateNotifySetMinRevertibleSideEffectCounter(_foreignMinRevertibleSideEffectCounter) {
448
+ // eslint-disable-next-line camelcase
449
+ aztec_prv_notifyRevertiblePhaseStart(_foreignMinRevertibleSideEffectCounter) {
377
450
  throw new Error('Enqueueing public calls is not supported in TestEnvironment::private_context');
378
451
  }
379
- async privateIsSideEffectCounterRevertible(foreignSideEffectCounter) {
452
+ // eslint-disable-next-line camelcase
453
+ async aztec_prv_isExecutionInRevertiblePhase(foreignSideEffectCounter) {
380
454
  const sideEffectCounter = fromSingle(foreignSideEffectCounter).toNumber();
381
- const isRevertible = await this.handlerAsPrivate().privateIsSideEffectCounterRevertible(sideEffectCounter);
455
+ const isRevertible = await this.handlerAsPrivate().isExecutionInRevertiblePhase(sideEffectCounter);
382
456
  return toForeignCallResult([
383
457
  toSingle(new Fr(isRevertible))
384
458
  ]);
385
459
  }
386
- utilityGetUtilityContext() {
387
- const context = this.handlerAsUtility().utilityGetUtilityContext();
460
+ // eslint-disable-next-line camelcase
461
+ aztec_utl_getUtilityContext() {
462
+ const context = this.handlerAsUtility().getUtilityContext();
388
463
  return toForeignCallResult(context.toNoirRepresentation());
389
464
  }
390
- async utilityGetBlockHeader(foreignBlockNumber) {
465
+ // eslint-disable-next-line camelcase
466
+ async aztec_utl_getBlockHeader(foreignBlockNumber) {
391
467
  const blockNumber = BlockNumber(fromSingle(foreignBlockNumber).toNumber());
392
- const header = await this.handlerAsUtility().utilityGetBlockHeader(blockNumber);
468
+ const header = await this.handlerAsUtility().getBlockHeader(blockNumber);
393
469
  if (!header) {
394
470
  throw new Error(`Block header not found for block ${blockNumber}.`);
395
471
  }
396
472
  return toForeignCallResult(header.toFields().map(toSingle));
397
473
  }
398
- async utilityGetNoteHashMembershipWitness(foreignAnchorBlockHash, foreignNoteHash) {
399
- const blockHash = new BlockHash(fromSingle(foreignAnchorBlockHash));
474
+ // eslint-disable-next-line camelcase
475
+ async aztec_utl_getNoteHashMembershipWitness(foreignAnchorBlockHash, foreignNoteHash) {
476
+ const blockHash = blockHashFromSingle(foreignAnchorBlockHash);
400
477
  const noteHash = fromSingle(foreignNoteHash);
401
- const witness = await this.handlerAsUtility().utilityGetNoteHashMembershipWitness(blockHash, noteHash);
478
+ const witness = await this.handlerAsUtility().getNoteHashMembershipWitness(blockHash, noteHash);
402
479
  if (!witness) {
403
480
  throw new Error(`Note hash ${noteHash} not found in the note hash tree at block ${blockHash.toString()}.`);
404
481
  }
405
482
  return toForeignCallResult(witness.toNoirRepresentation());
406
483
  }
407
- async utilityGetBlockHashMembershipWitness(foreignAnchorBlockHash, foreignBlockHash) {
408
- const anchorBlockHash = new BlockHash(fromSingle(foreignAnchorBlockHash));
409
- const blockHash = new BlockHash(fromSingle(foreignBlockHash));
410
- const witness = await this.handlerAsUtility().utilityGetBlockHashMembershipWitness(anchorBlockHash, blockHash);
484
+ // eslint-disable-next-line camelcase
485
+ async aztec_utl_getBlockHashMembershipWitness(foreignAnchorBlockHash, foreignBlockHash) {
486
+ const anchorBlockHash = blockHashFromSingle(foreignAnchorBlockHash);
487
+ const blockHash = blockHashFromSingle(foreignBlockHash);
488
+ const witness = await this.handlerAsUtility().getBlockHashMembershipWitness(anchorBlockHash, blockHash);
411
489
  if (!witness) {
412
490
  throw new Error(`Block hash ${blockHash.toString()} not found in the archive tree at anchor block ${anchorBlockHash.toString()}.`);
413
491
  }
414
492
  return toForeignCallResult(witness.toNoirRepresentation());
415
493
  }
416
- async utilityGetLowNullifierMembershipWitness(foreignBlockHash, foreignNullifier) {
417
- const blockHash = new BlockHash(fromSingle(foreignBlockHash));
494
+ // eslint-disable-next-line camelcase
495
+ async aztec_utl_getLowNullifierMembershipWitness(foreignBlockHash, foreignNullifier) {
496
+ const blockHash = blockHashFromSingle(foreignBlockHash);
418
497
  const nullifier = fromSingle(foreignNullifier);
419
- const witness = await this.handlerAsUtility().utilityGetLowNullifierMembershipWitness(blockHash, nullifier);
498
+ const witness = await this.handlerAsUtility().getLowNullifierMembershipWitness(blockHash, nullifier);
420
499
  if (!witness) {
421
500
  throw new Error(`Low nullifier witness not found for nullifier ${nullifier} at block ${blockHash}.`);
422
501
  }
423
502
  return toForeignCallResult(witness.toNoirRepresentation());
424
503
  }
425
- async utilityFetchTaggedLogs(foreignPendingTaggedLogArrayBaseSlot) {
504
+ // eslint-disable-next-line camelcase
505
+ async aztec_utl_getPendingTaggedLogs(foreignPendingTaggedLogArrayBaseSlot, foreignScope) {
426
506
  const pendingTaggedLogArrayBaseSlot = fromSingle(foreignPendingTaggedLogArrayBaseSlot);
427
- await this.handlerAsUtility().utilityFetchTaggedLogs(pendingTaggedLogArrayBaseSlot);
507
+ const scope = AztecAddress.fromField(fromSingle(foreignScope));
508
+ await this.handlerAsUtility().getPendingTaggedLogs(pendingTaggedLogArrayBaseSlot, scope);
428
509
  return toForeignCallResult([]);
429
510
  }
430
- async utilityValidateAndStoreEnqueuedNotesAndEvents(foreignContractAddress, foreignNoteValidationRequestsArrayBaseSlot, foreignEventValidationRequestsArrayBaseSlot) {
511
+ // eslint-disable-next-line camelcase
512
+ async aztec_utl_getPendingTaggedLogs_v2(foreignScope) {
513
+ const scope = AztecAddress.fromField(fromSingle(foreignScope));
514
+ const slot = await this.handlerAsUtility().getPendingTaggedLogsV2(scope);
515
+ return toForeignCallResult([
516
+ toSingle(slot)
517
+ ]);
518
+ }
519
+ // eslint-disable-next-line camelcase
520
+ async aztec_utl_validateAndStoreEnqueuedNotesAndEvents(foreignContractAddress, foreignNoteValidationRequestsArrayBaseSlot, foreignEventValidationRequestsArrayBaseSlot, foreignMaxNotePackedLen, foreignMaxEventSerializedLen, foreignScope) {
431
521
  const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
432
522
  const noteValidationRequestsArrayBaseSlot = fromSingle(foreignNoteValidationRequestsArrayBaseSlot);
433
523
  const eventValidationRequestsArrayBaseSlot = fromSingle(foreignEventValidationRequestsArrayBaseSlot);
434
- await this.handlerAsUtility().utilityValidateAndStoreEnqueuedNotesAndEvents(contractAddress, noteValidationRequestsArrayBaseSlot, eventValidationRequestsArrayBaseSlot);
524
+ const maxNotePackedLen = fromSingle(foreignMaxNotePackedLen).toNumber();
525
+ const maxEventSerializedLen = fromSingle(foreignMaxEventSerializedLen).toNumber();
526
+ const scope = AztecAddress.fromField(fromSingle(foreignScope));
527
+ await this.handlerAsUtility().validateAndStoreEnqueuedNotesAndEvents(contractAddress, noteValidationRequestsArrayBaseSlot, eventValidationRequestsArrayBaseSlot, maxNotePackedLen, maxEventSerializedLen, scope);
528
+ return toForeignCallResult([]);
529
+ }
530
+ // eslint-disable-next-line camelcase
531
+ async aztec_utl_validateAndStoreEnqueuedNotesAndEvents_v2(foreignNoteValidationRequestsArrayBaseSlot, foreignEventValidationRequestsArrayBaseSlot, foreignMaxNotePackedLen, foreignMaxEventSerializedLen, foreignScope) {
532
+ const noteValidationRequestsArrayBaseSlot = fromSingle(foreignNoteValidationRequestsArrayBaseSlot);
533
+ const eventValidationRequestsArrayBaseSlot = fromSingle(foreignEventValidationRequestsArrayBaseSlot);
534
+ const maxNotePackedLen = fromSingle(foreignMaxNotePackedLen).toNumber();
535
+ const maxEventSerializedLen = fromSingle(foreignMaxEventSerializedLen).toNumber();
536
+ const scope = AztecAddress.fromField(fromSingle(foreignScope));
537
+ await this.handlerAsUtility().validateAndStoreEnqueuedNotesAndEventsV2(noteValidationRequestsArrayBaseSlot, eventValidationRequestsArrayBaseSlot, maxNotePackedLen, maxEventSerializedLen, scope);
435
538
  return toForeignCallResult([]);
436
539
  }
437
- async utilityBulkRetrieveLogs(foreignContractAddress, foreignLogRetrievalRequestsArrayBaseSlot, foreignLogRetrievalResponsesArrayBaseSlot) {
540
+ // eslint-disable-next-line camelcase
541
+ async aztec_utl_getLogsByTag(foreignContractAddress, foreignLogRetrievalRequestsArrayBaseSlot, foreignLogRetrievalResponsesArrayBaseSlot, foreignScope) {
438
542
  const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
439
543
  const logRetrievalRequestsArrayBaseSlot = fromSingle(foreignLogRetrievalRequestsArrayBaseSlot);
440
544
  const logRetrievalResponsesArrayBaseSlot = fromSingle(foreignLogRetrievalResponsesArrayBaseSlot);
441
- await this.handlerAsUtility().utilityBulkRetrieveLogs(contractAddress, logRetrievalRequestsArrayBaseSlot, logRetrievalResponsesArrayBaseSlot);
545
+ const scope = AztecAddress.fromField(fromSingle(foreignScope));
546
+ await this.handlerAsUtility().getLogsByTag(contractAddress, logRetrievalRequestsArrayBaseSlot, logRetrievalResponsesArrayBaseSlot, scope);
547
+ return toForeignCallResult([]);
548
+ }
549
+ // eslint-disable-next-line camelcase
550
+ async aztec_utl_getMessageContextsByTxHash(foreignContractAddress, foreignMessageContextRequestsArrayBaseSlot, foreignMessageContextResponsesArrayBaseSlot, foreignScope) {
551
+ const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
552
+ const messageContextRequestsArrayBaseSlot = fromSingle(foreignMessageContextRequestsArrayBaseSlot);
553
+ const messageContextResponsesArrayBaseSlot = fromSingle(foreignMessageContextResponsesArrayBaseSlot);
554
+ const scope = AztecAddress.fromField(fromSingle(foreignScope));
555
+ await this.handlerAsUtility().getMessageContextsByTxHash(contractAddress, messageContextRequestsArrayBaseSlot, messageContextResponsesArrayBaseSlot, scope);
442
556
  return toForeignCallResult([]);
443
557
  }
444
- async utilityStoreCapsule(foreignContractAddress, foreignSlot, foreignCapsule) {
558
+ // eslint-disable-next-line camelcase
559
+ async aztec_utl_getLogsByTag_v2(foreignRequestArrayBaseSlot) {
560
+ const requestArrayBaseSlot = fromSingle(foreignRequestArrayBaseSlot);
561
+ const responseSlot = await this.handlerAsUtility().getLogsByTagV2(requestArrayBaseSlot);
562
+ return toForeignCallResult([
563
+ toSingle(responseSlot)
564
+ ]);
565
+ }
566
+ // eslint-disable-next-line camelcase
567
+ async aztec_utl_getMessageContextsByTxHash_v2(foreignRequestArrayBaseSlot) {
568
+ const requestArrayBaseSlot = fromSingle(foreignRequestArrayBaseSlot);
569
+ const responseSlot = await this.handlerAsUtility().getMessageContextsByTxHashV2(requestArrayBaseSlot);
570
+ return toForeignCallResult([
571
+ toSingle(responseSlot)
572
+ ]);
573
+ }
574
+ // eslint-disable-next-line camelcase
575
+ aztec_utl_setCapsule(foreignContractAddress, foreignSlot, foreignCapsule, foreignScope) {
445
576
  const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
446
577
  const slot = fromSingle(foreignSlot);
447
578
  const capsule = fromArray(foreignCapsule);
448
- await this.handlerAsUtility().utilityStoreCapsule(contractAddress, slot, capsule);
579
+ const scope = AztecAddress.fromField(fromSingle(foreignScope));
580
+ this.handlerAsUtility().setCapsule(contractAddress, slot, capsule, scope);
449
581
  return toForeignCallResult([]);
450
582
  }
451
- async utilityLoadCapsule(foreignContractAddress, foreignSlot, foreignTSize) {
583
+ // eslint-disable-next-line camelcase
584
+ async aztec_utl_getCapsule(foreignContractAddress, foreignSlot, foreignTSize, foreignScope) {
452
585
  const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
453
586
  const slot = fromSingle(foreignSlot);
454
587
  const tSize = fromSingle(foreignTSize).toNumber();
455
- const values = await this.handlerAsUtility().utilityLoadCapsule(contractAddress, slot);
588
+ const scope = AztecAddress.fromField(fromSingle(foreignScope));
589
+ const values = await this.handlerAsUtility().getCapsule(contractAddress, slot, scope);
456
590
  // We are going to return a Noir Option struct to represent the possibility of null values. Options are a struct
457
591
  // with two fields: `some` (a boolean) and `value` (a field array in this case).
458
592
  if (values === null) {
@@ -469,197 +603,361 @@ export class RPCTranslator {
469
603
  ]);
470
604
  }
471
605
  }
472
- async utilityDeleteCapsule(foreignContractAddress, foreignSlot) {
606
+ // eslint-disable-next-line camelcase
607
+ aztec_utl_deleteCapsule(foreignContractAddress, foreignSlot, foreignScope) {
473
608
  const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
474
609
  const slot = fromSingle(foreignSlot);
475
- await this.handlerAsUtility().utilityDeleteCapsule(contractAddress, slot);
610
+ const scope = AztecAddress.fromField(fromSingle(foreignScope));
611
+ this.handlerAsUtility().deleteCapsule(contractAddress, slot, scope);
476
612
  return toForeignCallResult([]);
477
613
  }
478
- async utilityCopyCapsule(foreignContractAddress, foreignSrcSlot, foreignDstSlot, foreignNumEntries) {
614
+ // eslint-disable-next-line camelcase
615
+ async aztec_utl_copyCapsule(foreignContractAddress, foreignSrcSlot, foreignDstSlot, foreignNumEntries, foreignScope) {
479
616
  const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
480
617
  const srcSlot = fromSingle(foreignSrcSlot);
481
618
  const dstSlot = fromSingle(foreignDstSlot);
482
619
  const numEntries = fromSingle(foreignNumEntries).toNumber();
483
- await this.handlerAsUtility().utilityCopyCapsule(contractAddress, srcSlot, dstSlot, numEntries);
620
+ const scope = AztecAddress.fromField(fromSingle(foreignScope));
621
+ await this.handlerAsUtility().copyCapsule(contractAddress, srcSlot, dstSlot, numEntries, scope);
622
+ return toForeignCallResult([]);
623
+ }
624
+ // eslint-disable-next-line camelcase
625
+ aztec_utl_pushEphemeral(foreignSlot, foreignElements) {
626
+ const slot = fromSingle(foreignSlot);
627
+ const elements = fromArray(foreignElements);
628
+ const newLen = this.handlerAsUtility().pushEphemeral(slot, elements);
629
+ return toForeignCallResult([
630
+ toSingle(new Fr(newLen))
631
+ ]);
632
+ }
633
+ // eslint-disable-next-line camelcase
634
+ aztec_utl_popEphemeral(foreignSlot) {
635
+ const slot = fromSingle(foreignSlot);
636
+ const element = this.handlerAsUtility().popEphemeral(slot);
637
+ return toForeignCallResult([
638
+ toArray(element)
639
+ ]);
640
+ }
641
+ // eslint-disable-next-line camelcase
642
+ aztec_utl_getEphemeral(foreignSlot, foreignIndex) {
643
+ const slot = fromSingle(foreignSlot);
644
+ const index = fromSingle(foreignIndex).toNumber();
645
+ const element = this.handlerAsUtility().getEphemeral(slot, index);
646
+ return toForeignCallResult([
647
+ toArray(element)
648
+ ]);
649
+ }
650
+ // eslint-disable-next-line camelcase
651
+ aztec_utl_setEphemeral(foreignSlot, foreignIndex, foreignElements) {
652
+ const slot = fromSingle(foreignSlot);
653
+ const index = fromSingle(foreignIndex).toNumber();
654
+ const elements = fromArray(foreignElements);
655
+ this.handlerAsUtility().setEphemeral(slot, index, elements);
656
+ return toForeignCallResult([]);
657
+ }
658
+ // eslint-disable-next-line camelcase
659
+ aztec_utl_getEphemeralLen(foreignSlot) {
660
+ const slot = fromSingle(foreignSlot);
661
+ const len = this.handlerAsUtility().getEphemeralLen(slot);
662
+ return toForeignCallResult([
663
+ toSingle(new Fr(len))
664
+ ]);
665
+ }
666
+ // eslint-disable-next-line camelcase
667
+ aztec_utl_removeEphemeral(foreignSlot, foreignIndex) {
668
+ const slot = fromSingle(foreignSlot);
669
+ const index = fromSingle(foreignIndex).toNumber();
670
+ this.handlerAsUtility().removeEphemeral(slot, index);
671
+ return toForeignCallResult([]);
672
+ }
673
+ // eslint-disable-next-line camelcase
674
+ aztec_utl_clearEphemeral(foreignSlot) {
675
+ const slot = fromSingle(foreignSlot);
676
+ this.handlerAsUtility().clearEphemeral(slot);
484
677
  return toForeignCallResult([]);
485
678
  }
486
679
  // TODO: I forgot to add a corresponding function here, when I introduced an oracle method to txe_oracle.ts.
487
680
  // 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
488
681
  // to implement this function here. Isn't there a way to programmatically identify that this is missing, given the
489
682
  // existence of a txe_oracle method?
490
- async utilityAes128Decrypt(foreignCiphertextBVecStorage, foreignCiphertextLength, foreignIv, foreignSymKey) {
683
+ // eslint-disable-next-line camelcase
684
+ async aztec_utl_decryptAes128(foreignCiphertextBVecStorage, foreignCiphertextLength, foreignIv, foreignSymKey) {
491
685
  const ciphertext = fromUintBoundedVec(foreignCiphertextBVecStorage, foreignCiphertextLength, 8);
492
686
  const iv = fromUintArray(foreignIv, 8);
493
687
  const symKey = fromUintArray(foreignSymKey, 8);
494
- const plaintextBuffer = await this.handlerAsUtility().utilityAes128Decrypt(ciphertext, iv, symKey);
495
- return toForeignCallResult(arrayToBoundedVec(bufferToU8Array(plaintextBuffer), foreignCiphertextBVecStorage.length));
688
+ // Noir Option<BoundedVec> is encoded as [is_some: Field, storage: Field[], length: Field].
689
+ try {
690
+ const plaintextBuffer = await this.handlerAsUtility().decryptAes128(ciphertext, iv, symKey);
691
+ const [storage, length] = arrayToBoundedVec(bufferToU8Array(plaintextBuffer), foreignCiphertextBVecStorage.length);
692
+ return toForeignCallResult([
693
+ toSingle(new Fr(1)),
694
+ storage,
695
+ length
696
+ ]);
697
+ } catch {
698
+ const zeroStorage = toArray(Array(foreignCiphertextBVecStorage.length).fill(new Fr(0)));
699
+ return toForeignCallResult([
700
+ toSingle(new Fr(0)),
701
+ zeroStorage,
702
+ toSingle(new Fr(0))
703
+ ]);
704
+ }
496
705
  }
497
- async utilityGetSharedSecret(foreignAddress, foreignEphPKField0, foreignEphPKField1, foreignEphPKField2) {
706
+ // eslint-disable-next-line camelcase
707
+ async aztec_utl_getSharedSecret(foreignAddress, foreignEphPKField0, foreignEphPKField1, foreignEphPKField2, foreignContractAddress) {
498
708
  const address = AztecAddress.fromField(fromSingle(foreignAddress));
499
709
  const ephPK = Point.fromFields([
500
710
  fromSingle(foreignEphPKField0),
501
711
  fromSingle(foreignEphPKField1),
502
712
  fromSingle(foreignEphPKField2)
503
713
  ]);
504
- const secret = await this.handlerAsUtility().utilityGetSharedSecret(address, ephPK);
505
- return toForeignCallResult(secret.toFields().map(toSingle));
714
+ const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
715
+ const secret = await this.handlerAsUtility().getSharedSecret(address, ephPK, contractAddress);
716
+ return toForeignCallResult([
717
+ toSingle(secret)
718
+ ]);
506
719
  }
507
- emitOffchainEffect(_foreignData) {
508
- throw new Error('Offchain effects are not yet supported in the TestEnvironment');
720
+ // eslint-disable-next-line camelcase
721
+ aztec_utl_setContractSyncCacheInvalid(foreignContractAddress, foreignScopes, foreignScopeCount) {
722
+ const contractAddress = addressFromSingle(foreignContractAddress);
723
+ const count = fromSingle(foreignScopeCount).toNumber();
724
+ const scopes = fromArray(foreignScopes).slice(0, count).map((f)=>new AztecAddress(f));
725
+ this.handlerAsUtility().setContractSyncCacheInvalid(contractAddress, scopes);
726
+ return Promise.resolve(toForeignCallResult([]));
727
+ }
728
+ // eslint-disable-next-line camelcase
729
+ aztec_utl_emitOffchainEffect(foreignData) {
730
+ // Record the raw payload against the currently-executing top-level call. The Noir side
731
+ // (via `env.offchain_messages()`) is responsible for decoding the protocol-reserved prefix
732
+ // (`OFFCHAIN_MESSAGE_IDENTIFIER`, recipient) and turning each payload into an `OffchainMessage` struct suitable
733
+ // for `offchain_receive`.
734
+ this.stateHandler.recordOffchainEffect(fromArray(foreignData));
735
+ return Promise.resolve(toForeignCallResult([]));
509
736
  }
510
737
  // AVM opcodes
511
- avmOpcodeEmitUnencryptedLog(_foreignMessage) {
738
+ // eslint-disable-next-line camelcase
739
+ aztec_avm_emitPublicLog(_foreignMessage) {
512
740
  // TODO(#8811): Implement
513
741
  return toForeignCallResult([]);
514
742
  }
515
- async avmOpcodeStorageRead(foreignSlot, foreignContractAddress) {
743
+ // eslint-disable-next-line camelcase
744
+ async aztec_avm_storageRead(foreignSlot, foreignContractAddress) {
516
745
  const slot = fromSingle(foreignSlot);
517
746
  const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
518
- const value = (await this.handlerAsAvm().avmOpcodeStorageRead(slot, contractAddress)).value;
747
+ const value = (await this.handlerAsAvm().storageRead(slot, contractAddress)).value;
519
748
  return toForeignCallResult([
520
749
  toSingle(new Fr(value))
521
750
  ]);
522
751
  }
523
- async avmOpcodeStorageWrite(foreignSlot, foreignValue) {
752
+ // eslint-disable-next-line camelcase
753
+ async aztec_avm_storageWrite(foreignSlot, foreignValue) {
524
754
  const slot = fromSingle(foreignSlot);
525
755
  const value = fromSingle(foreignValue);
526
- await this.handlerAsAvm().avmOpcodeStorageWrite(slot, value);
756
+ await this.handlerAsAvm().storageWrite(slot, value);
527
757
  return toForeignCallResult([]);
528
758
  }
529
- async avmOpcodeGetContractInstanceDeployer(foreignAddress) {
759
+ // eslint-disable-next-line camelcase
760
+ async aztec_avm_getContractInstanceDeployer(foreignAddress) {
530
761
  const address = addressFromSingle(foreignAddress);
531
- const instance = await this.handlerAsUtility().utilityGetContractInstance(address);
762
+ const instance = await this.handlerAsUtility().getContractInstance(address);
532
763
  return toForeignCallResult([
533
764
  toSingle(instance.deployer),
534
765
  // AVM requires an extra boolean indicating the instance was found
535
766
  toSingle(new Fr(1))
536
767
  ]);
537
768
  }
538
- async avmOpcodeGetContractInstanceClassId(foreignAddress) {
769
+ // eslint-disable-next-line camelcase
770
+ async aztec_avm_getContractInstanceClassId(foreignAddress) {
539
771
  const address = addressFromSingle(foreignAddress);
540
- const instance = await this.handlerAsUtility().utilityGetContractInstance(address);
772
+ const instance = await this.handlerAsUtility().getContractInstance(address);
541
773
  return toForeignCallResult([
542
774
  toSingle(instance.currentContractClassId),
543
775
  // AVM requires an extra boolean indicating the instance was found
544
776
  toSingle(new Fr(1))
545
777
  ]);
546
778
  }
547
- async avmOpcodeGetContractInstanceInitializationHash(foreignAddress) {
779
+ // eslint-disable-next-line camelcase
780
+ async aztec_avm_getContractInstanceInitializationHash(foreignAddress) {
548
781
  const address = addressFromSingle(foreignAddress);
549
- const instance = await this.handlerAsUtility().utilityGetContractInstance(address);
782
+ const instance = await this.handlerAsUtility().getContractInstance(address);
550
783
  return toForeignCallResult([
551
784
  toSingle(instance.initializationHash),
552
785
  // AVM requires an extra boolean indicating the instance was found
553
786
  toSingle(new Fr(1))
554
787
  ]);
555
788
  }
556
- async avmOpcodeSender() {
557
- const sender = await this.handlerAsAvm().avmOpcodeSender();
789
+ // eslint-disable-next-line camelcase
790
+ async aztec_avm_sender() {
791
+ const sender = await this.handlerAsAvm().sender();
558
792
  return toForeignCallResult([
559
793
  toSingle(sender)
560
794
  ]);
561
795
  }
562
- async avmOpcodeEmitNullifier(foreignNullifier) {
796
+ // eslint-disable-next-line camelcase
797
+ async aztec_avm_emitNullifier(foreignNullifier) {
563
798
  const nullifier = fromSingle(foreignNullifier);
564
- await this.handlerAsAvm().avmOpcodeEmitNullifier(nullifier);
799
+ await this.handlerAsAvm().emitNullifier(nullifier);
565
800
  return toForeignCallResult([]);
566
801
  }
567
- async avmOpcodeEmitNoteHash(foreignNoteHash) {
802
+ // eslint-disable-next-line camelcase
803
+ async aztec_avm_emitNoteHash(foreignNoteHash) {
568
804
  const noteHash = fromSingle(foreignNoteHash);
569
- await this.handlerAsAvm().avmOpcodeEmitNoteHash(noteHash);
805
+ await this.handlerAsAvm().emitNoteHash(noteHash);
570
806
  return toForeignCallResult([]);
571
807
  }
572
- async avmOpcodeNullifierExists(foreignSiloedNullifier) {
808
+ // eslint-disable-next-line camelcase
809
+ async aztec_avm_nullifierExists(foreignSiloedNullifier) {
573
810
  const siloedNullifier = fromSingle(foreignSiloedNullifier);
574
- const exists = await this.handlerAsAvm().avmOpcodeNullifierExists(siloedNullifier);
811
+ const exists = await this.handlerAsAvm().nullifierExists(siloedNullifier);
575
812
  return toForeignCallResult([
576
813
  toSingle(new Fr(exists))
577
814
  ]);
578
815
  }
579
- async avmOpcodeAddress() {
580
- const contractAddress = await this.handlerAsAvm().avmOpcodeAddress();
816
+ // eslint-disable-next-line camelcase
817
+ async aztec_avm_address() {
818
+ const contractAddress = await this.handlerAsAvm().address();
581
819
  return toForeignCallResult([
582
820
  toSingle(contractAddress.toField())
583
821
  ]);
584
822
  }
585
- async avmOpcodeBlockNumber() {
586
- const blockNumber = await this.handlerAsAvm().avmOpcodeBlockNumber();
823
+ // eslint-disable-next-line camelcase
824
+ async aztec_avm_blockNumber() {
825
+ const blockNumber = await this.handlerAsAvm().blockNumber();
587
826
  return toForeignCallResult([
588
827
  toSingle(new Fr(blockNumber))
589
828
  ]);
590
829
  }
591
- async avmOpcodeTimestamp() {
592
- const timestamp = await this.handlerAsAvm().avmOpcodeTimestamp();
830
+ // eslint-disable-next-line camelcase
831
+ async aztec_avm_timestamp() {
832
+ const timestamp = await this.handlerAsAvm().timestamp();
593
833
  return toForeignCallResult([
594
834
  toSingle(new Fr(timestamp))
595
835
  ]);
596
836
  }
597
- async avmOpcodeIsStaticCall() {
598
- const isStaticCall = await this.handlerAsAvm().avmOpcodeIsStaticCall();
837
+ // eslint-disable-next-line camelcase
838
+ async aztec_avm_isStaticCall() {
839
+ const isStaticCall = await this.handlerAsAvm().isStaticCall();
599
840
  return toForeignCallResult([
600
841
  toSingle(new Fr(isStaticCall ? 1 : 0))
601
842
  ]);
602
843
  }
603
- async avmOpcodeChainId() {
604
- const chainId = await this.handlerAsAvm().avmOpcodeChainId();
844
+ // eslint-disable-next-line camelcase
845
+ async aztec_avm_chainId() {
846
+ const chainId = await this.handlerAsAvm().chainId();
605
847
  return toForeignCallResult([
606
848
  toSingle(chainId)
607
849
  ]);
608
850
  }
609
- async avmOpcodeVersion() {
610
- const version = await this.handlerAsAvm().avmOpcodeVersion();
851
+ // eslint-disable-next-line camelcase
852
+ async aztec_avm_version() {
853
+ const version = await this.handlerAsAvm().version();
611
854
  return toForeignCallResult([
612
855
  toSingle(version)
613
856
  ]);
614
857
  }
615
- avmOpcodeReturndataSize() {
858
+ // eslint-disable-next-line camelcase
859
+ aztec_avm_returndataSize() {
616
860
  throw new Error('Contract calls are forbidden inside a `TestEnvironment::public_context`, use `public_call` instead');
617
861
  }
618
- avmOpcodeReturndataCopy(_foreignRdOffset, _foreignCopySize) {
862
+ // eslint-disable-next-line camelcase
863
+ aztec_avm_returndataCopy(_foreignRdOffset, _foreignCopySize) {
619
864
  throw new Error('Contract calls are forbidden inside a `TestEnvironment::public_context`, use `public_call` instead');
620
865
  }
621
- avmOpcodeCall(_foreignL2Gas, _foreignDaGas, _foreignAddress, _foreignLength, _foreignArgs) {
866
+ // eslint-disable-next-line camelcase
867
+ aztec_avm_call(_foreignL2Gas, _foreignDaGas, _foreignAddress, _foreignLength, _foreignArgs) {
622
868
  throw new Error('Contract calls are forbidden inside a `TestEnvironment::public_context`, use `public_call` instead');
623
869
  }
624
- avmOpcodeStaticCall(_foreignL2Gas, _foreignDaGas, _foreignAddress, _foreignLength, _foreignArgs) {
870
+ // eslint-disable-next-line camelcase
871
+ aztec_avm_staticCall(_foreignL2Gas, _foreignDaGas, _foreignAddress, _foreignLength, _foreignArgs) {
625
872
  throw new Error('Contract calls are forbidden inside a `TestEnvironment::public_context`, use `public_call` instead');
626
873
  }
627
- avmOpcodeSuccessCopy() {
874
+ // eslint-disable-next-line camelcase
875
+ aztec_avm_successCopy() {
628
876
  throw new Error('Contract calls are forbidden inside a `TestEnvironment::public_context`, use `public_call` instead');
629
877
  }
630
- async txePrivateCallNewFlow(foreignFrom, foreignTargetContractAddress, foreignFunctionSelector, foreignArgs, foreignArgsHash, foreignIsStaticCall) {
878
+ // eslint-disable-next-line camelcase
879
+ async aztec_txe_privateCallNewFlow(foreignFrom, foreignTargetContractAddress, foreignFunctionSelector, foreignArgs, foreignArgsHash, foreignIsStaticCall) {
631
880
  const from = addressFromSingle(foreignFrom);
632
881
  const targetContractAddress = addressFromSingle(foreignTargetContractAddress);
633
882
  const functionSelector = FunctionSelector.fromField(fromSingle(foreignFunctionSelector));
634
883
  const args = fromArray(foreignArgs);
635
884
  const argsHash = fromSingle(foreignArgsHash);
636
885
  const isStaticCall = fromSingle(foreignIsStaticCall).toBool();
637
- const returnValues = await this.handlerAsTxe().txePrivateCallNewFlow(from, targetContractAddress, functionSelector, args, argsHash, isStaticCall);
886
+ const returnValues = await this.stateHandler.withTopLevelCallTracking(async ()=>{
887
+ const { returnValues, offchainEffects } = await this.handlerAsTxe().privateCallNewFlow(from, targetContractAddress, functionSelector, args, argsHash, isStaticCall, this.stateHandler.getCurrentJob());
888
+ // Private execution collects offchain effects inside PXE's PrivateExecutionOracle rather than
889
+ // round-tripping them through `aztec_utl_emitOffchainEffect`, so the session buffer is empty
890
+ // at this point. Drain the effects from the execution tree into the session buffer so the
891
+ // next `env.offchain_messages()` call in the test sees them.
892
+ for (const data of offchainEffects){
893
+ this.stateHandler.recordOffchainEffect(data);
894
+ }
895
+ // TODO(F-335): Avoid doing the following call here.
896
+ await this.stateHandler.cycleJob();
897
+ if (isStaticCall) {
898
+ // Static calls revert their checkpoint and mine no block, so there is no tx hash to tag
899
+ // offchain effects with. Querying `getLastTxEffects()` here would return an unrelated
900
+ // predecessor tx.
901
+ return {
902
+ result: returnValues
903
+ };
904
+ }
905
+ const { txHash } = await this.handlerAsTxe().getLastTxEffects();
906
+ return {
907
+ result: returnValues,
908
+ txHash: txHash.hash
909
+ };
910
+ });
638
911
  return toForeignCallResult([
639
912
  toArray(returnValues)
640
913
  ]);
641
914
  }
642
- async txeSimulateUtilityFunction(foreignTargetContractAddress, foreignFunctionSelector, foreignArgs) {
915
+ // eslint-disable-next-line camelcase
916
+ async aztec_txe_executeUtilityFunction(foreignTargetContractAddress, foreignFunctionSelector, foreignArgs) {
643
917
  const targetContractAddress = addressFromSingle(foreignTargetContractAddress);
644
918
  const functionSelector = FunctionSelector.fromField(fromSingle(foreignFunctionSelector));
645
919
  const args = fromArray(foreignArgs);
646
- const returnValues = await this.handlerAsTxe().txeSimulateUtilityFunction(targetContractAddress, functionSelector, args);
920
+ const returnValues = await this.stateHandler.withTopLevelCallTracking(async ()=>{
921
+ const returnValues = await this.handlerAsTxe().executeUtilityFunction(targetContractAddress, functionSelector, args, this.stateHandler.getCurrentJob());
922
+ // TODO(F-335): Avoid doing the following call here.
923
+ await this.stateHandler.cycleJob();
924
+ return {
925
+ result: returnValues
926
+ };
927
+ });
647
928
  return toForeignCallResult([
648
929
  toArray(returnValues)
649
930
  ]);
650
931
  }
651
- async txePublicCallNewFlow(foreignFrom, foreignAddress, foreignCalldata, foreignIsStaticCall) {
932
+ // eslint-disable-next-line camelcase
933
+ async aztec_txe_publicCallNewFlow(foreignFrom, foreignAddress, foreignCalldata, foreignIsStaticCall) {
652
934
  const from = addressFromSingle(foreignFrom);
653
935
  const address = addressFromSingle(foreignAddress);
654
936
  const calldata = fromArray(foreignCalldata);
655
937
  const isStaticCall = fromSingle(foreignIsStaticCall).toBool();
656
- const returnValues = await this.handlerAsTxe().txePublicCallNewFlow(from, address, calldata, isStaticCall);
938
+ const returnValues = await this.stateHandler.withTopLevelCallTracking(async ()=>{
939
+ const returnValues = await this.handlerAsTxe().publicCallNewFlow(from, address, calldata, isStaticCall);
940
+ // TODO(F-335): Avoid doing the following call here.
941
+ await this.stateHandler.cycleJob();
942
+ if (isStaticCall) {
943
+ // See equivalent branch in `aztec_txe_privateCallNewFlow`.
944
+ return {
945
+ result: returnValues
946
+ };
947
+ }
948
+ const { txHash } = await this.handlerAsTxe().getLastTxEffects();
949
+ return {
950
+ result: returnValues,
951
+ txHash: txHash.hash
952
+ };
953
+ });
657
954
  return toForeignCallResult([
658
955
  toArray(returnValues)
659
956
  ]);
660
957
  }
661
- async privateGetSenderForTags() {
662
- const sender = await this.handlerAsPrivate().privateGetSenderForTags();
958
+ // eslint-disable-next-line camelcase
959
+ async aztec_prv_getSenderForTags() {
960
+ const sender = await this.handlerAsPrivate().getSenderForTags();
663
961
  // Return a Noir Option struct with `some` and `value` fields
664
962
  if (sender === undefined) {
665
963
  // No sender found, return Option with some=0 and value=0
@@ -675,15 +973,17 @@ export class RPCTranslator {
675
973
  ]);
676
974
  }
677
975
  }
678
- async privateSetSenderForTags(foreignSenderForTags) {
976
+ // eslint-disable-next-line camelcase
977
+ async aztec_prv_setSenderForTags(foreignSenderForTags) {
679
978
  const senderForTags = AztecAddress.fromField(fromSingle(foreignSenderForTags));
680
- await this.handlerAsPrivate().privateSetSenderForTags(senderForTags);
979
+ await this.handlerAsPrivate().setSenderForTags(senderForTags);
681
980
  return toForeignCallResult([]);
682
981
  }
683
- async privateGetNextAppTagAsSender(foreignSender, foreignRecipient) {
982
+ // eslint-disable-next-line camelcase
983
+ async aztec_prv_getNextAppTagAsSender(foreignSender, foreignRecipient) {
684
984
  const sender = AztecAddress.fromField(fromSingle(foreignSender));
685
985
  const recipient = AztecAddress.fromField(fromSingle(foreignRecipient));
686
- const nextAppTag = await this.handlerAsPrivate().privateGetNextAppTagAsSender(sender, recipient);
986
+ const nextAppTag = await this.handlerAsPrivate().getNextAppTagAsSender(sender, recipient);
687
987
  return toForeignCallResult([
688
988
  toSingle(nextAppTag.value)
689
989
  ]);