@aztec/pxe 0.0.1-commit.d3ec352c → 0.0.1-commit.e61ad554

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 (379) hide show
  1. package/dest/bin/check_oracle_version.js +105 -15
  2. package/dest/block_synchronizer/block_synchronizer.d.ts +43 -0
  3. package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -0
  4. package/dest/block_synchronizer/block_synchronizer.js +147 -0
  5. package/dest/block_synchronizer/index.d.ts +2 -0
  6. package/dest/block_synchronizer/index.d.ts.map +1 -0
  7. package/dest/block_synchronizer/index.js +1 -0
  8. package/dest/config/index.d.ts +6 -4
  9. package/dest/config/index.d.ts.map +1 -1
  10. package/dest/config/index.js +17 -0
  11. package/dest/config/package_info.js +1 -1
  12. package/dest/contract_function_simulator/benchmarked_node.d.ts +9 -0
  13. package/dest/contract_function_simulator/benchmarked_node.d.ts.map +1 -0
  14. package/dest/contract_function_simulator/benchmarked_node.js +77 -0
  15. package/dest/contract_function_simulator/contract_function_simulator.d.ts +42 -14
  16. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  17. package/dest/contract_function_simulator/contract_function_simulator.js +71 -30
  18. package/dest/contract_function_simulator/execution_note_cache.d.ts +21 -12
  19. package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
  20. package/dest/contract_function_simulator/execution_note_cache.js +48 -31
  21. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +1 -1
  22. package/dest/contract_function_simulator/execution_tagging_index_cache.js +1 -1
  23. package/dest/contract_function_simulator/hashed_values_cache.d.ts +2 -2
  24. package/dest/contract_function_simulator/hashed_values_cache.d.ts.map +1 -1
  25. package/dest/contract_function_simulator/index.d.ts +2 -2
  26. package/dest/contract_function_simulator/index.d.ts.map +1 -1
  27. package/dest/contract_function_simulator/index.js +1 -1
  28. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +5 -4
  29. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
  30. package/dest/contract_function_simulator/noir-structs/event_validation_request.js +6 -3
  31. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +5 -4
  32. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts.map +1 -1
  33. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.js +7 -6
  34. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +2 -2
  35. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
  36. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +1 -1
  37. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +3 -3
  38. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
  39. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +1 -1
  40. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +4 -10
  41. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -1
  42. package/dest/contract_function_simulator/noir-structs/utility_context.js +7 -18
  43. package/dest/contract_function_simulator/oracle/interfaces.d.ts +20 -16
  44. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
  45. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +4 -2
  46. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
  47. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.js +1 -1
  48. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +11 -7
  49. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
  50. package/dest/contract_function_simulator/oracle/note_packing_utils.js +14 -10
  51. package/dest/contract_function_simulator/oracle/oracle.d.ts +10 -8
  52. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
  53. package/dest/contract_function_simulator/oracle/oracle.js +58 -36
  54. package/dest/contract_function_simulator/oracle/private_execution.d.ts +2 -28
  55. package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
  56. package/dest/contract_function_simulator/oracle/private_execution.js +2 -38
  57. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +33 -25
  58. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  59. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +41 -45
  60. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +75 -25
  61. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  62. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +170 -64
  63. package/dest/contract_function_simulator/pick_notes.d.ts +2 -2
  64. package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -1
  65. package/dest/contract_function_simulator/pick_notes.js +1 -1
  66. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +4 -4
  67. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -1
  68. package/dest/contract_function_simulator/proxied_contract_data_source.js +23 -5
  69. package/dest/contract_sync/index.d.ts +23 -0
  70. package/dest/contract_sync/index.d.ts.map +1 -0
  71. package/dest/contract_sync/index.js +54 -0
  72. package/dest/debug/pxe_debug_utils.d.ts +31 -0
  73. package/dest/debug/pxe_debug_utils.d.ts.map +1 -0
  74. package/dest/debug/pxe_debug_utils.js +38 -0
  75. package/dest/entrypoints/client/bundle/index.d.ts +1 -2
  76. package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
  77. package/dest/entrypoints/client/bundle/index.js +0 -1
  78. package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
  79. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  80. package/dest/entrypoints/client/bundle/utils.js +12 -3
  81. package/dest/entrypoints/client/lazy/index.d.ts +1 -2
  82. package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
  83. package/dest/entrypoints/client/lazy/index.js +0 -1
  84. package/dest/entrypoints/client/lazy/utils.d.ts +1 -1
  85. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  86. package/dest/entrypoints/client/lazy/utils.js +12 -3
  87. package/dest/entrypoints/pxe_creation_options.d.ts +5 -2
  88. package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
  89. package/dest/entrypoints/server/index.d.ts +4 -2
  90. package/dest/entrypoints/server/index.d.ts.map +1 -1
  91. package/dest/entrypoints/server/index.js +3 -1
  92. package/dest/entrypoints/server/utils.d.ts +1 -1
  93. package/dest/entrypoints/server/utils.d.ts.map +1 -1
  94. package/dest/entrypoints/server/utils.js +12 -8
  95. package/dest/error_enriching.d.ts +4 -4
  96. package/dest/error_enriching.d.ts.map +1 -1
  97. package/dest/error_enriching.js +6 -6
  98. package/dest/events/event_service.d.ts +16 -0
  99. package/dest/events/event_service.d.ts.map +1 -0
  100. package/dest/events/event_service.js +45 -0
  101. package/dest/events/index.d.ts +2 -0
  102. package/dest/events/index.d.ts.map +1 -0
  103. package/dest/events/index.js +1 -0
  104. package/dest/events/private_event_filter_validator.d.ts +9 -0
  105. package/dest/events/private_event_filter_validator.d.ts.map +1 -0
  106. package/dest/events/private_event_filter_validator.js +38 -0
  107. package/dest/job_coordinator/job_coordinator.d.ts +74 -0
  108. package/dest/job_coordinator/job_coordinator.d.ts.map +1 -0
  109. package/dest/job_coordinator/job_coordinator.js +93 -0
  110. package/dest/logs/log_service.d.ts +27 -0
  111. package/dest/logs/log_service.d.ts.map +1 -0
  112. package/dest/logs/log_service.js +128 -0
  113. package/dest/notes/index.d.ts +2 -0
  114. package/dest/notes/index.d.ts.map +1 -0
  115. package/dest/notes/index.js +1 -0
  116. package/dest/notes/note_service.d.ts +49 -0
  117. package/dest/notes/note_service.d.ts.map +1 -0
  118. package/dest/notes/note_service.js +148 -0
  119. package/dest/oracle_version.d.ts +3 -3
  120. package/dest/oracle_version.d.ts.map +1 -1
  121. package/dest/oracle_version.js +4 -3
  122. package/dest/private_kernel/hints/index.d.ts +2 -2
  123. package/dest/private_kernel/hints/index.d.ts.map +1 -1
  124. package/dest/private_kernel/hints/index.js +1 -1
  125. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +28 -0
  126. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -0
  127. package/dest/private_kernel/hints/{build_private_kernel_reset_private_inputs.js → private_kernel_reset_private_inputs_builder.js} +13 -7
  128. package/dest/private_kernel/private_kernel_execution_prover.d.ts +1 -1
  129. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
  130. package/dest/private_kernel/private_kernel_execution_prover.js +8 -9
  131. package/dest/private_kernel/private_kernel_oracle.d.ts +26 -29
  132. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
  133. package/dest/private_kernel/private_kernel_oracle.js +90 -2
  134. package/dest/pxe.d.ts +45 -81
  135. package/dest/pxe.d.ts.map +1 -1
  136. package/dest/pxe.js +185 -216
  137. package/dest/storage/address_store/address_store.d.ts +11 -0
  138. package/dest/storage/address_store/address_store.d.ts.map +1 -0
  139. package/dest/storage/{address_data_provider/address_data_provider.js → address_store/address_store.js} +1 -1
  140. package/dest/storage/address_store/index.d.ts +2 -0
  141. package/dest/storage/address_store/index.d.ts.map +1 -0
  142. package/dest/storage/address_store/index.js +1 -0
  143. package/dest/storage/{sync_data_provider/sync_data_provider.d.ts → anchor_block_store/anchor_block_store.d.ts} +2 -4
  144. package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -0
  145. package/dest/storage/{sync_data_provider/sync_data_provider.js → anchor_block_store/anchor_block_store.js} +2 -9
  146. package/dest/storage/{sync_data_provider → anchor_block_store}/index.d.ts +2 -2
  147. package/dest/storage/anchor_block_store/index.d.ts.map +1 -0
  148. package/dest/storage/anchor_block_store/index.js +1 -0
  149. package/dest/storage/capsule_store/capsule_store.d.ts +72 -0
  150. package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -0
  151. package/dest/storage/capsule_store/capsule_store.js +255 -0
  152. package/dest/storage/capsule_store/index.d.ts +2 -0
  153. package/dest/storage/capsule_store/index.d.ts.map +1 -0
  154. package/dest/storage/capsule_store/index.js +1 -0
  155. package/dest/storage/{contract_data_provider/contract_data_provider.d.ts → contract_store/contract_store.d.ts} +7 -5
  156. package/dest/storage/contract_store/contract_store.d.ts.map +1 -0
  157. package/dest/storage/{contract_data_provider/contract_data_provider.js → contract_store/contract_store.js} +34 -3
  158. package/dest/storage/contract_store/index.d.ts +2 -0
  159. package/dest/storage/contract_store/index.d.ts.map +1 -0
  160. package/dest/storage/contract_store/index.js +1 -0
  161. package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.d.ts +1 -1
  162. package/dest/storage/contract_store/private_functions_tree.d.ts.map +1 -0
  163. package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.js +1 -1
  164. package/dest/storage/index.d.ts +8 -8
  165. package/dest/storage/index.d.ts.map +1 -1
  166. package/dest/storage/index.js +7 -7
  167. package/dest/storage/note_store/index.d.ts +3 -0
  168. package/dest/storage/note_store/index.d.ts.map +1 -0
  169. package/dest/storage/note_store/index.js +2 -0
  170. package/dest/storage/note_store/note_store.d.ts +73 -0
  171. package/dest/storage/note_store/note_store.d.ts.map +1 -0
  172. package/dest/storage/note_store/note_store.js +303 -0
  173. package/dest/storage/note_store/stored_note.d.ts +16 -0
  174. package/dest/storage/note_store/stored_note.d.ts.map +1 -0
  175. package/dest/storage/note_store/stored_note.js +43 -0
  176. package/dest/storage/private_event_store/private_event_store.d.ts +91 -0
  177. package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -0
  178. package/dest/storage/private_event_store/private_event_store.js +250 -0
  179. package/dest/storage/private_event_store/stored_private_event.d.ts +23 -0
  180. package/dest/storage/private_event_store/stored_private_event.d.ts.map +1 -0
  181. package/dest/storage/private_event_store/stored_private_event.js +56 -0
  182. package/dest/storage/tagging_store/index.d.ts +4 -0
  183. package/dest/storage/tagging_store/index.d.ts.map +1 -0
  184. package/dest/storage/tagging_store/index.js +3 -0
  185. package/dest/storage/tagging_store/recipient_tagging_store.d.ts +28 -0
  186. package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -0
  187. package/dest/storage/tagging_store/recipient_tagging_store.js +99 -0
  188. package/dest/storage/tagging_store/sender_address_book_store.d.ts +14 -0
  189. package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +1 -0
  190. package/dest/storage/tagging_store/sender_address_book_store.js +30 -0
  191. package/dest/storage/tagging_store/sender_tagging_store.d.ts +77 -0
  192. package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -0
  193. package/dest/storage/tagging_store/sender_tagging_store.js +278 -0
  194. package/dest/tagging/constants.d.ts +2 -2
  195. package/dest/tagging/constants.d.ts.map +1 -1
  196. package/dest/tagging/constants.js +10 -2
  197. package/dest/tagging/get_all_logs_by_tags.d.ts +24 -0
  198. package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -0
  199. package/dest/tagging/get_all_logs_by_tags.js +46 -0
  200. package/dest/tagging/index.d.ts +16 -6
  201. package/dest/tagging/index.d.ts.map +1 -1
  202. package/dest/tagging/index.js +15 -5
  203. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +15 -0
  204. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -0
  205. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +99 -0
  206. package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts +12 -0
  207. package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts.map +1 -0
  208. package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +20 -0
  209. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +15 -0
  210. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -0
  211. package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +32 -0
  212. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +21 -0
  213. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -0
  214. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +74 -0
  215. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +11 -0
  216. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -0
  217. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +29 -0
  218. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +21 -0
  219. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -0
  220. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +60 -0
  221. package/package.json +18 -18
  222. package/src/bin/check_oracle_version.ts +131 -20
  223. package/src/block_synchronizer/block_synchronizer.ts +174 -0
  224. package/src/block_synchronizer/index.ts +1 -0
  225. package/src/config/index.ts +17 -3
  226. package/src/config/package_info.ts +1 -1
  227. package/src/contract_function_simulator/benchmarked_node.ts +103 -0
  228. package/src/contract_function_simulator/contract_function_simulator.ts +113 -33
  229. package/src/contract_function_simulator/execution_note_cache.ts +51 -29
  230. package/src/contract_function_simulator/execution_tagging_index_cache.ts +1 -1
  231. package/src/contract_function_simulator/hashed_values_cache.ts +1 -1
  232. package/src/contract_function_simulator/index.ts +1 -1
  233. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +6 -2
  234. package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +6 -5
  235. package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +1 -1
  236. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +2 -2
  237. package/src/contract_function_simulator/noir-structs/utility_context.ts +6 -25
  238. package/src/contract_function_simulator/oracle/interfaces.ts +25 -15
  239. package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +1 -1
  240. package/src/contract_function_simulator/oracle/note_packing_utils.ts +27 -13
  241. package/src/contract_function_simulator/oracle/oracle.ts +74 -45
  242. package/src/contract_function_simulator/oracle/private_execution.ts +2 -69
  243. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +124 -59
  244. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +259 -81
  245. package/src/contract_function_simulator/pick_notes.ts +1 -1
  246. package/src/contract_function_simulator/proxied_contract_data_source.ts +24 -7
  247. package/src/contract_sync/index.ts +98 -0
  248. package/src/debug/pxe_debug_utils.ts +49 -0
  249. package/src/entrypoints/client/bundle/index.ts +0 -1
  250. package/src/entrypoints/client/bundle/utils.ts +9 -3
  251. package/src/entrypoints/client/lazy/index.ts +0 -1
  252. package/src/entrypoints/client/lazy/utils.ts +9 -4
  253. package/src/entrypoints/pxe_creation_options.ts +4 -1
  254. package/src/entrypoints/server/index.ts +3 -1
  255. package/src/entrypoints/server/utils.ts +12 -16
  256. package/src/error_enriching.ts +7 -15
  257. package/src/events/event_service.ts +73 -0
  258. package/src/events/index.ts +1 -0
  259. package/src/events/private_event_filter_validator.ts +46 -0
  260. package/src/job_coordinator/job_coordinator.ts +149 -0
  261. package/src/logs/log_service.ts +220 -0
  262. package/src/notes/index.ts +1 -0
  263. package/src/notes/note_service.ts +197 -0
  264. package/src/oracle_version.ts +4 -3
  265. package/src/private_kernel/hints/index.ts +1 -1
  266. package/src/private_kernel/hints/{build_private_kernel_reset_private_inputs.ts → private_kernel_reset_private_inputs_builder.ts} +34 -23
  267. package/src/private_kernel/private_kernel_execution_prover.ts +7 -9
  268. package/src/private_kernel/private_kernel_oracle.ts +118 -37
  269. package/src/pxe.ts +257 -280
  270. package/src/storage/{address_data_provider/address_data_provider.ts → address_store/address_store.ts} +1 -1
  271. package/src/storage/address_store/index.ts +1 -0
  272. package/src/storage/{sync_data_provider/sync_data_provider.ts → anchor_block_store/anchor_block_store.ts} +2 -12
  273. package/src/storage/anchor_block_store/index.ts +1 -0
  274. package/src/storage/capsule_store/capsule_store.ts +315 -0
  275. package/src/storage/capsule_store/index.ts +1 -0
  276. package/src/storage/{contract_data_provider/contract_data_provider.ts → contract_store/contract_store.ts} +45 -3
  277. package/src/storage/contract_store/index.ts +1 -0
  278. package/src/storage/{contract_data_provider → contract_store}/private_functions_tree.ts +1 -1
  279. package/src/storage/index.ts +7 -7
  280. package/src/storage/note_store/index.ts +2 -0
  281. package/src/storage/note_store/note_store.ts +381 -0
  282. package/src/storage/note_store/stored_note.ts +48 -0
  283. package/src/storage/private_event_store/private_event_store.ts +363 -0
  284. package/src/storage/private_event_store/stored_private_event.ts +73 -0
  285. package/src/storage/tagging_store/index.ts +3 -0
  286. package/src/storage/tagging_store/recipient_tagging_store.ts +129 -0
  287. package/src/storage/tagging_store/sender_address_book_store.ts +42 -0
  288. package/src/storage/tagging_store/sender_tagging_store.ts +345 -0
  289. package/src/tagging/constants.ts +10 -2
  290. package/src/tagging/get_all_logs_by_tags.ts +68 -0
  291. package/src/tagging/index.ts +18 -5
  292. package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +143 -0
  293. package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +34 -0
  294. package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +49 -0
  295. package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +99 -0
  296. package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +36 -0
  297. package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +84 -0
  298. package/dest/contract_function_simulator/execution_data_provider.d.ts +0 -267
  299. package/dest/contract_function_simulator/execution_data_provider.d.ts.map +0 -1
  300. package/dest/contract_function_simulator/execution_data_provider.js +0 -14
  301. package/dest/contract_function_simulator/proxied_node.d.ts +0 -9
  302. package/dest/contract_function_simulator/proxied_node.d.ts.map +0 -1
  303. package/dest/contract_function_simulator/proxied_node.js +0 -27
  304. package/dest/contract_function_simulator/pxe_oracle_interface.d.ts +0 -123
  305. package/dest/contract_function_simulator/pxe_oracle_interface.d.ts.map +0 -1
  306. package/dest/contract_function_simulator/pxe_oracle_interface.js +0 -696
  307. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +0 -28
  308. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +0 -1
  309. package/dest/private_kernel/private_kernel_oracle_impl.d.ts +0 -45
  310. package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +0 -1
  311. package/dest/private_kernel/private_kernel_oracle_impl.js +0 -86
  312. package/dest/storage/address_data_provider/address_data_provider.d.ts +0 -11
  313. package/dest/storage/address_data_provider/address_data_provider.d.ts.map +0 -1
  314. package/dest/storage/address_data_provider/index.d.ts +0 -2
  315. package/dest/storage/address_data_provider/index.d.ts.map +0 -1
  316. package/dest/storage/address_data_provider/index.js +0 -1
  317. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts +0 -25
  318. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +0 -1
  319. package/dest/storage/capsule_data_provider/capsule_data_provider.js +0 -118
  320. package/dest/storage/capsule_data_provider/index.d.ts +0 -2
  321. package/dest/storage/capsule_data_provider/index.d.ts.map +0 -1
  322. package/dest/storage/capsule_data_provider/index.js +0 -1
  323. package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +0 -1
  324. package/dest/storage/contract_data_provider/index.d.ts +0 -2
  325. package/dest/storage/contract_data_provider/index.d.ts.map +0 -1
  326. package/dest/storage/contract_data_provider/index.js +0 -1
  327. package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +0 -1
  328. package/dest/storage/note_data_provider/index.d.ts +0 -3
  329. package/dest/storage/note_data_provider/index.d.ts.map +0 -1
  330. package/dest/storage/note_data_provider/index.js +0 -2
  331. package/dest/storage/note_data_provider/note_data_provider.d.ts +0 -83
  332. package/dest/storage/note_data_provider/note_data_provider.d.ts.map +0 -1
  333. package/dest/storage/note_data_provider/note_data_provider.js +0 -314
  334. package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +0 -37
  335. package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts.map +0 -1
  336. package/dest/storage/private_event_data_provider/private_event_data_provider.js +0 -105
  337. package/dest/storage/sync_data_provider/index.d.ts.map +0 -1
  338. package/dest/storage/sync_data_provider/index.js +0 -1
  339. package/dest/storage/sync_data_provider/sync_data_provider.d.ts.map +0 -1
  340. package/dest/storage/tagging_data_provider/index.d.ts +0 -2
  341. package/dest/storage/tagging_data_provider/index.d.ts.map +0 -1
  342. package/dest/storage/tagging_data_provider/index.js +0 -1
  343. package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts +0 -40
  344. package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts.map +0 -1
  345. package/dest/storage/tagging_data_provider/tagging_data_provider.js +0 -89
  346. package/dest/synchronizer/index.d.ts +0 -2
  347. package/dest/synchronizer/index.d.ts.map +0 -1
  348. package/dest/synchronizer/index.js +0 -1
  349. package/dest/synchronizer/synchronizer.d.ts +0 -36
  350. package/dest/synchronizer/synchronizer.d.ts.map +0 -1
  351. package/dest/synchronizer/synchronizer.js +0 -102
  352. package/dest/tagging/siloed_tag.d.ts +0 -14
  353. package/dest/tagging/siloed_tag.d.ts.map +0 -1
  354. package/dest/tagging/siloed_tag.js +0 -20
  355. package/dest/tagging/tag.d.ts +0 -12
  356. package/dest/tagging/tag.d.ts.map +0 -1
  357. package/dest/tagging/tag.js +0 -17
  358. package/dest/tagging/utils.d.ts +0 -18
  359. package/dest/tagging/utils.d.ts.map +0 -1
  360. package/dest/tagging/utils.js +0 -24
  361. package/src/contract_function_simulator/execution_data_provider.ts +0 -342
  362. package/src/contract_function_simulator/proxied_node.ts +0 -33
  363. package/src/contract_function_simulator/pxe_oracle_interface.ts +0 -1023
  364. package/src/private_kernel/private_kernel_oracle_impl.ts +0 -132
  365. package/src/storage/address_data_provider/index.ts +0 -1
  366. package/src/storage/capsule_data_provider/capsule_data_provider.ts +0 -147
  367. package/src/storage/capsule_data_provider/index.ts +0 -1
  368. package/src/storage/contract_data_provider/index.ts +0 -1
  369. package/src/storage/note_data_provider/index.ts +0 -2
  370. package/src/storage/note_data_provider/note_data_provider.ts +0 -403
  371. package/src/storage/private_event_data_provider/private_event_data_provider.ts +0 -143
  372. package/src/storage/sync_data_provider/index.ts +0 -1
  373. package/src/storage/tagging_data_provider/index.ts +0 -1
  374. package/src/storage/tagging_data_provider/tagging_data_provider.ts +0 -120
  375. package/src/synchronizer/index.ts +0 -1
  376. package/src/synchronizer/synchronizer.ts +0 -121
  377. package/src/tagging/siloed_tag.ts +0 -22
  378. package/src/tagging/tag.ts +0 -16
  379. package/src/tagging/utils.ts +0 -31
