@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
@@ -0,0 +1,147 @@
1
+ /* eslint-disable camelcase */
2
+ import { MAX_NOTE_HASHES_PER_TX, PRIVATE_LOG_CIPHERTEXT_LEN, PRIVATE_LOG_SIZE_IN_FIELDS } from '@aztec/constants';
3
+ import { computeFeeJuiceMessageNullifier } from '@aztec/stdlib/messaging';
4
+
5
+ import type { EphemeralArray } from '../noir-structs/ephemeral_array.js';
6
+ import type { LogRetrievalResponse } from '../noir-structs/log_retrieval_response.js';
7
+ import { Option } from '../noir-structs/option.js';
8
+ import type { PendingTaggedLog } from '../noir-structs/pending_tagged_log.js';
9
+ import type { ResolvedTx } from '../noir-structs/resolved_tx.js';
10
+ import {
11
+ type InferDeserializedParams,
12
+ ORACLE_REGISTRY,
13
+ type OracleRegistryEntry,
14
+ type ParamTypes,
15
+ type RegistryParam,
16
+ } from './oracle_registry.js';
17
+ import {
18
+ AZTEC_ADDRESS,
19
+ EPHEMERAL_ARRAY,
20
+ FIELD,
21
+ FIXED_BOUNDED_VEC,
22
+ STRUCT,
23
+ TX_HASH,
24
+ type TypeMapping,
25
+ } from './oracle_type_mappings.js';
26
+
27
+ const LEGACY_LOG_RETRIEVAL_RESPONSE: TypeMapping<LegacyLogRetrievalResponse> = STRUCT([
28
+ { name: 'logPayload', type: FIXED_BOUNDED_VEC(FIELD, PRIVATE_LOG_CIPHERTEXT_LEN) },
29
+ { name: 'txHash', type: TX_HASH },
30
+ { name: 'uniqueNoteHashesInTx', type: FIXED_BOUNDED_VEC(FIELD, MAX_NOTE_HASHES_PER_TX) },
31
+ { name: 'firstNullifierInTx', type: FIELD },
32
+ ]);
33
+
34
+ // Block-less transaction context: the prefix of `ResolvedTx`'s wire carried by the original `getPendingTaggedLogs`
35
+ // oracle. Known as `MessageContext` in the Aztec.nr versions that call that oracle.
36
+ const LEGACY_MESSAGE_CONTEXT: TypeMapping<LegacyMessageContext> = STRUCT<LegacyMessageContext>([
37
+ { name: 'txHash', type: TX_HASH },
38
+ { name: 'uniqueNoteHashesInTx', type: FIXED_BOUNDED_VEC(FIELD, MAX_NOTE_HASHES_PER_TX) },
39
+ { name: 'firstNullifierInTx', type: FIELD },
40
+ ]);
41
+
42
+ const LEGACY_PENDING_TAGGED_LOG: TypeMapping<LegacyPendingTaggedLog> = STRUCT<LegacyPendingTaggedLog>([
43
+ { name: 'log', type: FIXED_BOUNDED_VEC(FIELD, PRIVATE_LOG_SIZE_IN_FIELDS) },
44
+ { name: 'context', type: LEGACY_MESSAGE_CONTEXT },
45
+ ]);
46
+
47
+ /**
48
+ * Wire shapes that already-deployed contracts still call by their original oracle name, keyed by that retired name.
49
+ * New Aztec.nr calls the current name in `ORACLE_REGISTRY`; old bytecode keeps calling the name compiled into it and
50
+ * is served from here, so versioning an oracle's wire (e.g. adding return fields) stops being a breaking change.
51
+ *
52
+ * Append-only. Drop an entry only once the `ORACLE_VERSION_MAJOR` that introduced its successor is retired, since
53
+ * older contracts can no longer run against this environment.
54
+ */
55
+ export const LEGACY_ORACLE_REGISTRY: Record<string, LegacyOracleEntry> = {
56
+ aztec_utl_getL1ToL2MembershipWitness: legacyOracle({
57
+ modernOracle: 'aztec_utl_getL1ToL2MembershipWitnessV2',
58
+ // The old wire passed the contract address and secret, the modern oracle takes the unsiloed nullifier (plus the
59
+ // address to silo it with) instead. We derive it here so already-deployed contracts that still emit the old call
60
+ // keep working.
61
+ //
62
+ // This is the fee juice message nullifier derivation: only contracts using that scheme call this retired oracle.
63
+ params: {
64
+ legacyType: [
65
+ { name: 'contractAddress', type: AZTEC_ADDRESS },
66
+ { name: 'messageHash', type: FIELD },
67
+ { name: 'secret', type: FIELD },
68
+ ],
69
+ mapping: async ([contractAddress, messageHash, secret]) => [
70
+ messageHash,
71
+ Option.some({ contractAddress, nullifier: await computeFeeJuiceMessageNullifier(messageHash, secret) }),
72
+ ],
73
+ },
74
+ }),
75
+ aztec_utl_getLogsByTag: legacyOracle({
76
+ modernOracle: 'aztec_utl_getLogsByTagV2',
77
+ returnType: {
78
+ legacyType: EPHEMERAL_ARRAY(EPHEMERAL_ARRAY(LEGACY_LOG_RETRIEVAL_RESPONSE)),
79
+ // We can map this directly, since the new type is a superset of the old type
80
+ mapping: result => result as unknown as EphemeralArray<EphemeralArray<LegacyLogRetrievalResponse>>,
81
+ },
82
+ }),
83
+ aztec_utl_getPendingTaggedLogs: legacyOracle({
84
+ modernOracle: 'aztec_utl_getPendingTaggedLogsV2',
85
+ returnType: {
86
+ legacyType: EPHEMERAL_ARRAY(LEGACY_PENDING_TAGGED_LOG),
87
+ // We can map this directly, since `ResolvedTx` carries the legacy context's fields under the same names
88
+ mapping: result => result as unknown as EphemeralArray<LegacyPendingTaggedLog>,
89
+ },
90
+ }),
91
+ };
92
+
93
+ type LegacyLogRetrievalResponse = Pick<
94
+ LogRetrievalResponse,
95
+ 'logPayload' | 'txHash' | 'uniqueNoteHashesInTx' | 'firstNullifierInTx'
96
+ >;
97
+
98
+ type LegacyMessageContext = Pick<ResolvedTx, 'txHash' | 'uniqueNoteHashesInTx' | 'firstNullifierInTx'>;
99
+
100
+ type LegacyPendingTaggedLog = {
101
+ log: PendingTaggedLog['log'];
102
+ context: LegacyMessageContext;
103
+ };
104
+
105
+ type Registry = typeof ORACLE_REGISTRY;
106
+
107
+ /** The handler return value type of a modern oracle entry. */
108
+ type ReturnValueOf<K extends keyof Registry> = Registry[K] extends OracleRegistryEntry<any, infer R> ? R : never;
109
+
110
+ /** The modern handler's positional argument tuple, derived from the oracle's declared params. */
111
+ type HandlerArgsOf<K extends keyof Registry> = ParamTypes<ReturnType<Registry[K]['deserializeParams']>>;
112
+
113
+ /**
114
+ * A legacy oracle adapter, stored under the retired oracle name that already-deployed contracts still call. It reuses
115
+ * the handler of `modernOracle` and overrides only the wire side(s) that changed; an omitted side falls back to that
116
+ * modern entry.
117
+ */
118
+ export interface LegacyOracleEntry {
119
+ /** The current oracle whose handler this reuses and whose param/return wire it inherits by default. */
120
+ modernOracle: keyof Registry;
121
+ /**
122
+ * Old param wire. `legacyType` deserializes the old wire; `mapping` bridges the deserialized legacy args to the
123
+ * modern handler's args. The mapping may be async. Omit when the param wire is unchanged.
124
+ */
125
+ params?: {
126
+ legacyType: readonly RegistryParam[];
127
+ mapping: (legacyArgs: any) => readonly unknown[] | Promise<readonly unknown[]>;
128
+ };
129
+ /**
130
+ * Old return wire. `legacyType` serializes the subset the old contract reads; `mapping` bridges the handler's
131
+ * current result to that subset's value type. Omit when the return wire is unchanged.
132
+ */
133
+ returnType?: { legacyType: TypeMapping; mapping: (result: any) => unknown };
134
+ }
135
+
136
+ function legacyOracle<K extends keyof Registry, W = never, const TLegacyParams extends RegistryParam[] = []>(entry: {
137
+ modernOracle: K;
138
+ params?: {
139
+ legacyType: [...TLegacyParams];
140
+ mapping: (
141
+ legacyArgs: ParamTypes<InferDeserializedParams<TLegacyParams>>,
142
+ ) => HandlerArgsOf<K> | Promise<HandlerArgsOf<K>>;
143
+ };
144
+ returnType?: { legacyType: TypeMapping<W>; mapping: (result: ReturnValueOf<K>) => W };
145
+ }): LegacyOracleEntry {
146
+ return entry;
147
+ }
@@ -1,23 +1,8 @@
1
- import { Fr } from '@aztec/foundation/curves/bn254';
2
1
  import type { SiblingPath } from '@aztec/foundation/trees';
