@aztec/pxe 0.0.1-commit.cd76b27 → 0.0.1-commit.ce4f8c4f2

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 (139) hide show
  1. package/dest/config/index.d.ts +2 -2
  2. package/dest/config/index.d.ts.map +1 -1
  3. package/dest/config/index.js +1 -1
  4. package/dest/contract_function_simulator/contract_function_simulator.d.ts +9 -3
  5. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  6. package/dest/contract_function_simulator/contract_function_simulator.js +33 -11
  7. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +7 -7
  8. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -1
  9. package/dest/contract_function_simulator/execution_tagging_index_cache.js +19 -11
  10. package/dest/contract_function_simulator/index.d.ts +2 -1
  11. package/dest/contract_function_simulator/index.d.ts.map +1 -1
  12. package/dest/contract_function_simulator/index.js +1 -0
  13. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +2 -3
  14. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
  15. package/dest/contract_function_simulator/noir-structs/event_validation_request.js +5 -4
  16. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +1 -1
  17. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
  18. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +1 -3
  19. package/dest/contract_function_simulator/noir-structs/message_tx_context.d.ts +16 -0
  20. package/dest/contract_function_simulator/noir-structs/message_tx_context.d.ts.map +1 -0
  21. package/dest/contract_function_simulator/noir-structs/message_tx_context.js +57 -0
  22. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +2 -4
  23. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
  24. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +3 -5
  25. package/dest/contract_function_simulator/oracle/interfaces.d.ts +50 -45
  26. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
  27. package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.d.ts +9 -0
  28. package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.d.ts.map +1 -0
  29. package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.js +42 -0
  30. package/dest/contract_function_simulator/oracle/oracle.d.ts +45 -44
  31. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
  32. package/dest/contract_function_simulator/oracle/oracle.js +163 -94
  33. package/dest/contract_function_simulator/oracle/private_execution.js +5 -3
  34. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +22 -47
  35. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  36. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +40 -80
  37. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +57 -39
  38. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  39. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +138 -63
  40. package/dest/contract_logging.d.ts +22 -0
  41. package/dest/contract_logging.d.ts.map +1 -0
  42. package/dest/contract_logging.js +23 -0
  43. package/dest/contract_sync/contract_sync_service.d.ts +5 -3
  44. package/dest/contract_sync/contract_sync_service.d.ts.map +1 -1
  45. package/dest/contract_sync/contract_sync_service.js +47 -30
  46. package/dest/entrypoints/client/bundle/index.d.ts +2 -1
  47. package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
  48. package/dest/entrypoints/client/bundle/index.js +1 -0
  49. package/dest/entrypoints/client/lazy/index.d.ts +2 -1
  50. package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
  51. package/dest/entrypoints/client/lazy/index.js +1 -0
  52. package/dest/logs/log_service.d.ts +1 -1
  53. package/dest/logs/log_service.d.ts.map +1 -1
  54. package/dest/logs/log_service.js +4 -4
  55. package/dest/messages/message_context_service.d.ts +17 -0
  56. package/dest/messages/message_context_service.d.ts.map +1 -0
  57. package/dest/messages/message_context_service.js +36 -0
  58. package/dest/oracle_version.d.ts +2 -2
  59. package/dest/oracle_version.js +3 -3
  60. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +4 -3
  61. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -1
  62. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.js +125 -64
  63. package/dest/private_kernel/hints/test_utils.d.ts +122 -0
  64. package/dest/private_kernel/hints/test_utils.d.ts.map +1 -0
  65. package/dest/private_kernel/hints/test_utils.js +203 -0
  66. package/dest/private_kernel/private_kernel_execution_prover.d.ts +1 -1
  67. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
  68. package/dest/private_kernel/private_kernel_execution_prover.js +13 -5
  69. package/dest/private_kernel/private_kernel_oracle.d.ts +6 -2
  70. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
  71. package/dest/private_kernel/private_kernel_oracle.js +7 -3
  72. package/dest/pxe.d.ts +8 -4
  73. package/dest/pxe.d.ts.map +1 -1
  74. package/dest/pxe.js +55 -33
  75. package/dest/storage/contract_store/contract_store.d.ts +42 -15
  76. package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
  77. package/dest/storage/contract_store/contract_store.js +140 -64
  78. package/dest/storage/metadata.d.ts +1 -1
  79. package/dest/storage/metadata.js +1 -1
  80. package/dest/storage/tagging_store/recipient_tagging_store.d.ts +6 -6
  81. package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -1
  82. package/dest/storage/tagging_store/sender_tagging_store.d.ts +29 -28
  83. package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
  84. package/dest/storage/tagging_store/sender_tagging_store.js +141 -115
  85. package/dest/tagging/index.d.ts +3 -3
  86. package/dest/tagging/index.d.ts.map +1 -1
  87. package/dest/tagging/index.js +1 -1
  88. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +4 -5
  89. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -1
  90. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +3 -3
  91. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +6 -7
  92. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -1
  93. package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +12 -11
  94. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +4 -8
  95. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
  96. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +13 -7
  97. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +4 -3
  98. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -1
  99. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +20 -10
  100. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +5 -7
  101. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -1
  102. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +36 -24
  103. package/package.json +16 -16
  104. package/src/config/index.ts +1 -1
  105. package/src/contract_function_simulator/contract_function_simulator.ts +51 -20
  106. package/src/contract_function_simulator/execution_tagging_index_cache.ts +19 -14
  107. package/src/contract_function_simulator/index.ts +1 -0
  108. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +8 -5
  109. package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +1 -4
  110. package/src/contract_function_simulator/noir-structs/message_tx_context.ts +55 -0
  111. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +3 -6
  112. package/src/contract_function_simulator/oracle/interfaces.ts +54 -54
  113. package/src/contract_function_simulator/oracle/legacy_oracle_mappings.ts +135 -0
  114. package/src/contract_function_simulator/oracle/oracle.ts +176 -138
  115. package/src/contract_function_simulator/oracle/private_execution.ts +4 -4
  116. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +45 -99
  117. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +200 -80
  118. package/src/contract_logging.ts +39 -0
  119. package/src/contract_sync/contract_sync_service.ts +67 -38
  120. package/src/entrypoints/client/bundle/index.ts +1 -0
  121. package/src/entrypoints/client/lazy/index.ts +1 -0
  122. package/src/logs/log_service.ts +10 -5
  123. package/src/messages/message_context_service.ts +45 -0
  124. package/src/oracle_version.ts +3 -3
  125. package/src/private_kernel/hints/private_kernel_reset_private_inputs_builder.ts +157 -110
  126. package/src/private_kernel/hints/test_utils.ts +325 -0
  127. package/src/private_kernel/private_kernel_execution_prover.ts +13 -6
  128. package/src/private_kernel/private_kernel_oracle.ts +7 -7
  129. package/src/pxe.ts +74 -34
  130. package/src/storage/contract_store/contract_store.ts +170 -71
  131. package/src/storage/metadata.ts +1 -1
  132. package/src/storage/tagging_store/recipient_tagging_store.ts +9 -5
  133. package/src/storage/tagging_store/sender_tagging_store.ts +185 -138
  134. package/src/tagging/index.ts +2 -2
  135. package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +3 -6
  136. package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +10 -15
  137. package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +23 -10
  138. package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +26 -11
  139. package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +27 -26