@@ -3,7 +3,7 @@ import type { AztecAsyncArray, AztecAsyncKVStore, AztecAsyncMap } from '@aztec/k
3
3
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
4
4
  import { CompleteAddress } from '@aztec/stdlib/contract';
5
5
 
6
- export class AddressDataProvider {
6
+ export class AddressStore {
7
7
  #store: AztecAsyncKVStore;
8
8
  #completeAddresses: AztecAsyncArray<Buffer>;
9
9
  #completeAddressIndex: AztecAsyncMap<string, number>;
@@ -0,0 +1 @@
1
+ export { AddressStore } from './address_store.js';
@@ -1,8 +1,7 @@
1
- import type { BlockNumber } from '@aztec/foundation/branded-types';
2
1
  import type { AztecAsyncKVStore, AztecAsyncSingleton } from '@aztec/kv-store';
3
2
  import { BlockHeader } from '@aztec/stdlib/tx';
4
3
 
5
- export class SyncDataProvider {
4
+ export class AnchorBlockStore {
6
5
  #store: AztecAsyncKVStore;
7
6
  #synchronizedHeader: AztecAsyncSingleton<Buffer>;
8
7
 
@@ -15,19 +14,10 @@ export class SyncDataProvider {
15
14
  await this.#synchronizedHeader.set(header.toBuffer());
16
15
  }
17
16
 
18
- async getBlockNumber(): Promise<BlockNumber> {
19
- const headerBuffer = await this.#synchronizedHeader.getAsync();
20
- if (!headerBuffer) {
21
- throw new Error(`Trying to get block number with a not-yet-synchronized PXE - this should never happen`);
22
- }
23
-
24
- return BlockHeader.fromBuffer(headerBuffer).globalVariables.blockNumber;
25
- }
26
-
27
17
  async getBlockHeader(): Promise<BlockHeader> {
28
18
  const headerBuffer = await this.#synchronizedHeader.getAsync();
29
19
  if (!headerBuffer) {
30
- throw new Error(`Header not set`);
20
+ throw new Error(`Trying to get block header with a not-yet-synchronized PXE - this should never happen`);
31
21
  }
32
22
 
33
23
  return BlockHeader.fromBuffer(headerBuffer);
@@ -0,0 +1 @@
1
+ export { AnchorBlockStore } from './anchor_block_store.js';
@@ -0,0 +1,315 @@
1
+ import { Fr } from '@aztec/foundation/curves/bn254';
2
+ import { type Logger, createLogger } from '@aztec/foundation/log';
3
+ import type { AztecAsyncKVStore, AztecAsyncMap } from '@aztec/kv-store';
4
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
5
+
6
+ import type { StagedStore } from '../../job_coordinator/job_coordinator.js';
7
+
8
+ export class CapsuleStore implements StagedStore {
9
+ readonly storeName = 'capsule';
10
+
11
+ #store: AztecAsyncKVStore;
12
+
13
+ // Arbitrary data stored by contracts. Key is computed as `${contractAddress}:${key}`
14
+ #capsules: AztecAsyncMap<string, Buffer>;
15
+
16
+ // jobId => `${contractAddress}:${key}` => capsule data
17
+ // when `#stagedCapsules.get('some-job-id').get('${some-contract-address:some-key') === null`,
18
+ // it signals that the capsule was deleted during the job, so it needs to be deleted on commit
19
+ #stagedCapsules: Map<string, Map<string, Buffer | null>>;
20
+
21
+ logger: Logger;
22
+
23
+ constructor(store: AztecAsyncKVStore) {
24
+ this.#store = store;
25
+
26
+ this.#capsules = this.#store.openMap('capsules');
27
+
28
+ this.#stagedCapsules = new Map();
29
+
30
+ this.logger = createLogger('pxe:capsule-data-provider');
31
+ }
32
+
33
+ /**
34
+ * Given a job denoted by `jobId`, it returns the
35
+ * capsules that said job has interacted with.
36
+ *
37
+ * Capsules that haven't been committed to persistence KV storage
38
+ * are kept in-memory in `#stagedCapsules`, this method provides a convenient
39
+ * way to access that in-memory collection of data.
40
+ *
41
+ * @param jobId
42
+ * @returns
43
+ */
44
+ #getJobStagedCapsules(jobId: string): Map<string, Buffer | null> {
45
+ let jobStagedCapsules = this.#stagedCapsules.get(jobId);
46
+ if (!jobStagedCapsules) {
47
+ jobStagedCapsules = new Map();
48
+ this.#stagedCapsules.set(jobId, jobStagedCapsules);
49
+ }
50
+ return jobStagedCapsules;
51
+ }
52
+
53
+ /**
54
+ * Reads a capsule's slot from the staged version of the data associated to the given jobId.
55
+ *
56
+ * If it is not there, it reads it from the KV store.
57
+ */
58
+ async #getFromStage(jobId: string, dbSlotKey: string): Promise<Buffer | null | undefined> {
59
+ const jobStagedCapsules = this.#getJobStagedCapsules(jobId);
60
+ let staged: Buffer | null | undefined = jobStagedCapsules.get(dbSlotKey);
61
+ // Note that if staged === null, we marked it for deletion, so we don't want to
62
+ // re-read it from DB
63
+ if (staged === undefined) {
64
+ // If we don't have a staged version of this dbSlotKey, first we check if there's one in DB
65
+ staged = await this.#loadCapsuleFromDb(dbSlotKey);
66
+ }
67
+ return staged;
68
+ }
69
+
70
+ /**
71
+ * Writes a capsule to the stage of a job.
72
+ */
73
+ #setOnStage(jobId: string, dbSlotKey: string, capsuleData: Buffer) {
74
+ this.#getJobStagedCapsules(jobId).set(dbSlotKey, capsuleData);
75
+ }
76
+
77
+ /**
78
+ * Deletes a capsule on the stage of a job. Note the capsule will still
79
+ * exist in storage until the job is committed.
80
+ */
81
+ #deleteOnStage(jobId: string, dbSlotKey: string) {
82
+ this.#getJobStagedCapsules(jobId).set(dbSlotKey, null);
83
+ }
84
+
85
+ async #loadCapsuleFromDb(dbSlotKey: string): Promise<Buffer | null> {
86
+ const dataBuffer = await this.#capsules.getAsync(dbSlotKey);
87
+ if (!dataBuffer) {
88
+ return null;
89
+ }
90
+
91
+ return dataBuffer;
92
+ }
93
+
94
+ /**
95
+ * Commits staged data to main storage.
96
+ * Called by JobCoordinator when a job completes successfully.
97
+ * Note: JobCoordinator wraps all commits in a single transaction, so we don't
98
+ * need our own transactionAsync here (and using one would deadlock on IndexedDB).
99
+ * @param jobId - The jobId identifying which staged data to commit
100
+ */
101
+ async commit(jobId: string): Promise<void> {
102
+ const jobStagedCapsules = this.#getJobStagedCapsules(jobId);
103
+
104
+ for (const [key, value] of jobStagedCapsules) {
105
+ // In the write stage, we represent deleted capsules with null
106
+ // (as opposed to undefined, which denotes there was never a capsule there to begin with).
107
+ // So we delete from actual KV store here.
108
+ if (value === null) {
109
+ await this.#capsules.delete(key);
110
+ } else {
111
+ await this.#capsules.set(key, value);
112
+ }
113
+ }
114
+
115
+ this.#stagedCapsules.delete(jobId);
116
+ }
117
+
118
+ /**
119
+ * Discards staged data without committing.
120
+ */
121
+ discardStaged(jobId: string): Promise<void> {
122
+ this.#stagedCapsules.delete(jobId);
123
+ return Promise.resolve();
124
+ }
125
+
126
+ /**
127
+ * Stores arbitrary information in a per-contract non-volatile database, which can later be retrieved with `loadCapsule`.
128
+ * * If data was already stored at this slot, it is overwritten.
129
+ * @param contractAddress - The contract address to scope the data under.
130
+ * @param slot - The slot in the database in which to store the value. Slots need not be contiguous.
131
+ * @param capsule - An array of field elements representing the capsule.
132
+ * @param jobId - The context in which this store will be visible until PXE decides to persist it to underlying KV store
133
+ * @remarks A capsule is a "blob" of data that is passed to the contract through an oracle. It works similarly
134
+ * to public contract storage in that it's indexed by the contract address and storage slot but instead of the global
135
+ * network state it's backed by local PXE db.
136
+ */
137
+ storeCapsule(contractAddress: AztecAddress, slot: Fr, capsule: Fr[], jobId: string) {
138
+ const dbSlotKey = dbSlotToKey(contractAddress, slot);
139
+
140
+ // A store overrides any pre-existing data on the slot
141
+ this.#setOnStage(jobId, dbSlotKey, Buffer.concat(capsule.map(value => value.toBuffer())));
142
+ }
143
+
144
+ /**
145
+ * Returns data previously stored via `storeCapsule` in the per-contract non-volatile database.
146
+ * @param contractAddress - The contract address under which the data is scoped.
147
+ * @param slot - The slot in the database to read.
148
+ * @returns The stored data or `null` if no data is stored under the slot.
149
+ */
150
+ async loadCapsule(contractAddress: AztecAddress, slot: Fr, jobId: string): Promise<Fr[] | null> {
151
+ const dataBuffer = await this.#getFromStage(jobId, dbSlotToKey(contractAddress, slot));
152
+ if (!dataBuffer) {
153
+ this.logger.trace(`Data not found for contract ${contractAddress.toString()} and slot ${slot.toString()}`);
154
+ return null;
155
+ }
156
+ const capsule: Fr[] = [];
157
+ for (let i = 0; i < dataBuffer.length; i += Fr.SIZE_IN_BYTES) {
158
+ capsule.push(Fr.fromBuffer(dataBuffer.subarray(i, i + Fr.SIZE_IN_BYTES)));
159
+ }
160
+ return capsule;
161
+ }
162
+
163
+ /**
164
+ * Deletes data in the per-contract non-volatile database. Does nothing if no data was present.
165
+ * @param contractAddress - The contract address under which the data is scoped.
166
+ * @param slot - The slot in the database to delete.
167
+ */
168
+ deleteCapsule(contractAddress: AztecAddress, slot: Fr, jobId: string) {
169
+ // When we commit this, we will interpret null as a deletion, so we'll propagate the delete to the KV store
170
+ this.#deleteOnStage(jobId, dbSlotToKey(contractAddress, slot));
171
+ }
172
+
173
+ /**
174
+ * Copies a number of contiguous entries in the per-contract non-volatile database. This allows for efficient data
175
+ * structures by avoiding repeated calls to `loadCapsule` and `storeCapsule`.
176
+ * Supports overlapping source and destination regions (which will result in the overlapped source values being
177
+ * overwritten). All copied slots must exist in the database (i.e. have been stored and not deleted)
178
+ *
179
+ * @param contractAddress - The contract address under which the data is scoped.
180
+ * @param srcSlot - The first slot to copy from.
181
+ * @param dstSlot - The first slot to copy to.
182
+ * @param numEntries - The number of entries to copy.
183
+ */
184
+ copyCapsule(
185
+ contractAddress: AztecAddress,
186
+ srcSlot: Fr,
187
+ dstSlot: Fr,
188
+ numEntries: number,
189
+ jobId: string,
190
+ ): Promise<void> {
191
+ // This transactional context gives us "copy atomicity":
192
+ // there shouldn't be concurrent writes to what's being copied here.
193
+ // Equally important: this in practice is expected to perform thousands of DB operations
194
+ // and not using a transaction here would heavily impact performance.
195
+ return this.#store.transactionAsync(async () => {
196
+ // In order to support overlapping source and destination regions, we need to check the relative positions of source
197
+ // and destination. If destination is ahead of source, then by the time we overwrite source elements using forward
198
+ // indexes we'll have already read those. On the contrary, if source is ahead of destination we need to use backward
199
+ // indexes to avoid reading elements that've been overwritten.
200
+ const indexes = Array.from(Array(numEntries).keys());
201
+ if (srcSlot.lt(dstSlot)) {
202
+ indexes.reverse();
203
+ }
204
+
205
+ for (const i of indexes) {
206
+ const currentSrcSlot = dbSlotToKey(contractAddress, srcSlot.add(new Fr(i)));
207
+ const currentDstSlot = dbSlotToKey(contractAddress, dstSlot.add(new Fr(i)));
208
+
209
+ const toCopy = await this.#getFromStage(jobId, currentSrcSlot);
210
+ if (!toCopy) {
211
+ throw new Error(`Attempted to copy empty slot ${currentSrcSlot} for contract ${contractAddress.toString()}`);
212
+ }
213
+
214
+ this.#setOnStage(jobId, currentDstSlot, toCopy);
215
+ }
216
+ });
217
+ }
218
+
219
+ /**
220
+ * Appends multiple capsules to a capsule array stored at the base slot.
221
+ * The array length is stored at the base slot, and elements are stored in consecutive slots after it.
222
+ * All operations are performed in a single transaction.
223
+ * @param contractAddress - The contract address that owns the capsule array
224
+ * @param baseSlot - The slot where the array length is stored
225
+ * @param content - Array of capsule data to append
226
+ */
227
+ appendToCapsuleArray(contractAddress: AztecAddress, baseSlot: Fr, content: Fr[][], jobId: string): Promise<void> {
228
+ // We wrap this in a transaction to serialize concurrent calls from Promise.all.
229
+ // Without this, concurrent appends to the same array could race: both read length=0,
230
+ // both write at the same slots, one overwrites the other.
231
+ // Equally important: this in practice is expected to perform thousands of DB operations
232
+ // and not using a transaction here would heavily impact performance.
233
+ return this.#store.transactionAsync(async () => {
234
+ // Load current length, defaulting to 0 if not found
235
+ const lengthData = await this.loadCapsule(contractAddress, baseSlot, jobId);
236
+ const currentLength = lengthData ? lengthData[0].toNumber() : 0;
237
+
238
+ // Store each capsule at consecutive slots after baseSlot + 1 + currentLength
239
+ for (let i = 0; i < content.length; i++) {
240
+ const nextSlot = arraySlot(baseSlot, currentLength + i);
241
+ this.storeCapsule(contractAddress, nextSlot, content[i], jobId);
242
+ }
243
+
244
+ // Update length to include all new capsules
245
+ const newLength = currentLength + content.length;
246
+ this.storeCapsule(contractAddress, baseSlot, [new Fr(newLength)], jobId);
247
+ });
248
+ }
249
+
250
+ readCapsuleArray(contractAddress: AztecAddress, baseSlot: Fr, jobId: string): Promise<Fr[][]> {
251
+ // I'm leaving this transactional context here though because I'm assuming this
252
+ // gives us "read array atomicity": there shouldn't be concurrent writes to what's being copied
253
+ // here.
254
+ // This is one point we should revisit in the future if we want to relax the concurrency
255
+ // of jobs: different calls running concurrently on the same contract may cause trouble.
256
+ return this.#store.transactionAsync(async () => {
257
+ // Load length, defaulting to 0 if not found
258
+ const maybeLength = await this.loadCapsule(contractAddress, baseSlot, jobId);
259
+ const length = maybeLength ? maybeLength[0].toBigInt() : 0n;
260
+
261
+ const values: Fr[][] = [];
262
+
263
+ // Read each capsule at consecutive slots after baseSlot
264
+ for (let i = 0; i < length; i++) {
265
+ const currentValue = await this.loadCapsule(contractAddress, arraySlot(baseSlot, i), jobId);
266
+ if (currentValue == undefined) {
267
+ throw new Error(
268
+ `Expected non-empty value at capsule array in base slot ${baseSlot} at index ${i} for contract ${contractAddress}`,
269
+ );
270
+ }
271
+
272
+ values.push(currentValue);
273
+ }
274
+
275
+ return values;
276
+ });
277
+ }
278
+
279
+ setCapsuleArray(contractAddress: AztecAddress, baseSlot: Fr, content: Fr[][], jobId: string) {
280
+ // This transactional context in theory isn't so critical now because we aren't
281
+ // writing to DB so if there's exceptions midway and it blows up, no visible impact
282
+ // to persistent storage will happen.
283
+ // I'm leaving this transactional context here though because I'm assuming this
284
+ // gives us "write array atomicity": there shouldn't be concurrent writes to what's being copied
285
+ // here.
286
+ // This is one point we should revisit in the future if we want to relax the concurrency
287
+ // of jobs: different calls running concurrently on the same contract may cause trouble.
288
+ return this.#store.transactionAsync(async () => {
289
+ // Load current length, defaulting to 0 if not found
290
+ const maybeLength = await this.loadCapsule(contractAddress, baseSlot, jobId);
291
+ const originalLength = maybeLength ? maybeLength[0].toNumber() : 0;
292
+
293
+ // Set the new length
294
+ this.storeCapsule(contractAddress, baseSlot, [new Fr(content.length)], jobId);
295
+
296
+ // Store the new content, possibly overwriting existing values
297
+ for (let i = 0; i < content.length; i++) {
298
+ this.storeCapsule(contractAddress, arraySlot(baseSlot, i), content[i], jobId);
299
+ }
300
+
301
+ // Clear any stragglers
302
+ for (let i = content.length; i < originalLength; i++) {
303
+ this.deleteCapsule(contractAddress, arraySlot(baseSlot, i), jobId);
304
+ }
305
+ });
306
+ }
307
+ }
308
+
309
+ function dbSlotToKey(contractAddress: AztecAddress, slot: Fr): string {
310
+ return `${contractAddress.toString()}:${slot.toString()}`;
311
+ }
312
+
313
+ function arraySlot(baseSlot: Fr, index: number) {
314
+ return baseSlot.add(new Fr(1)).add(new Fr(index));
315
+ }
@@ -0,0 +1 @@
1
+ export { CapsuleStore } from './capsule_store.js';
@@ -1,5 +1,5 @@
1
1
  import type { FUNCTION_TREE_HEIGHT } from '@aztec/constants';