3
2
 
4
- export class MessageLoadOracleInputs<N extends number> {
5
- constructor(
6
- /** The index of the message commitment in the merkle tree. */
7
- public index: bigint,
8
- /** The path in the merkle tree to the message. */
9
- public siblingPath: SiblingPath<N>,
10
- ) {}
11
-
12
- toFields(): Fr[] {
13
- return [new Fr(this.index), ...this.siblingPath.toFields()];
14
- }
15
-
16
- /**
17
- * Returns a representation of the public data witness as expected by intrinsic Noir deserialization.
18
- */
19
- public toNoirRepresentation(): (string | string[])[] {
20
- // TODO(#12874): remove the stupid as string conversion by modifying ForeignCallOutput type in acvm.js
21
- return [new Fr(this.index).toString() as string, this.siblingPath.toFields().map(fr => fr.toString()) as string[]];
22
- }
23
- }
3
+ export type MessageLoadOracleInputs<N extends number> = {
4
+ /** The index of the message commitment in the merkle tree. */
5
+ index: bigint;
6
+ /** The path in the merkle tree to the message. */
7
+ siblingPath: SiblingPath<N>;
8
+ };
@@ -3,6 +3,7 @@ import { ARCHIVE_HEIGHT, NOTE_HASH_TREE_HEIGHT } from '@aztec/constants';
3
3
  import { Fr } from '@aztec/foundation/curves/bn254';
