@aztec/pxe 5.0.0-rc.1 → 5.0.0

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 (297) 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 +16 -12
  5. package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
  6. package/dest/block_synchronizer/block_synchronizer.js +49 -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/contract_class_service.d.ts +31 -0
  11. package/dest/contract/contract_class_service.d.ts.map +1 -0
  12. package/dest/contract/contract_class_service.js +68 -0
  13. package/dest/{contract_sync → contract}/contract_sync_service.d.ts +7 -6
  14. package/dest/contract/contract_sync_service.d.ts.map +1 -0
  15. package/dest/{contract_sync → contract}/contract_sync_service.js +10 -30
  16. package/dest/contract/helpers.d.ts +7 -0
  17. package/dest/contract/helpers.d.ts.map +1 -0
  18. package/dest/contract/helpers.js +20 -0
  19. package/dest/contract_function_simulator/anchored_contract_data.d.ts +36 -0
  20. package/dest/contract_function_simulator/anchored_contract_data.d.ts.map +1 -0
  21. package/dest/contract_function_simulator/anchored_contract_data.js +54 -0
  22. package/dest/contract_function_simulator/aztec_node_read_cache.d.ts +39 -0
  23. package/dest/contract_function_simulator/aztec_node_read_cache.d.ts.map +1 -0
  24. package/dest/contract_function_simulator/aztec_node_read_cache.js +60 -0
  25. package/dest/contract_function_simulator/contract_function_simulator.d.ts +19 -18
  26. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  27. package/dest/contract_function_simulator/contract_function_simulator.js +52 -31
  28. package/dest/contract_function_simulator/execution_note_cache.d.ts +3 -9
  29. package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
  30. package/dest/contract_function_simulator/execution_note_cache.js +8 -28
  31. package/dest/contract_function_simulator/index.d.ts +17 -9
  32. package/dest/contract_function_simulator/index.d.ts.map +1 -1
  33. package/dest/contract_function_simulator/index.js +4 -7
  34. package/dest/contract_function_simulator/noir-structs/bounded_vec.d.ts +8 -27
  35. package/dest/contract_function_simulator/noir-structs/bounded_vec.d.ts.map +1 -1
  36. package/dest/contract_function_simulator/noir-structs/bounded_vec.js +8 -23
  37. package/dest/contract_function_simulator/noir-structs/contract_class_log_data.d.ts +9 -0
  38. package/dest/contract_function_simulator/noir-structs/contract_class_log_data.d.ts.map +1 -0
  39. package/dest/contract_function_simulator/noir-structs/contract_class_log_data.js +1 -0
  40. package/dest/contract_function_simulator/noir-structs/embedded_curve_point.d.ts +7 -0
  41. package/dest/contract_function_simulator/noir-structs/embedded_curve_point.d.ts.map +1 -0
  42. package/dest/contract_function_simulator/noir-structs/embedded_curve_point.js +1 -0
  43. package/dest/contract_function_simulator/noir-structs/event_validation_request.js +1 -1
  44. package/dest/contract_function_simulator/noir-structs/fact.d.ts +16 -0
  45. package/dest/contract_function_simulator/noir-structs/fact.d.ts.map +1 -0
  46. package/dest/contract_function_simulator/noir-structs/fact.js +6 -0
  47. package/dest/contract_function_simulator/noir-structs/fact_collection.d.ts +27 -0
  48. package/dest/contract_function_simulator/noir-structs/fact_collection.d.ts.map +1 -0
  49. package/dest/contract_function_simulator/noir-structs/fact_collection.js +31 -0
  50. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +11 -12
  51. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts.map +1 -1
  52. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.js +6 -49
  53. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +10 -8
  54. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
  55. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +1 -60
  56. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +2 -2
  57. package/dest/contract_function_simulator/noir-structs/option.d.ts +9 -11
  58. package/dest/contract_function_simulator/noir-structs/option.d.ts.map +1 -1
  59. package/dest/contract_function_simulator/noir-structs/option.js +18 -13
  60. package/dest/contract_function_simulator/noir-structs/origin_block.d.ts +11 -0
  61. package/dest/contract_function_simulator/noir-structs/origin_block.d.ts.map +1 -0
  62. package/dest/contract_function_simulator/noir-structs/origin_block.js +5 -0
  63. package/dest/contract_function_simulator/noir-structs/pending_tagged_log.d.ts +11 -0
  64. package/dest/contract_function_simulator/noir-structs/pending_tagged_log.d.ts.map +1 -0
  65. package/dest/contract_function_simulator/noir-structs/pending_tagged_log.js +4 -0
  66. package/dest/contract_function_simulator/noir-structs/provided_secret.d.ts +6 -9
  67. package/dest/contract_function_simulator/noir-structs/provided_secret.d.ts.map +1 -1
  68. package/dest/contract_function_simulator/noir-structs/provided_secret.js +1 -14
  69. package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.d.ts +28 -0
  70. package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.d.ts.map +1 -0
  71. package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.js +50 -0
  72. package/dest/contract_function_simulator/noir-structs/resolved_tx.d.ts +21 -0
  73. package/dest/contract_function_simulator/noir-structs/resolved_tx.d.ts.map +1 -0
  74. package/dest/contract_function_simulator/noir-structs/resolved_tx.js +50 -0
  75. package/dest/contract_function_simulator/noir-structs/tx_effect_data.d.ts +14 -0
  76. package/dest/contract_function_simulator/noir-structs/tx_effect_data.d.ts.map +1 -0
  77. package/dest/contract_function_simulator/noir-structs/tx_effect_data.js +5 -0
  78. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +6 -11
  79. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -1
  80. package/dest/contract_function_simulator/noir-structs/utility_context.js +1 -20
  81. package/dest/contract_function_simulator/oracle/acir_callback.d.ts +7 -2
  82. package/dest/contract_function_simulator/oracle/acir_callback.d.ts.map +1 -1
  83. package/dest/contract_function_simulator/oracle/acir_callback.js +55 -11
  84. package/dest/contract_function_simulator/oracle/legacy_oracle_registry.d.ts +39 -0
  85. package/dest/contract_function_simulator/oracle/legacy_oracle_registry.d.ts.map +1 -0
  86. package/dest/contract_function_simulator/oracle/legacy_oracle_registry.js +107 -0
  87. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +3 -14
  88. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
  89. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.js +1 -24
  90. package/dest/contract_function_simulator/oracle/oracle_registry.d.ts +86 -8
  91. package/dest/contract_function_simulator/oracle/oracle_registry.d.ts.map +1 -1
  92. package/dest/contract_function_simulator/oracle/oracle_registry.js +168 -18
  93. package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts +123 -40
  94. package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts.map +1 -1
  95. package/dest/contract_function_simulator/oracle/oracle_type_mappings.js +947 -264
  96. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +21 -8
  97. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  98. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +126 -16
  99. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +63 -33
  100. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  101. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +175 -90
  102. package/dest/debug/pxe_debug_utils.d.ts +2 -2
  103. package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
  104. package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
  105. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  106. package/dest/entrypoints/client/bundle/utils.js +3 -2
  107. package/dest/entrypoints/client/lazy/utils.d.ts +1 -1
  108. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  109. package/dest/entrypoints/client/lazy/utils.js +3 -2
  110. package/dest/entrypoints/pxe_creation_options.d.ts +8 -2
  111. package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
  112. package/dest/entrypoints/server/index.d.ts +5 -3
  113. package/dest/entrypoints/server/index.d.ts.map +1 -1
  114. package/dest/entrypoints/server/index.js +3 -2
  115. package/dest/entrypoints/server/utils.d.ts +1 -1
  116. package/dest/entrypoints/server/utils.d.ts.map +1 -1
  117. package/dest/entrypoints/server/utils.js +3 -1
  118. package/dest/error_enriching.d.ts +5 -3
  119. package/dest/error_enriching.d.ts.map +1 -1
  120. package/dest/error_enriching.js +13 -11
  121. package/dest/hooks/execution_hooks.d.ts +27 -7
  122. package/dest/hooks/execution_hooks.d.ts.map +1 -1
  123. package/dest/hooks/execution_hooks.js +3 -3
  124. package/dest/hooks/index.d.ts +4 -3
  125. package/dest/hooks/index.d.ts.map +1 -1
  126. package/dest/hooks/index.js +1 -0
  127. package/dest/hooks/resolve_custom_request.d.ts +23 -0
  128. package/dest/hooks/resolve_custom_request.d.ts.map +1 -0
  129. package/dest/hooks/resolve_custom_request.js +3 -0
  130. package/dest/hooks/resolve_tagging_secret_strategy.d.ts +50 -0
  131. package/dest/hooks/resolve_tagging_secret_strategy.d.ts.map +1 -0
  132. package/dest/hooks/resolve_tagging_secret_strategy.js +3 -0
  133. package/dest/logs/log_service.d.ts +7 -6
  134. package/dest/logs/log_service.d.ts.map +1 -1
  135. package/dest/logs/log_service.js +79 -28
  136. package/dest/messages/tx_resolver_service.d.ts +17 -0
  137. package/dest/messages/tx_resolver_service.d.ts.map +1 -0
  138. package/dest/messages/{message_context_service.js → tx_resolver_service.js} +8 -8
  139. package/dest/oracle_version.d.ts +3 -3
  140. package/dest/oracle_version.js +3 -3
  141. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +1 -1
  142. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -1
  143. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.js +6 -2
  144. package/dest/private_kernel/hints/test_utils.js +1 -1
  145. package/dest/private_kernel/private_kernel_execution_prover.d.ts +1 -1
  146. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
  147. package/dest/private_kernel/private_kernel_execution_prover.js +17 -36
  148. package/dest/private_kernel/private_kernel_oracle.d.ts +4 -2
  149. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
  150. package/dest/private_kernel/private_kernel_oracle.js +17 -5
  151. package/dest/pxe.d.ts +109 -47
  152. package/dest/pxe.d.ts.map +1 -1
  153. package/dest/pxe.js +222 -139
  154. package/dest/storage/allowed_scopes.d.ts +6 -0
  155. package/dest/storage/allowed_scopes.d.ts.map +1 -0
  156. package/dest/storage/allowed_scopes.js +7 -0
  157. package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts +1 -1
  158. package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts.map +1 -1
  159. package/dest/storage/backwards_compatibility_tests/schema_tests.js +114 -37
  160. package/dest/storage/capsule_store/capsule_service.d.ts +1 -1
  161. package/dest/storage/capsule_store/capsule_service.d.ts.map +1 -1
  162. package/dest/storage/capsule_store/capsule_service.js +6 -9
  163. package/dest/storage/contract_store/contract_store.d.ts +27 -24
  164. package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
  165. package/dest/storage/contract_store/contract_store.js +64 -75
  166. package/dest/storage/fact_store/fact_service.d.ts +22 -0
  167. package/dest/storage/fact_store/fact_service.d.ts.map +1 -0
  168. package/dest/storage/fact_store/fact_service.js +45 -0
  169. package/dest/storage/fact_store/fact_store.d.ts +95 -0
  170. package/dest/storage/fact_store/fact_store.d.ts.map +1 -0
  171. package/dest/storage/fact_store/fact_store.js +408 -0
  172. package/dest/storage/fact_store/fact_store_keys.d.ts +34 -0
  173. package/dest/storage/fact_store/fact_store_keys.d.ts.map +1 -0
  174. package/dest/storage/fact_store/fact_store_keys.js +50 -0
  175. package/dest/storage/fact_store/index.d.ts +6 -0
  176. package/dest/storage/fact_store/index.d.ts.map +1 -0
  177. package/dest/storage/fact_store/index.js +4 -0
  178. package/dest/storage/fact_store/origin_state.d.ts +57 -0
  179. package/dest/storage/fact_store/origin_state.d.ts.map +1 -0
  180. package/dest/storage/fact_store/origin_state.js +53 -0
  181. package/dest/storage/fact_store/stored_fact.d.ts +32 -0
  182. package/dest/storage/fact_store/stored_fact.d.ts.map +1 -0
  183. package/dest/storage/fact_store/stored_fact.js +64 -0
  184. package/dest/storage/index.d.ts +2 -1
  185. package/dest/storage/index.d.ts.map +1 -1
  186. package/dest/storage/index.js +1 -0
  187. package/dest/storage/metadata.d.ts +2 -2
  188. package/dest/storage/metadata.d.ts.map +1 -1
  189. package/dest/storage/metadata.js +1 -1
  190. package/dest/storage/open_pxe_stores.d.ts +5 -3
  191. package/dest/storage/open_pxe_stores.d.ts.map +1 -1
  192. package/dest/storage/open_pxe_stores.js +5 -3
  193. package/dest/storage/tagging_store/index.d.ts +2 -2
  194. package/dest/storage/tagging_store/index.d.ts.map +1 -1
  195. package/dest/storage/tagging_store/index.js +1 -1
  196. package/dest/storage/tagging_store/tagging_secret_sources_store.d.ts +51 -0
  197. package/dest/storage/tagging_store/tagging_secret_sources_store.d.ts.map +1 -0
  198. package/dest/storage/tagging_store/tagging_secret_sources_store.js +105 -0
  199. package/dest/tagging/constants.d.ts +2 -2
  200. package/dest/tagging/constants.d.ts.map +1 -1
  201. package/dest/tagging/constants.js +18 -9
  202. package/package.json +17 -17
  203. package/src/block_synchronizer/block_stream_source.ts +6 -45
  204. package/src/block_synchronizer/block_synchronizer.ts +65 -24
  205. package/src/config/index.ts +1 -0
  206. package/src/contract/contract_class_service.ts +83 -0
  207. package/src/{contract_sync → contract}/contract_sync_service.ts +18 -37
  208. package/src/contract/helpers.ts +35 -0
  209. package/src/contract_function_simulator/anchored_contract_data.ts +74 -0
  210. package/src/contract_function_simulator/aztec_node_read_cache.ts +89 -0
  211. package/src/contract_function_simulator/contract_function_simulator.ts +86 -43
  212. package/src/contract_function_simulator/execution_note_cache.ts +7 -28
  213. package/src/contract_function_simulator/index.ts +24 -9
  214. package/src/contract_function_simulator/noir-structs/bounded_vec.ts +12 -24
  215. package/src/contract_function_simulator/noir-structs/contract_class_log_data.ts +9 -0
  216. package/src/contract_function_simulator/noir-structs/embedded_curve_point.ts +4 -0
  217. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +1 -1
  218. package/src/contract_function_simulator/noir-structs/fact.ts +13 -0
  219. package/src/contract_function_simulator/noir-structs/fact_collection.ts +64 -0
  220. package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +20 -46
  221. package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +13 -60
  222. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +2 -2
  223. package/src/contract_function_simulator/noir-structs/option.ts +17 -11
  224. package/src/contract_function_simulator/noir-structs/origin_block.ts +8 -0
  225. package/src/contract_function_simulator/noir-structs/pending_tagged_log.ts +12 -0
  226. package/src/contract_function_simulator/noir-structs/provided_secret.ts +4 -15
  227. package/src/contract_function_simulator/noir-structs/resolved_tagging_strategy.ts +66 -0
  228. package/src/contract_function_simulator/noir-structs/resolved_tx.ts +53 -0
  229. package/src/contract_function_simulator/noir-structs/tx_effect_data.ts +15 -0
  230. package/src/contract_function_simulator/noir-structs/utility_context.ts +5 -17
  231. package/src/contract_function_simulator/oracle/acir_callback.ts +58 -12
  232. package/src/contract_function_simulator/oracle/legacy_oracle_registry.ts +147 -0
  233. package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +6 -21
  234. package/src/contract_function_simulator/oracle/oracle_registry.ts +119 -86
  235. package/src/contract_function_simulator/oracle/oracle_type_mappings.ts +659 -248
  236. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +155 -24
  237. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +300 -115
  238. package/src/debug/pxe_debug_utils.ts +1 -1
  239. package/src/entrypoints/client/bundle/utils.ts +3 -2
  240. package/src/entrypoints/client/lazy/utils.ts +3 -2
  241. package/src/entrypoints/pxe_creation_options.ts +7 -1
  242. package/src/entrypoints/server/index.ts +5 -2
  243. package/src/entrypoints/server/utils.ts +3 -1
  244. package/src/error_enriching.ts +27 -11
  245. package/src/hooks/execution_hooks.ts +28 -8
  246. package/src/hooks/index.ts +8 -2
  247. package/src/hooks/resolve_custom_request.ts +24 -0
  248. package/src/hooks/resolve_tagging_secret_strategy.ts +60 -0
  249. package/src/logs/log_service.ts +91 -37
  250. package/src/messages/{message_context_service.ts → tx_resolver_service.ts} +16 -9
  251. package/src/oracle_version.ts +3 -3
  252. package/src/private_kernel/hints/private_kernel_reset_private_inputs_builder.ts +11 -1
  253. package/src/private_kernel/hints/test_utils.ts +1 -1
  254. package/src/private_kernel/private_kernel_execution_prover.ts +22 -52
  255. package/src/private_kernel/private_kernel_oracle.ts +23 -4
  256. package/src/pxe.ts +320 -158
  257. package/src/storage/allowed_scopes.ts +14 -0
  258. package/src/storage/backwards_compatibility_tests/__snapshots__/AddressStore.json +6 -6
  259. package/src/storage/backwards_compatibility_tests/__snapshots__/ContractStore.json +1 -1
  260. package/src/storage/backwards_compatibility_tests/__snapshots__/FactStore.json +40 -0
  261. package/src/storage/backwards_compatibility_tests/__snapshots__/KeyStore.json +12 -12
  262. package/src/storage/backwards_compatibility_tests/__snapshots__/L2TipsKVStore.json +1 -1
  263. package/src/storage/backwards_compatibility_tests/__snapshots__/RecipientTaggingStore.json +11 -3
  264. package/src/storage/backwards_compatibility_tests/__snapshots__/SenderTaggingStore.json +12 -4
  265. package/src/storage/backwards_compatibility_tests/__snapshots__/TaggingSecretSourcesStore.json +30 -0
  266. package/src/storage/backwards_compatibility_tests/__snapshots__/opened_stores.json +21 -5
  267. package/src/storage/backwards_compatibility_tests/schema_tests.ts +125 -36
  268. package/src/storage/capsule_store/capsule_service.ts +8 -13
  269. package/src/storage/contract_store/contract_store.ts +86 -93
  270. package/src/storage/fact_store/fact_service.ts +69 -0
  271. package/src/storage/fact_store/fact_store.ts +487 -0
  272. package/src/storage/fact_store/fact_store_keys.ts +75 -0
  273. package/src/storage/fact_store/index.ts +14 -0
  274. package/src/storage/fact_store/origin_state.ts +75 -0
  275. package/src/storage/fact_store/stored_fact.ts +80 -0
  276. package/src/storage/index.ts +1 -0
  277. package/src/storage/metadata.ts +1 -1
  278. package/src/storage/open_pxe_stores.ts +6 -3
  279. package/src/storage/tagging_store/index.ts +1 -1
  280. package/src/storage/tagging_store/tagging_secret_sources_store.ts +138 -0
  281. package/src/tagging/constants.ts +19 -9
  282. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +0 -6
  283. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +0 -1
  284. package/dest/contract_function_simulator/proxied_contract_data_source.js +0 -51
  285. package/dest/contract_sync/contract_sync_service.d.ts.map +0 -1
  286. package/dest/contract_sync/helpers.d.ts +0 -27
  287. package/dest/contract_sync/helpers.d.ts.map +0 -1
  288. package/dest/contract_sync/helpers.js +0 -53
  289. package/dest/messages/message_context_service.d.ts +0 -17
  290. package/dest/messages/message_context_service.d.ts.map +0 -1
  291. package/dest/storage/tagging_store/sender_address_book_store.d.ts +0 -14
  292. package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +0 -1
  293. package/dest/storage/tagging_store/sender_address_book_store.js +0 -36
  294. package/src/contract_function_simulator/proxied_contract_data_source.ts +0 -60
  295. package/src/contract_sync/helpers.ts +0 -86
  296. package/src/storage/backwards_compatibility_tests/__snapshots__/SenderAddressBookStore.json +0 -16
  297. package/src/storage/tagging_store/sender_address_book_store.ts +0 -48
