@aztec/pxe 0.0.1-commit.023c3e5 → 0.0.1-commit.033589e

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 (167) hide show
  1. package/dest/access_scopes.d.ts +9 -0
  2. package/dest/access_scopes.d.ts.map +1 -0
  3. package/dest/access_scopes.js +6 -0
  4. package/dest/block_synchronizer/block_synchronizer.d.ts +4 -2
  5. package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
  6. package/dest/block_synchronizer/block_synchronizer.js +7 -1
  7. package/dest/config/package_info.js +1 -1
  8. package/dest/contract_function_simulator/contract_function_simulator.d.ts +54 -28
  9. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  10. package/dest/contract_function_simulator/contract_function_simulator.js +177 -71
  11. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +5 -5
  12. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -1
  13. package/dest/contract_function_simulator/execution_tagging_index_cache.js +3 -3
  14. package/dest/contract_function_simulator/noir-structs/event_validation_request.js +1 -1
  15. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +2 -2
  16. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
  17. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +1 -1
  18. package/dest/contract_function_simulator/oracle/interfaces.d.ts +44 -44
  19. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
  20. package/dest/contract_function_simulator/oracle/oracle.d.ts +44 -44
  21. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
  22. package/dest/contract_function_simulator/oracle/oracle.js +151 -96
  23. package/dest/contract_function_simulator/oracle/private_execution.js +1 -1
  24. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +55 -54
  25. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  26. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +100 -55
  27. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +60 -42
  28. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  29. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +91 -80
  30. package/dest/contract_logging.d.ts +22 -0
  31. package/dest/contract_logging.d.ts.map +1 -0
  32. package/dest/contract_logging.js +23 -0
  33. package/dest/contract_sync/contract_sync_service.d.ts +43 -0
  34. package/dest/contract_sync/contract_sync_service.d.ts.map +1 -0
  35. package/dest/contract_sync/contract_sync_service.js +97 -0
  36. package/dest/contract_sync/helpers.d.ts +29 -0
  37. package/dest/contract_sync/helpers.d.ts.map +1 -0
  38. package/dest/contract_sync/{index.js → helpers.js} +13 -12
  39. package/dest/debug/pxe_debug_utils.d.ts +14 -10
  40. package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
  41. package/dest/debug/pxe_debug_utils.js +16 -15
  42. package/dest/entrypoints/client/bundle/index.d.ts +4 -1
  43. package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
  44. package/dest/entrypoints/client/bundle/index.js +3 -0
  45. package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
  46. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  47. package/dest/entrypoints/client/bundle/utils.js +9 -1
  48. package/dest/entrypoints/client/lazy/index.d.ts +4 -1
  49. package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
  50. package/dest/entrypoints/client/lazy/index.js +3 -0
  51. package/dest/entrypoints/client/lazy/utils.d.ts +1 -1
  52. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  53. package/dest/entrypoints/client/lazy/utils.js +9 -1
  54. package/dest/entrypoints/server/index.d.ts +4 -2
  55. package/dest/entrypoints/server/index.d.ts.map +1 -1
  56. package/dest/entrypoints/server/index.js +3 -1
  57. package/dest/entrypoints/server/utils.js +9 -1
  58. package/dest/logs/log_service.d.ts +3 -2
  59. package/dest/logs/log_service.d.ts.map +1 -1
  60. package/dest/logs/log_service.js +11 -18
  61. package/dest/notes/note_service.d.ts +4 -3
  62. package/dest/notes/note_service.d.ts.map +1 -1
  63. package/dest/notes/note_service.js +3 -2
  64. package/dest/notes_filter.d.ts +25 -0
  65. package/dest/notes_filter.d.ts.map +1 -0
  66. package/dest/notes_filter.js +4 -0
  67. package/dest/oracle_version.d.ts +2 -2
  68. package/dest/oracle_version.js +3 -3
  69. package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts +4 -0
  70. package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts.map +1 -0
  71. package/dest/private_kernel/hints/{compute_tx_include_by_timestamp.js → compute_tx_expiration_timestamp.js} +12 -12
  72. package/dest/private_kernel/hints/index.d.ts +1 -1
  73. package/dest/private_kernel/hints/index.js +1 -1
  74. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +4 -3
  75. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -1
  76. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.js +129 -68
  77. package/dest/private_kernel/hints/test_utils.d.ts +122 -0
  78. package/dest/private_kernel/hints/test_utils.d.ts.map +1 -0
  79. package/dest/private_kernel/hints/test_utils.js +203 -0
  80. package/dest/private_kernel/private_kernel_execution_prover.d.ts +1 -1
  81. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
  82. package/dest/private_kernel/private_kernel_execution_prover.js +19 -11
  83. package/dest/private_kernel/private_kernel_oracle.d.ts +6 -2
  84. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
  85. package/dest/private_kernel/private_kernel_oracle.js +7 -3
  86. package/dest/pxe.d.ts +71 -24
  87. package/dest/pxe.d.ts.map +1 -1
  88. package/dest/pxe.js +100 -64
  89. package/dest/storage/contract_store/contract_store.d.ts +42 -15
  90. package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
  91. package/dest/storage/contract_store/contract_store.js +145 -69
  92. package/dest/storage/note_store/note_store.d.ts +3 -3
  93. package/dest/storage/note_store/note_store.d.ts.map +1 -1
  94. package/dest/storage/note_store/note_store.js +6 -4
  95. package/dest/storage/tagging_store/recipient_tagging_store.d.ts +6 -6
  96. package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -1
  97. package/dest/storage/tagging_store/sender_tagging_store.d.ts +5 -5
  98. package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
  99. package/dest/storage/tagging_store/sender_tagging_store.js +4 -4
  100. package/dest/tagging/get_all_logs_by_tags.d.ts +1 -1
  101. package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -1
  102. package/dest/tagging/get_all_logs_by_tags.js +17 -3
  103. package/dest/tagging/index.d.ts +2 -2
  104. package/dest/tagging/index.d.ts.map +1 -1
  105. package/dest/tagging/index.js +1 -1
  106. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +4 -5
  107. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -1
  108. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +7 -7
  109. package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +2 -2
  110. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +6 -7
  111. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -1
  112. package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +12 -11
  113. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +4 -8
  114. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
  115. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +3 -6
  116. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +4 -7
  117. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -1
  118. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +14 -15
  119. package/package.json +25 -16
  120. package/src/access_scopes.ts +9 -0
  121. package/src/block_synchronizer/block_synchronizer.ts +6 -0
  122. package/src/config/package_info.ts +1 -1
  123. package/src/contract_function_simulator/contract_function_simulator.ts +326 -131
  124. package/src/contract_function_simulator/execution_tagging_index_cache.ts +5 -5
  125. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +1 -1
  126. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +1 -1
  127. package/src/contract_function_simulator/oracle/interfaces.ts +43 -43
  128. package/src/contract_function_simulator/oracle/oracle.ts +145 -110
  129. package/src/contract_function_simulator/oracle/private_execution.ts +1 -1
  130. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +126 -132
  131. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +136 -86
  132. package/src/contract_logging.ts +39 -0
  133. package/src/contract_sync/contract_sync_service.ts +152 -0
  134. package/src/contract_sync/{index.ts → helpers.ts} +21 -21
  135. package/src/debug/pxe_debug_utils.ts +48 -18
  136. package/src/entrypoints/client/bundle/index.ts +3 -0
  137. package/src/entrypoints/client/bundle/utils.ts +9 -1
  138. package/src/entrypoints/client/lazy/index.ts +3 -0
  139. package/src/entrypoints/client/lazy/utils.ts +9 -1
  140. package/src/entrypoints/server/index.ts +3 -1
  141. package/src/entrypoints/server/utils.ts +7 -7
  142. package/src/logs/log_service.ts +18 -25
  143. package/src/notes/note_service.ts +4 -3
  144. package/src/notes_filter.ts +26 -0
  145. package/src/oracle_version.ts +3 -3
  146. package/src/private_kernel/hints/{compute_tx_include_by_timestamp.ts → compute_tx_expiration_timestamp.ts} +13 -13
  147. package/src/private_kernel/hints/index.ts +1 -1
  148. package/src/private_kernel/hints/private_kernel_reset_private_inputs_builder.ts +164 -117
  149. package/src/private_kernel/hints/test_utils.ts +325 -0
  150. package/src/private_kernel/private_kernel_execution_prover.ts +19 -12
  151. package/src/private_kernel/private_kernel_oracle.ts +7 -7
  152. package/src/pxe.ts +184 -113
  153. package/src/storage/contract_store/contract_store.ts +174 -75
  154. package/src/storage/note_store/note_store.ts +12 -5
  155. package/src/storage/tagging_store/recipient_tagging_store.ts +9 -5
  156. package/src/storage/tagging_store/sender_tagging_store.ts +8 -8
  157. package/src/tagging/get_all_logs_by_tags.ts +28 -4
  158. package/src/tagging/index.ts +1 -1
  159. package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +7 -10
  160. package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +2 -2
  161. package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +10 -15
  162. package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +4 -9
  163. package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +11 -20
  164. package/dest/contract_sync/index.d.ts +0 -23
  165. package/dest/contract_sync/index.d.ts.map +0 -1
  166. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +0 -4
  167. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts.map +0 -1
