@aztec/pxe 5.0.0-rc.1 → 5.0.0-rc.2

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 (218) hide show
  1. package/dest/block_synchronizer/block_stream_source.d.ts +5 -5
  2. package/dest/block_synchronizer/block_stream_source.d.ts.map +1 -1
  3. package/dest/block_synchronizer/block_stream_source.js +4 -29
  4. package/dest/block_synchronizer/block_synchronizer.d.ts +13 -11
  5. package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
  6. package/dest/block_synchronizer/block_synchronizer.js +43 -15
  7. package/dest/config/index.d.ts +2 -1
  8. package/dest/config/index.d.ts.map +1 -1
  9. package/dest/config/index.js +1 -0
  10. package/dest/contract_function_simulator/contract_function_simulator.d.ts +11 -16
  11. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  12. package/dest/contract_function_simulator/contract_function_simulator.js +22 -18
  13. package/dest/contract_function_simulator/index.d.ts +15 -9
  14. package/dest/contract_function_simulator/index.d.ts.map +1 -1
  15. package/dest/contract_function_simulator/index.js +3 -7
  16. package/dest/contract_function_simulator/noir-structs/bounded_vec.d.ts +8 -27
  17. package/dest/contract_function_simulator/noir-structs/bounded_vec.d.ts.map +1 -1
  18. package/dest/contract_function_simulator/noir-structs/bounded_vec.js +8 -23
  19. package/dest/contract_function_simulator/noir-structs/contract_class_log_data.d.ts +9 -0
  20. package/dest/contract_function_simulator/noir-structs/contract_class_log_data.d.ts.map +1 -0
  21. package/dest/contract_function_simulator/noir-structs/contract_class_log_data.js +1 -0
  22. package/dest/contract_function_simulator/noir-structs/embedded_curve_point.d.ts +7 -0
  23. package/dest/contract_function_simulator/noir-structs/embedded_curve_point.d.ts.map +1 -0
  24. package/dest/contract_function_simulator/noir-structs/embedded_curve_point.js +1 -0
  25. package/dest/contract_function_simulator/noir-structs/event_validation_request.js +1 -1
  26. package/dest/contract_function_simulator/noir-structs/fact.d.ts +16 -0
  27. package/dest/contract_function_simulator/noir-structs/fact.d.ts.map +1 -0
  28. package/dest/contract_function_simulator/noir-structs/fact.js +6 -0
  29. package/dest/contract_function_simulator/noir-structs/fact_collection.d.ts +27 -0
  30. package/dest/contract_function_simulator/noir-structs/fact_collection.d.ts.map +1 -0
  31. package/dest/contract_function_simulator/noir-structs/fact_collection.js +29 -0
  32. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +11 -12
  33. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts.map +1 -1
  34. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.js +6 -49
  35. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +4 -8
  36. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
  37. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +1 -60
  38. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +2 -2
  39. package/dest/contract_function_simulator/noir-structs/option.d.ts +9 -11
  40. package/dest/contract_function_simulator/noir-structs/option.d.ts.map +1 -1
  41. package/dest/contract_function_simulator/noir-structs/option.js +18 -13
  42. package/dest/contract_function_simulator/noir-structs/origin_block.d.ts +11 -0
  43. package/dest/contract_function_simulator/noir-structs/origin_block.d.ts.map +1 -0
  44. package/dest/contract_function_simulator/noir-structs/origin_block.js +5 -0
  45. package/dest/contract_function_simulator/noir-structs/provided_secret.d.ts +5 -8
  46. package/dest/contract_function_simulator/noir-structs/provided_secret.d.ts.map +1 -1
  47. package/dest/contract_function_simulator/noir-structs/provided_secret.js +1 -14
  48. package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.d.ts +21 -0
  49. package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.d.ts.map +1 -0
  50. package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.js +33 -0
  51. package/dest/contract_function_simulator/noir-structs/resolved_tx.d.ts +21 -0
  52. package/dest/contract_function_simulator/noir-structs/resolved_tx.d.ts.map +1 -0
  53. package/dest/contract_function_simulator/noir-structs/resolved_tx.js +50 -0
  54. package/dest/contract_function_simulator/noir-structs/tx_effect_data.d.ts +14 -0
  55. package/dest/contract_function_simulator/noir-structs/tx_effect_data.d.ts.map +1 -0
  56. package/dest/contract_function_simulator/noir-structs/tx_effect_data.js +5 -0
  57. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +6 -11
  58. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -1
  59. package/dest/contract_function_simulator/noir-structs/utility_context.js +1 -20
  60. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +3 -14
  61. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
  62. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.js +1 -24
  63. package/dest/contract_function_simulator/oracle/oracle_registry.d.ts +81 -6
  64. package/dest/contract_function_simulator/oracle/oracle_registry.d.ts.map +1 -1
  65. package/dest/contract_function_simulator/oracle/oracle_registry.js +128 -9
  66. package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts +80 -36
  67. package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts.map +1 -1
  68. package/dest/contract_function_simulator/oracle/oracle_type_mappings.js +926 -264
  69. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +13 -8
  70. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  71. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +80 -11
  72. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +46 -20
  73. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  74. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +119 -55
  75. package/dest/contract_sync/helpers.d.ts +7 -6
  76. package/dest/contract_sync/helpers.d.ts.map +1 -1
  77. package/dest/contract_sync/helpers.js +11 -16
  78. package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
  79. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  80. package/dest/entrypoints/client/bundle/utils.js +1 -0
  81. package/dest/entrypoints/client/lazy/utils.d.ts +1 -1
  82. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  83. package/dest/entrypoints/client/lazy/utils.js +1 -0
  84. package/dest/entrypoints/pxe_creation_options.d.ts +8 -2
  85. package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
  86. package/dest/entrypoints/server/index.d.ts +1 -2
  87. package/dest/entrypoints/server/index.d.ts.map +1 -1
  88. package/dest/entrypoints/server/index.js +0 -1
  89. package/dest/entrypoints/server/utils.d.ts +1 -1
  90. package/dest/entrypoints/server/utils.d.ts.map +1 -1
  91. package/dest/entrypoints/server/utils.js +3 -1
  92. package/dest/error_enriching.js +1 -1
  93. package/dest/hooks/execution_hooks.d.ts +16 -7
  94. package/dest/hooks/execution_hooks.d.ts.map +1 -1
  95. package/dest/hooks/execution_hooks.js +3 -3
  96. package/dest/hooks/index.d.ts +3 -3
  97. package/dest/hooks/index.d.ts.map +1 -1
  98. package/dest/hooks/resolve_tagging_secret_strategy.d.ts +41 -0
  99. package/dest/hooks/resolve_tagging_secret_strategy.d.ts.map +1 -0
  100. package/dest/hooks/resolve_tagging_secret_strategy.js +3 -0
  101. package/dest/logs/log_service.d.ts +6 -6
  102. package/dest/logs/log_service.d.ts.map +1 -1
  103. package/dest/logs/log_service.js +62 -28
  104. package/dest/messages/tx_resolver_service.d.ts +17 -0
  105. package/dest/messages/tx_resolver_service.d.ts.map +1 -0
  106. package/dest/messages/{message_context_service.js → tx_resolver_service.js} +8 -8
  107. package/dest/oracle_version.d.ts +2 -2
  108. package/dest/oracle_version.js +2 -2
  109. package/dest/private_kernel/hints/test_utils.js +1 -1
  110. package/dest/pxe.d.ts +46 -19
  111. package/dest/pxe.d.ts.map +1 -1
  112. package/dest/pxe.js +104 -52
  113. package/dest/storage/allowed_scopes.d.ts +6 -0
  114. package/dest/storage/allowed_scopes.d.ts.map +1 -0
  115. package/dest/storage/allowed_scopes.js +7 -0
  116. package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts +1 -1
  117. package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts.map +1 -1
  118. package/dest/storage/backwards_compatibility_tests/schema_tests.js +86 -33
  119. package/dest/storage/capsule_store/capsule_service.d.ts +1 -1
  120. package/dest/storage/capsule_store/capsule_service.d.ts.map +1 -1
  121. package/dest/storage/capsule_store/capsule_service.js +6 -9
  122. package/dest/storage/contract_store/contract_store.js +2 -2
  123. package/dest/storage/fact_store/fact_service.d.ts +20 -0
  124. package/dest/storage/fact_store/fact_service.d.ts.map +1 -0
  125. package/dest/storage/fact_store/fact_service.js +30 -0
  126. package/dest/storage/fact_store/fact_store.d.ts +95 -0
  127. package/dest/storage/fact_store/fact_store.d.ts.map +1 -0
  128. package/dest/storage/fact_store/fact_store.js +408 -0
  129. package/dest/storage/fact_store/fact_store_keys.d.ts +34 -0
  130. package/dest/storage/fact_store/fact_store_keys.d.ts.map +1 -0
  131. package/dest/storage/fact_store/fact_store_keys.js +50 -0
  132. package/dest/storage/fact_store/index.d.ts +5 -0
  133. package/dest/storage/fact_store/index.d.ts.map +1 -0
  134. package/dest/storage/fact_store/index.js +3 -0
  135. package/dest/storage/fact_store/stored_fact.d.ts +32 -0
  136. package/dest/storage/fact_store/stored_fact.d.ts.map +1 -0
  137. package/dest/storage/fact_store/stored_fact.js +64 -0
  138. package/dest/storage/index.d.ts +2 -1
  139. package/dest/storage/index.d.ts.map +1 -1
  140. package/dest/storage/index.js +1 -0
  141. package/dest/storage/metadata.d.ts +1 -1
  142. package/dest/storage/metadata.js +1 -1
  143. package/dest/storage/open_pxe_stores.d.ts +5 -3
  144. package/dest/storage/open_pxe_stores.d.ts.map +1 -1
  145. package/dest/storage/open_pxe_stores.js +5 -3
  146. package/dest/storage/tagging_store/index.d.ts +2 -2
  147. package/dest/storage/tagging_store/index.d.ts.map +1 -1
  148. package/dest/storage/tagging_store/index.js +1 -1
  149. package/dest/storage/tagging_store/tagging_secret_sources_store.d.ts +40 -0
  150. package/dest/storage/tagging_store/tagging_secret_sources_store.d.ts.map +1 -0
  151. package/dest/storage/tagging_store/tagging_secret_sources_store.js +92 -0
  152. package/package.json +17 -17
  153. package/src/block_synchronizer/block_stream_source.ts +6 -45
  154. package/src/block_synchronizer/block_synchronizer.ts +56 -23
  155. package/src/config/index.ts +1 -0
  156. package/src/contract_function_simulator/contract_function_simulator.ts +32 -31
  157. package/src/contract_function_simulator/index.ts +17 -8
  158. package/src/contract_function_simulator/noir-structs/bounded_vec.ts +12 -24
  159. package/src/contract_function_simulator/noir-structs/contract_class_log_data.ts +9 -0
  160. package/src/contract_function_simulator/noir-structs/embedded_curve_point.ts +4 -0
  161. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +1 -1
  162. package/src/contract_function_simulator/noir-structs/fact.ts +13 -0
  163. package/src/contract_function_simulator/noir-structs/fact_collection.ts +59 -0
  164. package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +20 -46
  165. package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +7 -60
  166. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +2 -2
  167. package/src/contract_function_simulator/noir-structs/option.ts +17 -11
  168. package/src/contract_function_simulator/noir-structs/origin_block.ts +8 -0
  169. package/src/contract_function_simulator/noir-structs/provided_secret.ts +3 -14
  170. package/src/contract_function_simulator/noir-structs/resolved_tagging_strategy.ts +45 -0
  171. package/src/contract_function_simulator/noir-structs/resolved_tx.ts +53 -0
  172. package/src/contract_function_simulator/noir-structs/tx_effect_data.ts +15 -0
  173. package/src/contract_function_simulator/noir-structs/utility_context.ts +5 -17
  174. package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +6 -21
  175. package/src/contract_function_simulator/oracle/oracle_registry.ts +87 -79
  176. package/src/contract_function_simulator/oracle/oracle_type_mappings.ts +641 -247
  177. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +94 -14
  178. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +206 -66
  179. package/src/contract_sync/helpers.ts +11 -18
  180. package/src/entrypoints/client/bundle/utils.ts +1 -0
  181. package/src/entrypoints/client/lazy/utils.ts +1 -0
  182. package/src/entrypoints/pxe_creation_options.ts +7 -1
  183. package/src/entrypoints/server/index.ts +0 -1
  184. package/src/entrypoints/server/utils.ts +3 -1
  185. package/src/error_enriching.ts +1 -1
  186. package/src/hooks/execution_hooks.ts +17 -8
  187. package/src/hooks/index.ts +6 -2
  188. package/src/hooks/resolve_tagging_secret_strategy.ts +46 -0
  189. package/src/logs/log_service.ts +71 -37
  190. package/src/messages/{message_context_service.ts → tx_resolver_service.ts} +16 -9
  191. package/src/oracle_version.ts +2 -2
  192. package/src/private_kernel/hints/test_utils.ts +1 -1
  193. package/src/pxe.ts +150 -54
  194. package/src/storage/allowed_scopes.ts +14 -0
  195. package/src/storage/backwards_compatibility_tests/__snapshots__/FactStore.json +40 -0
  196. package/src/storage/backwards_compatibility_tests/__snapshots__/L2TipsKVStore.json +1 -1
  197. package/src/storage/backwards_compatibility_tests/__snapshots__/TaggingSecretSourcesStore.json +30 -0
  198. package/src/storage/backwards_compatibility_tests/__snapshots__/opened_stores.json +21 -5
  199. package/src/storage/backwards_compatibility_tests/schema_tests.ts +88 -33
  200. package/src/storage/capsule_store/capsule_service.ts +8 -13
  201. package/src/storage/contract_store/contract_store.ts +2 -2
  202. package/src/storage/fact_store/fact_service.ts +45 -0
  203. package/src/storage/fact_store/fact_store.ts +487 -0
  204. package/src/storage/fact_store/fact_store_keys.ts +75 -0
  205. package/src/storage/fact_store/index.ts +4 -0
  206. package/src/storage/fact_store/stored_fact.ts +80 -0
  207. package/src/storage/index.ts +1 -0
  208. package/src/storage/metadata.ts +1 -1
  209. package/src/storage/open_pxe_stores.ts +6 -3
  210. package/src/storage/tagging_store/index.ts +1 -1
  211. package/src/storage/tagging_store/tagging_secret_sources_store.ts +117 -0
  212. package/dest/messages/message_context_service.d.ts +0 -17
  213. package/dest/messages/message_context_service.d.ts.map +0 -1
  214. package/dest/storage/tagging_store/sender_address_book_store.d.ts +0 -14
  215. package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +0 -1
  216. package/dest/storage/tagging_store/sender_address_book_store.js +0 -36
  217. package/src/storage/backwards_compatibility_tests/__snapshots__/SenderAddressBookStore.json +0 -16
  218. package/src/storage/tagging_store/sender_address_book_store.ts +0 -48