@@ -5,8 +5,8 @@ import type { NoteDao } from '@aztec/stdlib/note';
5
5
  import type { ContractOverrides } from '@aztec/stdlib/tx';
6
6
 
7
7
  import type { BlockSynchronizer } from '../block_synchronizer/block_synchronizer.js';
8
+ import type { ContractSyncService } from '../contract/contract_sync_service.js';
8
9
  import type { ContractFunctionSimulator } from '../contract_function_simulator/contract_function_simulator.js';
9
- import type { ContractSyncService } from '../contract_sync/contract_sync_service.js';
10
10
  import type { NotesFilter } from '../notes_filter.js';
11
11
  import type { AnchorBlockStore } from '../storage/index.js';
12
12
  import type { NoteStore } from '../storage/note_store/note_store.js';
@@ -1,6 +1,6 @@
1
1
  import { BBBundlePrivateKernelProver } from '@aztec/bb-prover/client/bundle';
2
2
  import { createLogger } from '@aztec/foundation/log';
3
- import { createStore } from '@aztec/kv-store/indexeddb';
3
+ import { createStore } from '@aztec/kv-store/sqlite-opfs';
4
4
  import { BundledProtocolContractsProvider } from '@aztec/protocol-contracts/providers/bundle';
5
5
  import { WASMSimulator } from '@aztec/simulator/client';
