@aztec/pxe 0.0.1-commit.343b43af6 → 0.0.1-commit.350e0a4d

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 (485) hide show
  1. package/dest/bin/check_oracle_version.js +45 -111
  2. package/dest/bin/index.d.ts +2 -0
  3. package/dest/bin/index.d.ts.map +1 -0
  4. package/dest/bin/index.js +1 -0
  5. package/dest/bin/oracle_version_helpers.d.ts +51 -0
  6. package/dest/bin/oracle_version_helpers.d.ts.map +1 -0
  7. package/dest/bin/oracle_version_helpers.js +254 -0
  8. package/dest/block_synchronizer/block_stream_source.d.ts +10 -0
  9. package/dest/block_synchronizer/block_stream_source.d.ts.map +1 -0
  10. package/dest/block_synchronizer/block_stream_source.js +37 -0
  11. package/dest/block_synchronizer/block_synchronizer.d.ts +23 -15
  12. package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
  13. package/dest/block_synchronizer/block_synchronizer.js +84 -28
  14. package/dest/config/index.d.ts +8 -1
  15. package/dest/config/index.d.ts.map +1 -1
  16. package/dest/config/index.js +13 -14
  17. package/dest/config/package_info.js +1 -1
  18. package/dest/contract/contract_class_service.d.ts +31 -0
  19. package/dest/contract/contract_class_service.d.ts.map +1 -0
  20. package/dest/contract/contract_class_service.js +68 -0
  21. package/dest/contract/contract_sync_service.d.ts +48 -0
  22. package/dest/contract/contract_sync_service.d.ts.map +1 -0
  23. package/dest/contract/contract_sync_service.js +116 -0
  24. package/dest/contract/helpers.d.ts +7 -0
  25. package/dest/contract/helpers.d.ts.map +1 -0
  26. package/dest/contract/helpers.js +20 -0
  27. package/dest/contract_function_simulator/anchored_contract_data.d.ts +36 -0
  28. package/dest/contract_function_simulator/anchored_contract_data.d.ts.map +1 -0
  29. package/dest/contract_function_simulator/anchored_contract_data.js +54 -0
  30. package/dest/contract_function_simulator/contract_function_simulator.d.ts +30 -18
  31. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  32. package/dest/contract_function_simulator/contract_function_simulator.js +106 -40
  33. package/dest/contract_function_simulator/ephemeral_array_service.d.ts +28 -0
  34. package/dest/contract_function_simulator/ephemeral_array_service.d.ts.map +1 -0
  35. package/dest/contract_function_simulator/ephemeral_array_service.js +78 -0
  36. package/dest/contract_function_simulator/execution_note_cache.d.ts +4 -10
  37. package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
  38. package/dest/contract_function_simulator/execution_note_cache.js +8 -28
  39. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +7 -11
  40. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -1
  41. package/dest/contract_function_simulator/execution_tagging_index_cache.js +19 -15
  42. package/dest/contract_function_simulator/index.d.ts +26 -5
  43. package/dest/contract_function_simulator/index.d.ts.map +1 -1
  44. package/dest/contract_function_simulator/index.js +12 -3
  45. package/dest/contract_function_simulator/noir-structs/bounded_vec.d.ts +29 -0
  46. package/dest/contract_function_simulator/noir-structs/bounded_vec.d.ts.map +1 -0
  47. package/dest/contract_function_simulator/noir-structs/bounded_vec.js +30 -0
  48. package/dest/contract_function_simulator/noir-structs/contract_class_log_data.d.ts +9 -0
  49. package/dest/contract_function_simulator/noir-structs/contract_class_log_data.d.ts.map +1 -0
  50. package/dest/contract_function_simulator/noir-structs/contract_class_log_data.js +1 -0
  51. package/dest/contract_function_simulator/noir-structs/embedded_curve_point.d.ts +7 -0
  52. package/dest/contract_function_simulator/noir-structs/embedded_curve_point.d.ts.map +1 -0
  53. package/dest/contract_function_simulator/noir-structs/embedded_curve_point.js +1 -0
  54. package/dest/contract_function_simulator/noir-structs/ephemeral_array.d.ts +37 -0
  55. package/dest/contract_function_simulator/noir-structs/ephemeral_array.d.ts.map +1 -0
  56. package/dest/contract_function_simulator/noir-structs/ephemeral_array.js +59 -0
  57. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +5 -5
  58. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
  59. package/dest/contract_function_simulator/noir-structs/event_validation_request.js +7 -9
  60. package/dest/contract_function_simulator/noir-structs/fact.d.ts +16 -0
  61. package/dest/contract_function_simulator/noir-structs/fact.d.ts.map +1 -0
  62. package/dest/contract_function_simulator/noir-structs/fact.js +6 -0
  63. package/dest/contract_function_simulator/noir-structs/fact_collection.d.ts +27 -0
  64. package/dest/contract_function_simulator/noir-structs/fact_collection.d.ts.map +1 -0
  65. package/dest/contract_function_simulator/noir-structs/fact_collection.js +31 -0
  66. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +19 -10
  67. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts.map +1 -1
  68. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.js +12 -24
  69. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +11 -9
  70. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
  71. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +2 -61
  72. package/dest/contract_function_simulator/noir-structs/note_data.d.ts +27 -0
  73. package/dest/contract_function_simulator/noir-structs/note_data.d.ts.map +1 -0
  74. package/dest/contract_function_simulator/noir-structs/note_data.js +3 -0
  75. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +5 -5
  76. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
  77. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +8 -10
  78. package/dest/contract_function_simulator/noir-structs/option.d.ts +59 -0
  79. package/dest/contract_function_simulator/noir-structs/option.d.ts.map +1 -0
  80. package/dest/contract_function_simulator/noir-structs/option.js +67 -0
  81. package/dest/contract_function_simulator/noir-structs/origin_block.d.ts +11 -0
  82. package/dest/contract_function_simulator/noir-structs/origin_block.d.ts.map +1 -0
  83. package/dest/contract_function_simulator/noir-structs/origin_block.js +5 -0
  84. package/dest/contract_function_simulator/noir-structs/pending_tagged_log.d.ts +11 -0
  85. package/dest/contract_function_simulator/noir-structs/pending_tagged_log.d.ts.map +1 -0
  86. package/dest/contract_function_simulator/noir-structs/pending_tagged_log.js +4 -0
  87. package/dest/contract_function_simulator/noir-structs/provided_secret.d.ts +8 -0
  88. package/dest/contract_function_simulator/noir-structs/provided_secret.d.ts.map +1 -0
  89. package/dest/contract_function_simulator/noir-structs/provided_secret.js +1 -0
  90. package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.d.ts +28 -0
  91. package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.d.ts.map +1 -0
  92. package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.js +43 -0
  93. package/dest/contract_function_simulator/noir-structs/resolved_tx.d.ts +21 -0
  94. package/dest/contract_function_simulator/noir-structs/resolved_tx.d.ts.map +1 -0
  95. package/dest/contract_function_simulator/noir-structs/resolved_tx.js +50 -0
  96. package/dest/contract_function_simulator/noir-structs/tx_effect_data.d.ts +14 -0
  97. package/dest/contract_function_simulator/noir-structs/tx_effect_data.d.ts.map +1 -0
  98. package/dest/contract_function_simulator/noir-structs/tx_effect_data.js +5 -0
  99. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +6 -11
  100. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -1
  101. package/dest/contract_function_simulator/noir-structs/utility_context.js +1 -20
  102. package/dest/contract_function_simulator/oracle/acir_callback.d.ts +21 -0
  103. package/dest/contract_function_simulator/oracle/acir_callback.d.ts.map +1 -0
  104. package/dest/contract_function_simulator/oracle/acir_callback.js +115 -0
  105. package/dest/contract_function_simulator/oracle/index.d.ts +2 -13
  106. package/dest/contract_function_simulator/oracle/index.d.ts.map +1 -1
  107. package/dest/contract_function_simulator/oracle/index.js +1 -1
  108. package/dest/contract_function_simulator/oracle/interfaces.d.ts +15 -101
  109. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
  110. package/dest/contract_function_simulator/oracle/interfaces.js +2 -2
  111. package/dest/contract_function_simulator/oracle/legacy_oracle_registry.d.ts +39 -0
  112. package/dest/contract_function_simulator/oracle/legacy_oracle_registry.d.ts.map +1 -0
  113. package/dest/contract_function_simulator/oracle/legacy_oracle_registry.js +74 -0
  114. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +3 -14
  115. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
  116. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.js +1 -24
  117. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +2 -2
  118. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
  119. package/dest/contract_function_simulator/oracle/note_packing_utils.js +2 -2
  120. package/dest/contract_function_simulator/oracle/oracle_registry.d.ts +136 -0
  121. package/dest/contract_function_simulator/oracle/oracle_registry.d.ts.map +1 -0
  122. package/dest/contract_function_simulator/oracle/oracle_registry.js +989 -0
  123. package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts +222 -0
  124. package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts.map +1 -0
  125. package/dest/contract_function_simulator/oracle/oracle_type_mappings.js +1243 -0
  126. package/dest/contract_function_simulator/oracle/private_execution.d.ts +1 -1
  127. package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
  128. package/dest/contract_function_simulator/oracle/private_execution.js +7 -6
  129. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +54 -55
  130. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  131. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +195 -77
  132. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +162 -73
  133. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  134. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +523 -149
  135. package/dest/contract_function_simulator/pick_notes.d.ts +1 -1
  136. package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -1
  137. package/dest/contract_function_simulator/pick_notes.js +20 -3
  138. package/dest/contract_function_simulator/transient_array_service.d.ts +31 -0
  139. package/dest/contract_function_simulator/transient_array_service.d.ts.map +1 -0
  140. package/dest/contract_function_simulator/transient_array_service.js +62 -0
  141. package/dest/contract_logging.d.ts +9 -4
  142. package/dest/contract_logging.d.ts.map +1 -1
  143. package/dest/contract_logging.js +21 -6
  144. package/dest/debug/pxe_debug_utils.d.ts +4 -9
  145. package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
  146. package/dest/debug/pxe_debug_utils.js +0 -6
  147. package/dest/entrypoints/client/bundle/index.d.ts +1 -2
  148. package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
  149. package/dest/entrypoints/client/bundle/index.js +0 -1
  150. package/dest/entrypoints/client/bundle/utils.d.ts +2 -2
  151. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  152. package/dest/entrypoints/client/bundle/utils.js +20 -7
  153. package/dest/entrypoints/client/lazy/index.d.ts +1 -2
  154. package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
  155. package/dest/entrypoints/client/lazy/index.js +0 -1
  156. package/dest/entrypoints/client/lazy/utils.d.ts +2 -2
  157. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  158. package/dest/entrypoints/client/lazy/utils.js +20 -7
  159. package/dest/entrypoints/pxe_creation_options.d.ts +16 -2
  160. package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
  161. package/dest/entrypoints/pxe_creation_options.js +3 -1
  162. package/dest/entrypoints/server/index.d.ts +6 -4
  163. package/dest/entrypoints/server/index.d.ts.map +1 -1
  164. package/dest/entrypoints/server/index.js +4 -3
  165. package/dest/entrypoints/server/utils.d.ts +4 -3
  166. package/dest/entrypoints/server/utils.d.ts.map +1 -1
  167. package/dest/entrypoints/server/utils.js +20 -6
  168. package/dest/error_enriching.d.ts +5 -3
  169. package/dest/error_enriching.d.ts.map +1 -1
  170. package/dest/error_enriching.js +13 -11
  171. package/dest/events/event_service.d.ts +15 -6
  172. package/dest/events/event_service.d.ts.map +1 -1
  173. package/dest/events/event_service.js +44 -11
  174. package/dest/events/private_event_filter_validator.d.ts +3 -2
  175. package/dest/events/private_event_filter_validator.d.ts.map +1 -1
  176. package/dest/events/private_event_filter_validator.js +15 -0
  177. package/dest/hooks/authorize_utility_call.d.ts +41 -0
  178. package/dest/hooks/authorize_utility_call.d.ts.map +1 -0
  179. package/dest/hooks/authorize_utility_call.js +4 -0
  180. package/dest/hooks/execution_hooks.d.ts +62 -0
  181. package/dest/hooks/execution_hooks.d.ts.map +1 -0
  182. package/dest/hooks/execution_hooks.js +9 -0
  183. package/dest/hooks/index.d.ts +5 -0
  184. package/dest/hooks/index.d.ts.map +1 -0
  185. package/dest/hooks/index.js +1 -0
  186. package/dest/hooks/resolve_custom_request.d.ts +23 -0
  187. package/dest/hooks/resolve_custom_request.d.ts.map +1 -0
  188. package/dest/hooks/resolve_custom_request.js +3 -0
  189. package/dest/hooks/resolve_tagging_secret_strategy.d.ts +48 -0
  190. package/dest/hooks/resolve_tagging_secret_strategy.d.ts.map +1 -0
  191. package/dest/hooks/resolve_tagging_secret_strategy.js +3 -0
  192. package/dest/logs/log_service.d.ts +13 -12
  193. package/dest/logs/log_service.d.ts.map +1 -1
  194. package/dest/logs/log_service.js +186 -81
  195. package/dest/messages/tx_resolver_service.d.ts +17 -0
  196. package/dest/messages/tx_resolver_service.d.ts.map +1 -0
  197. package/dest/messages/tx_resolver_service.js +55 -0
  198. package/dest/notes/note_service.d.ts +27 -6
  199. package/dest/notes/note_service.d.ts.map +1 -1
  200. package/dest/notes/note_service.js +80 -56
  201. package/dest/notes_filter.d.ts +2 -3
  202. package/dest/notes_filter.d.ts.map +1 -1
  203. package/dest/oracle_version.d.ts +4 -3
  204. package/dest/oracle_version.d.ts.map +1 -1
  205. package/dest/oracle_version.js +20 -10
  206. package/dest/private_kernel/batch_planner.d.ts +47 -0
  207. package/dest/private_kernel/batch_planner.d.ts.map +1 -0
  208. package/dest/private_kernel/batch_planner.js +104 -0
  209. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +1 -1
  210. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -1
  211. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.js +7 -3
  212. package/dest/private_kernel/hints/test_utils.d.ts +1 -1
  213. package/dest/private_kernel/hints/test_utils.d.ts.map +1 -1
  214. package/dest/private_kernel/hints/test_utils.js +3 -4
  215. package/dest/private_kernel/private_kernel_execution_prover.d.ts +6 -2
  216. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
  217. package/dest/private_kernel/private_kernel_execution_prover.js +203 -89
  218. package/dest/private_kernel/private_kernel_oracle.d.ts +12 -10
  219. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
  220. package/dest/private_kernel/private_kernel_oracle.js +40 -26
  221. package/dest/pxe.d.ts +169 -54
  222. package/dest/pxe.d.ts.map +1 -1
  223. package/dest/pxe.js +348 -204
  224. package/dest/storage/allowed_scopes.d.ts +6 -0
  225. package/dest/storage/allowed_scopes.d.ts.map +1 -0
  226. package/dest/storage/allowed_scopes.js +7 -0
  227. package/dest/storage/anchor_block_store/anchor_block_store.d.ts +9 -6
  228. package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -1
  229. package/dest/storage/anchor_block_store/anchor_block_store.js +9 -7
  230. package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.d.ts +42 -0
  231. package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.d.ts.map +1 -0
  232. package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.js +93 -0
  233. package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts +15 -0
  234. package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts.map +1 -0
  235. package/dest/storage/backwards_compatibility_tests/schema_tests.js +647 -0
  236. package/dest/storage/backwards_compatibility_tests/store_spy.d.ts +19 -0
  237. package/dest/storage/backwards_compatibility_tests/store_spy.d.ts.map +1 -0
  238. package/dest/storage/backwards_compatibility_tests/store_spy.js +63 -0
  239. package/dest/storage/capsule_store/capsule_service.d.ts +21 -0
  240. package/dest/storage/capsule_store/capsule_service.d.ts.map +1 -0
  241. package/dest/storage/capsule_store/capsule_service.js +47 -0
  242. package/dest/storage/capsule_store/capsule_store.d.ts +9 -9
  243. package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -1
  244. package/dest/storage/capsule_store/capsule_store.js +36 -28
  245. package/dest/storage/capsule_store/index.d.ts +2 -1
  246. package/dest/storage/capsule_store/index.d.ts.map +1 -1
  247. package/dest/storage/capsule_store/index.js +1 -0
  248. package/dest/storage/contract_store/contract_store.d.ts +27 -24
  249. package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
  250. package/dest/storage/contract_store/contract_store.js +70 -98
  251. package/dest/storage/fact_store/fact_service.d.ts +22 -0
  252. package/dest/storage/fact_store/fact_service.d.ts.map +1 -0
  253. package/dest/storage/fact_store/fact_service.js +45 -0
  254. package/dest/storage/fact_store/fact_store.d.ts +95 -0
  255. package/dest/storage/fact_store/fact_store.d.ts.map +1 -0
  256. package/dest/storage/fact_store/fact_store.js +408 -0
  257. package/dest/storage/fact_store/fact_store_keys.d.ts +34 -0
  258. package/dest/storage/fact_store/fact_store_keys.d.ts.map +1 -0
  259. package/dest/storage/fact_store/fact_store_keys.js +50 -0
  260. package/dest/storage/fact_store/index.d.ts +6 -0
  261. package/dest/storage/fact_store/index.d.ts.map +1 -0
  262. package/dest/storage/fact_store/index.js +4 -0
  263. package/dest/storage/fact_store/origin_state.d.ts +57 -0
  264. package/dest/storage/fact_store/origin_state.d.ts.map +1 -0
  265. package/dest/storage/fact_store/origin_state.js +53 -0
  266. package/dest/storage/fact_store/stored_fact.d.ts +32 -0
  267. package/dest/storage/fact_store/stored_fact.d.ts.map +1 -0
  268. package/dest/storage/fact_store/stored_fact.js +64 -0
  269. package/dest/storage/index.d.ts +3 -2
  270. package/dest/storage/index.d.ts.map +1 -1
  271. package/dest/storage/index.js +2 -1
  272. package/dest/storage/metadata.d.ts +2 -2
  273. package/dest/storage/metadata.d.ts.map +1 -1
  274. package/dest/storage/metadata.js +1 -1
  275. package/dest/storage/note_store/note_store.d.ts +42 -33
  276. package/dest/storage/note_store/note_store.d.ts.map +1 -1
  277. package/dest/storage/note_store/note_store.js +199 -170
  278. package/dest/storage/note_store/stored_note.d.ts +3 -8
  279. package/dest/storage/note_store/stored_note.d.ts.map +1 -1
  280. package/dest/storage/note_store/stored_note.js +4 -20
  281. package/dest/storage/open_pxe_stores.d.ts +35 -0
  282. package/dest/storage/open_pxe_stores.d.ts.map +1 -0
  283. package/dest/storage/open_pxe_stores.js +29 -0
  284. package/dest/storage/private_event_store/private_event_store.d.ts +13 -16
  285. package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -1
  286. package/dest/storage/private_event_store/private_event_store.js +43 -43
  287. package/dest/storage/private_event_store/stored_private_event.js +1 -1
  288. package/dest/storage/tagging_store/index.d.ts +2 -2
  289. package/dest/storage/tagging_store/index.d.ts.map +1 -1
  290. package/dest/storage/tagging_store/index.js +1 -1
  291. package/dest/storage/tagging_store/recipient_tagging_store.d.ts +6 -6
  292. package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -1
  293. package/dest/storage/tagging_store/sender_tagging_store.d.ts +29 -28
  294. package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
  295. package/dest/storage/tagging_store/sender_tagging_store.js +141 -115
  296. package/dest/storage/tagging_store/tagging_secret_sources_store.d.ts +51 -0
  297. package/dest/storage/tagging_store/tagging_secret_sources_store.d.ts.map +1 -0
  298. package/dest/storage/tagging_store/tagging_secret_sources_store.js +105 -0
  299. package/dest/tagging/constants.d.ts +2 -2
  300. package/dest/tagging/constants.d.ts.map +1 -1
  301. package/dest/tagging/constants.js +5 -8
  302. package/dest/tagging/get_all_logs_by_tags.d.ts +34 -10
  303. package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -1
  304. package/dest/tagging/get_all_logs_by_tags.js +36 -37
  305. package/dest/tagging/index.d.ts +6 -5
  306. package/dest/tagging/index.d.ts.map +1 -1
  307. package/dest/tagging/index.js +4 -3
  308. package/dest/tagging/persist_sender_tagging_index_ranges.d.ts +29 -0
  309. package/dest/tagging/persist_sender_tagging_index_ranges.d.ts.map +1 -0
  310. package/dest/tagging/persist_sender_tagging_index_ranges.js +42 -0
  311. package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts +69 -0
  312. package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts.map +1 -0
  313. package/dest/tagging/recipient_sync/sync_tagged_private_logs.js +203 -0
  314. package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts +3 -3
  315. package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts.map +1 -1
  316. package/dest/tagging/reconcile_tagging_index_ranges.d.ts +36 -0
  317. package/dest/tagging/reconcile_tagging_index_ranges.d.ts.map +1 -0
  318. package/dest/tagging/reconcile_tagging_index_ranges.js +74 -0
  319. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +4 -5
  320. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
  321. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +31 -10
  322. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +13 -7
  323. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -1
  324. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +41 -10
  325. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +5 -4
  326. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -1
  327. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +26 -13
  328. package/package.json +20 -17
  329. package/src/bin/check_oracle_version.ts +51 -133
  330. package/src/bin/index.ts +5 -0
  331. package/src/bin/oracle_version_helpers.ts +311 -0
  332. package/src/block_synchronizer/block_stream_source.ts +42 -0
  333. package/src/block_synchronizer/block_synchronizer.ts +102 -39
  334. package/src/config/index.ts +15 -8
  335. package/src/config/package_info.ts +1 -1
  336. package/src/contract/contract_class_service.ts +83 -0
  337. package/src/contract/contract_sync_service.ts +176 -0
  338. package/src/contract/helpers.ts +35 -0
  339. package/src/contract_function_simulator/anchored_contract_data.ts +74 -0
  340. package/src/contract_function_simulator/contract_function_simulator.ts +170 -56
  341. package/src/contract_function_simulator/ephemeral_array_service.ts +110 -0
  342. package/src/contract_function_simulator/execution_note_cache.ts +8 -29
  343. package/src/contract_function_simulator/execution_tagging_index_cache.ts +19 -18
  344. package/src/contract_function_simulator/index.ts +69 -4
  345. package/src/contract_function_simulator/noir-structs/bounded_vec.ts +43 -0
  346. package/src/contract_function_simulator/noir-structs/contract_class_log_data.ts +9 -0
  347. package/src/contract_function_simulator/noir-structs/embedded_curve_point.ts +4 -0
  348. package/src/contract_function_simulator/noir-structs/ephemeral_array.ts +66 -0
  349. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +5 -7
  350. package/src/contract_function_simulator/noir-structs/fact.ts +13 -0
  351. package/src/contract_function_simulator/noir-structs/fact_collection.ts +64 -0
  352. package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +27 -20
  353. package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +14 -61
  354. package/src/contract_function_simulator/noir-structs/note_data.ts +27 -0
  355. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +6 -8
  356. package/src/contract_function_simulator/noir-structs/option.ts +75 -0
  357. package/src/contract_function_simulator/noir-structs/origin_block.ts +8 -0
  358. package/src/contract_function_simulator/noir-structs/pending_tagged_log.ts +12 -0
  359. package/src/contract_function_simulator/noir-structs/provided_secret.ts +5 -0
  360. package/src/contract_function_simulator/noir-structs/resolved_tagging_strategy.ts +58 -0
  361. package/src/contract_function_simulator/noir-structs/resolved_tx.ts +53 -0
  362. package/src/contract_function_simulator/noir-structs/tx_effect_data.ts +15 -0
  363. package/src/contract_function_simulator/noir-structs/utility_context.ts +5 -17
  364. package/src/contract_function_simulator/oracle/acir_callback.ts +154 -0
  365. package/src/contract_function_simulator/oracle/index.ts +1 -15
  366. package/src/contract_function_simulator/oracle/interfaces.ts +11 -170
  367. package/src/contract_function_simulator/oracle/legacy_oracle_registry.ts +120 -0
  368. package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +6 -21
  369. package/src/contract_function_simulator/oracle/note_packing_utils.ts +3 -3
  370. package/src/contract_function_simulator/oracle/oracle_registry.ts +689 -0
  371. package/src/contract_function_simulator/oracle/oracle_type_mappings.ts +964 -0
  372. package/src/contract_function_simulator/oracle/private_execution.ts +6 -7
  373. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +241 -103
  374. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +804 -238
  375. package/src/contract_function_simulator/pick_notes.ts +22 -3
  376. package/src/contract_function_simulator/transient_array_service.ts +91 -0
  377. package/src/contract_logging.ts +18 -5
  378. package/src/debug/pxe_debug_utils.ts +4 -12
  379. package/src/entrypoints/client/bundle/index.ts +0 -1
  380. package/src/entrypoints/client/bundle/utils.ts +19 -7
  381. package/src/entrypoints/client/lazy/index.ts +0 -1
  382. package/src/entrypoints/client/lazy/utils.ts +19 -7
  383. package/src/entrypoints/pxe_creation_options.ts +21 -1
  384. package/src/entrypoints/server/index.ts +6 -3
  385. package/src/entrypoints/server/utils.ts +24 -7
  386. package/src/error_enriching.ts +27 -11
  387. package/src/events/event_service.ts +69 -21
  388. package/src/events/private_event_filter_validator.ts +21 -1
  389. package/src/hooks/authorize_utility_call.ts +44 -0
  390. package/src/hooks/execution_hooks.ts +68 -0
  391. package/src/hooks/index.ts +12 -0
  392. package/src/hooks/resolve_custom_request.ts +24 -0
  393. package/src/hooks/resolve_tagging_secret_strategy.ts +57 -0
  394. package/src/logs/log_service.ts +224 -146
  395. package/src/messages/tx_resolver_service.ts +69 -0
  396. package/src/notes/note_service.ts +119 -85
  397. package/src/notes_filter.ts +1 -3
  398. package/src/oracle_version.ts +20 -10
  399. package/src/private_kernel/batch_planner.ts +168 -0
  400. package/src/private_kernel/hints/private_kernel_reset_private_inputs_builder.ts +12 -2
  401. package/src/private_kernel/hints/test_utils.ts +3 -10
  402. package/src/private_kernel/private_kernel_execution_prover.ts +335 -121
  403. package/src/private_kernel/private_kernel_oracle.ts +58 -29
  404. package/src/pxe.ts +563 -233
  405. package/src/storage/allowed_scopes.ts +14 -0
  406. package/src/storage/anchor_block_store/anchor_block_store.ts +9 -7
  407. package/src/storage/backwards_compatibility_tests/__snapshots__/AddressStore.json +22 -0
  408. package/src/storage/backwards_compatibility_tests/__snapshots__/AnchorBlockStore.json +3 -0
  409. package/src/storage/backwards_compatibility_tests/__snapshots__/CapsuleStore.json +16 -0
  410. package/src/storage/backwards_compatibility_tests/__snapshots__/ContractStore.json +28 -0
  411. package/src/storage/backwards_compatibility_tests/__snapshots__/FactStore.json +40 -0
  412. package/src/storage/backwards_compatibility_tests/__snapshots__/KeyStore.json +52 -0
  413. package/src/storage/backwards_compatibility_tests/__snapshots__/L2TipsKVStore.json +40 -0
  414. package/src/storage/backwards_compatibility_tests/__snapshots__/NoteStore.json +56 -0
  415. package/src/storage/backwards_compatibility_tests/__snapshots__/PrivateEventStore.json +44 -0
  416. package/src/storage/backwards_compatibility_tests/__snapshots__/RecipientTaggingStore.json +18 -0
  417. package/src/storage/backwards_compatibility_tests/__snapshots__/SenderTaggingStore.json +22 -0
  418. package/src/storage/backwards_compatibility_tests/__snapshots__/TaggingSecretSourcesStore.json +30 -0
  419. package/src/storage/backwards_compatibility_tests/__snapshots__/opened_stores.json +117 -0
  420. package/src/storage/backwards_compatibility_tests/kv_store_snapshot.ts +122 -0
  421. package/src/storage/backwards_compatibility_tests/schema_tests.ts +774 -0
  422. package/src/storage/backwards_compatibility_tests/store_spy.ts +73 -0
  423. package/src/storage/capsule_store/capsule_service.ts +85 -0
  424. package/src/storage/capsule_store/capsule_store.ts +44 -26
  425. package/src/storage/capsule_store/index.ts +1 -0
  426. package/src/storage/contract_store/contract_store.ts +96 -124
  427. package/src/storage/fact_store/fact_service.ts +69 -0
  428. package/src/storage/fact_store/fact_store.ts +487 -0
  429. package/src/storage/fact_store/fact_store_keys.ts +75 -0
  430. package/src/storage/fact_store/index.ts +14 -0
  431. package/src/storage/fact_store/origin_state.ts +75 -0
  432. package/src/storage/fact_store/stored_fact.ts +80 -0
  433. package/src/storage/index.ts +2 -1
  434. package/src/storage/metadata.ts +1 -1
  435. package/src/storage/note_store/note_store.ts +228 -192
  436. package/src/storage/note_store/stored_note.ts +5 -27
  437. package/src/storage/open_pxe_stores.ts +52 -0
  438. package/src/storage/private_event_store/private_event_store.ts +52 -54
  439. package/src/storage/private_event_store/stored_private_event.ts +1 -1
  440. package/src/storage/tagging_store/index.ts +1 -1
  441. package/src/storage/tagging_store/recipient_tagging_store.ts +5 -9
  442. package/src/storage/tagging_store/sender_tagging_store.ts +185 -138
  443. package/src/storage/tagging_store/tagging_secret_sources_store.ts +138 -0
  444. package/src/tagging/constants.ts +6 -8
  445. package/src/tagging/get_all_logs_by_tags.ts +78 -50
  446. package/src/tagging/index.ts +5 -4
  447. package/src/tagging/persist_sender_tagging_index_ranges.ts +57 -0
  448. package/src/tagging/recipient_sync/sync_tagged_private_logs.ts +301 -0
  449. package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +2 -2
  450. package/src/tagging/reconcile_tagging_index_ranges.ts +102 -0
  451. package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +52 -12
  452. package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +44 -14
  453. package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +23 -14
  454. package/dest/access_scopes.d.ts +0 -9
  455. package/dest/access_scopes.d.ts.map +0 -1
  456. package/dest/access_scopes.js +0 -6
  457. package/dest/contract_function_simulator/oracle/oracle.d.ts +0 -59
  458. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +0 -1
  459. package/dest/contract_function_simulator/oracle/oracle.js +0 -406
  460. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +0 -6
  461. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +0 -1
  462. package/dest/contract_function_simulator/proxied_contract_data_source.js +0 -80
  463. package/dest/contract_sync/contract_sync_service.d.ts +0 -43
  464. package/dest/contract_sync/contract_sync_service.d.ts.map +0 -1
  465. package/dest/contract_sync/contract_sync_service.js +0 -97
  466. package/dest/contract_sync/helpers.d.ts +0 -29
  467. package/dest/contract_sync/helpers.d.ts.map +0 -1
  468. package/dest/contract_sync/helpers.js +0 -55
  469. package/dest/storage/tagging_store/sender_address_book_store.d.ts +0 -14
  470. package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +0 -1
  471. package/dest/storage/tagging_store/sender_address_book_store.js +0 -36
  472. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +0 -14
  473. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +0 -1
  474. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +0 -99
  475. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +0 -14
  476. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +0 -1
  477. package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +0 -33
  478. package/src/access_scopes.ts +0 -9
  479. package/src/contract_function_simulator/oracle/oracle.ts +0 -637
  480. package/src/contract_function_simulator/proxied_contract_data_source.ts +0 -83
  481. package/src/contract_sync/contract_sync_service.ts +0 -152
  482. package/src/contract_sync/helpers.ts +0 -98
  483. package/src/storage/tagging_store/sender_address_book_store.ts +0 -48
  484. package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +0 -140
  485. package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +0 -44