@@ -2,7 +2,6 @@ import { MAX_FR_CALLDATA_TO_ALL_ENQUEUED_CALLS, PRIVATE_CONTEXT_INPUTS_LENGTH }
2
2
  import { Fr } from '@aztec/foundation/curves/bn254';
3
3
  import { createLogger } from '@aztec/foundation/log';
4
4
  import { Timer } from '@aztec/foundation/timer';
5
- import type { KeyStore } from '@aztec/key-store';
6
5
  import { type CircuitSimulator, toACVMWitness } from '@aztec/simulator/client';
7
6
  import {
8
7
  type FunctionAbi,
@@ -12,33 +11,23 @@ import {
12
11
  type NoteSelector,
13
12
  countArgumentsSize,
14
13
  } from '@aztec/stdlib/abi';
15
- import type { AuthWitness } from '@aztec/stdlib/auth-witness';
16
14
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
17
15
  import { siloNullifier } from '@aztec/stdlib/hash';
18
- import type { AztecNode } from '@aztec/stdlib/interfaces/client';
19
16
  import { PrivateContextInputs } from '@aztec/stdlib/kernel';
20
- import { type ContractClassLog, DirectionalAppTaggingSecret, type PreTag } from '@aztec/stdlib/logs';
17
+ import { type ContractClassLog, ExtendedDirectionalAppTaggingSecret, type PreTag } from '@aztec/stdlib/logs';
21
18
  import { Tag } from '@aztec/stdlib/logs';
22
19
  import { Note, type NoteStatus } from '@aztec/stdlib/note';
23
20
  import {
24
- type BlockHeader,
25
21
  CallContext,
26
- Capsule,
27
22
  CountedContractClassLog,
28
23
  NoteAndSlot,
29
24
  PrivateCallExecutionResult,
30
25
  type TxContext,
31
26
  } from '@aztec/stdlib/tx';
32
27
 
33
- import { ensureContractSynced } from '../../contract_sync/index.js';
28
+ import type { AccessScopes } from '../../access_scopes.js';
29
+ import type { ContractSyncService } from '../../contract_sync/contract_sync_service.js';
34
30
  import { NoteService } from '../../notes/note_service.js';
35
- import type { AddressStore } from '../../storage/address_store/address_store.js';
36
- import type { CapsuleStore } from '../../storage/capsule_store/capsule_store.js';
37
- import type { ContractStore } from '../../storage/contract_store/contract_store.js';
38
- import type { NoteStore } from '../../storage/note_store/note_store.js';
39
- import type { PrivateEventStore } from '../../storage/private_event_store/private_event_store.js';
40
- import type { RecipientTaggingStore } from '../../storage/tagging_store/recipient_tagging_store.js';
41
- import type { SenderAddressBookStore } from '../../storage/tagging_store/sender_address_book_store.js';
42
31
  import type { SenderTaggingStore } from '../../storage/tagging_store/sender_tagging_store.js';
43
32
  import { syncSenderTaggingIndexes } from '../../tagging/index.js';
44
33
  import type { ExecutionNoteCache } from '../execution_note_cache.js';
@@ -47,7 +36,25 @@ import type { HashedValuesCache } from '../hashed_values_cache.js';
47
36
  import { pickNotes } from '../pick_notes.js';
48
37
  import type { IPrivateExecutionOracle, NoteData } from './interfaces.js';
49
38
  import { executePrivateFunction } from './private_execution.js';
50
- import { UtilityExecutionOracle } from './utility_execution_oracle.js';
39
+ import { UtilityExecutionOracle, type UtilityExecutionOracleArgs } from './utility_execution_oracle.js';
40
+
41
+ /** Args for PrivateExecutionOracle constructor. */
42
+ export type PrivateExecutionOracleArgs = Omit<UtilityExecutionOracleArgs, 'contractAddress'> & {
43
+ argsHash: Fr;
44
+ txContext: TxContext;
45
+ callContext: CallContext;
46
+ /** Needed to trigger contract synchronization before nested calls */
47
+ utilityExecutor: (call: FunctionCall, scopes: AccessScopes) => Promise<void>;
48
+ executionCache: HashedValuesCache;
49
+ noteCache: ExecutionNoteCache;
50
+ taggingIndexCache: ExecutionTaggingIndexCache;
51
+ senderTaggingStore: SenderTaggingStore;
52
+ contractSyncService: ContractSyncService;
53
+ totalPublicCalldataCount?: number;
54
+ sideEffectCounter?: number;
55
+ senderForTags?: AztecAddress;
56
+ simulator?: CircuitSimulator;
57
+ };
51
58
 
52
59
  /**
53
60
  * The execution oracle for the private part of a transaction.
@@ -69,56 +76,39 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
69
76
  private offchainEffects: { data: Fr[] }[] = [];
70
77
  private nestedExecutionResults: PrivateCallExecutionResult[] = [];
71
78
 
72
- constructor(
73
- private readonly argsHash: Fr,
74
- private readonly txContext: TxContext,
75
- private readonly callContext: CallContext,
76
- /** Header of a block whose state is used during private execution (not the block the transaction is included in). */
77
- protected override readonly anchorBlockHeader: BlockHeader,
78
- /** Needed to trigger contract synchronization before nested calls */
79
- private readonly utilityExecutor: (call: FunctionCall) => Promise<void>,
80
- /** List of transient auth witnesses to be used during this simulation */
81
- authWitnesses: AuthWitness[],
82
- capsules: Capsule[],
83
- private readonly executionCache: HashedValuesCache,
84
- private readonly noteCache: ExecutionNoteCache,
85
- private readonly taggingIndexCache: ExecutionTaggingIndexCache,
86
- contractStore: ContractStore,
87
- noteStore: NoteStore,
88
- keyStore: KeyStore,
89
- addressStore: AddressStore,
90
- aztecNode: AztecNode,
91
- private readonly senderTaggingStore: SenderTaggingStore,
92
- recipientTaggingStore: RecipientTaggingStore,
93
- senderAddressBookStore: SenderAddressBookStore,
94
- capsuleStore: CapsuleStore,
95
- privateEventStore: PrivateEventStore,
96
- jobId: string,
97
- private totalPublicCalldataCount: number = 0,
98
- protected sideEffectCounter: number = 0,
99
- log = createLogger('simulator:client_execution_context'),
100
- scopes?: AztecAddress[],
101
- private senderForTags?: AztecAddress,
102
- private simulator?: CircuitSimulator,
103
- ) {
104
- super(
105
- callContext.contractAddress,
106
- authWitnesses,
107
- capsules,
108
- anchorBlockHeader,
109
- contractStore,
110
- noteStore,
111
- keyStore,
112
- addressStore,
113
- aztecNode,
114
- recipientTaggingStore,
115
- senderAddressBookStore,
116
- capsuleStore,
117
- privateEventStore,
118
- jobId,
119
- log,
120
- scopes,
121
- );
79
+ private readonly argsHash: Fr;
80
+ private readonly txContext: TxContext;
81
+ private readonly callContext: CallContext;
82
+ private readonly utilityExecutor: (call: FunctionCall, scopes: AccessScopes) => Promise<void>;
83
+ private readonly executionCache: HashedValuesCache;
84
+ private readonly noteCache: ExecutionNoteCache;
85
+ private readonly taggingIndexCache: ExecutionTaggingIndexCache;
86
+ private readonly senderTaggingStore: SenderTaggingStore;
87
+ private readonly contractSyncService: ContractSyncService;
88
+ private totalPublicCalldataCount: number;
89
+ protected sideEffectCounter: number;
90
+ private senderForTags?: AztecAddress;
91
+ private readonly simulator?: CircuitSimulator;
92
+
93
+ constructor(args: PrivateExecutionOracleArgs) {
94
+ super({
95
+ ...args,
96
+ contractAddress: args.callContext.contractAddress,
97
+ log: args.log ?? createLogger('simulator:client_execution_context'),
98
+ });
99
+ this.argsHash = args.argsHash;
100
+ this.txContext = args.txContext;
101
+ this.callContext = args.callContext;
102
+ this.utilityExecutor = args.utilityExecutor;
103
+ this.executionCache = args.executionCache;
104
+ this.noteCache = args.noteCache;
105
+ this.taggingIndexCache = args.taggingIndexCache;
106
+ this.senderTaggingStore = args.senderTaggingStore;
107
+ this.contractSyncService = args.contractSyncService;
108
+ this.totalPublicCalldataCount = args.totalPublicCalldataCount ?? 0;
109
+ this.sideEffectCounter = args.sideEffectCounter ?? 0;
110
+ this.senderForTags = args.senderForTags;
111
+ this.simulator = args.simulator;
122
112
  }
123
113
 
124
114
  public getPrivateContextInputs(): PrivateContextInputs {
@@ -199,7 +189,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
199
189
  * The value persists through nested calls, meaning all calls down the stack will use the same
200
190
  * 'senderForTags' value (unless it is replaced).
201
191
  */
202
- public privateGetSenderForTags(): Promise<AztecAddress | undefined> {
192
+ public getSenderForTags(): Promise<AztecAddress | undefined> {
203
193
  return Promise.resolve(this.senderForTags);
204
194
  }
205
195
 
@@ -214,7 +204,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
214
204
  * through nested calls, meaning all calls down the stack will use the same 'senderForTags'
215
205
  * value (unless it is replaced by another call to this setter).
216
206
  */
217
- public privateSetSenderForTags(senderForTags: AztecAddress): Promise<void> {
207
+ public setSenderForTags(senderForTags: AztecAddress): Promise<void> {
218
208
  this.senderForTags = senderForTags;
219
209
  return Promise.resolve();
220
210
  }
@@ -225,26 +215,30 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
225
215
  * @param recipient - The address receiving the log
226
216
  * @returns An app tag to be used in a log.
227
217
  */
228
- public async privateGetNextAppTagAsSender(sender: AztecAddress, recipient: AztecAddress): Promise<Tag> {
229
- const secret = await this.#calculateDirectionalAppTaggingSecret(this.contractAddress, sender, recipient);
218
+ public async getNextAppTagAsSender(sender: AztecAddress, recipient: AztecAddress): Promise<Tag> {
219
+ const extendedSecret = await this.#calculateExtendedDirectionalAppTaggingSecret(
220
+ this.contractAddress,
221
+ sender,
222
+ recipient,
223
+ );
230
224
 
231
- const index = await this.#getIndexToUseForSecret(secret);
232
- this.log.debug(
225
+ const index = await this.#getIndexToUseForSecret(extendedSecret);
226
+ this.logger.debug(
233
227
  `Incrementing tagging index for sender: ${sender}, recipient: ${recipient}, contract: ${this.contractAddress} to ${index}`,
234
228
  );
235
- this.taggingIndexCache.setLastUsedIndex(secret, index);
229
+ this.taggingIndexCache.setLastUsedIndex(extendedSecret, index);
236
230
 
237
- return Tag.compute({ secret, index });
231
+ return Tag.compute({ extendedSecret, index });
238
232
  }
239
233
 
240
- async #calculateDirectionalAppTaggingSecret(
234
+ async #calculateExtendedDirectionalAppTaggingSecret(
241
235
  contractAddress: AztecAddress,
242
236
  sender: AztecAddress,
243
237
  recipient: AztecAddress,
244
238
  ) {
245
- const senderCompleteAddress = await this.getCompleteAddress(sender);
239
+ const senderCompleteAddress = await this.getCompleteAddressOrFail(sender);
246
240
  const senderIvsk = await this.keyStore.getMasterIncomingViewingSecretKey(sender);
247
- return DirectionalAppTaggingSecret.compute(
241
+ return ExtendedDirectionalAppTaggingSecret.compute(
248
242
  senderCompleteAddress,
249
243
  senderIvsk,
250
244
  recipient,
@@ -253,7 +247,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
253
247
  );
254
248
  }
255
249
 
256
- async #getIndexToUseForSecret(secret: DirectionalAppTaggingSecret): Promise<number> {
250
+ async #getIndexToUseForSecret(secret: ExtendedDirectionalAppTaggingSecret): Promise<number> {
257
251
  // If we have the tagging index in the cache, we use it. If not we obtain it from the execution data provider.
258
252
  const lastUsedIndexInTx = this.taggingIndexCache.getLastUsedIndex(secret);
259
253
 
@@ -265,7 +259,6 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
265
259
  // that'd be wasteful as most tagging secrets are not used in each tx.
266
260
  await syncSenderTaggingIndexes(
267
261
  secret,
268
- this.contractAddress,
269
262
  this.aztecNode,
270
263
  this.senderTaggingStore,
271
264
  await this.anchorBlockHeader.hash(),
@@ -284,7 +277,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
284
277
  * @param values - Values to store.
285
278
  * @returns The hash of the values.
286
279
  */
287
- public privateStoreInExecutionCache(values: Fr[], hash: Fr) {
280
+ public storeInExecutionCache(values: Fr[], hash: Fr) {
288
281
  return this.executionCache.store(values, hash);
289
282
  }
290
283
 
@@ -293,7 +286,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
293
286
  * @param hash - Hash of the values.
294
287
  * @returns The values.
295
288
  */
296
- public privateLoadFromExecutionCache(hash: Fr): Promise<Fr[]> {
289
+ public loadFromExecutionCache(hash: Fr): Promise<Fr[]> {
297
290
  const preimage = this.executionCache.getPreimage(hash);
298
291
  if (!preimage) {
299
292
  throw new Error(`Preimage for hash ${hash.toString()} not found in cache`);
@@ -301,12 +294,12 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
301
294
  return Promise.resolve(preimage);
302
295
  }
303
296
 
304
- override async utilityCheckNullifierExists(innerNullifier: Fr): Promise<boolean> {
297
+ override async checkNullifierExists(innerNullifier: Fr): Promise<boolean> {
305
298
  // This oracle must be overridden because while utility execution can only meaningfully check if a nullifier exists
306
299
  // in the synched block, during private execution there's also the possibility of it being pending, i.e. created
307
300
  // in the current transaction.
308
301
 
309
- this.log.debug(`Checking existence of inner nullifier ${innerNullifier}`, {
302
+ this.logger.debug(`Checking existence of inner nullifier ${innerNullifier}`, {
310
303
  contractAddress: this.contractAddress,
311
304
  });
312
305
 
@@ -314,7 +307,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
314
307
 
315
308
  return (
316
309
  this.noteCache.getNullifiers(this.contractAddress).has(nullifier) ||
317
- (await super.utilityCheckNullifierExists(innerNullifier))
310
+ (await super.checkNullifierExists(innerNullifier))
318
311
  );
319
312
  }
320
313
 
@@ -339,7 +332,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
339
332
  * @param status - The status of notes to fetch.
340
333
  * @returns Array of note data.
341
334
  */
342
- public override async utilityGetNotes(
335
+ public override async getNotes(
343
336
  owner: AztecAddress | undefined,
344
337
  storageSlot: Fr,
345
338
  numSelects: number,
@@ -385,7 +378,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
385
378
  offset,
386
379
  });
387
380
 
388
- this.log.debug(
381
+ this.logger.debug(
389
382
  `Returning ${notes.length} notes for ${this.callContext.contractAddress} at ${storageSlot}: ${notes
390
383
  .map(n => `${n.noteNonce.toString()}:[${n.note.items.map(i => i.toString()).join(',')}]`)
391
384
  .join(', ')}`,
@@ -405,7 +398,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
405
398
  * @param noteHash - A hash of the new note.
406
399
  * @returns
407
400
  */
408
- public privateNotifyCreatedNote(
401
+ public notifyCreatedNote(
409
402
  owner: AztecAddress,
410
403
  storageSlot: Fr,
411
404
  randomness: Fr,
@@ -414,7 +407,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
414
407
  noteHash: Fr,
415
408
  counter: number,
416
409
  ) {
417
- this.log.debug(`Notified of new note with inner hash ${noteHash}`, {
410
+ this.logger.debug(`Notified of new note with inner hash ${noteHash}`, {
418
411
  contractAddress: this.callContext.contractAddress,
419
412
  storageSlot,
420
413
  randomness,
@@ -446,7 +439,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
446
439
  * @param innerNullifier - The pending nullifier to add in the list (not yet siloed by contract address).
447
440
  * @param noteHash - A hash of the new note.
448
441
  */
449
- public async privateNotifyNullifiedNote(innerNullifier: Fr, noteHash: Fr, counter: number) {
442
+ public async notifyNullifiedNote(innerNullifier: Fr, noteHash: Fr, counter: number) {
450
443
  const nullifiedNoteHashCounter = await this.noteCache.nullifyNote(
451
444
  this.callContext.contractAddress,
452
445
  innerNullifier,
@@ -463,19 +456,19 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
463
456
  * @param innerNullifier - The pending nullifier to add in the list (not yet siloed by contract address).
464
457
  * @param noteHash - A hash of the new note.
465
458
  */
466
- public privateNotifyCreatedNullifier(innerNullifier: Fr) {
467
- this.log.debug(`Notified of new inner nullifier ${innerNullifier}`, { contractAddress: this.contractAddress });
459
+ public notifyCreatedNullifier(innerNullifier: Fr) {
460
+ this.logger.debug(`Notified of new inner nullifier ${innerNullifier}`, { contractAddress: this.contractAddress });
468
461
  return this.noteCache.nullifierCreated(this.callContext.contractAddress, innerNullifier);
469
462
  }
470
463
 
471
464
  /**
472
- * Check if a nullifier has been emitted in the same transaction, i.e. if privateNotifyCreatedNullifier has been
465
+ * Check if a nullifier has been emitted in the same transaction, i.e. if notifyCreatedNullifier has been
473
466
  * called for this inner nullifier from the contract with the specified address.
474
467
  * @param innerNullifier - The inner nullifier to check.
475
468
  * @param contractAddress - Address of the contract that emitted the nullifier.
476
469
  * @returns A boolean indicating whether the nullifier is pending or not.
477
470
  */
478
- public async privateIsNullifierPending(innerNullifier: Fr, contractAddress: AztecAddress): Promise<boolean> {
471
+ public async isNullifierPending(innerNullifier: Fr, contractAddress: AztecAddress): Promise<boolean> {
479
472
  const siloedNullifier = await siloNullifier(contractAddress, innerNullifier);
480
473
  const isNullifierPending = this.noteCache.getNullifiers(contractAddress).has(siloedNullifier.toBigInt());
481
474
  return Promise.resolve(isNullifierPending);
@@ -488,10 +481,10 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
488
481
  * @param log - The contract class log to be emitted.
489
482
  * @param counter - The contract class log's counter.
490
483
  */
491
- public privateNotifyCreatedContractClassLog(log: ContractClassLog, counter: number) {
484
+ public notifyCreatedContractClassLog(log: ContractClassLog, counter: number) {
492
485
  this.contractClassLogs.push(new CountedContractClassLog(log, counter));
493
486
  const text = log.toBuffer().toString('hex');
494
- this.log.verbose(
487
+ this.logger.verbose(
495
488
  `Emitted log from ContractClassRegistry: "${text.length > 100 ? text.slice(0, 100) + '...' : text}"`,
496
489
  );
497
490
  }
@@ -517,7 +510,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
517
510
  * @param isStaticCall - Whether the call is a static call.
518
511
  * @returns The execution result.
519
512
  */
520
- async privateCallPrivateFunction(
513
+ async callPrivateFunction(
521
514
  targetContractAddress: AztecAddress,
522
515
  functionSelector: FunctionSelector,
523
516
  argsHash: Fr,
@@ -531,19 +524,19 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
531
524
  }
532
525
 
533
526
  const simulatorSetupTimer = new Timer();
534
- this.log.debug(
527
+ this.logger.debug(
535
528
  `Calling private function ${targetContractAddress}:${functionSelector} from ${this.callContext.contractAddress}`,
536
529
  );
537
530
 
538
531
  isStaticCall = isStaticCall || this.callContext.isStaticCall;
539
532
 
540
- await ensureContractSynced(
533
+ await this.contractSyncService.ensureContractSynced(
541
534
  targetContractAddress,
542
535
  functionSelector,
543
536
  this.utilityExecutor,
544
- this.aztecNode,
545
- this.contractStore,
546
537
  this.anchorBlockHeader,
538
+ this.jobId,
539
+ this.scopes,
547
540
  );
548
541
 
549
542
  const targetArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(
@@ -555,40 +548,41 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
555
548
 
556
549
  const derivedCallContext = await this.deriveCallContext(targetContractAddress, targetArtifact, isStaticCall);
557
550
 
558
- const privateExecutionOracle = new PrivateExecutionOracle(
551
+ const privateExecutionOracle = new PrivateExecutionOracle({
559
552
  argsHash,
560
- derivedTxContext,
561
- derivedCallContext,
562
- this.anchorBlockHeader,
563
- this.utilityExecutor,
564
- this.authWitnesses,
565
- this.capsules,
566
- this.executionCache,
567
- this.noteCache,
568
- this.taggingIndexCache,
569
- this.contractStore,
570
- this.noteStore,
571
- this.keyStore,
572
- this.addressStore,
573
- this.aztecNode,
574
- this.senderTaggingStore,
575
- this.recipientTaggingStore,
576
- this.senderAddressBookStore,
577
- this.capsuleStore,
578
- this.privateEventStore,
579
- this.jobId,
580
- this.totalPublicCalldataCount,
553
+ txContext: derivedTxContext,
554
+ callContext: derivedCallContext,
555
+ anchorBlockHeader: this.anchorBlockHeader,
556
+ utilityExecutor: this.utilityExecutor,
557
+ authWitnesses: this.authWitnesses,
558
+ capsules: this.capsules,
559
+ executionCache: this.executionCache,
560
+ noteCache: this.noteCache,
561
+ taggingIndexCache: this.taggingIndexCache,
562
+ contractStore: this.contractStore,
563
+ noteStore: this.noteStore,
564
+ keyStore: this.keyStore,
565
+ addressStore: this.addressStore,
566
+ aztecNode: this.aztecNode,
567
+ senderTaggingStore: this.senderTaggingStore,
568
+ recipientTaggingStore: this.recipientTaggingStore,
569
+ senderAddressBookStore: this.senderAddressBookStore,
570
+ capsuleStore: this.capsuleStore,
571
+ privateEventStore: this.privateEventStore,
572
+ contractSyncService: this.contractSyncService,
573
+ jobId: this.jobId,
574
+ totalPublicCalldataCount: this.totalPublicCalldataCount,
581
575
  sideEffectCounter,
582
- this.log,
583
- this.scopes,
584
- this.senderForTags,
585
- this.simulator,
586
- );
576
+ log: this.logger,
577
+ scopes: this.scopes,
578
+ senderForTags: this.senderForTags,
579
+ simulator: this.simulator!,
580
+ });
587
581
 
588
582
  const setupTime = simulatorSetupTimer.ms();
589
583
 
590
584
  const childExecutionResult = await executePrivateFunction(
591
- this.simulator,
585
+ this.simulator!,
592
586
  privateExecutionOracle,
593
587
  targetArtifact,
594
588
  targetContractAddress,
@@ -633,7 +627,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
633
627
  * @param sideEffectCounter - The side effect counter at the start of the call.
634
628
  * @param isStaticCall - Whether the call is a static call.
635
629
  */
636
- public privateNotifyEnqueuedPublicFunctionCall(
630
+ public notifyEnqueuedPublicFunctionCall(
637
631
  _targetContractAddress: AztecAddress,
638
632
  calldataHash: Fr,
639
633
  _sideEffectCounter: number,
@@ -650,7 +644,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
650
644
  * @param sideEffectCounter - The side effect counter at the start of the call.
651
645
  * @param isStaticCall - Whether the call is a static call.
652
646
  */
653
- public privateNotifySetPublicTeardownFunctionCall(
647
+ public notifySetPublicTeardownFunctionCall(
654
648
  _targetContractAddress: AztecAddress,
655
649
  calldataHash: Fr,
656
650
  _sideEffectCounter: number,
@@ -660,11 +654,11 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
660
654
  return Promise.resolve();
661
655
  }
662
656
 
663
- public privateNotifySetMinRevertibleSideEffectCounter(minRevertibleSideEffectCounter: number): Promise<void> {
657
+ public notifySetMinRevertibleSideEffectCounter(minRevertibleSideEffectCounter: number): Promise<void> {
664
658
  return this.noteCache.setMinRevertibleSideEffectCounter(minRevertibleSideEffectCounter);
665
659
  }
666
660
 
667
- public privateIsSideEffectCounterRevertible(sideEffectCounter: number): Promise<boolean> {
661
+ public isSideEffectCounterRevertible(sideEffectCounter: number): Promise<boolean> {
668
662
  return Promise.resolve(this.noteCache.isSideEffectCounterRevertible(sideEffectCounter));
669
663
  }
670
664
 
@@ -692,7 +686,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
692
686
  return this.contractStore.getDebugFunctionName(this.contractAddress, this.callContext.functionSelector);
693
687
  }
694
688
 
695
- public utilityEmitOffchainEffect(data: Fr[]): Promise<void> {
689
+ public emitOffchainEffect(data: Fr[]): Promise<void> {
696
690
  this.offchainEffects.push({ data });
697
691
  return Promise.resolve();
698
692
  }