@@ -16,7 +16,8 @@ import { PrivateContextInputs } from '@aztec/stdlib/kernel';
16
16
  import {
17
17
  AppTaggingSecret,
18
18
  AppTaggingSecretKind,
19
- type ContractClassLog,
19
+ ContractClassLog,
20
+ ContractClassLogFields,
20
21
  type TaggingIndexRange,
21
22
  } from '@aztec/stdlib/logs';
22
23
  import { Note, type NoteStatus } from '@aztec/stdlib/note';
@@ -28,6 +29,10 @@ import {
28
29
  type TxContext,
29
30
  } from '@aztec/stdlib/tx';
30
31
 
32
+ import type {
33
+ ResolveTaggingSecretStrategy,
34
+ TaggingSecretStrategy,
35
+ } from '../../hooks/resolve_tagging_secret_strategy.js';
31
36
  import { NoteService } from '../../notes/note_service.js';
32
37
  import type { SenderTaggingStore } from '../../storage/tagging_store/sender_tagging_store.js';
33
38
  import { syncSenderTaggingIndexes } from '../../tagging/index.js';
@@ -35,18 +40,19 @@ import type { ExecutionNoteCache } from '../execution_note_cache.js';
35
40
  import { ExecutionTaggingIndexCache } from '../execution_tagging_index_cache.js';