2
- import type { Fr } from '@aztec/foundation/fields';
2
+ import type { Fr } from '@aztec/foundation/curves/bn254';
3
3
  import { toArray } from '@aztec/foundation/iterable';
4
4
  import type { MembershipWitness } from '@aztec/foundation/trees';
5
5
  import type { AztecAsyncKVStore, AztecAsyncMap } from '@aztec/kv-store';
@@ -8,11 +8,13 @@ import {
8
8
  type FunctionAbi,
9
9
  type FunctionArtifact,
10
10
  type FunctionArtifactWithContractName,
11
+ FunctionCall,
11
12
  type FunctionDebugMetadata,
12
13
  FunctionSelector,
13
14
  FunctionType,
14
15
  contractArtifactFromBuffer,
15
16
  contractArtifactToBuffer,
17
+ encodeArguments,
16
18
  getFunctionDebugMetadata,
17
19
  } from '@aztec/stdlib/abi';
18
20
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
@@ -26,13 +28,13 @@ import {
26
28
  import { PrivateFunctionsTree } from './private_functions_tree.js';
27
29
 
28
30
  /**
29
- * ContractDataProvider serves as a data manager and retriever for Aztec.nr contracts.
31
+ * ContractStore serves as a data manager and retriever for Aztec.nr contracts.
30
32
  * It provides methods to obtain contract addresses, function ABI, bytecode, and membership witnesses
31
33
  * from a given contract address and function selector. The class maintains a cache of ContractTree instances
32
34
  * to efficiently serve the requested data. It interacts with the ContractDatabase and AztecNode to fetch
33
35
  * the required information and facilitate cryptographic proof generation.
34
36
  */
35
- export class ContractDataProvider {
37
+ export class ContractStore {
36
38
  /** Map from contract class id to private function tree. */
37
39
  // TODO: Update it to be LRU cache so that it doesn't keep all the data all the time.
38
40
  #privateFunctionTrees: Map<string, PrivateFunctionsTree> = new Map();
@@ -176,6 +178,21 @@ export class ContractDataProvider {
176
178
  return fnArtifact && { ...fnArtifact, contractName: artifact.name };
177
179
  }
178
180
 
181
+ public async getFunctionArtifactWithDebugMetadata(
182
+ contractAddress: AztecAddress,
183
+ selector: FunctionSelector,
184
+ ): Promise<FunctionArtifactWithContractName> {
185
+ const artifact = await this.getFunctionArtifact(contractAddress, selector);
186
+ if (!artifact) {
187
+ throw new Error(`Function artifact not found for contract ${contractAddress} and selector ${selector}.`);
188
+ }
189
+ const debug = await this.getFunctionDebugMetadata(contractAddress, selector);
190
+ return {
191
+ ...artifact,
192
+ debug,
193
+ };
194
+ }
195
+
179
196
  public async getPublicFunctionArtifact(
180
197
  contractAddress: AztecAddress,
181
198
  ): Promise<FunctionArtifactWithContractName | undefined> {
@@ -274,4 +291,29 @@ export class ContractDataProvider {
274
291
  }
275
292
  }
276
293
  }
294
+
295
+ public async getFunctionCall(functionName: string, args: any[], to: AztecAddress): Promise<FunctionCall> {
296
+ const contract = await this.getContract(to);
297
+ if (!contract) {
298
+ throw new Error(
299
+ `Unknown contract ${to}: add it to PXE by calling server.addContracts(...).\nSee docs for context: https://docs.aztec.network/developers/resources/debugging/aztecnr-errors#unknown-contract-0x0-add-it-to-pxe-by-calling-serveraddcontracts`,
300
+ );
301
+ }
302
+
303
+ const functionDao = contract.functions.find(f => f.name === functionName);
304
+ if (!functionDao) {
305
+ throw new Error(`Unknown function ${functionName} in contract ${contract.name}.`);
306
+ }
307
+
308
+ return {
309
+ name: functionDao.name,
310
+ args: encodeArguments(functionDao, args),
311
+ selector: await FunctionSelector.fromNameAndParameters(functionDao.name, functionDao.parameters),
312
+ type: functionDao.functionType,
313
+ to,
314
+ hideMsgSender: false,
315
+ isStatic: functionDao.isStatic,
316
+ returnTypes: functionDao.returnTypes,
317
+ };
318
+ }
277
319
  }
@@ -0,0 +1 @@
1
+ export { ContractStore } from './contract_store.js';
@@ -1,5 +1,5 @@
1
1
  import { FUNCTION_TREE_HEIGHT } from '@aztec/constants';
2
- import { Fr } from '@aztec/foundation/fields';
2
+ import { Fr } from '@aztec/foundation/curves/bn254';
3
3
  import { assertLength } from '@aztec/foundation/serialize';
4
4
  import { MembershipWitness, type MerkleTree } from '@aztec/foundation/trees';
5
5
  import { type ContractArtifact, FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
@@ -1,8 +1,8 @@
1
- export * from './address_data_provider/index.js';
2
- export * from './capsule_data_provider/index.js';
3
- export * from './contract_data_provider/index.js';
4
- export * from './note_data_provider/index.js';
5
- export * from './sync_data_provider/index.js';
6
- export * from './tagging_data_provider/index.js';
1
+ export * from './address_store/index.js';
2
+ export * from './capsule_store/index.js';
3
+ export * from './contract_store/index.js';
4
+ export * from './note_store/index.js';
5
+ export * from './anchor_block_store/index.js';
6
+ export * from './tagging_store/index.js';
7
7
  export * from './metadata.js';
8
- export * from './private_event_data_provider/private_event_data_provider.js';
8
+ export * from './private_event_store/private_event_store.js';
@@ -0,0 +1,2 @@
1
+ export { NoteDao } from '@aztec/stdlib/note';
2
+ export { NoteStore } from './note_store.js';