6
6
  import { getStandardAuthRegistry } from '@aztec/standard-contracts/auth-registry';
@@ -37,7 +37,7 @@ export async function createPXE(
37
37
  ...l1ContractAddresses,
38
38
  } as PXEConfig;
39
39
 
40
- const storeLogger = loggers.store ?? createLogger('pxe:data:idb', { actor });
40
+ const storeLogger = loggers.store ?? createLogger('pxe:data', { actor });
41
41
 
42
42
  const store =
43
43
  options.store ?? (await createStore('pxe_data', configWithContracts, PXE_DATA_SCHEMA_VERSION, storeLogger));
@@ -63,6 +63,7 @@ export async function createPXE(
63
63
  const pxeLogger = loggers.pxe ?? createLogger('pxe:service', { actor });
64
64
  const pxe = await PXE.create({
65
65
  node: aztecNode,
66
+ nodeDebug: options.nodeDebug,
66
67
  store,
67
68
  proofCreator: prover,
68
69
  simulator,
@@ -1,6 +1,6 @@
1
1
  import { BBLazyPrivateKernelProver } from '@aztec/bb-prover/client/lazy';
2
2
  import { createLogger } from '@aztec/foundation/log';
3
- import { createStore } from '@aztec/kv-store/indexeddb';
3
+ import { createStore } from '@aztec/kv-store/sqlite-opfs';
4
4
  import { LazyProtocolContractsProvider } from '@aztec/protocol-contracts/providers/lazy';
5
5
  import { WASMSimulator } from '@aztec/simulator/client';
6
6
  import { getStandardAuthRegistry } from '@aztec/standard-contracts/auth-registry/lazy';
@@ -37,7 +37,7 @@ export async function createPXE(
37
37
 
38
38
  const loggers = options.loggers ?? {};
39
39
 
40
- const storeLogger = loggers.store ?? createLogger('pxe:data:idb', { actor });
40
+ const storeLogger = loggers.store ?? createLogger('pxe:data', { actor });
41
41
 
42
42
  const store =
43
43
  options.store ?? (await createStore('pxe_data', configWithContracts, PXE_DATA_SCHEMA_VERSION, storeLogger));
@@ -63,6 +63,7 @@ export async function createPXE(
63
63
  const pxeLogger = loggers.pxe ?? createLogger('pxe:service', { actor });
64
64
  const pxe = await PXE.create({
65
65
  node: aztecNode,
66
+ nodeDebug: options.nodeDebug,
66
67
  store,
67
68
  proofCreator: prover,
68
69
  simulator,
@@ -2,7 +2,7 @@ import type { BBPrivateKernelProverOptions } from '@aztec/bb-prover/client';
2
2
  import type { Logger } from '@aztec/foundation/log';
3
3
  import type { AztecAsyncKVStore } from '@aztec/kv-store';
4
4
  import type { CircuitSimulator } from '@aztec/simulator/client';
5
- import type { PrivateKernelProver } from '@aztec/stdlib/interfaces/client';
5
+ import type { AztecNodeDebug, PrivateKernelProver } from '@aztec/stdlib/interfaces/client';
6
6
 
7
7
  import type { ExecutionHooks } from '../hooks/index.js';
8
8
  import type { PreloadedContractsProvider } from '../pxe.js';
@@ -18,6 +18,12 @@ export type PXECreationOptions = {
18
18
  hooks?: ExecutionHooks;
19
19
  /** Contracts to preload on startup. Replaces the default when set. */
20
20
  preloadedContractsProvider?: PreloadedContractsProvider;
21
+ /**
22
+ * Optional debug API client for the same node. When provided, public function signatures are registered so the
23
+ * node can produce named public-execution stack traces. Only available on nodes started with debug endpoints
24
+ * enabled; omitted in prod-like setups.
25
+ */
26
+ nodeDebug?: AztecNodeDebug;
21
27
  };
22
28
 
23
29
  /** Checks if the given value implements the PrivateKernelProver interface via duck-typing. */
@@ -1,6 +1,7 @@
1
+ export { type AccountPrivacyKeys, type AccountPrivacySecretKeys } from '@aztec/key-store';
2
+
1
3
  export * from '../../notes_filter.js';
2
4
  export * from '../../pxe.js';
3
- export * from '../../hooks/index.js';
4
5
  export * from '../../config/index.js';
5
6
  export * from '../../error_enriching.js';
6
7
  export * from '../../storage/index.js';
@@ -9,4 +10,6 @@ export { NoteService } from '../../notes/note_service.js';
9
10
  export { ORACLE_VERSION_MAJOR, ORACLE_VERSION_MINOR } from '../../oracle_version.js';
10
11
  export { type PXECreationOptions } from '../pxe_creation_options.js';
11
12
  export { JobCoordinator } from '../../job_coordinator/job_coordinator.js';
12
- export { ContractSyncService } from '../../contract_sync/contract_sync_service.js';
13
+ export { ContractSyncService } from '../../contract/contract_sync_service.js';
14
+ export { ContractClassService } from '../../contract/contract_class_service.js';
15
+ export { AnchoredContractData } from '../../contract_function_simulator/anchored_contract_data.js';
@@ -3,7 +3,8 @@ import type { L1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses'
3
3
  import { createLogger } from '@aztec/foundation/log';
4
4
  import { createStore } from '@aztec/kv-store/lmdb-v2';
5
5
  import { BundledProtocolContractsProvider } from '@aztec/protocol-contracts/providers/bundle';
6
- import { MemoryCircuitRecorder, SimulatorRecorderWrapper, WASMSimulator } from '@aztec/simulator/client';
6
+ import { WASMSimulator } from '@aztec/simulator/client';
7
+ import { MemoryCircuitRecorder, SimulatorRecorderWrapper } from '@aztec/simulator/server';
7
8
  import { FileCircuitRecorder } from '@aztec/simulator/testing';
8
9
  import { getStandardAuthRegistry } from '@aztec/standard-contracts/auth-registry';
9
10
  import { getStandardHandshakeRegistry } from '@aztec/standard-contracts/handshake-registry';
@@ -73,6 +74,7 @@ export async function createPXE(
73
74
  const pxeLogger = loggers.pxe ?? createLogger('pxe:service', { actor });
74
75
  const pxe = await PXE.create({
75
76
  node: aztecNode,
77
+ nodeDebug: options.nodeDebug,
76
78
  store: options.store,
77
79
  proofCreator: prover,
78
80
  simulator,
@@ -3,7 +3,9 @@ import { resolveAssertionMessageFromRevertData, resolveOpcodeLocations } from '@
3
3
  import { FunctionSelector } from '@aztec/stdlib/abi';
4
4
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
5
5
  import { type SimulationError, isNoirCallStackUnresolved } from '@aztec/stdlib/errors';
6
+ import type { BlockHeader } from '@aztec/stdlib/tx';
6
7
 
8
+ import type { ContractClassService } from './contract/contract_class_service.js';
7
9
  import type { ContractStore } from './storage/contract_store/contract_store.js';
8
10
 
9
11
  /**
@@ -11,7 +13,13 @@ import type { ContractStore } from './storage/contract_store/contract_store.js';
11
13
  * can be found in the PXE database
12
14
  * @param err - The error to enrich.
13
15
  */
14
- export async function enrichSimulationError(err: SimulationError, contractStore: ContractStore, logger: Logger) {
16
+ export async function enrichSimulationError(
17
+ err: SimulationError,
18
+ contractStore: ContractStore,
19
+ contractClassService: ContractClassService,
20
+ anchorHeader: BlockHeader,
21
+ logger: Logger,
22
+ ) {
15
23
  // Maps contract addresses to the set of function selectors that were in error.
16
24
  // Map and Set do reference equality for their keys instead of value equality, so we store the string
17
25
  // representation to get e.g. different contract address objects with the same address value to match.
@@ -29,14 +37,15 @@ export async function enrichSimulationError(err: SimulationError, contractStore:
29
37
 
30
38
  await Promise.all(
31
39
  [...mentionedFunctions.entries()].map(async ([contractAddress, fnSelectors]) => {
32
- const parsedContractAddress = AztecAddress.fromString(contractAddress);
33
- const contract = await contractStore.getContract(parsedContractAddress);
34
- if (contract) {
35
- err.enrichWithContractName(parsedContractAddress, contract.name);
40
+ const parsedContractAddress = AztecAddress.fromStringUnsafe(contractAddress);
41
+ const classId = await contractClassService.getCurrentClassId(parsedContractAddress, anchorHeader);
42
+ const artifact = classId && (await contractStore.getContractArtifact(classId));
43
+ if (artifact) {
44
+ err.enrichWithContractName(parsedContractAddress, artifact.name);
36
45
  // Map from function selector to function name. It uses a stringified key for the same reason as mentionedFunctions.
37
46
  const selectorToNameMap: Map<string, string> = new Map();
38
47
  await Promise.all(
39
- contract.functions.map(async fn => {
48
+ artifact.functions.map(async fn => {
40
49
  const selector = await FunctionSelector.fromNameAndParameters(fn);
41
50
  selectorToNameMap.set(selector.toString(), fn.name);
42
51
  }),
@@ -51,7 +60,7 @@ export async function enrichSimulationError(err: SimulationError, contractStore:
51
60
  );
52
61
  } else {
53
62
  logger.warn(
54
- `Could not find function artifact in contract ${contract.name} for function '${fnSelector}' when enriching error callstack`,
63
+ `Could not find function artifact in contract ${artifact.name} for function '${fnSelector}' when enriching error callstack`,
55
64
  );
56
65
  }
57
66
  }
@@ -64,7 +73,13 @@ export async function enrichSimulationError(err: SimulationError, contractStore:
64
73
  );
65
74
  }
66
75
 
67
- export async function enrichPublicSimulationError(err: SimulationError, contractStore: ContractStore, logger: Logger) {
76
+ export async function enrichPublicSimulationError(
77
+ err: SimulationError,
78
+ contractStore: ContractStore,
79
+ contractClassService: ContractClassService,
80
+ anchorHeader: BlockHeader,
81
+ logger: Logger,
82
+ ) {
68
83
  const callStack = err.getCallStack();
69
84
  const originalFailingFunction = callStack[callStack.length - 1];
70
85
 
@@ -72,7 +87,8 @@ export async function enrichPublicSimulationError(err: SimulationError, contract
72
87
  throw new Error(`Original failing function not found when enriching public simulation, missing callstack`);
73
88
  }
74
89
 
75
- const artifact = await contractStore.getPublicFunctionArtifact(originalFailingFunction.contractAddress);
90
+ const classId = await contractClassService.getCurrentClassId(originalFailingFunction.contractAddress, anchorHeader);
91
+ const artifact = classId && (await contractStore.getPublicFunctionArtifact(classId));
76
92
  if (!artifact) {
77
93
  throw new Error(
78
94
  `Artifact not found when enriching public simulation error. Contract address: ${originalFailingFunction.contractAddress}.`,
@@ -84,7 +100,7 @@ export async function enrichPublicSimulationError(err: SimulationError, contract
84
100
  err.setOriginalMessage(err.getOriginalMessage() + `${assertionMessage}`);
85
101
  }
86
102
 
87
- const debugInfo = await contractStore.getPublicFunctionDebugMetadata(originalFailingFunction.contractAddress);
103
+ const debugInfo = await contractStore.getPublicFunctionDebugMetadata(classId);
88
104
 
89
105
  const noirCallStack = err.getNoirCallStack();
90
106
  if (debugInfo) {
@@ -102,6 +118,6 @@ export async function enrichPublicSimulationError(err: SimulationError, contract
102
118
  );
103
119
  }
104
120
  }
105
- await enrichSimulationError(err, contractStore, logger);
121
+ await enrichSimulationError(err, contractStore, contractClassService, anchorHeader, logger);
106
122
  }
107
123
  }
@@ -1,16 +1,18 @@
1
1
  import type { AuthorizeUtilityCall } from './authorize_utility_call.js';
2
+ import type { ResolveCustomRequest } from './resolve_custom_request.js';
3
+ import type { ResolveTaggingSecretStrategy } from './resolve_tagging_secret_strategy.js';
2
4
 
3
5
  /**
4
- * Hooks that PXE invokes during client-side simulation to gate operations that the protocol
6
+ * Hooks that PXE invokes during client-side simulation to gate or steer operations that the protocol
5
7
  * does not restrict on its own. They give the wallet a chance to apply custom policies (e.g.
6
8
  * prompting the user, consulting a dynamic allowlist, or inspecting call arguments) before the
7
- * execution proceeds.
9
+ * execution proceeds. All hooks are optional, and when a hook is absent PXE applies a safe default.
8
10
  *
9
11
  * For example, {@link authorizeUtilityCall} is called whenever a utility function makes a cross-contract call. A call
10
12
  * made by a malicious contract could leak private information, so the hook lets the wallet decide, per-call, whether
11
13
  * to allow it. A static allowlist would not work here because neither the app nor the wallet can predict ahead of
12
14
  * time which contracts will be invoked during execution. Calls to standard contracts (such as the HandshakeRegistry)
13
- * bypass this hook and are always authorized.
15
+ * bypass this hook and are always authorized. When the hook is absent, cross-contract utility calls are denied.
14
16
  *
15
17
  * Note: hooks are unrelated to authentication witnesses (authwits). Authwits are an on-chain
16
18
  * mechanism where a contract verifies that a caller was authorized by a specific account; hooks
@@ -27,22 +29,40 @@ import type { AuthorizeUtilityCall } from './authorize_utility_call.js';
27
29
  * ? { authorized: true }
28
30
  * : { authorized: false, reason: 'Unknown target' };
29
31
  * },
32
+ * // Apply per-recipient policy: reach a known contact via their address keys (no onchain trace) and use a
33
+ * // non-interactive handshake for everyone else.
34
+ * resolveTaggingSecretStrategy: async ({ recipient }) =>
35
+ * knownContacts.has(recipient.toString())
36
+ * ? { type: 'address-derived' }
37
+ * : { type: 'non-interactive-handshake' },
30
38
  * },
31
39
  * });
32
40
  * ```
33
41
  */
34
42
  export interface ExecutionHooks {
35
- /** Called when a contract attempts a cross-contract utility call. */
36
- authorizeUtilityCall: AuthorizeUtilityCall;
43
+ /** Called when a contract attempts a cross-contract utility call. Calls are denied when absent. */
44
+ authorizeUtilityCall?: AuthorizeUtilityCall;
45
+ /**
46
+ * Resolves a message's tagging secret when none is already established for the sender/recipient pair, letting the
47
+ * wallet apply per-recipient policy. PXE applies a default when absent.
48
+ * See {@link ResolveTaggingSecretStrategy} for the request shape and defaults.
49
+ */
50
+ resolveTaggingSecretStrategy?: ResolveTaggingSecretStrategy;
51
+ /**
52
+ * Resolves a custom, caller-defined request a circuit cannot serve from local state. Any contract can issue one, so
53
+ * an implementor should verify both the request `kind` and the issuing contract (its address and class ID) before
54
+ * fulfilling it. Rejected when absent; see {@link ResolveCustomRequest}.
55
+ */
56
+ resolveCustomRequest?: ResolveCustomRequest;
37
57
  }
38
58
 
39
59
  /**
40
60
  * Builds an {@link ExecutionHooks} from individually-constructed hook callbacks. Returns `undefined`
41
61
  * when every field is absent, so callers can unconditionally pass the result as `hooks`.
42
62
  */
43
- export function composeHooks(partial: Partial<ExecutionHooks>): ExecutionHooks | undefined {
44
- if (Object.values(partial).every(v => v === undefined)) {
63
+ export function composeHooks(hooks: ExecutionHooks): ExecutionHooks | undefined {
64
+ if (Object.values(hooks).every(v => v === undefined)) {
45
65
  return undefined;
46
66
  }
47
- return partial as ExecutionHooks;
67
+ return hooks;
48
68
  }
@@ -3,5 +3,11 @@ export type {
3
3
  UtilityCallAuthorizationRequest,
4
4
  UtilityCallAuthorizationResponse,
5
5
  } from './authorize_utility_call.js';
6
- export type { ExecutionHooks } from './execution_hooks.js';
7
- export { composeHooks } from './execution_hooks.js';
6
+ export { type ExecutionHooks, composeHooks } from './execution_hooks.js';
7
+ export { type CustomRequest, type ResolveCustomRequest } from './resolve_custom_request.js';
8
+ export {
9
+ DEFAULT_TAGGING_SECRET_STRATEGY,
10
+ type ResolveTaggingSecretStrategy,
11
+ type TaggingSecretStrategy,
12
+ type TaggingSecretStrategyRequest,
13
+ } from './resolve_tagging_secret_strategy.js';
@@ -0,0 +1,24 @@
1
+ import type { Fr } from '@aztec/foundation/curves/bn254';
2
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
3
+
4
+ /**
5
+ * A custom, caller-defined request resolved via the {@link ResolveCustomRequest} hook. It carries no fixed meaning:
6
+ * `kind` selects the request type so one hook can serve many such types, and `payload` holds the opaque,
7
+ * request-specific arguments. The resolver answers by whatever means it needs (local state, a third party,
8
+ * offchain data).
9
+ */
10
+ export type CustomRequest = {
11
+ /** The address of the contract issuing the request. */
12
+ contractAddress: AztecAddress;
13
+ /** The issuing contract's class ID, so resolvers can apply class-level (not just per-address) policy. */
14
+ contractClassId: Fr;
15
+ /** Discriminates the request type, letting one hook serve many such types. */
16
+ kind: Fr;
17
+ /** Opaque, request-specific arguments. */
18
+ payload: Fr[];
19
+ };
20
+
21
+ /**
22
+ * Hook resolving a {@link CustomRequest}. The resolver produces the response however it needs to.
23
+ */
24
+ export type ResolveCustomRequest = (request: CustomRequest) => Promise<Fr[]>;
@@ -0,0 +1,60 @@
1
+ import type { Fr } from '@aztec/foundation/curves/bn254';
2
+ import type { Point } from '@aztec/foundation/curves/grumpkin';
3
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
4
+ import type { AppTaggingSecretKind } from '@aztec/stdlib/logs';
5
+
6
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars -- only referenced by a {@link} doc tag
7
+ import type { ResolveCustomRequest } from './resolve_custom_request.js';
8
+
9
+ /**
10
+ * How a message's tagging secret is chosen: the wallet's strategy, returned by the `resolveTaggingSecretStrategy` hook
11
+ * when no onchain handshake has been registered for the sender/recipient pair. This is intent (plus, for an arbitrary
12
+ * secret, the raw material); PXE resolves it into the secret it hands the contract.
13
+ */
14
+ export type TaggingSecretStrategy =
15
+ | {
16
+ /** Establish a fresh non-interactive handshake via the onchain registry; reveals the recipient onchain. */
17
+ type: 'non-interactive-handshake';
18
+ }
19
+ | {
20
+ /**
21
+ * Establish a fresh interactive handshake via the onchain registry. Reveals nothing about the recipient
22
+ * onchain, but requires the recipient to answer the registry's signed-authorization request (served through
23
+ * the {@link ResolveCustomRequest} hook), so the send fails when it cannot be served.
24
+ */
25
+ type: 'interactive-handshake';
26
+ }
27
+ | {
28
+ /** Derive the secret from the sender's and recipient's address keys via ECDH. PXE computes and silos it. */
29
+ type: 'address-derived';
30
+ }
31
+ | {
32
+ /**
33
+ * A raw shared secret point the two parties already share offchain (e.g. coordinated out-of-band), supplied by
34
+ * the wallet. PXE app-silos it before use. Only sound for unconstrained delivery, since nothing onchain proves
35
+ * the recipient knows it.
36
+ */
37
+ type: 'arbitrary-secret';
38
+ /** The raw (un-siloed) shared secret point to derive the tag from. */
39
+ secret: Point;
40
+ };
41
+
42
+ /** The strategy PXE applies to both delivery modes when no `resolveTaggingSecretStrategy` hook is configured. */
43
+ export const DEFAULT_TAGGING_SECRET_STRATEGY: TaggingSecretStrategy = { type: 'non-interactive-handshake' };
44
+
45
+ /** Information about the message delivery requesting a tagging secret strategy. */
46
+ export type TaggingSecretStrategyRequest = {
47
+ contractAddress: AztecAddress;
48
+ /**
49
+ * The contract class ID of the executing contract, so wallets can apply class-level (not just per-address) policy.
50
+ */
51
+ contractClassId: Fr;
52
+ sender: AztecAddress;
53
+ recipient: AztecAddress;
54
+ deliveryMode: AppTaggingSecretKind;
55
+ };
56
+
57
+ /**
58
+ * Hook returning the {@link TaggingSecretStrategy} for an outgoing message.
59
+ */
60
+ export type ResolveTaggingSecretStrategy = (request: TaggingSecretStrategyRequest) => Promise<TaggingSecretStrategy>;
@@ -1,20 +1,31 @@
1
+ import { PRIVATE_LOG_CIPHERTEXT_LEN } from '@aztec/constants';
1
2
  import type { BlockNumber } from '@aztec/foundation/branded-types';
3
+ import type { GrumpkinScalar, Point } from '@aztec/foundation/curves/grumpkin';
2
4
  import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
3
5
  import type { KeyStore } from '@aztec/key-store';
4
6
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
5
7
  import type { BlockHash, L2TipsProvider } from '@aztec/stdlib/block';
8
+ import type { CompleteAddress } from '@aztec/stdlib/contract';
6
9
  import type { AztecNode } from '@aztec/stdlib/interfaces/server';
7
- import { AppTaggingSecret, type LogResult, PendingTaggedLog, SiloedTag } from '@aztec/stdlib/logs';
10
+ import {
11
+ AppTaggingSecret,
12
+ AppTaggingSecretKind,
13
+ type LogResult,
14
+ SiloedTag,
15
+ computeSharedTaggingSecret,
16
+ } from '@aztec/stdlib/logs';
8
17
  import type { BlockHeader } from '@aztec/stdlib/tx';
9
18
 
10
19
  import {
11
20
  type LogRetrievalRequest,
12
21
  LogSource,
13
22
  } from '../contract_function_simulator/noir-structs/log_retrieval_request.js';
14
- import { LogRetrievalResponse } from '../contract_function_simulator/noir-structs/log_retrieval_response.js';
23
+ import type { LogRetrievalResponse } from '../contract_function_simulator/noir-structs/log_retrieval_response.js';
24
+ import type { PendingTaggedLog } from '../contract_function_simulator/noir-structs/pending_tagged_log.js';
25
+ import { ResolvedTx } from '../contract_function_simulator/noir-structs/resolved_tx.js';
15
26
  import { AddressStore } from '../storage/address_store/address_store.js';
16
27
  import type { RecipientTaggingStore } from '../storage/tagging_store/recipient_tagging_store.js';
17
- import type { SenderAddressBookStore } from '../storage/tagging_store/sender_address_book_store.js';
28
+ import type { TaggingSecretSourcesStore } from '../storage/tagging_store/tagging_secret_sources_store.js';
18
29
  import {
19
30
  getAllPrivateLogsByTags,
20
31
  getAllPublicLogsByTagsFromContract,
@@ -34,7 +45,7 @@ export class LogService {
34
45
  private readonly l2TipsStore: L2TipsProvider,
35
46
  private readonly keyStore: KeyStore,
36
47
  private readonly recipientTaggingStore: RecipientTaggingStore,
37
- private readonly senderAddressBookStore: SenderAddressBookStore,
48
+ private readonly taggingSecretSourcesStore: TaggingSecretSourcesStore,
38
49
  private readonly addressStore: AddressStore,
39
50
  private readonly jobId: string,
40
51
  bindings?: LoggerBindings,
@@ -139,12 +150,14 @@ export class LogService {
139
150
  ): Map<RangeKey, { fromBlock?: BlockNumber; toBlock?: BlockNumber; entries: typeof entries }> {
140
151
  const groups = new Map<RangeKey, { fromBlock?: BlockNumber; toBlock?: BlockNumber; entries: typeof entries }>();
141
152
  for (const entry of entries) {
142
- const key = rangeKey(entry.request.fromBlock, entry.request.toBlock);
153
+ const fromBlock = entry.request.fromBlock.value;
154
+ const toBlock = entry.request.toBlock.value;
155
+ const key = rangeKey(fromBlock, toBlock);
143
156
  const existing = groups.get(key);
144
157
  if (existing) {
145
158
  existing.entries.push(entry);
146
159
  } else {
147
- groups.set(key, { fromBlock: entry.request.fromBlock, toBlock: entry.request.toBlock, entries: [entry] });
160
+ groups.set(key, { fromBlock, toBlock, entries: [entry] });
148
161
  }
149
162
  }
150
163
  return groups;
@@ -158,12 +171,17 @@ export class LogService {
158
171
  if (nullifiers.length === 0) {
159
172
  throw new Error(`Log for tx ${log.txHash} returned no nullifiers from the node`);
160
173
  }
161
- return new LogRetrievalResponse(
162
- log.logData.slice(1), // Skip the tag
163
- log.txHash,
164
- noteHashes,
165
- nullifiers[0],
166
- );
174
+ return {
175
+ // Skip the tag, and clip to the wire cap: public logs can exceed PRIVATE_LOG_CIPHERTEXT_LEN, which is the fixed
176
+ // size of the oracle's BoundedVec slot. A no-op for private logs, which are already within the cap.
177
+ logPayload: log.logData.slice(1, 1 + PRIVATE_LOG_CIPHERTEXT_LEN),
178
+ txHash: log.txHash,
179
+ uniqueNoteHashesInTx: noteHashes,
180
+ firstNullifierInTx: nullifiers[0],
181
+ blockNumber: log.blockNumber,
182
+ blockTimestamp: log.blockTimestamp,
183
+ blockHash: log.blockHash,
184
+ };
167
185
  }
168
186
 
169
187
  public async fetchTaggedLogs(
@@ -171,12 +189,20 @@ export class LogService {
171
189
  recipient: AztecAddress,
172
190
  providedSecrets: AppTaggingSecret[],
173
191
  ): Promise<PendingTaggedLog[]> {
174
- this.log.verbose(`Fetching tagged logs for ${contractAddress.toString()}`);
192
+ this.log.verbose(
193
+ `Fetching tagged logs for contract ${contractAddress.toString()} and recipient ${recipient.toString()}`,
194
+ );
175
195
 
176
196
  const l2Tips = await this.l2TipsStore.getL2Tips();
177
- // The secrets PXE derives or stores internally, plus any the app supplies explicitly for secrets PXE cannot
178
- // enumerate itself (e.g. handshake-derived ones).
179
- const secrets = [...(await this.#getSecretsForSenders(contractAddress, recipient)), ...providedSecrets];
197
+
198
+ // Secrets PXE can enumerate for this recipient (senders via ECDH + pre-shared store secrets), plus any the app
199
+ // supplies explicitly for secrets PXE cannot enumerate itself (e.g. handshake-derived ones). The latter arrive
200
+ // already computed and are searched even when the recipient's account is unknown locally, since they need no ECDH.
201
+ const combinedSecrets = [...(await this.#getPointDerivedSecrets(contractAddress, recipient)), ...providedSecrets];
202
+
203
+ // These sources can overlap (a sender that is also a PXE account, or a pre-shared secret that coincides with a
204
+ // sender-derived one), so we deduplicate the combined set.
205
+ const secrets = Array.from(new Map(combinedSecrets.map(secret => [secret.toString(), secret])).values());
180
206
 
181
207
  const logs = await syncTaggedPrivateLogs(
182
208
  secrets,
@@ -193,44 +219,72 @@ export class LogService {
193
219
  if (nullifiers.length === 0) {
194
220
  throw new Error(`Log for tx ${log.txHash} returned no nullifiers from the node`);
195
221
  }
196
- return new PendingTaggedLog(log.logData, log.txHash, noteHashes, nullifiers[0]);
222
+ return {
223
+ log: log.logData,
224
+ context: new ResolvedTx(log.txHash, noteHashes, nullifiers[0], log.blockNumber, log.blockHash.toFr()),
225
+ };
197
226
  });
198
227
  }
199
228
 
200
- async #getSecretsForSenders(contractAddress: AztecAddress, recipient: AztecAddress): Promise<AppTaggingSecret[]> {
229
+ /**
230
+ * Computes the tagging secrets PXE can enumerate for a recipient: one per known sender (via ECDH) plus any
231
+ * pre-shared secrets registered directly for the recipient. Each registered secret is scanned under the tag
232
+ * streams its kind can back. Deriving the sender-based secrets requires the recipient's address preimage and keys,
233
+ * so returns an empty array when those are unavailable. App-supplied secrets (e.g. derived from discovered
234
+ * handshakes) are handled separately by the caller and do not go through here.
235
+ */
236
+ async #getPointDerivedSecrets(contractAddress: AztecAddress, recipient: AztecAddress): Promise<AppTaggingSecret[]> {
201
237
  const recipientCompleteAddress = await this.addressStore.getCompleteAddress(recipient);
202
- if (!recipientCompleteAddress) {
238
+ if (!recipientCompleteAddress || !(await this.keyStore.hasAccount(recipient))) {
239
+ this.log.warn(
240
+ `Skipping sender-derived tag retrieval for ${recipient.toString()} due to unknown address preimage`,
241
+ );
203
242
  return [];
204
243
  }
205
244
  const recipientIvsk = await this.keyStore.getMasterIncomingViewingSecretKey(recipient);
206
245
 
207
- // We implicitly add all PXE accounts as senders, this helps us find tagged logs with messages that are sent to a
208
- // local account (recipient = us, sender = us)
209
- const allSenders = [...(await this.senderAddressBookStore.getSenders()), ...(await this.keyStore.getAccounts())];
246
+ const [senderPoints, registeredSecrets] = await Promise.all([
247
+ this.#getSecretsForSenders(recipientCompleteAddress, recipientIvsk),
248
+ this.taggingSecretSourcesStore.getSharedSecretsForRecipient(recipient),
249
+ ]);
250
+ return Promise.all([
251
+ ...senderPoints.map(secret => AppTaggingSecret.computeDirectional(secret, contractAddress, recipient)),
252
+ ...registeredSecrets.flatMap(({ kind, secret }) => {
253
+ switch (kind) {
254
+ case 'arbitrary-secret':
255
+ return [AppTaggingSecret.computeDirectional(secret, contractAddress, recipient)];
256
+ case 'handshake':
257
+ // A handshake-backed sender tags messages with the bare app-siloed secret, one tag domain per delivery
258
+ // mode.
259
+ return [
260
+ AppTaggingSecret.computeAppSiloed(secret, contractAddress, AppTaggingSecretKind.UNCONSTRAINED),
261
+ AppTaggingSecret.computeAppSiloed(secret, contractAddress, AppTaggingSecretKind.CONSTRAINED),
262
+ ];
263
+ }
264
+ }),
265
+ ]);
266
+ }
210
267
 
211
- // We deduplicate the senders by adding them to a set and then converting the set back to an array
212
- const deduplicatedSenders = Array.from(new Set(allSenders.map(sender => sender.toString()))).map(sender =>
213
- AztecAddress.fromString(sender),
214
- );
268
+ async #getSecretsForSenders(
269
+ recipientCompleteAddress: CompleteAddress,
270
+ recipientIvsk: GrumpkinScalar,
271
+ ): Promise<Point[]> {
272
+ // We implicitly add all PXE accounts as senders, this helps us decrypt tags on notes that we send to ourselves
273
+ // (recipient = us, sender = us).
274
+ const allSenders = [...(await this.taggingSecretSourcesStore.getSenders()), ...(await this.keyStore.getAccounts())];
215
275
 
216
276
  return Promise.all(
217
- deduplicatedSenders.map(async sender => {
218
- const secret = await AppTaggingSecret.computeUnconstrained(
219
- recipientCompleteAddress,
220
- recipientIvsk,
221
- sender,
222
- contractAddress,
223
- recipient,
224
- );
277
+ allSenders.map(async sender => {
278
+ const taggingSecretPoint = await computeSharedTaggingSecret(recipientCompleteAddress, recipientIvsk, sender);
225
279
 
226
- if (!secret) {
227
- // Note that all senders originate from either the SenderAddressBookStore or the KeyStore.
280
+ if (!taggingSecretPoint) {
281
+ // Note that all senders originate from either the TaggingSecretSourcesStore or the KeyStore.
228
282
  throw new Error(
229
283
  `Failed to compute a tagging secret for sender ${sender} - this implies this is an invalid address, which should not happen as they have been previously registered in PXE.`,
230
284
  );
231
285
  }
232
286
 
233
- return secret;
287
+ return taggingSecretPoint;
234
288
  }),
235
289
  );
236
290
  }
@@ -1,21 +1,22 @@
1
1
  import { uniqueBy } from '@aztec/foundation/collection';
2
2
  import { Fr } from '@aztec/foundation/curves/bn254';
3
3
  import type { AztecNode } from '@aztec/stdlib/interfaces/server';
4
- import { MessageContext } from '@aztec/stdlib/logs';
5
4
  import { type IndexedTxEffect, TxHash } from '@aztec/stdlib/tx';
6
5
 
7
- /** Resolves transaction hashes into the context needed to process messages. */
8
- export class MessageContextService {
6
+ import { ResolvedTx } from '../contract_function_simulator/noir-structs/resolved_tx.js';
7
+
8
+ /** Resolves transaction hashes into their on-chain context (note hashes, first nullifier, and mined block). */
9
+ export class TxResolverService {
9
10
  constructor(private readonly aztecNode: AztecNode) {}
10
11
 
11
12
  /**
12
- * Resolves a list of tx hashes into their message contexts.
13
+ * Resolves a list of tx hashes into their on-chain context.
13
14
  *
14
- * For each tx hash, looks up the corresponding tx effect and extracts the note hashes and first nullifier needed to
15
- * process messages that originated from that transaction. Returns `null` for tx hashes that are zero, not yet
16
- * available, or in blocks beyond the anchor block.
15
+ * For each tx hash, looks up the corresponding tx effect and extracts the note hashes, first nullifier, and the
16
+ * number and hash of the block it was mined in. Returns `null` for tx hashes that are zero, not yet available, or in
17
+ * blocks beyond the anchor block.
17
18
  */
18
- async getMessageContextsByTxHash(txHashes: Fr[], anchorBlockNumber: number): Promise<(MessageContext | null)[]> {
19
+ async resolveTxs(txHashes: Fr[], anchorBlockNumber: number): Promise<(ResolvedTx | null)[]> {
19
20
  const nonZeroTxHashes = txHashes.filter(h => !h.isZero()).map(h => TxHash.fromField(h));
20
21
  const uniqueTxHashes = uniqueBy(nonZeroTxHashes, h => h.toString());
21
22
  const fetched = await Promise.all(
@@ -56,7 +57,13 @@ export class MessageContextService {
56
57
  throw new Error(`Tx effect for ${txHash} has no nullifiers`);
57
58
  }
58
59
 
59
- return new MessageContext(data.txHash, data.noteHashes, data.nullifiers[0]);
60
+ return new ResolvedTx(
61
+ data.txHash,
62
+ data.noteHashes,
63
+ data.nullifiers[0],
64
+ txEffect.l2BlockNumber,
65
+ txEffect.l2BlockHash.toFr(),
66
+ );
60
67
  });
61
68
  }
62
69
  }