36
41
  import type { HashedValuesCache } from '../hashed_values_cache.js';
37
42
  import { BoundedVec } from '../noir-structs/bounded_vec.js';
43
+ import type { ContractClassLogData } from '../noir-structs/contract_class_log_data.js';
38
44
  import type { NoteData } from '../noir-structs/note_data.js';
39
45
  import { Option } from '../noir-structs/option.js';
46
+ import type { ResolvedTaggingStrategy } from '../noir-structs/resolved_tagging_strategy.js';
40
47
  import { pickNotes } from '../pick_notes.js';
41
48
  import type { IPrivateExecutionOracle } from './interfaces.js';
42
49
  import { executePrivateFunction } from './private_execution.js';
43
50
  import { UtilityExecutionOracle, type UtilityExecutionOracleArgs } from './utility_execution_oracle.js';
44
51
 
45
52
  /** Args for PrivateExecutionOracle constructor. */
46
- export type PrivateExecutionOracleArgs = Omit<UtilityExecutionOracleArgs, 'contractAddress'> & {
53
+ export type PrivateExecutionOracleArgs = UtilityExecutionOracleArgs & {
47
54
  argsHash: Fr;
48
55
  txContext: TxContext;
49
- callContext: CallContext;
50
56
  executionCache: HashedValuesCache;
51
57
  noteCache: ExecutionNoteCache;
52
58
  taggingIndexCache: ExecutionTaggingIndexCache;
@@ -77,7 +83,6 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
77
83
 
78
84
  private readonly argsHash: Fr;
79
85
  private readonly txContext: TxContext;
80
- private readonly callContext: CallContext;
81
86
  private readonly executionCache: HashedValuesCache;
82
87
  private readonly noteCache: ExecutionNoteCache;
83
88
  private readonly taggingIndexCache: ExecutionTaggingIndexCache;
@@ -90,12 +95,10 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
90
95
  constructor(args: PrivateExecutionOracleArgs) {
91
96
  super({
92
97
  ...args,
93
- contractAddress: args.callContext.contractAddress,
94
98
  log: args.log ?? createLogger('simulator:client_execution_context'),
95
99
  });
96
100
  this.argsHash = args.argsHash;
97
101
  this.txContext = args.txContext;
98
- this.callContext = args.callContext;
99
102
  this.executionCache = args.executionCache;
100
103
  this.noteCache = args.noteCache;
101
104
  this.taggingIndexCache = args.taggingIndexCache;
@@ -181,9 +184,80 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
181
184
  * Returns the wallet-supplied default sender for tags, or `None` if no default was provided.
182
185
  */
183
186
  public getSenderForTags(): Promise<Option<AztecAddress>> {
184
- return Promise.resolve(
185
- this.defaultSenderForTags ? Option.some(this.defaultSenderForTags) : Option.none(AztecAddress.ZERO),
186
- );
187
+ return Promise.resolve(this.defaultSenderForTags ? Option.some(this.defaultSenderForTags) : Option.none());
188
+ }
189
+
190
+ /**
191
+ * Resolves the tagging strategy for a message via the wallet's {@link ResolveTaggingSecretStrategy} hook. The contract receives a ready-to-use {@link ResolvedTaggingStrategy}.
192
+ * When no hook is configured, applies a privacy-safe default.
193
+ */
194
+ public async resolveTaggingStrategy(
195
+ sender: AztecAddress,
196
+ recipient: AztecAddress,
197
+ deliveryMode: AppTaggingSecretKind,
198
+ ): Promise<ResolvedTaggingStrategy> {
199
+ const hook: ResolveTaggingSecretStrategy | undefined = this.hooks?.resolveTaggingSecretStrategy;
200
+ let strategy: TaggingSecretStrategy;
201
+ if (hook) {
202
+ const { currentContractClassId } = await this.getContractInstance(this.contractAddress);
203
+ strategy = await hook({
204
+ contractAddress: this.contractAddress,
205
+ contractClassId: currentContractClassId,
206
+ sender,
207
+ recipient,
208
+ deliveryMode,
209
+ });
210
+ } else {
211
+ strategy = this.#defaultTaggingSecretStrategy(deliveryMode, recipient);
212
+ }
213
+ return this.#resolveTaggingSecretStrategy(strategy, sender, recipient);
214
+ }
215
+
216
+ /** Resolves a wallet-provided {@link TaggingSecretStrategy} into the app-siloed secret handed to the contract. */
217
+ async #resolveTaggingSecretStrategy(
218
+ strategy: TaggingSecretStrategy,
219
+ sender: AztecAddress,
220
+ recipient: AztecAddress,
221
+ ): Promise<ResolvedTaggingStrategy> {
222
+ // PXE only performs the derivation; it does not reject a strategy that is unsound for the delivery mode (e.g. an
223
+ // address-derived or arbitrary-secret strategy for constrained delivery). That soundness check belongs in the
224
+ // Noir circuit, which constrains the resolved strategy against the delivery mode.
225
+ switch (strategy.type) {
226
+ case 'non-interactive-handshake':
227
+ return { type: 'non-interactive-handshake' };
228
+ case 'address-derived':
229
+ return this.#addressDerivedSecret(sender, recipient);
230
+ case 'arbitrary-secret': {
231
+ // App-silo the raw arbitrary secret point here so wallets never replicate the derivation.
232
+ const appTaggingSecret = await AppTaggingSecret.compute(strategy.secret, this.contractAddress, recipient);
233
+ return { type: 'unconstrained-secret', secret: appTaggingSecret.secret };
234
+ }
235
+ }
236
+ }
237
+
238
+ /** The privacy-safe tagging secret strategy used when no {@link ResolveTaggingSecretStrategy} hook is configured. */
239
+ #defaultTaggingSecretStrategy(deliveryMode: AppTaggingSecretKind, recipient: AztecAddress): TaggingSecretStrategy {
240
+ if (deliveryMode === AppTaggingSecretKind.CONSTRAINED) {
241
+ // Constrained delivery has no "safe" default: a non-interactive handshake would reveal the recipient onchain,
242
+ // and an interactive handshake always needs a wallet interaction (i.e. a configured hook). With no hook there is
243
+ // nothing safe to fall back to, so we always fail.
244
+ throw new Error(`Constrained delivery to ${recipient} requires a configured resolveTaggingSecretStrategy hook.`);
245
+ }
246
+
247
+ // Unconstrained default: an address-derived (Diffie-Hellman) shared secret, which leaves no onchain trace.
248
+ return { type: 'address-derived' };
249
+ }
250
+
251
+ /**
252
+ * The app-siloed, recipient-directional secret derived from the sender's and recipient's address keys via ECDH,
253
+ * ready to hand to the contract. Callers must validate the recipient in-circuit before reaching here, so an invalid one is unexpected.
254
+ */
255
+ async #addressDerivedSecret(sender: AztecAddress, recipient: AztecAddress): Promise<ResolvedTaggingStrategy> {
256
+ const secret = await this.getAppTaggingSecret(sender, recipient);
257
+ if (!secret.isSome()) {
258
+ throw new Error(`Cannot derive an address-derived tagging secret for invalid recipient ${recipient}`);
259
+ }
260
+ return { type: 'unconstrained-secret', secret: secret.value };
187
261
  }