4
4
  import { FieldReader } from '@aztec/foundation/serialize';
5
5
  import { toACVMField } from '@aztec/simulator/client';
6
+ import type { UnsiloedMessageNullifier } from '@aztec/stdlib/messaging';
6
7
 
7
8
  import {
8
9
  ARRAY,
@@ -15,11 +16,12 @@ import {
15
16
  BUFFER,
16
17
  BYTE,
17
18
  CALL_PRIVATE_RESULT,
18
- CONTRACT_CLASS_LOG_INPUT,
19
+ CONTRACT_CLASS_LOG,
19
20
  CONTRACT_INSTANCE,
20
21
  DELIVERY_MODE,
21
22
  EPHEMERAL_ARRAY,
22
23
  EVENT_VALIDATION_REQUEST,
24
+ FACT_COLLECTION,
23
25
  FIELD,
24
26
  FUNCTION_SELECTOR,
25
27
  type InputSlot,
@@ -27,7 +29,6 @@ import {
27
29
  LOG_RETRIEVAL_REQUEST,
28
30
  LOG_RETRIEVAL_RESPONSE,
29
31
  MEMBERSHIP_WITNESS,
30
- MESSAGE_CONTEXT,
31
32
  MESSAGE_LOAD_ORACLE_INPUTS,
32
33
  type MaybePromise,
33
34
  NOTE,
@@ -35,19 +36,24 @@ import {
35
36
  NOTE_VALIDATION_REQUEST,
36
37
  NULLIFIER_MEMBERSHIP_WITNESS,
37
38
  OPTION,
39
+ ORIGIN_BLOCK,
38
40
  type OutputSlot,
39
41
  PENDING_TAGGED_LOG,
40
42
  POINT,
41
43
  PROVIDED_SECRET,
42
44
  PUBLIC_DATA_WITNESS,
43
45
  PUBLIC_KEYS_AND_PARTIAL_ADDRESS,
46
+ RESOLVED_TAGGING_STRATEGY,
47
+ RESOLVED_TX,
44
48
  STR,
49
+ STRUCT,
45
50
  TX_EFFECT,
46
51
  TX_HASH,
47
52
  type TypeMapping,
48
53
  U32,
49
54
  UTILITY_CONTEXT,
50
55
  assertReadersConsumed,
56
+ slotsOf,
51
57
  } from './oracle_type_mappings.js';
52
58
 
53
59
  export {
@@ -59,7 +65,9 @@ export {
59
65
  BOUNDED_VEC,
60
66
  BUFFER,
61
67
  BYTE,
68
+ CONTRACT_CLASS_LOG,
62
69
  DELIVERY_MODE,
70
+ RESOLVED_TAGGING_STRATEGY,
63
71
  EPHEMERAL_ARRAY,
64
72
  EVENT_VALIDATION_REQUEST,
65
73
  FIELD,
@@ -67,85 +75,23 @@ export {
67
75
  LOG_RETRIEVAL_REQUEST,
68
76
  LOG_RETRIEVAL_RESPONSE,
69
77
  MEMBERSHIP_WITNESS,
70
- MESSAGE_CONTEXT,
71
78
  NOTE_VALIDATION_REQUEST,
72
79
  OPTION,
73
80
  PENDING_TAGGED_LOG,
74
81
  POINT,
75
82
  PROVIDED_SECRET,
83
+ RESOLVED_TX,
76
84
  STR,
77
85
  U32,
86
+ slotsOf,
78
87
  type InputSlot,
79
88
  type MaybePromise,
80
89
  type OutputSlot,
90
+ type SlotShape,
81
91
  type TypeMapping,
82
92
  } from './oracle_type_mappings.js';
83
93
 
84
- type OracleRegistryName =
85
- | 'aztec_misc_assertCompatibleOracleVersion'
86
- | 'aztec_misc_getRandomField'
87
- | 'aztec_misc_log'
88
- | 'aztec_utl_getUtilityContext'
89
- | 'aztec_utl_getKeyValidationRequest'
90
- | 'aztec_utl_getContractInstance'
91
- | 'aztec_utl_getNoteHashMembershipWitness'
92
- | 'aztec_utl_getBlockHashMembershipWitness'
93
- | 'aztec_utl_getNullifierMembershipWitness'
94
- | 'aztec_utl_getLowNullifierMembershipWitness'
95
- | 'aztec_utl_getPublicDataWitness'
96
- | 'aztec_utl_getBlockHeader'
97
- | 'aztec_utl_getAuthWitness'
98
- | 'aztec_utl_getPublicKeysAndPartialAddress'
99
- | 'aztec_utl_doesNullifierExist'
100
- | 'aztec_utl_getL1ToL2MembershipWitness'
101
- | 'aztec_utl_getFromPublicStorage'
102
- | 'aztec_utl_getNotes'
103
- | 'aztec_utl_getPendingTaggedLogs'
104
- | 'aztec_utl_validateAndStoreEnqueuedNotesAndEvents'
105
- | 'aztec_utl_getLogsByTag'
106
- | 'aztec_utl_getMessageContextsByTxHash'
107
- | 'aztec_utl_getTxEffect'
108
- | 'aztec_utl_setCapsule'
109
- | 'aztec_utl_getCapsule'
110
- | 'aztec_utl_deleteCapsule'
111
- | 'aztec_utl_copyCapsule'
112
- | 'aztec_utl_decryptAes128'
113
- | 'aztec_utl_getSharedSecrets'
114
- | 'aztec_utl_setContractSyncCacheInvalid'
115
- | 'aztec_utl_emitOffchainEffect'
116
- | 'aztec_utl_callUtilityFunction'
117
- | 'aztec_utl_pushEphemeral'
118
- | 'aztec_utl_popEphemeral'
119
- | 'aztec_utl_getEphemeral'
120
- | 'aztec_utl_setEphemeral'
121
- | 'aztec_utl_getEphemeralLen'
122
- | 'aztec_utl_removeEphemeral'
123
- | 'aztec_utl_clearEphemeral'
124
- | 'aztec_utl_pushTransient'
125
- | 'aztec_utl_popTransient'
126
- | 'aztec_utl_getTransient'
127
- | 'aztec_utl_setTransient'
128
- | 'aztec_utl_getTransientLen'
129
- | 'aztec_utl_removeTransient'
130
- | 'aztec_utl_clearTransient'
131
- | 'aztec_prv_setHashPreimage'
132
- | 'aztec_prv_getHashPreimage'
133
- | 'aztec_prv_notifyCreatedNote'
134
- | 'aztec_prv_notifyNullifiedNote'
135
- | 'aztec_prv_notifyCreatedNullifier'
136
- | 'aztec_prv_isNullifierPending'
137
- | 'aztec_prv_notifyCreatedContractClassLog'
138
- | 'aztec_prv_callPrivateFunction'
139
- | 'aztec_prv_assertValidPublicCalldata'
140
- | 'aztec_prv_notifyRevertiblePhaseStart'
141
- | 'aztec_prv_isExecutionInRevertiblePhase'
142
- | 'aztec_prv_getAppTaggingSecret'
143
- | 'aztec_prv_getNextTaggingIndex'
144
- | 'aztec_prv_getSenderForTags';
145
-
146
- type OracleRegistry = Record<OracleRegistryName, OracleRegistryEntry>;
147
-
148
- export const ORACLE_REGISTRY: OracleRegistry = {
94
+ export const ORACLE_REGISTRY = {
149
95
  aztec_misc_assertCompatibleOracleVersion: makeEntry({
150
96
  params: [
151
97
  { name: 'major', type: U32 },
@@ -167,7 +113,10 @@ export const ORACLE_REGISTRY: OracleRegistry = {
167
113
  aztec_utl_getUtilityContext: makeEntry({ returnType: UTILITY_CONTEXT }),
168
114
 
169
115
  aztec_utl_getKeyValidationRequest: makeEntry({
170
- params: [{ name: 'pkMHash', type: FIELD }],
116
+ params: [
117
+ { name: 'pkMHash', type: FIELD },
118
+ { name: 'keyIndex', type: FIELD },
119
+ ],
171
120
  returnType: KEY_VALIDATION_REQUEST,
172
121
  }),
173
122
 
@@ -192,6 +141,14 @@ export const ORACLE_REGISTRY: OracleRegistry = {
192
141
  returnType: OPTION(MEMBERSHIP_WITNESS(ARCHIVE_HEIGHT)),
193
142
  }),
194
143
 
144
+ aztec_utl_areBlockHashesInArchive: makeEntry({
145
+ params: [
146
+ { name: 'anchorBlockHash', type: BLOCK_HASH },
147
+ { name: 'blockHashes', type: EPHEMERAL_ARRAY(BLOCK_HASH) },
148
+ ],
149
+ returnType: EPHEMERAL_ARRAY(BOOL),
150
+ }),
151
+
195
152
  aztec_utl_getNullifierMembershipWitness: makeEntry({
196
153
  params: [
197
154
  { name: 'blockHash', type: BLOCK_HASH },
@@ -236,11 +193,18 @@ export const ORACLE_REGISTRY: OracleRegistry = {
236
193
  returnType: BOOL,
237
194
  }),
238
195
 
239
- aztec_utl_getL1ToL2MembershipWitness: makeEntry({
196
+ aztec_utl_getL1ToL2MembershipWitnessV2: makeEntry({
240
197
  params: [
241
- { name: 'contractAddress', type: AZTEC_ADDRESS },
242
198
  { name: 'messageHash', type: FIELD },
243
- { name: 'secret', type: FIELD },
199
+ {
200
+ name: 'nullifier',
201
+ type: OPTION(
202
+ STRUCT<UnsiloedMessageNullifier>([
203
+ { name: 'contractAddress', type: AZTEC_ADDRESS },
204
+ { name: 'nullifier', type: FIELD },
205
+ ]),
206
+ ),
207
+ },
244
208
  ],
245
209
  returnType: MESSAGE_LOAD_ORACLE_INPUTS,
246
210
  }),
@@ -278,7 +242,7 @@ export const ORACLE_REGISTRY: OracleRegistry = {
278
242
  returnType: BOUNDED_VEC(NOTE),
279
243
  }),
280
244
 
281
- aztec_utl_getPendingTaggedLogs: makeEntry({
245
+ aztec_utl_getPendingTaggedLogsV2: makeEntry({
282
246
  params: [
283
247
  { name: 'scope', type: AZTEC_ADDRESS },
284
248
  { name: 'providedSecrets', type: EPHEMERAL_ARRAY(PROVIDED_SECRET) },
@@ -294,14 +258,14 @@ export const ORACLE_REGISTRY: OracleRegistry = {
294
258
  ],
295
259
  }),
296
260
 
297
- aztec_utl_getLogsByTag: makeEntry({
261
+ aztec_utl_getLogsByTagV2: makeEntry({
298
262
  params: [{ name: 'requests', type: EPHEMERAL_ARRAY(LOG_RETRIEVAL_REQUEST) }],
299
263
  returnType: EPHEMERAL_ARRAY(EPHEMERAL_ARRAY(LOG_RETRIEVAL_RESPONSE)),
300
264
  }),
301
265
 
302
- aztec_utl_getMessageContextsByTxHash: makeEntry({
266
+ aztec_utl_getResolvedTxs: makeEntry({
303
267
  params: [{ name: 'requests', type: EPHEMERAL_ARRAY(FIELD) }],
304
- returnType: EPHEMERAL_ARRAY(OPTION(MESSAGE_CONTEXT)),
268
+ returnType: EPHEMERAL_ARRAY(OPTION(RESOLVED_TX)),
305
269
  }),
306
270
 
307
271
  aztec_utl_getTxEffect: makeEntry({
@@ -349,8 +313,8 @@ export const ORACLE_REGISTRY: OracleRegistry = {
349
313
  aztec_utl_decryptAes128: makeEntry({
350
314
  params: [
351
315
  { name: 'ciphertext', type: BOUNDED_VEC(BYTE) },
352
- { name: 'iv', type: BUFFER(8) },
353
- { name: 'symKey', type: BUFFER(8) },
316
+ { name: 'iv', type: BUFFER(8, 16) },
317
+ { name: 'symKey', type: BUFFER(8, 16) },
354
318
  ],
355
319
  returnType: OPTION(BOUNDED_VEC(BYTE)),
356
320
  }),
@@ -375,6 +339,46 @@ export const ORACLE_REGISTRY: OracleRegistry = {
375
339
  params: [{ name: 'data', type: ARRAY(FIELD) }],
376
340
  }),
377
341
 
342
+ aztec_utl_recordFact: makeEntry({
343
+ params: [
344
+ { name: 'contractAddress', type: AZTEC_ADDRESS },
345
+ { name: 'scope', type: AZTEC_ADDRESS },
346
+ { name: 'factCollectionTypeId', type: FIELD },
347
+ { name: 'factCollectionId', type: FIELD },
348
+ { name: 'factTypeId', type: FIELD },
349
+ { name: 'payload', type: EPHEMERAL_ARRAY(FIELD) },
350
+ { name: 'originBlock', type: OPTION(ORIGIN_BLOCK) },
351
+ ],
352
+ }),
353
+
354
+ aztec_utl_deleteFactCollection: makeEntry({
355
+ params: [
356
+ { name: 'contractAddress', type: AZTEC_ADDRESS },
357
+ { name: 'scope', type: AZTEC_ADDRESS },
358
+ { name: 'factCollectionTypeId', type: FIELD },
359
+ { name: 'factCollectionId', type: FIELD },
360
+ ],
361
+ }),
362
+
363
+ aztec_utl_getFactCollection: makeEntry({
364
+ params: [
365
+ { name: 'contractAddress', type: AZTEC_ADDRESS },
366
+ { name: 'scope', type: AZTEC_ADDRESS },
367
+ { name: 'factCollectionTypeId', type: FIELD },
368
+ { name: 'factCollectionId', type: FIELD },
369
+ ],
370
+ returnType: OPTION(FACT_COLLECTION),
371
+ }),
372
+
373
+ aztec_utl_getFactCollectionsByType: makeEntry({
374
+ params: [
375
+ { name: 'contractAddress', type: AZTEC_ADDRESS },
376
+ { name: 'scope', type: AZTEC_ADDRESS },
377
+ { name: 'factCollectionTypeId', type: FIELD },
378
+ ],
379
+ returnType: EPHEMERAL_ARRAY(FACT_COLLECTION),
380
+ }),
381
+
378
382
  aztec_utl_callUtilityFunction: makeEntry({
379
383
  params: [
380
384
  { name: 'contractAddress', type: AZTEC_ADDRESS },
@@ -520,7 +524,7 @@ export const ORACLE_REGISTRY: OracleRegistry = {
520
524
 
521
525
  aztec_prv_notifyCreatedContractClassLog: makeEntry({
522
526
  params: [
523
- { name: 'log', type: CONTRACT_CLASS_LOG_INPUT },
527
+ { name: 'log', type: CONTRACT_CLASS_LOG },
524
528
  { name: 'counter', type: U32 },
525
529
  ],
526
530
  }),
@@ -566,7 +570,24 @@ export const ORACLE_REGISTRY: OracleRegistry = {
566
570
  }),
567
571
 
568
572
  aztec_prv_getSenderForTags: makeEntry({ returnType: OPTION(AZTEC_ADDRESS) }),
569
- };
573
+
574
+ aztec_prv_resolveTaggingStrategy: makeEntry({
575
+ params: [
576
+ { name: 'sender', type: AZTEC_ADDRESS },
577
+ { name: 'recipient', type: AZTEC_ADDRESS },
578
+ { name: 'deliveryMode', type: DELIVERY_MODE },
579
+ ],
580
+ returnType: RESOLVED_TAGGING_STRATEGY,
581
+ }),
582
+
583
+ aztec_prv_resolveCustomRequest: makeEntry({
584
+ params: [
585
+ { name: 'kind', type: FIELD },
586
+ { name: 'payload', type: ARRAY(FIELD) },
587
+ ],
588
+ returnType: ARRAY(FIELD),
589
+ }),
590
+ } satisfies Record<string, OracleRegistryEntry>;
570
591
 
571
592
  // ─── Registry Infrastructure ─────────────────────────────────────────────────
572
593
 
@@ -584,6 +605,10 @@ export interface OracleRegistryEntry<
584
605
  deserializeParams(inputs: InputSlot[]): TDeserializedParams;
585
606
  /** Serialize a handler return value into ACVM output slots. */
586
607
  serializeReturn(result: TReturnValue): OutputSlot[];
608
+ /** The ordered named parameters with their {@link TypeMapping}s. Lets callers introspect the oracle's wire ABI. */
609
+ readonly params: readonly RegistryParam[];
610
+ /** The return {@link TypeMapping}, or `undefined` for oracles that return nothing. */
611
+ readonly returnType?: TypeMapping<TReturnValue>;
587
612
  }
588
613
 
589
614
  export function makeEntry<const TParams extends RegistryParam[] = [], TReturnValue = void>({
@@ -594,16 +619,18 @@ export function makeEntry<const TParams extends RegistryParam[] = [], TReturnVal
594
619
  returnType?: TypeMapping<TReturnValue>;
595
620
  } = {}): OracleRegistryEntry<InferDeserializedParams<TParams>, TReturnValue> {
596
621
  return {
622
+ params: params ?? [],
623
+ returnType,
597
624
  deserializeParams(inputs: InputSlot[]): InferDeserializedParams<TParams> {
598
625
  const resolvedParams: RegistryParam[] = params ?? [];
599
626
  // Walk the input slots left-to-right, advancing by each param's slot count.
600
627
  let offset = 0;
601
- return resolvedParams.map(param => {
628
+ const named = resolvedParams.map(param => {
602
629
  if (!param.type.deserialization) {
603
630
  throw new Error(`Param '${param.name}' has no deserialization defined`);
604
631
  }
605
632
  // Collect the slots for this param and wrap each in a FieldReader.
606
- const slotCount = param.type.deserialization.slots;
633
+ const slotCount = slotsOf(param.type);
607
634
  const readers = inputs
608
635
  .slice(offset, offset + slotCount)
609
636
  .map(slot => new FieldReader(slot.map(hex => Fr.fromString(hex))));
@@ -613,7 +640,13 @@ export function makeEntry<const TParams extends RegistryParam[] = [], TReturnVal
613
640
  const value = param.type.deserialization.fn(readers);
614
641
  assertReadersConsumed(readers);
615
642
  return { name: param.name, value };
616
- }) as unknown as InferDeserializedParams<TParams>;
643
+ });
644
+ // Every input slot must be specified by a param: oracles whose Noir decl passes an extra field must declare it
645
+ // (the handler can ignore it). Otherwise an under-declared shape would silently drop a field into nothing.
646
+ if (offset !== inputs.length) {
647
+ throw new Error(`Oracle received ${inputs.length} input slot(s) but the registry specifies ${offset}`);
648
+ }
649
+ return named as unknown as InferDeserializedParams<TParams>;
617
650
  },
618
651
  serializeReturn(result: TReturnValue): OutputSlot[] {
619
652
  if (returnType?.serialization === undefined) {
@@ -627,7 +660,7 @@ export function makeEntry<const TParams extends RegistryParam[] = [], TReturnVal
627
660
  }
628
661
 
629
662
  /** A named oracle parameter with its TypeMapping. */
630
- interface RegistryParam<TName extends string = string, T = any> {
663
+ export interface RegistryParam<TName extends string = string, T = any> {
631
664
  name: TName;
632
665
  type: TypeMapping<T>;
633
666
  }
@@ -653,14 +686,14 @@ export type ParamTypes<T extends readonly NamedValue[]> = {
653
686
  * @example `InferDeserializedParams<[RegistryParam<'addr', AztecAddress>, RegistryParam<'slot', Fr>]>`
654
687
  * → `[NamedValue<'addr', AztecAddress>, NamedValue<'slot', Fr>]`
655
688
  */
656
- type InferDeserializedParams<T extends RegistryParam[]> = {
689
+ export type InferDeserializedParams<T extends RegistryParam[]> = {
657
690
  [K in keyof T]: T[K] extends RegistryParam<infer N, infer V> ? NamedValue<N, V> : never;
658
691
  };
659
692
 
660
693
  // ─── Derived Handler Interfaces ─────────────────────────────────────────────
661
694
 
662
695
  /** Strips the `aztec_{scope}_` prefix from an oracle key to get the handler method name. */
663
- export type StripOraclePrefix<K extends string> = K extends `aztec_${string}_${infer M}` ? M : never;
696
+ type StripOraclePrefix<K extends string> = K extends `aztec_${string}_${infer M}` ? M : never;
664
697
 
665
698
  /** Derives the handler function signature from a registry entry's deserialization/serialization types. */
666
699
  type HandlerFn<E extends OracleRegistryEntry> = (