@@ -1,637 +0,0 @@
1
- import { BlockNumber } from '@aztec/foundation/branded-types';
2
- import { Fr } from '@aztec/foundation/curves/bn254';
3
- import { Point } from '@aztec/foundation/curves/grumpkin';
4
- import {
5
- type ACIRCallback,
6
- type ACVMField,
7
- arrayOfArraysToBoundedVecOfArrays,
8
- bufferToBoundedVec,
9
- fromUintArray,
10
- fromUintBoundedVec,
11
- toACVMField,
12
- } from '@aztec/simulator/client';
13
- import { FunctionSelector, NoteSelector } from '@aztec/stdlib/abi';
14
- import { AztecAddress } from '@aztec/stdlib/aztec-address';
15
- import { BlockHash } from '@aztec/stdlib/block';
16
- import { ContractClassLog, ContractClassLogFields } from '@aztec/stdlib/logs';
17
-
18
- import type { IMiscOracle, IPrivateExecutionOracle, IUtilityExecutionOracle } from './interfaces.js';
19
- import { packAsHintedNote } from './note_packing_utils.js';
20
-
21
- export class UnavailableOracleError extends Error {
22
- constructor(oracleName: string) {
23
- super(`${oracleName} oracles not available with the current handler`);
24
- }
25
- }
26
-
27
- /**
28
- * A data source that has all the apis required by Aztec.nr.
29
- */
30
- export class Oracle {
31
- constructor(private handler: IMiscOracle | IUtilityExecutionOracle | IPrivateExecutionOracle) {}
32
-
33
- private handlerAsMisc(): IMiscOracle {
34
- if (!('isMisc' in this.handler)) {
35
- throw new UnavailableOracleError('Misc');
36
- }
37
-
38
- return this.handler;
39
- }
40
-
41
- private handlerAsUtility(): IUtilityExecutionOracle {
42
- if (!('isUtility' in this.handler)) {
43
- throw new UnavailableOracleError('Utility');
44
- }
45
-
46
- return this.handler;
47
- }
48
-
49
- private handlerAsPrivate(): IPrivateExecutionOracle {
50
- if (!('isPrivate' in this.handler)) {
51
- throw new UnavailableOracleError('Private');
52
- }
53
-
54
- return this.handler;
55
- }
56
-
57
- toACIRCallback(): ACIRCallback {
58
- const excludedProps = [
59
- 'handler',
60
- 'constructor',
61
- 'toACIRCallback',
62
- 'handlerAsMisc',
63
- 'handlerAsUtility',
64
- 'handlerAsPrivate',
65
- ] as const;
66
-
67
- // Get all the oracle function names
68
- const oracleNames = Object.getOwnPropertyNames(Oracle.prototype).filter(
69
- name => !excludedProps.includes(name as (typeof excludedProps)[number]),
70
- );
71
-
72
- // Validate oracle names - these must be prefixed with either "aztec_prv_" or "aztec_utl_" to indicate their scope
73
- // and must correspond to a function on the Oracle class.
74
- oracleNames.forEach(name => {
75
- if (!name.startsWith('aztec_prv_') && !name.startsWith('aztec_utl_')) {
76
- throw new Error(
77
- `Oracle function "${name}" must be prefixed with either "aztec_prv_" or "aztec_utl_" to indicate its scope`,
78
- );
79
- }
80
-
81
- const method = this[name as keyof Omit<Oracle, (typeof excludedProps)[number]>];
82
- if (typeof method !== 'function') {
83
- throw new Error(`Oracle property "${name}" must be a function`);
84
- }
85
- });
86
-
87
- // Build callback object and return it
88
- return oracleNames.reduce((acc, name) => {
89
- const method = this[name as keyof Omit<Oracle, (typeof excludedProps)[number]>];
90
- acc[name] = method.bind(this);
91
- return acc;
92
- }, {} as ACIRCallback);
93
- }
94
-
95
- // eslint-disable-next-line camelcase
96
- aztec_utl_assertCompatibleOracleVersion([version]: ACVMField[]) {
97
- this.handlerAsMisc().assertCompatibleOracleVersion(Fr.fromString(version).toNumber());
98
- return Promise.resolve([]);
99
- }
100
-
101
- // eslint-disable-next-line camelcase
102
- aztec_utl_getRandomField(): Promise<ACVMField[]> {
103
- const val = this.handlerAsMisc().getRandomField();
104
- return Promise.resolve([toACVMField(val)]);
105
- }
106
-
107
- // eslint-disable-next-line camelcase
108
- aztec_prv_storeInExecutionCache(values: ACVMField[], [hash]: ACVMField[]): Promise<ACVMField[]> {
109
- this.handlerAsPrivate().storeInExecutionCache(values.map(Fr.fromString), Fr.fromString(hash));
110
- return Promise.resolve([]);
111
- }
112
-
113
- // eslint-disable-next-line camelcase
114
- async aztec_prv_loadFromExecutionCache([returnsHash]: ACVMField[]): Promise<ACVMField[][]> {
115
- const values = await this.handlerAsPrivate().loadFromExecutionCache(Fr.fromString(returnsHash));
116
- return [values.map(toACVMField)];
117
- }
118
-
119
- // eslint-disable-next-line camelcase
120
- aztec_utl_getUtilityContext(): Promise<(ACVMField | ACVMField[])[]> {
121
- const context = this.handlerAsUtility().getUtilityContext();
122
- return Promise.resolve(context.toNoirRepresentation());
123
- }
124
-
125
- // eslint-disable-next-line camelcase
126
- async aztec_utl_getKeyValidationRequest([pkMHash]: ACVMField[]): Promise<ACVMField[]> {
127
- const keyValidationRequest = await this.handlerAsUtility().getKeyValidationRequest(Fr.fromString(pkMHash));
128
-
129
- return keyValidationRequest.toFields().map(toACVMField);
130
- }
131
-
132
- // eslint-disable-next-line camelcase
133
- async aztec_utl_getContractInstance([address]: ACVMField[]): Promise<ACVMField[]> {
134
- const instance = await this.handlerAsUtility().getContractInstance(AztecAddress.fromField(Fr.fromString(address)));
135
-
136
- return [
137
- instance.salt,
138
- instance.deployer,
139
- instance.currentContractClassId,
140
- instance.initializationHash,
141
- ...instance.publicKeys.toFields(),
142
- ].map(toACVMField);
143
- }
144
-
145
- // eslint-disable-next-line camelcase
146
- async aztec_utl_getNoteHashMembershipWitness(
147
- [anchorBlockHash]: ACVMField[],
148
- [noteHash]: ACVMField[],
149
- ): Promise<(ACVMField | ACVMField[])[]> {
150
- const parsedAnchorBlockHash = BlockHash.fromString(anchorBlockHash);
151
- const parsedNoteHash = Fr.fromString(noteHash);
152
-
153
- const witness = await this.handlerAsUtility().getNoteHashMembershipWitness(parsedAnchorBlockHash, parsedNoteHash);
154
- if (!witness) {
155
- throw new Error(
156
- `Note hash ${noteHash} not found in the note hash tree at anchor block hash ${parsedAnchorBlockHash.toString()}.`,
157
- );
158
- }
159
- return witness.toNoirRepresentation();
160
- }
161
-
162
- // eslint-disable-next-line camelcase
163
- async aztec_utl_getBlockHashMembershipWitness(
164
- [anchorBlockHash]: ACVMField[],
165
- [blockHash]: ACVMField[],
166
- ): Promise<(ACVMField | ACVMField[])[]> {
167
- const parsedAnchorBlockHash = BlockHash.fromString(anchorBlockHash);
168
- const parsedBlockHash = BlockHash.fromString(blockHash);
169
-
170
- const witness = await this.handlerAsUtility().getBlockHashMembershipWitness(parsedAnchorBlockHash, parsedBlockHash);
171
- if (!witness) {
172
- throw new Error(
173
- `Block hash ${parsedBlockHash.toString()} not found in the archive tree at anchor block ${parsedAnchorBlockHash.toString()}.`,
174
- );
175
- }
176
- return witness.toNoirRepresentation();
177
- }
178
-
179
- // eslint-disable-next-line camelcase
180
- async aztec_utl_getNullifierMembershipWitness(
181
- [blockHash]: ACVMField[],
182
- [nullifier]: ACVMField[], // nullifier, we try to find the witness for (to prove inclusion)
183
- ): Promise<(ACVMField | ACVMField[])[]> {
184
- const parsedBlockHash = BlockHash.fromString(blockHash);
185
- const parsedNullifier = Fr.fromString(nullifier);
186
-
187
- const witness = await this.handlerAsUtility().getNullifierMembershipWitness(parsedBlockHash, parsedNullifier);
188
- if (!witness) {
189
- throw new Error(
190
- `Nullifier witness not found for nullifier ${parsedNullifier} at block hash ${parsedBlockHash.toString()}.`,
191
- );
192
- }
193
- return witness.toNoirRepresentation();
194
- }
195
-
196
- // eslint-disable-next-line camelcase
197
- async aztec_utl_getLowNullifierMembershipWitness(
198
- [blockHash]: ACVMField[],
199
- [nullifier]: ACVMField[], // nullifier, we try to find the low nullifier witness for (to prove non-inclusion)
200
- ): Promise<(ACVMField | ACVMField[])[]> {
201
- const parsedBlockHash = BlockHash.fromString(blockHash);
202
- const parsedNullifier = Fr.fromString(nullifier);
203
-
204
- const witness = await this.handlerAsUtility().getLowNullifierMembershipWitness(parsedBlockHash, parsedNullifier);
205
- if (!witness) {
206
- throw new Error(
207
- `Low nullifier witness not found for nullifier ${parsedNullifier} at block hash ${parsedBlockHash.toString()}.`,
208
- );
209
- }
210
- return witness.toNoirRepresentation();
211
- }
212
-
213
- // eslint-disable-next-line camelcase
214
- async aztec_utl_getPublicDataWitness(
215
- [blockHash]: ACVMField[],
216
- [leafSlot]: ACVMField[],
217
- ): Promise<(ACVMField | ACVMField[])[]> {
218
- const parsedBlockHash = BlockHash.fromString(blockHash);
219
- const parsedLeafSlot = Fr.fromString(leafSlot);
220
-
221
- const witness = await this.handlerAsUtility().getPublicDataWitness(parsedBlockHash, parsedLeafSlot);
222
- if (!witness) {
223
- throw new Error(
224
- `Public data witness not found for slot ${parsedLeafSlot} at block hash ${parsedBlockHash.toString()}.`,
225
- );
226
- }
227
- return witness.toNoirRepresentation();
228
- }
229
-
230
- // eslint-disable-next-line camelcase
231
- async aztec_utl_getBlockHeader([blockNumber]: ACVMField[]): Promise<ACVMField[]> {
232
- const parsedBlockNumber = Fr.fromString(blockNumber).toNumber();
233
-
234
- const header = await this.handlerAsUtility().getBlockHeader(BlockNumber(parsedBlockNumber));
235
- if (!header) {
236
- throw new Error(`Block header not found for block ${parsedBlockNumber}.`);
237
- }
238
- return header.toFields().map(toACVMField);
239
- }
240
-
241
- // eslint-disable-next-line camelcase
242
- async aztec_utl_getAuthWitness([messageHash]: ACVMField[]): Promise<ACVMField[][]> {
243
- const messageHashField = Fr.fromString(messageHash);
244
- const witness = await this.handlerAsUtility().getAuthWitness(messageHashField);
245
- if (!witness) {
246
- throw new Error(`Unknown auth witness for message hash ${messageHashField}`);
247
- }
248
- return [witness.map(toACVMField)];
249
- }
250
-
251
- // eslint-disable-next-line camelcase
252
- async aztec_utl_tryGetPublicKeysAndPartialAddress([address]: ACVMField[]): Promise<(ACVMField | ACVMField[])[]> {
253
- const parsedAddress = AztecAddress.fromField(Fr.fromString(address));
254
- const result = await this.handlerAsUtility().tryGetPublicKeysAndPartialAddress(parsedAddress);
255
-
256
- // We are going to return a Noir Option struct to represent the possibility of null values. Options are a struct
257
- // with two fields: `some` (a boolean) and `value` (a field array in this case).
258
- if (result === undefined) {
259
- // No data was found so we set `some` to 0 and pad `value` with zeros get the correct return size.
260
- return [toACVMField(0), Array(13).fill(toACVMField(0))];
261
- } else {
262
- // Data was found so we set `some` to 1 and return it along with `value`.
263
- return [toACVMField(1), [...result.publicKeys.toFields(), result.partialAddress].map(toACVMField)];
264
- }
265
- }
266
-
267
- // eslint-disable-next-line camelcase
268
- async aztec_utl_getNotes(
269
- [ownerSome]: ACVMField[],
270
- [ownerValue]: ACVMField[],
271
- [storageSlot]: ACVMField[],
272
- [numSelects]: ACVMField[],
273
- selectByIndexes: ACVMField[],
274
- selectByOffsets: ACVMField[],
275
- selectByLengths: ACVMField[],
276
- selectValues: ACVMField[],
277
- selectComparators: ACVMField[],
278
- sortByIndexes: ACVMField[],
279
- sortByOffsets: ACVMField[],
280
- sortByLengths: ACVMField[],
281
- sortOrder: ACVMField[],
282
- [limit]: ACVMField[],
283
- [offset]: ACVMField[],
284
- [status]: ACVMField[],
285
- [maxNotes]: ACVMField[],
286
- [packedHintedNoteLength]: ACVMField[],
287
- ): Promise<(ACVMField | ACVMField[])[]> {
288
- // Parse Option<AztecAddress>: ownerSome is 0 for None, 1 for Some
289
- const owner = Fr.fromString(ownerSome).toNumber() === 1 ? AztecAddress.fromString(ownerValue) : undefined;
290
- const noteDatas = await this.handlerAsUtility().getNotes(
291
- owner,
292
- Fr.fromString(storageSlot),
293
- +numSelects,
294
- selectByIndexes.map(s => +s),
295
- selectByOffsets.map(s => +s),
296
- selectByLengths.map(s => +s),
297
- selectValues.map(Fr.fromString),
298
- selectComparators.map(s => +s),
299
- sortByIndexes.map(s => +s),
300
- sortByOffsets.map(s => +s),
301
- sortByLengths.map(s => +s),
302
- sortOrder.map(s => +s),
303
- +limit,
304
- +offset,
305
- +status,
306
- );
307
-
308
- const returnDataAsArrayOfPackedHintedNotes = noteDatas.map(noteData =>
309
- packAsHintedNote({
310
- contractAddress: noteData.contractAddress,
311
- owner: noteData.owner,
312
- randomness: noteData.randomness,
313
- storageSlot: noteData.storageSlot,
314
- noteNonce: noteData.noteNonce,
315
- isPending: noteData.isPending,
316
- note: noteData.note,
317
- }),
318
- );
319
-
320
- // Now we convert each sub-array to an array of ACVMField
321
- const returnDataAsArrayOfACVMFieldArrays = returnDataAsArrayOfPackedHintedNotes.map(subArray =>
322
- subArray.map(toACVMField),
323
- );
324
-
325
- // At last we convert the array of arrays to a bounded vec of arrays
326
- return arrayOfArraysToBoundedVecOfArrays(returnDataAsArrayOfACVMFieldArrays, +maxNotes, +packedHintedNoteLength);
327
- }
328
-
329
- // eslint-disable-next-line camelcase
330
- aztec_prv_notifyCreatedNote(
331
- [owner]: ACVMField[],
332
- [storageSlot]: ACVMField[],
333
- [randomness]: ACVMField[],
334
- [noteTypeId]: ACVMField[],
335
- note: ACVMField[],
336
- [noteHash]: ACVMField[],
337
- [counter]: ACVMField[],
338
- ): Promise<ACVMField[]> {
339
- this.handlerAsPrivate().notifyCreatedNote(
340
- AztecAddress.fromString(owner),
341
- Fr.fromString(storageSlot),
342
- Fr.fromString(randomness),
343
- NoteSelector.fromField(Fr.fromString(noteTypeId)),
344
- note.map(Fr.fromString),
345
- Fr.fromString(noteHash),
346
- +counter,
347
- );
348
- return Promise.resolve([]);
349
- }
350
-
351
- // eslint-disable-next-line camelcase
352
- async aztec_prv_notifyNullifiedNote(
353
- [innerNullifier]: ACVMField[],
354
- [noteHash]: ACVMField[],
355
- [counter]: ACVMField[],
356
- ): Promise<ACVMField[]> {
357
- await this.handlerAsPrivate().notifyNullifiedNote(Fr.fromString(innerNullifier), Fr.fromString(noteHash), +counter);
358
- return [];
359
- }
360
-
361
- // eslint-disable-next-line camelcase
362
- async aztec_prv_notifyCreatedNullifier([innerNullifier]: ACVMField[]): Promise<ACVMField[]> {
363
- await this.handlerAsPrivate().notifyCreatedNullifier(Fr.fromString(innerNullifier));
364
- return [];
365
- }
366
-
367
- // eslint-disable-next-line camelcase
368
- async aztec_prv_isNullifierPending(
369
- [innerNullifier]: ACVMField[],
370
- [contractAddress]: ACVMField[],
371
- ): Promise<ACVMField[]> {
372
- const isPending = await this.handlerAsPrivate().isNullifierPending(
373
- Fr.fromString(innerNullifier),
374
- AztecAddress.fromString(contractAddress),
375
- );
376
- return [toACVMField(isPending)];
377
- }
378
-
379
- // eslint-disable-next-line camelcase
380
- async aztec_utl_checkNullifierExists([innerNullifier]: ACVMField[]): Promise<ACVMField[]> {
381
- const exists = await this.handlerAsUtility().checkNullifierExists(Fr.fromString(innerNullifier));
382
- return [toACVMField(exists)];
383
- }
384
-
385
- // eslint-disable-next-line camelcase
386
- async aztec_utl_getL1ToL2MembershipWitness(
387
- [contractAddress]: ACVMField[],
388
- [messageHash]: ACVMField[],
389
- [secret]: ACVMField[],
390
- ): Promise<(ACVMField | ACVMField[])[]> {
391
- const message = await this.handlerAsUtility().getL1ToL2MembershipWitness(
392
- AztecAddress.fromString(contractAddress),
393
- Fr.fromString(messageHash),
394
- Fr.fromString(secret),
395
- );
396
- return message.toNoirRepresentation();
397
- }
398
-
399
- // eslint-disable-next-line camelcase
400
- async aztec_utl_storageRead(
401
- [blockHash]: ACVMField[],
402
- [contractAddress]: ACVMField[],
403
- [startStorageSlot]: ACVMField[],
404
- [numberOfElements]: ACVMField[],
405
- ): Promise<ACVMField[][]> {
406
- const values = await this.handlerAsUtility().storageRead(
407
- BlockHash.fromString(blockHash),
408
- new AztecAddress(Fr.fromString(contractAddress)),
409
- Fr.fromString(startStorageSlot),
410
- +numberOfElements,
411
- );
412
- return [values.map(toACVMField)];
413
- }
414
-
415
- // eslint-disable-next-line camelcase
416
- aztec_prv_notifyCreatedContractClassLog(
417
- [contractAddress]: ACVMField[],
418
- message: ACVMField[],
419
- [length]: ACVMField[],
420
- [counter]: ACVMField[],
421
- ): Promise<ACVMField[]> {
422
- const logFields = new ContractClassLogFields(message.map(Fr.fromString));
423
- const log = new ContractClassLog(new AztecAddress(Fr.fromString(contractAddress)), logFields, +length);
424
-
425
- this.handlerAsPrivate().notifyCreatedContractClassLog(log, +counter);
426
- return Promise.resolve([]);
427
- }
428
-
429
- // eslint-disable-next-line camelcase
430
- async aztec_utl_log(
431
- level: ACVMField[],
432
- message: ACVMField[],
433
- _ignoredFieldsSize: ACVMField[],
434
- fields: ACVMField[],
435
- ): Promise<ACVMField[]> {
436
- const levelFr = Fr.fromString(level[0]);
437
- const messageStr = message.map(acvmField => String.fromCharCode(Fr.fromString(acvmField).toNumber())).join('');
438
- const fieldsFr = fields.map(Fr.fromString);
439
- await this.handlerAsMisc().log(levelFr.toNumber(), messageStr, fieldsFr);
440
- return [];
441
- }
442
-
443
- // This function's name is directly hardcoded in `circuit_recorder.ts`. Don't forget to update it there if you
444
- // change the name here.
445
- // eslint-disable-next-line camelcase
446
- async aztec_prv_callPrivateFunction(
447
- [contractAddress]: ACVMField[],
448
- [functionSelector]: ACVMField[],
449
- [argsHash]: ACVMField[],
450
- [sideEffectCounter]: ACVMField[],
451
- [isStaticCall]: ACVMField[],
452
- ): Promise<ACVMField[][]> {
453
- const { endSideEffectCounter, returnsHash } = await this.handlerAsPrivate().callPrivateFunction(
454
- AztecAddress.fromField(Fr.fromString(contractAddress)),
455
- FunctionSelector.fromField(Fr.fromString(functionSelector)),
456
- Fr.fromString(argsHash),
457
- Fr.fromString(sideEffectCounter).toNumber(),
458
- Fr.fromString(isStaticCall).toBool(),
459
- );
460
- return [[endSideEffectCounter, returnsHash].map(toACVMField)];
461
- }
462
-
463
- // eslint-disable-next-line camelcase
464
- async aztec_prv_validatePublicCalldata([calldataHash]: ACVMField[]): Promise<ACVMField[]> {
465
- await this.handlerAsPrivate().validatePublicCalldata(Fr.fromString(calldataHash));
466
- return [];
467
- }
468
-
469
- // eslint-disable-next-line camelcase
470
- async aztec_prv_notifyRevertiblePhaseStart([minRevertibleSideEffectCounter]: ACVMField[]): Promise<ACVMField[]> {
471
- await this.handlerAsPrivate().notifyRevertiblePhaseStart(Fr.fromString(minRevertibleSideEffectCounter).toNumber());
472
- return Promise.resolve([]);
473
- }
474
-
475
- // eslint-disable-next-line camelcase
476
- async aztec_prv_inRevertiblePhase([sideEffectCounter]: ACVMField[]): Promise<ACVMField[]> {
477
- const isRevertible = await this.handlerAsPrivate().inRevertiblePhase(Fr.fromString(sideEffectCounter).toNumber());
478
- return Promise.resolve([toACVMField(isRevertible)]);
479
- }
480
-
481
- // eslint-disable-next-line camelcase
482
- async aztec_prv_getNextAppTagAsSender([sender]: ACVMField[], [recipient]: ACVMField[]): Promise<ACVMField[]> {
483
- const tag = await this.handlerAsPrivate().getNextAppTagAsSender(
484
- AztecAddress.fromString(sender),
485
- AztecAddress.fromString(recipient),
486
- );
487
- return [toACVMField(tag.value)];
488
- }
489
-
490
- // eslint-disable-next-line camelcase
491
- async aztec_utl_fetchTaggedLogs([pendingTaggedLogArrayBaseSlot]: ACVMField[]): Promise<ACVMField[]> {
492
- await this.handlerAsUtility().fetchTaggedLogs(Fr.fromString(pendingTaggedLogArrayBaseSlot));
493
- return [];
494
- }
495
-
496
- // eslint-disable-next-line camelcase
497
- async aztec_utl_validateAndStoreEnqueuedNotesAndEvents(
498
- [contractAddress]: ACVMField[],
499
- [noteValidationRequestsArrayBaseSlot]: ACVMField[],
500
- [eventValidationRequestsArrayBaseSlot]: ACVMField[],
501
- [maxNotePackedLen]: ACVMField[],
502
- [maxEventSerializedLen]: ACVMField[],
503
- ): Promise<ACVMField[]> {
504
- await this.handlerAsUtility().validateAndStoreEnqueuedNotesAndEvents(
505
- AztecAddress.fromString(contractAddress),
506
- Fr.fromString(noteValidationRequestsArrayBaseSlot),
507
- Fr.fromString(eventValidationRequestsArrayBaseSlot),
508
- Fr.fromString(maxNotePackedLen).toNumber(),
509
- Fr.fromString(maxEventSerializedLen).toNumber(),
510
- );
511
-
512
- return [];
513
- }
514
-
515
- // eslint-disable-next-line camelcase
516
- async aztec_utl_bulkRetrieveLogs(
517
- [contractAddress]: ACVMField[],
518
- [logRetrievalRequestsArrayBaseSlot]: ACVMField[],
519
- [logRetrievalResponsesArrayBaseSlot]: ACVMField[],
520
- ): Promise<ACVMField[]> {
521
- await this.handlerAsUtility().bulkRetrieveLogs(
522
- AztecAddress.fromString(contractAddress),
523
- Fr.fromString(logRetrievalRequestsArrayBaseSlot),
524
- Fr.fromString(logRetrievalResponsesArrayBaseSlot),
525
- );
526
- return [];
527
- }
528
-
529
- // eslint-disable-next-line camelcase
530
- async aztec_utl_storeCapsule(
531
- [contractAddress]: ACVMField[],
532
- [slot]: ACVMField[],
533
- capsule: ACVMField[],
534
- ): Promise<ACVMField[]> {
535
- await this.handlerAsUtility().storeCapsule(
536
- AztecAddress.fromField(Fr.fromString(contractAddress)),
537
- Fr.fromString(slot),
538
- capsule.map(Fr.fromString),
539
- );
540
- return [];
541
- }
542
-
543
- // eslint-disable-next-line camelcase
544
- async aztec_utl_loadCapsule(
545
- [contractAddress]: ACVMField[],
546
- [slot]: ACVMField[],
547
- [tSize]: ACVMField[],
548
- ): Promise<(ACVMField | ACVMField[])[]> {
549
- const values = await this.handlerAsUtility().loadCapsule(
550
- AztecAddress.fromField(Fr.fromString(contractAddress)),
551
- Fr.fromString(slot),
552
- );
553
-
554
- // We are going to return a Noir Option struct to represent the possibility of null values. Options are a struct
555
- // with two fields: `some` (a boolean) and `value` (a field array in this case).
556
- if (values === null) {
557
- // No data was found so we set `some` to 0 and pad `value` with zeros get the correct return size.
558
- return [toACVMField(0), Array(Fr.fromString(tSize).toNumber()).fill(toACVMField(0))];
559
- } else {
560
- // Data was found so we set `some` to 1 and return it along with `value`.
561
- return [toACVMField(1), values.map(toACVMField)];
562
- }
563
- }
564
-
565
- // eslint-disable-next-line camelcase
566
- async aztec_utl_deleteCapsule([contractAddress]: ACVMField[], [slot]: ACVMField[]): Promise<ACVMField[]> {
567
- await this.handlerAsUtility().deleteCapsule(
568
- AztecAddress.fromField(Fr.fromString(contractAddress)),
569
- Fr.fromString(slot),
570
- );
571
- return [];
572
- }
573
-
574
- // eslint-disable-next-line camelcase
575
- async aztec_utl_copyCapsule(
576
- [contractAddress]: ACVMField[],
577
- [srcSlot]: ACVMField[],
578
- [dstSlot]: ACVMField[],
579
- [numEntries]: ACVMField[],
580
- ): Promise<ACVMField[]> {
581
- await this.handlerAsUtility().copyCapsule(
582
- AztecAddress.fromField(Fr.fromString(contractAddress)),
583
- Fr.fromString(srcSlot),
584
- Fr.fromString(dstSlot),
585
- Fr.fromString(numEntries).toNumber(),
586
- );
587
- return [];
588
- }
589
-
590
- // eslint-disable-next-line camelcase
591
- async aztec_utl_aes128Decrypt(
592
- ciphertextBVecStorage: ACVMField[],
593
- [ciphertextLength]: ACVMField[],
594
- iv: ACVMField[],
595
- symKey: ACVMField[],
596
- ): Promise<(ACVMField | ACVMField[])[]> {
597
- const ciphertext = fromUintBoundedVec(ciphertextBVecStorage, ciphertextLength, 8);
598
- const ivBuffer = fromUintArray(iv, 8);
599
- const symKeyBuffer = fromUintArray(symKey, 8);
600
-
601
- const plaintext = await this.handlerAsUtility().aes128Decrypt(ciphertext, ivBuffer, symKeyBuffer);
602
- return bufferToBoundedVec(plaintext, ciphertextBVecStorage.length);
603
- }
604
-
605
- // eslint-disable-next-line camelcase
606
- async aztec_utl_getSharedSecret(
607
- [address]: ACVMField[],
608
- [ephPKField0]: ACVMField[],
609
- [ephPKField1]: ACVMField[],
610
- [ephPKField2]: ACVMField[],
611
- ): Promise<ACVMField[]> {
612
- const secret = await this.handlerAsUtility().getSharedSecret(
613
- AztecAddress.fromField(Fr.fromString(address)),
614
- Point.fromFields([ephPKField0, ephPKField1, ephPKField2].map(Fr.fromString)),
615
- );
616
- return secret.toFields().map(toACVMField);
617
- }
618
-
619
- // eslint-disable-next-line camelcase
620
- async aztec_utl_emitOffchainEffect(data: ACVMField[]) {
621
- await this.handlerAsPrivate().emitOffchainEffect(data.map(Fr.fromString));
622
- return [];
623
- }
624
-
625
- // eslint-disable-next-line camelcase
626
- async aztec_prv_getSenderForTags(): Promise<ACVMField[]> {
627
- const sender = await this.handlerAsPrivate().getSenderForTags();
628
- // Return [1, address] for Some(address), [0, 0] for None
629
- return sender ? [toACVMField(1n), toACVMField(sender)] : [toACVMField(0n), toACVMField(0n)];
630
- }
631
-
632
- // eslint-disable-next-line camelcase
633
- async aztec_prv_setSenderForTags([senderForTags]: ACVMField[]): Promise<ACVMField[]> {
634
- await this.handlerAsPrivate().setSenderForTags(AztecAddress.fromField(Fr.fromString(senderForTags)));
635
- return [];
636
- }
637
- }