188
262
 
189
263
  /**
@@ -203,7 +277,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
203
277
  this.logger.warn(`Computing a tagging secret for invalid recipient ${recipient} - returning no secret`, {
204
278
  contractAddress: this.contractAddress,
205
279
  });
206
- return Option.none(Fr.ZERO);
280
+ return Option.none();
207
281
  }
208
282
 
209
283
  return Option.some(extendedSecret.secret);
@@ -475,10 +549,15 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
475
549
  * Emit a contract class log.
476
550
  * This fn exists because we only carry a poseidon hash through the kernels, and need to
477
551
  * keep the preimage in ts for later.
478
- * @param log - The contract class log to be emitted.
552
+ * @param logData - The contract class log to be emitted.
479
553
  * @param counter - The contract class log's counter.
480
554
  */
481
- public notifyCreatedContractClassLog(log: ContractClassLog, counter: number) {
555
+ public notifyCreatedContractClassLog(logData: ContractClassLogData, counter: number) {
556
+ const log = ContractClassLog.from({
557
+ contractAddress: logData.contractAddress,
558
+ fields: new ContractClassLogFields(logData.fields),
559
+ emittedLength: logData.emittedLength,
560
+ });
482
561
  this.contractClassLogs.push(new CountedContractClassLog(log, counter));
483
562
  const text = log.toBuffer().toString('hex');
484
563
  this.logger.verbose(
@@ -563,10 +642,11 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
563
642
  aztecNode: this.aztecNode,
564
643
  senderTaggingStore: this.senderTaggingStore,
565
644
  recipientTaggingStore: this.recipientTaggingStore,
566
- senderAddressBookStore: this.senderAddressBookStore,
645
+ taggingSecretSourcesStore: this.taggingSecretSourcesStore,
567
646
  capsuleService: this.capsuleService,
647
+ factService: this.factService,
568
648
  privateEventStore: this.privateEventStore,
569
- messageContextService: this.messageContextService,
649
+ txResolver: this.txResolver,
570
650
  contractSyncService: this.contractSyncService,
571
651
  jobId: this.jobId,
572
652
  totalPublicCalldataCount: this.totalPublicCalldataCount,