@@ -76,12 +76,12 @@ export async function executePrivateFunction(
76
76
 
77
77
  const contractClassLogs = privateExecutionOracle.getContractClassLogs();
78
78
 
79
- const rawReturnValues = await privateExecutionOracle.privateLoadFromExecutionCache(publicInputs.returnsHash);
79
+ const rawReturnValues = await privateExecutionOracle.loadFromExecutionCache(publicInputs.returnsHash);
80
80
 
81
81
  const newNotes = privateExecutionOracle.getNewNotes();
82
82
  const noteHashNullifierCounterMap = privateExecutionOracle.getNoteHashNullifierCounterMap();
83
83
  const offchainEffects = privateExecutionOracle.getOffchainEffects();
84
- const preTags = privateExecutionOracle.getUsedPreTags();
84
+ const taggingIndexRanges = privateExecutionOracle.getUsedTaggingIndexRanges();
85
85
  const nestedExecutionResults = privateExecutionOracle.getNestedExecutionResults();
86
86
 
87
87
  let timerSubtractionList = nestedExecutionResults;
@@ -103,8 +103,8 @@ export async function executePrivateFunction(
103
103
  newNotes,
104
104
  noteHashNullifierCounterMap,
105
105
  rawReturnValues,
106
- offchainEffects,
107
- preTags,
106
+ offchainEffects.map(e => ({ data: e.data })),
107
+ taggingIndexRanges,
108
108
  nestedExecutionResults,
109
109
  contractClassLogs,
110
110
  {
@@ -14,7 +14,7 @@ import {
14
14
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
15
15
  import { siloNullifier } from '@aztec/stdlib/hash';
16
16
  import { PrivateContextInputs } from '@aztec/stdlib/kernel';
17
- import { type ContractClassLog, DirectionalAppTaggingSecret, type PreTag } from '@aztec/stdlib/logs';
17
+ import { type ContractClassLog, ExtendedDirectionalAppTaggingSecret, type TaggingIndexRange } from '@aztec/stdlib/logs';
18
18
  import { Tag } from '@aztec/stdlib/logs';
19
19
  import { Note, type NoteStatus } from '@aztec/stdlib/note';
20
20
  import {
@@ -26,7 +26,6 @@ import {
26
26
  } from '@aztec/stdlib/tx';
27
27
 
28
28
  import type { AccessScopes } from '../../access_scopes.js';
29
- import type { ContractSyncService } from '../../contract_sync/contract_sync_service.js';
30
29
  import { NoteService } from '../../notes/note_service.js';
31
30
  import type { SenderTaggingStore } from '../../storage/tagging_store/sender_tagging_store.js';
32
31
  import { syncSenderTaggingIndexes } from '../../tagging/index.js';
@@ -49,7 +48,6 @@ export type PrivateExecutionOracleArgs = Omit<UtilityExecutionOracleArgs, 'contr
49
48
  noteCache: ExecutionNoteCache;
50
49
  taggingIndexCache: ExecutionTaggingIndexCache;
51
50
  senderTaggingStore: SenderTaggingStore;
52
- contractSyncService: ContractSyncService;
53
51
  totalPublicCalldataCount?: number;
54
52
  sideEffectCounter?: number;
55
53
  senderForTags?: AztecAddress;
@@ -73,7 +71,6 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
73
71
  private newNotes: NoteAndSlot[] = [];
74
72
  private noteHashNullifierCounterMap: Map<number, number> = new Map();
75
73
  private contractClassLogs: CountedContractClassLog[] = [];
76
- private offchainEffects: { data: Fr[] }[] = [];
77
74
  private nestedExecutionResults: PrivateCallExecutionResult[] = [];
78
75
 
79
76
  private readonly argsHash: Fr;
@@ -84,7 +81,6 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
84
81
  private readonly noteCache: ExecutionNoteCache;
85
82
  private readonly taggingIndexCache: ExecutionTaggingIndexCache;
86
83
  private readonly senderTaggingStore: SenderTaggingStore;
87
- private readonly contractSyncService: ContractSyncService;
88
84
  private totalPublicCalldataCount: number;
89
85
  protected sideEffectCounter: number;
90
86
  private senderForTags?: AztecAddress;
@@ -104,7 +100,6 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
104
100
  this.noteCache = args.noteCache;
105
101
  this.taggingIndexCache = args.taggingIndexCache;
106
102
  this.senderTaggingStore = args.senderTaggingStore;
107
- this.contractSyncService = args.contractSyncService;
108
103
  this.totalPublicCalldataCount = args.totalPublicCalldataCount ?? 0;
109
104
  this.sideEffectCounter = args.sideEffectCounter ?? 0;
110
105
  this.senderForTags = args.senderForTags;
@@ -159,17 +154,10 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
159
154
  }
160
155
 
161
156
  /**
162
- * Return the offchain effects emitted during this execution.
157
+ * Returns the tagging index ranges that were used in this execution (and that need to be stored in the db).
163
158
  */
164
- public getOffchainEffects() {
165
- return this.offchainEffects;
166
- }
167
-
168
- /**
169
- * Returns the pre-tags that were used in this execution (and that need to be stored in the db).
170
- */
171
- public getUsedPreTags(): PreTag[] {
172
- return this.taggingIndexCache.getUsedPreTags();
159
+ public getUsedTaggingIndexRanges(): TaggingIndexRange[] {
160
+ return this.taggingIndexCache.getUsedTaggingIndexRanges();
173
161
  }
174
162
 
175
163
  /**
@@ -189,7 +177,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
189
177
  * The value persists through nested calls, meaning all calls down the stack will use the same
190
178
  * 'senderForTags' value (unless it is replaced).
191
179
  */
192
- public privateGetSenderForTags(): Promise<AztecAddress | undefined> {
180
+ public getSenderForTags(): Promise<AztecAddress | undefined> {
193
181
  return Promise.resolve(this.senderForTags);
194
182
  }
195
183
 
@@ -204,7 +192,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
204
192
  * through nested calls, meaning all calls down the stack will use the same 'senderForTags'
205
193
  * value (unless it is replaced by another call to this setter).
206
194
  */
207
- public privateSetSenderForTags(senderForTags: AztecAddress): Promise<void> {
195
+ public setSenderForTags(senderForTags: AztecAddress): Promise<void> {
208
196
  this.senderForTags = senderForTags;
209
197
  return Promise.resolve();
210
198
  }
@@ -215,26 +203,30 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
215
203
  * @param recipient - The address receiving the log
216
204
  * @returns An app tag to be used in a log.
217
205
  */
218
- public async privateGetNextAppTagAsSender(sender: AztecAddress, recipient: AztecAddress): Promise<Tag> {
219
- const secret = await this.#calculateDirectionalAppTaggingSecret(this.contractAddress, sender, recipient);
206
+ public async getNextAppTagAsSender(sender: AztecAddress, recipient: AztecAddress): Promise<Tag> {
207
+ const extendedSecret = await this.#calculateExtendedDirectionalAppTaggingSecret(
208
+ this.contractAddress,
209
+ sender,
210
+ recipient,
211
+ );
220
212
 
221
- const index = await this.#getIndexToUseForSecret(secret);
222
- this.log.debug(
213
+ const index = await this.#getIndexToUseForSecret(extendedSecret);
214
+ this.logger.debug(
223
215
  `Incrementing tagging index for sender: ${sender}, recipient: ${recipient}, contract: ${this.contractAddress} to ${index}`,
224
216
  );
225
- this.taggingIndexCache.setLastUsedIndex(secret, index);
217
+ this.taggingIndexCache.setLastUsedIndex(extendedSecret, index);
226
218
 
227
- return Tag.compute({ secret, index });
219
+ return Tag.compute({ extendedSecret, index });
228
220
  }
229
221
 
230
- async #calculateDirectionalAppTaggingSecret(
222
+ async #calculateExtendedDirectionalAppTaggingSecret(
231
223
  contractAddress: AztecAddress,
232
224
  sender: AztecAddress,
233
225
  recipient: AztecAddress,
234
226
  ) {
235
227
  const senderCompleteAddress = await this.getCompleteAddressOrFail(sender);
236
228
  const senderIvsk = await this.keyStore.getMasterIncomingViewingSecretKey(sender);
237
- return DirectionalAppTaggingSecret.compute(
229
+ return ExtendedDirectionalAppTaggingSecret.compute(
238
230
  senderCompleteAddress,
239
231
  senderIvsk,
240
232
  recipient,
@@ -243,7 +235,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
243
235
  );
244
236
  }
245
237
 
246
- async #getIndexToUseForSecret(secret: DirectionalAppTaggingSecret): Promise<number> {
238
+ async #getIndexToUseForSecret(secret: ExtendedDirectionalAppTaggingSecret): Promise<number> {
247
239
  // If we have the tagging index in the cache, we use it. If not we obtain it from the execution data provider.
248
240
  const lastUsedIndexInTx = this.taggingIndexCache.getLastUsedIndex(secret);
249
241
 
@@ -255,7 +247,6 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
255
247
  // that'd be wasteful as most tagging secrets are not used in each tx.
256
248
  await syncSenderTaggingIndexes(
257
249
  secret,
258
- this.contractAddress,
259
250
  this.aztecNode,
260
251
  this.senderTaggingStore,
261
252
  await this.anchorBlockHeader.hash(),
@@ -274,7 +265,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
274
265
  * @param values - Values to store.
275
266
  * @returns The hash of the values.
276
267
  */
277
- public privateStoreInExecutionCache(values: Fr[], hash: Fr) {
268
+ public storeInExecutionCache(values: Fr[], hash: Fr) {
278
269
  return this.executionCache.store(values, hash);
279
270
  }
280
271
 
@@ -283,7 +274,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
283
274
  * @param hash - Hash of the values.
284
275
  * @returns The values.
285
276
  */
286
- public privateLoadFromExecutionCache(hash: Fr): Promise<Fr[]> {
277
+ public loadFromExecutionCache(hash: Fr): Promise<Fr[]> {
287
278
  const preimage = this.executionCache.getPreimage(hash);
288
279
  if (!preimage) {
289
280
  throw new Error(`Preimage for hash ${hash.toString()} not found in cache`);
@@ -291,12 +282,12 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
291
282
  return Promise.resolve(preimage);
292
283
  }
293
284
 
294
- override async utilityCheckNullifierExists(innerNullifier: Fr): Promise<boolean> {
285
+ override async checkNullifierExists(innerNullifier: Fr): Promise<boolean> {
295
286
  // This oracle must be overridden because while utility execution can only meaningfully check if a nullifier exists
296
287
  // in the synched block, during private execution there's also the possibility of it being pending, i.e. created
297
288
  // in the current transaction.
298
289
 
299
- this.log.debug(`Checking existence of inner nullifier ${innerNullifier}`, {
290
+ this.logger.debug(`Checking existence of inner nullifier ${innerNullifier}`, {
300
291
  contractAddress: this.contractAddress,
301
292
  });
302
293
 
@@ -304,7 +295,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
304
295
 
305
296
  return (
306
297
  this.noteCache.getNullifiers(this.contractAddress).has(nullifier) ||
307
- (await super.utilityCheckNullifierExists(innerNullifier))
298
+ (await super.checkNullifierExists(innerNullifier))
308
299
  );
309
300
  }
310
301
 
@@ -329,7 +320,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
329
320
  * @param status - The status of notes to fetch.
330
321
  * @returns Array of note data.
331
322
  */
332
- public override async utilityGetNotes(
323
+ public override async getNotes(
333
324
  owner: AztecAddress | undefined,
334
325
  storageSlot: Fr,
335
326
  numSelects: number,
@@ -375,7 +366,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
375
366
  offset,
376
367
  });
377
368
 
378
- this.log.debug(
369
+ this.logger.debug(
379
370
  `Returning ${notes.length} notes for ${this.callContext.contractAddress} at ${storageSlot}: ${notes
380
371
  .map(n => `${n.noteNonce.toString()}:[${n.note.items.map(i => i.toString()).join(',')}]`)
381
372
  .join(', ')}`,
@@ -395,7 +386,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
395
386
  * @param noteHash - A hash of the new note.
396
387
  * @returns
397
388
  */
398
- public privateNotifyCreatedNote(
389
+ public notifyCreatedNote(
399
390
  owner: AztecAddress,
400
391
  storageSlot: Fr,
401
392
  randomness: Fr,
@@ -404,7 +395,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
404
395
  noteHash: Fr,
405
396
  counter: number,
406
397
  ) {
407
- this.log.debug(`Notified of new note with inner hash ${noteHash}`, {
398
+ this.logger.debug(`Notified of new note with inner hash ${noteHash}`, {
408
399
  contractAddress: this.callContext.contractAddress,
409
400
  storageSlot,
410
401
  randomness,
@@ -436,7 +427,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
436
427
  * @param innerNullifier - The pending nullifier to add in the list (not yet siloed by contract address).
437
428
  * @param noteHash - A hash of the new note.
438
429
  */
439
- public async privateNotifyNullifiedNote(innerNullifier: Fr, noteHash: Fr, counter: number) {
430
+ public async notifyNullifiedNote(innerNullifier: Fr, noteHash: Fr, counter: number) {
440
431
  const nullifiedNoteHashCounter = await this.noteCache.nullifyNote(
441
432
  this.callContext.contractAddress,
442
433
  innerNullifier,
@@ -453,19 +444,19 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
453
444
  * @param innerNullifier - The pending nullifier to add in the list (not yet siloed by contract address).
454
445
  * @param noteHash - A hash of the new note.
455
446
  */
456
- public privateNotifyCreatedNullifier(innerNullifier: Fr) {
457
- this.log.debug(`Notified of new inner nullifier ${innerNullifier}`, { contractAddress: this.contractAddress });
447
+ public notifyCreatedNullifier(innerNullifier: Fr) {
448
+ this.logger.debug(`Notified of new inner nullifier ${innerNullifier}`, { contractAddress: this.contractAddress });
458
449
  return this.noteCache.nullifierCreated(this.callContext.contractAddress, innerNullifier);
459
450
  }
460
451
 
461
452
  /**
462
- * Check if a nullifier has been emitted in the same transaction, i.e. if privateNotifyCreatedNullifier has been
453
+ * Check if a nullifier has been emitted in the same transaction, i.e. if notifyCreatedNullifier has been
463
454
  * called for this inner nullifier from the contract with the specified address.
464
455
  * @param innerNullifier - The inner nullifier to check.
465
456
  * @param contractAddress - Address of the contract that emitted the nullifier.
466
457
  * @returns A boolean indicating whether the nullifier is pending or not.
467
458
  */
468
- public async privateIsNullifierPending(innerNullifier: Fr, contractAddress: AztecAddress): Promise<boolean> {
459
+ public async isNullifierPending(innerNullifier: Fr, contractAddress: AztecAddress): Promise<boolean> {
469
460
  const siloedNullifier = await siloNullifier(contractAddress, innerNullifier);
470
461
  const isNullifierPending = this.noteCache.getNullifiers(contractAddress).has(siloedNullifier.toBigInt());
471
462
  return Promise.resolve(isNullifierPending);
@@ -478,10 +469,10 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
478
469
  * @param log - The contract class log to be emitted.
479
470
  * @param counter - The contract class log's counter.
480
471
  */
481
- public privateNotifyCreatedContractClassLog(log: ContractClassLog, counter: number) {
472
+ public notifyCreatedContractClassLog(log: ContractClassLog, counter: number) {
482
473
  this.contractClassLogs.push(new CountedContractClassLog(log, counter));
483
474
  const text = log.toBuffer().toString('hex');
484
- this.log.verbose(
475
+ this.logger.verbose(
485
476
  `Emitted log from ContractClassRegistry: "${text.length > 100 ? text.slice(0, 100) + '...' : text}"`,
486
477
  );
487
478
  }
@@ -507,7 +498,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
507
498
  * @param isStaticCall - Whether the call is a static call.
508
499
  * @returns The execution result.
509
500
  */
510
- async privateCallPrivateFunction(
501
+ async callPrivateFunction(
511
502
  targetContractAddress: AztecAddress,
512
503
  functionSelector: FunctionSelector,
513
504
  argsHash: Fr,
@@ -521,28 +512,19 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
521
512
  }
522
513
 
523
514
  const simulatorSetupTimer = new Timer();
524
- this.log.debug(
515
+ this.logger.debug(
525
516
  `Calling private function ${targetContractAddress}:${functionSelector} from ${this.callContext.contractAddress}`,
526
517
  );
527
518
 
528
519
  isStaticCall = isStaticCall || this.callContext.isStaticCall;
529
520
 
530
- // When scopes are set and the target contract is a registered account (has keys in the keyStore),
531
- // expand scopes to include it so nested private calls can sync and read the contract's own notes.
532
- // We only expand for registered accounts because the log service needs the recipient's keys to derive
533
- // tagging secrets, which are only available for registered accounts.
534
- const expandedScopes =
535
- this.scopes !== 'ALL_SCOPES' && (await this.keyStore.hasAccount(targetContractAddress))
536
- ? [...this.scopes, targetContractAddress]
537
- : this.scopes;
538
-
539
521
  await this.contractSyncService.ensureContractSynced(
540
522
  targetContractAddress,
541
523
  functionSelector,
542
524
  this.utilityExecutor,
543
525
  this.anchorBlockHeader,
544
526
  this.jobId,
545
- expandedScopes,
527
+ this.scopes,
546
528
  );
547
529
 
548
530
  const targetArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(
@@ -575,12 +557,13 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
575
557
  senderAddressBookStore: this.senderAddressBookStore,
576
558
  capsuleStore: this.capsuleStore,
577
559
  privateEventStore: this.privateEventStore,
560
+ messageContextService: this.messageContextService,
578
561
  contractSyncService: this.contractSyncService,
579
562
  jobId: this.jobId,
580
563
  totalPublicCalldataCount: this.totalPublicCalldataCount,
581
564
  sideEffectCounter,
582
- log: this.log,
583
- scopes: expandedScopes,
565
+ log: this.logger,
566
+ scopes: this.scopes,
584
567
  senderForTags: this.senderForTags,
585
568
  simulator: this.simulator!,
586
569
  });
@@ -614,7 +597,8 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
614
597
  };
615
598
  }
616
599
 
617
- #onNewPublicFunctionCall(calldataHash: Fr) {
600
+ /** Validates the calldata preimage exists in the cache and checks cumulative calldata size is within limits. */
601
+ public validatePublicCalldata(calldataHash: Fr) {
618
602
  const calldata = this.executionCache.getPreimage(calldataHash);
619
603
  if (!calldata) {
620
604
  throw new Error('Calldata for public call not found in cache');
@@ -624,47 +608,14 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
624
608
  if (this.totalPublicCalldataCount > MAX_FR_CALLDATA_TO_ALL_ENQUEUED_CALLS) {
625
609
  throw new Error(`Too many total args to all enqueued public calls! (> ${MAX_FR_CALLDATA_TO_ALL_ENQUEUED_CALLS})`);
626
610
  }
627
- }
628
-
629
- /**
630
- * Verify relevant information when a public function is enqueued.
631
- * @param targetContractAddress - The address of the contract to call.
632
- * @param calldataHash - The hash of the function selector and arguments.
633
- * @param sideEffectCounter - The side effect counter at the start of the call.
634
- * @param isStaticCall - Whether the call is a static call.
635
- */
636
- public privateNotifyEnqueuedPublicFunctionCall(
637
- _targetContractAddress: AztecAddress,
638
- calldataHash: Fr,
639
- _sideEffectCounter: number,
640
- _isStaticCall: boolean,
641
- ) {
642
- this.#onNewPublicFunctionCall(calldataHash);
643
611
  return Promise.resolve();
644
612
  }
645
613
 
646
- /**
647
- * Verify relevant information when a public teardown function is set.
648
- * @param targetContractAddress - The address of the contract to call.
649
- * @param argsHash - The arguments hash to pass to the function.
650
- * @param sideEffectCounter - The side effect counter at the start of the call.
651
- * @param isStaticCall - Whether the call is a static call.
652
- */
653
- public privateNotifySetPublicTeardownFunctionCall(
654
- _targetContractAddress: AztecAddress,
655
- calldataHash: Fr,
656
- _sideEffectCounter: number,
657
- _isStaticCall: boolean,
658
- ) {
659
- this.#onNewPublicFunctionCall(calldataHash);
660
- return Promise.resolve();
661
- }
662
-
663
- public privateNotifySetMinRevertibleSideEffectCounter(minRevertibleSideEffectCounter: number): Promise<void> {
614
+ public notifyRevertiblePhaseStart(minRevertibleSideEffectCounter: number): Promise<void> {
664
615
  return this.noteCache.setMinRevertibleSideEffectCounter(minRevertibleSideEffectCounter);
665
616
  }
666
617
 
667
- public privateIsSideEffectCounterRevertible(sideEffectCounter: number): Promise<boolean> {
618
+ public inRevertiblePhase(sideEffectCounter: number): Promise<boolean> {
668
619
  return Promise.resolve(this.noteCache.isSideEffectCounterRevertible(sideEffectCounter));
669
620
  }
670
621
 
@@ -691,9 +642,4 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
691
642
  public getDebugFunctionName() {
692
643
  return this.contractStore.getDebugFunctionName(this.contractAddress, this.callContext.functionSelector);
693
644
  }
694
-
695
- public utilityEmitOffchainEffect(data: Fr[]): Promise<void> {
696
- this.offchainEffects.push({ data });
697
- return Promise.resolve();
698
- }
699
645
  }