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

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 (359) hide show
  1. package/dest/bin/check_oracle_version.js +105 -15
  2. package/dest/block_synchronizer/block_synchronizer.d.ts +41 -0
  3. package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -0
  4. package/dest/{synchronizer/synchronizer.js → block_synchronizer/block_synchronizer.js} +35 -30
  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 +4 -4
  9. package/dest/config/index.d.ts.map +1 -1
  10. package/dest/config/package_info.js +1 -1
  11. package/dest/contract_function_simulator/benchmarked_node.d.ts +9 -0
  12. package/dest/contract_function_simulator/benchmarked_node.d.ts.map +1 -0
  13. package/dest/contract_function_simulator/benchmarked_node.js +77 -0
  14. package/dest/contract_function_simulator/contract_function_simulator.d.ts +42 -14
  15. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  16. package/dest/contract_function_simulator/contract_function_simulator.js +73 -29
  17. package/dest/contract_function_simulator/execution_note_cache.d.ts +21 -12
  18. package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
  19. package/dest/contract_function_simulator/execution_note_cache.js +48 -31
  20. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +1 -1
  21. package/dest/contract_function_simulator/execution_tagging_index_cache.js +1 -1
  22. package/dest/contract_function_simulator/hashed_values_cache.d.ts +2 -2
  23. package/dest/contract_function_simulator/hashed_values_cache.d.ts.map +1 -1
  24. package/dest/contract_function_simulator/index.d.ts +2 -2
  25. package/dest/contract_function_simulator/index.d.ts.map +1 -1
  26. package/dest/contract_function_simulator/index.js +1 -1
  27. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +4 -3
  28. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
  29. package/dest/contract_function_simulator/noir-structs/event_validation_request.js +5 -2
  30. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +5 -4
  31. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts.map +1 -1
  32. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.js +7 -6
  33. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +2 -2
  34. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
  35. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +1 -1
  36. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +2 -2
  37. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
  38. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +4 -10
  39. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -1
  40. package/dest/contract_function_simulator/noir-structs/utility_context.js +7 -18
  41. package/dest/contract_function_simulator/oracle/interfaces.d.ts +14 -13
  42. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
  43. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +4 -2
  44. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
  45. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.js +1 -1
  46. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +11 -7
  47. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
  48. package/dest/contract_function_simulator/oracle/note_packing_utils.js +14 -10
  49. package/dest/contract_function_simulator/oracle/oracle.d.ts +7 -7
  50. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
  51. package/dest/contract_function_simulator/oracle/oracle.js +40 -28
  52. package/dest/contract_function_simulator/oracle/private_execution.d.ts +10 -16
  53. package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
  54. package/dest/contract_function_simulator/oracle/private_execution.js +19 -18
  55. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +25 -25
  56. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  57. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +29 -44
  58. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +63 -21
  59. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  60. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +162 -54
  61. package/dest/contract_function_simulator/pick_notes.d.ts +2 -2
  62. package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -1
  63. package/dest/contract_function_simulator/pick_notes.js +1 -1
  64. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +4 -4
  65. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -1
  66. package/dest/contract_function_simulator/proxied_contract_data_source.js +23 -5
  67. package/dest/debug/pxe_debug_utils.d.ts +31 -0
  68. package/dest/debug/pxe_debug_utils.d.ts.map +1 -0
  69. package/dest/debug/pxe_debug_utils.js +37 -0
  70. package/dest/entrypoints/client/bundle/index.d.ts +1 -2
  71. package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
  72. package/dest/entrypoints/client/bundle/index.js +0 -1
  73. package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
  74. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  75. package/dest/entrypoints/client/bundle/utils.js +12 -3
  76. package/dest/entrypoints/client/lazy/index.d.ts +1 -2
  77. package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
  78. package/dest/entrypoints/client/lazy/index.js +0 -1
  79. package/dest/entrypoints/client/lazy/utils.d.ts +1 -1
  80. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  81. package/dest/entrypoints/client/lazy/utils.js +12 -3
  82. package/dest/entrypoints/pxe_creation_options.d.ts +5 -2
  83. package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
  84. package/dest/entrypoints/server/index.d.ts +3 -2
  85. package/dest/entrypoints/server/index.d.ts.map +1 -1
  86. package/dest/entrypoints/server/index.js +2 -1
  87. package/dest/entrypoints/server/utils.d.ts +1 -1
  88. package/dest/entrypoints/server/utils.d.ts.map +1 -1
  89. package/dest/entrypoints/server/utils.js +12 -8
  90. package/dest/error_enriching.d.ts +4 -4
  91. package/dest/error_enriching.d.ts.map +1 -1
  92. package/dest/error_enriching.js +6 -6
  93. package/dest/events/event_service.d.ts +16 -0
  94. package/dest/events/event_service.d.ts.map +1 -0
  95. package/dest/events/event_service.js +45 -0
  96. package/dest/events/index.d.ts +2 -0
  97. package/dest/events/index.d.ts.map +1 -0
  98. package/dest/events/index.js +1 -0
  99. package/dest/events/private_event_filter_validator.d.ts +9 -0
  100. package/dest/events/private_event_filter_validator.d.ts.map +1 -0
  101. package/dest/events/private_event_filter_validator.js +38 -0
  102. package/dest/job_coordinator/job_coordinator.d.ts +74 -0
  103. package/dest/job_coordinator/job_coordinator.d.ts.map +1 -0
  104. package/dest/job_coordinator/job_coordinator.js +93 -0
  105. package/dest/logs/log_service.d.ts +27 -0
  106. package/dest/logs/log_service.d.ts.map +1 -0
  107. package/dest/logs/log_service.js +122 -0
  108. package/dest/notes/index.d.ts +2 -0
  109. package/dest/notes/index.d.ts.map +1 -0
  110. package/dest/notes/index.js +1 -0
  111. package/dest/notes/note_service.d.ts +48 -0
  112. package/dest/notes/note_service.d.ts.map +1 -0
  113. package/dest/notes/note_service.js +147 -0
  114. package/dest/oracle_version.d.ts +2 -2
  115. package/dest/oracle_version.js +2 -2
  116. package/dest/private_kernel/hints/index.d.ts +2 -2
  117. package/dest/private_kernel/hints/index.d.ts.map +1 -1
  118. package/dest/private_kernel/hints/index.js +1 -1
  119. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +28 -0
  120. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -0
  121. package/dest/private_kernel/hints/{build_private_kernel_reset_private_inputs.js → private_kernel_reset_private_inputs_builder.js} +13 -7
  122. package/dest/private_kernel/private_kernel_execution_prover.d.ts +1 -1
  123. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
  124. package/dest/private_kernel/private_kernel_execution_prover.js +8 -9
  125. package/dest/private_kernel/private_kernel_oracle.d.ts +26 -29
  126. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
  127. package/dest/private_kernel/private_kernel_oracle.js +90 -2
  128. package/dest/pxe.d.ts +45 -81
  129. package/dest/pxe.d.ts.map +1 -1
  130. package/dest/pxe.js +182 -215
  131. package/dest/storage/address_store/address_store.d.ts +11 -0
  132. package/dest/storage/address_store/address_store.d.ts.map +1 -0
  133. package/dest/storage/{address_data_provider/address_data_provider.js → address_store/address_store.js} +1 -1
  134. package/dest/storage/address_store/index.d.ts +2 -0
  135. package/dest/storage/address_store/index.d.ts.map +1 -0
  136. package/dest/storage/address_store/index.js +1 -0
  137. package/dest/storage/{sync_data_provider/sync_data_provider.d.ts → anchor_block_store/anchor_block_store.d.ts} +2 -4
  138. package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -0
  139. package/dest/storage/{sync_data_provider/sync_data_provider.js → anchor_block_store/anchor_block_store.js} +2 -9
  140. package/dest/storage/{sync_data_provider → anchor_block_store}/index.d.ts +2 -2
  141. package/dest/storage/anchor_block_store/index.d.ts.map +1 -0
  142. package/dest/storage/anchor_block_store/index.js +1 -0
  143. package/dest/storage/capsule_store/capsule_store.d.ts +72 -0
  144. package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -0
  145. package/dest/storage/capsule_store/capsule_store.js +255 -0
  146. package/dest/storage/capsule_store/index.d.ts +2 -0
  147. package/dest/storage/capsule_store/index.d.ts.map +1 -0
  148. package/dest/storage/capsule_store/index.js +1 -0
  149. package/dest/storage/{contract_data_provider/contract_data_provider.d.ts → contract_store/contract_store.d.ts} +8 -5
  150. package/dest/storage/contract_store/contract_store.d.ts.map +1 -0
  151. package/dest/storage/{contract_data_provider/contract_data_provider.js → contract_store/contract_store.js} +46 -3
  152. package/dest/storage/contract_store/index.d.ts +2 -0
  153. package/dest/storage/contract_store/index.d.ts.map +1 -0
  154. package/dest/storage/contract_store/index.js +1 -0
  155. package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.d.ts +1 -1
  156. package/dest/storage/contract_store/private_functions_tree.d.ts.map +1 -0
  157. package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.js +1 -1
  158. package/dest/storage/index.d.ts +8 -8
  159. package/dest/storage/index.d.ts.map +1 -1
  160. package/dest/storage/index.js +7 -7
  161. package/dest/storage/note_store/index.d.ts +3 -0
  162. package/dest/storage/note_store/index.d.ts.map +1 -0
  163. package/dest/storage/note_store/index.js +2 -0
  164. package/dest/storage/{note_data_provider/note_data_provider.d.ts → note_store/note_store.d.ts} +15 -13
  165. package/dest/storage/note_store/note_store.d.ts.map +1 -0
  166. package/dest/storage/{note_data_provider/note_data_provider.js → note_store/note_store.js} +105 -102
  167. package/dest/storage/private_event_store/private_event_store.d.ts +78 -0
  168. package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -0
  169. package/dest/storage/private_event_store/private_event_store.js +222 -0
  170. package/dest/storage/tagging_store/index.d.ts +4 -0
  171. package/dest/storage/tagging_store/index.d.ts.map +1 -0
  172. package/dest/storage/tagging_store/index.js +3 -0
  173. package/dest/storage/tagging_store/recipient_tagging_store.d.ts +28 -0
  174. package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -0
  175. package/dest/storage/tagging_store/recipient_tagging_store.js +99 -0
  176. package/dest/storage/tagging_store/sender_address_book_store.d.ts +14 -0
  177. package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +1 -0
  178. package/dest/storage/tagging_store/sender_address_book_store.js +30 -0
  179. package/dest/storage/tagging_store/sender_tagging_store.d.ts +77 -0
  180. package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -0
  181. package/dest/storage/tagging_store/sender_tagging_store.js +278 -0
  182. package/dest/tagging/constants.d.ts +2 -2
  183. package/dest/tagging/constants.d.ts.map +1 -1
  184. package/dest/tagging/constants.js +10 -2
  185. package/dest/tagging/index.d.ts +15 -6
  186. package/dest/tagging/index.d.ts.map +1 -1
  187. package/dest/tagging/index.js +14 -5
  188. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +14 -0
  189. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -0
  190. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +99 -0
  191. package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts +12 -0
  192. package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts.map +1 -0
  193. package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +20 -0
  194. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +14 -0
  195. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -0
  196. package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +29 -0
  197. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +20 -0
  198. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -0
  199. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +74 -0
  200. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +11 -0
  201. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -0
  202. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +32 -0
  203. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +20 -0
  204. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -0
  205. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +57 -0
  206. package/dest/tree_membership/tree_membership_service.d.ts +50 -0
  207. package/dest/tree_membership/tree_membership_service.d.ts.map +1 -0
  208. package/dest/tree_membership/tree_membership_service.js +75 -0
  209. package/package.json +18 -18
  210. package/src/bin/check_oracle_version.ts +130 -20
  211. package/src/{synchronizer/synchronizer.ts → block_synchronizer/block_synchronizer.ts} +44 -30
  212. package/src/block_synchronizer/index.ts +1 -0
  213. package/src/config/index.ts +3 -3
  214. package/src/config/package_info.ts +1 -1
  215. package/src/contract_function_simulator/benchmarked_node.ts +103 -0
  216. package/src/contract_function_simulator/contract_function_simulator.ts +118 -30
  217. package/src/contract_function_simulator/execution_note_cache.ts +51 -29
  218. package/src/contract_function_simulator/execution_tagging_index_cache.ts +1 -1
  219. package/src/contract_function_simulator/hashed_values_cache.ts +1 -1
  220. package/src/contract_function_simulator/index.ts +1 -1
  221. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +5 -1
  222. package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +6 -5
  223. package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +1 -1
  224. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +1 -1
  225. package/src/contract_function_simulator/noir-structs/utility_context.ts +6 -25
  226. package/src/contract_function_simulator/oracle/interfaces.ts +13 -12
  227. package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +1 -1
  228. package/src/contract_function_simulator/oracle/note_packing_utils.ts +27 -13
  229. package/src/contract_function_simulator/oracle/oracle.ts +48 -32
  230. package/src/contract_function_simulator/oracle/private_execution.ts +22 -30
  231. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +97 -58
  232. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +233 -63
  233. package/src/contract_function_simulator/pick_notes.ts +1 -1
  234. package/src/contract_function_simulator/proxied_contract_data_source.ts +24 -7
  235. package/src/debug/pxe_debug_utils.ts +48 -0
  236. package/src/entrypoints/client/bundle/index.ts +0 -1
  237. package/src/entrypoints/client/bundle/utils.ts +9 -3
  238. package/src/entrypoints/client/lazy/index.ts +0 -1
  239. package/src/entrypoints/client/lazy/utils.ts +9 -4
  240. package/src/entrypoints/pxe_creation_options.ts +4 -1
  241. package/src/entrypoints/server/index.ts +2 -1
  242. package/src/entrypoints/server/utils.ts +12 -16
  243. package/src/error_enriching.ts +7 -15
  244. package/src/events/event_service.ts +73 -0
  245. package/src/events/index.ts +1 -0
  246. package/src/events/private_event_filter_validator.ts +46 -0
  247. package/src/job_coordinator/job_coordinator.ts +149 -0
  248. package/src/logs/log_service.ts +204 -0
  249. package/src/notes/index.ts +1 -0
  250. package/src/notes/note_service.ts +194 -0
  251. package/src/oracle_version.ts +2 -2
  252. package/src/private_kernel/hints/index.ts +1 -1
  253. package/src/private_kernel/hints/{build_private_kernel_reset_private_inputs.ts → private_kernel_reset_private_inputs_builder.ts} +34 -23
  254. package/src/private_kernel/private_kernel_execution_prover.ts +7 -9
  255. package/src/private_kernel/private_kernel_oracle.ts +118 -37
  256. package/src/pxe.ts +233 -279
  257. package/src/storage/{address_data_provider/address_data_provider.ts → address_store/address_store.ts} +1 -1
  258. package/src/storage/address_store/index.ts +1 -0
  259. package/src/storage/{sync_data_provider/sync_data_provider.ts → anchor_block_store/anchor_block_store.ts} +2 -12
  260. package/src/storage/anchor_block_store/index.ts +1 -0
  261. package/src/storage/capsule_store/capsule_store.ts +315 -0
  262. package/src/storage/capsule_store/index.ts +1 -0
  263. package/src/storage/{contract_data_provider/contract_data_provider.ts → contract_store/contract_store.ts} +65 -3
  264. package/src/storage/contract_store/index.ts +1 -0
  265. package/src/storage/{contract_data_provider → contract_store}/private_functions_tree.ts +1 -1
  266. package/src/storage/index.ts +7 -7
  267. package/src/storage/note_store/index.ts +2 -0
  268. package/src/storage/{note_data_provider/note_data_provider.ts → note_store/note_store.ts} +117 -105
  269. package/src/storage/private_event_store/private_event_store.ts +324 -0
  270. package/src/storage/tagging_store/index.ts +3 -0
  271. package/src/storage/tagging_store/recipient_tagging_store.ts +129 -0
  272. package/src/storage/tagging_store/sender_address_book_store.ts +42 -0
  273. package/src/storage/tagging_store/sender_tagging_store.ts +345 -0
  274. package/src/tagging/constants.ts +10 -2
  275. package/src/tagging/index.ts +17 -5
  276. package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +133 -0
  277. package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +34 -0
  278. package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +43 -0
  279. package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +97 -0
  280. package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +48 -0
  281. package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +75 -0
  282. package/src/tree_membership/tree_membership_service.ts +97 -0
  283. package/dest/contract_function_simulator/execution_data_provider.d.ts +0 -267
  284. package/dest/contract_function_simulator/execution_data_provider.d.ts.map +0 -1
  285. package/dest/contract_function_simulator/execution_data_provider.js +0 -14
  286. package/dest/contract_function_simulator/proxied_node.d.ts +0 -9
  287. package/dest/contract_function_simulator/proxied_node.d.ts.map +0 -1
  288. package/dest/contract_function_simulator/proxied_node.js +0 -27
  289. package/dest/contract_function_simulator/pxe_oracle_interface.d.ts +0 -123
  290. package/dest/contract_function_simulator/pxe_oracle_interface.d.ts.map +0 -1
  291. package/dest/contract_function_simulator/pxe_oracle_interface.js +0 -696
  292. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +0 -28
  293. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +0 -1
  294. package/dest/private_kernel/private_kernel_oracle_impl.d.ts +0 -45
  295. package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +0 -1
  296. package/dest/private_kernel/private_kernel_oracle_impl.js +0 -86
  297. package/dest/storage/address_data_provider/address_data_provider.d.ts +0 -11
  298. package/dest/storage/address_data_provider/address_data_provider.d.ts.map +0 -1
  299. package/dest/storage/address_data_provider/index.d.ts +0 -2
  300. package/dest/storage/address_data_provider/index.d.ts.map +0 -1
  301. package/dest/storage/address_data_provider/index.js +0 -1
  302. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts +0 -25
  303. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +0 -1
  304. package/dest/storage/capsule_data_provider/capsule_data_provider.js +0 -118
  305. package/dest/storage/capsule_data_provider/index.d.ts +0 -2
  306. package/dest/storage/capsule_data_provider/index.d.ts.map +0 -1
  307. package/dest/storage/capsule_data_provider/index.js +0 -1
  308. package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +0 -1
  309. package/dest/storage/contract_data_provider/index.d.ts +0 -2
  310. package/dest/storage/contract_data_provider/index.d.ts.map +0 -1
  311. package/dest/storage/contract_data_provider/index.js +0 -1
  312. package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +0 -1
  313. package/dest/storage/note_data_provider/index.d.ts +0 -3
  314. package/dest/storage/note_data_provider/index.d.ts.map +0 -1
  315. package/dest/storage/note_data_provider/index.js +0 -2
  316. package/dest/storage/note_data_provider/note_data_provider.d.ts.map +0 -1
  317. package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +0 -37
  318. package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts.map +0 -1
  319. package/dest/storage/private_event_data_provider/private_event_data_provider.js +0 -105
  320. package/dest/storage/sync_data_provider/index.d.ts.map +0 -1
  321. package/dest/storage/sync_data_provider/index.js +0 -1
  322. package/dest/storage/sync_data_provider/sync_data_provider.d.ts.map +0 -1
  323. package/dest/storage/tagging_data_provider/index.d.ts +0 -2
  324. package/dest/storage/tagging_data_provider/index.d.ts.map +0 -1
  325. package/dest/storage/tagging_data_provider/index.js +0 -1
  326. package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts +0 -40
  327. package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts.map +0 -1
  328. package/dest/storage/tagging_data_provider/tagging_data_provider.js +0 -89
  329. package/dest/synchronizer/index.d.ts +0 -2
  330. package/dest/synchronizer/index.d.ts.map +0 -1
  331. package/dest/synchronizer/index.js +0 -1
  332. package/dest/synchronizer/synchronizer.d.ts +0 -36
  333. package/dest/synchronizer/synchronizer.d.ts.map +0 -1
  334. package/dest/tagging/siloed_tag.d.ts +0 -14
  335. package/dest/tagging/siloed_tag.d.ts.map +0 -1
  336. package/dest/tagging/siloed_tag.js +0 -20
  337. package/dest/tagging/tag.d.ts +0 -12
  338. package/dest/tagging/tag.d.ts.map +0 -1
  339. package/dest/tagging/tag.js +0 -17
  340. package/dest/tagging/utils.d.ts +0 -18
  341. package/dest/tagging/utils.d.ts.map +0 -1
  342. package/dest/tagging/utils.js +0 -24
  343. package/src/contract_function_simulator/execution_data_provider.ts +0 -342
  344. package/src/contract_function_simulator/proxied_node.ts +0 -33
  345. package/src/contract_function_simulator/pxe_oracle_interface.ts +0 -1023
  346. package/src/private_kernel/private_kernel_oracle_impl.ts +0 -132
  347. package/src/storage/address_data_provider/index.ts +0 -1
  348. package/src/storage/capsule_data_provider/capsule_data_provider.ts +0 -147
  349. package/src/storage/capsule_data_provider/index.ts +0 -1
  350. package/src/storage/contract_data_provider/index.ts +0 -1
  351. package/src/storage/note_data_provider/index.ts +0 -2
  352. package/src/storage/private_event_data_provider/private_event_data_provider.ts +0 -143
  353. package/src/storage/sync_data_provider/index.ts +0 -1
  354. package/src/storage/tagging_data_provider/index.ts +0 -1
  355. package/src/storage/tagging_data_provider/tagging_data_provider.ts +0 -120
  356. package/src/synchronizer/index.ts +0 -1
  357. package/src/tagging/siloed_tag.ts +0 -22
  358. package/src/tagging/tag.ts +0 -16
  359. 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,18 +1,21 @@
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';
6
+ import { isProtocolContract } from '@aztec/protocol-contracts';
6
7
  import {
7
8
  type ContractArtifact,
8
9
  type FunctionAbi,
9
10
  type FunctionArtifact,
10
11
  type FunctionArtifactWithContractName,
12
+ FunctionCall,
11
13
  type FunctionDebugMetadata,
12
14
  FunctionSelector,
13
15
  FunctionType,
14
16
  contractArtifactFromBuffer,
15
17
  contractArtifactToBuffer,
18
+ encodeArguments,
16
19
  getFunctionDebugMetadata,
17
20
  } from '@aztec/stdlib/abi';
18
21
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
@@ -26,13 +29,13 @@ import {
26
29
  import { PrivateFunctionsTree } from './private_functions_tree.js';
27
30
 
28
31
  /**
29
- * ContractDataProvider serves as a data manager and retriever for Aztec.nr contracts.
32
+ * ContractStore serves as a data manager and retriever for Aztec.nr contracts.
30
33
  * It provides methods to obtain contract addresses, function ABI, bytecode, and membership witnesses
31
34
  * from a given contract address and function selector. The class maintains a cache of ContractTree instances
32
35
  * to efficiently serve the requested data. It interacts with the ContractDatabase and AztecNode to fetch
33
36
  * the required information and facilitate cryptographic proof generation.
34
37
  */
35
- export class ContractDataProvider {
38
+ export class ContractStore {
36
39
  /** Map from contract class id to private function tree. */
37
40
  // TODO: Update it to be LRU cache so that it doesn't keep all the data all the time.
38
41
  #privateFunctionTrees: Map<string, PrivateFunctionsTree> = new Map();
@@ -176,6 +179,21 @@ export class ContractDataProvider {
176
179
  return fnArtifact && { ...fnArtifact, contractName: artifact.name };
177
180
  }
178
181
 
182
+ public async getFunctionArtifactWithDebugMetadata(
183
+ contractAddress: AztecAddress,
184
+ selector: FunctionSelector,
185
+ ): Promise<FunctionArtifactWithContractName> {
186
+ const artifact = await this.getFunctionArtifact(contractAddress, selector);
187
+ if (!artifact) {
188
+ throw new Error(`Function artifact not found for contract ${contractAddress} and selector ${selector}.`);
189
+ }
190
+ const debug = await this.getFunctionDebugMetadata(contractAddress, selector);
191
+ return {
192
+ ...artifact,
193
+ debug,
194
+ };
195
+ }
196
+
179
197
  public async getPublicFunctionArtifact(
180
198
  contractAddress: AztecAddress,
181
199
  ): Promise<FunctionArtifactWithContractName | undefined> {
@@ -274,4 +292,48 @@ export class ContractDataProvider {
274
292
  }
275
293
  }
276
294
  }
295
+
296
+ public async getFunctionCall(functionName: string, args: any[], to: AztecAddress): Promise<FunctionCall> {
297
+ const contract = await this.getContract(to);
298
+ if (!contract) {
299
+ throw new Error(
300
+ `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`,
301
+ );
302
+ }
303
+
304
+ const functionDao = contract.functions.find(f => f.name === functionName);
305
+ if (!functionDao) {
306
+ throw new Error(`Unknown function ${functionName} in contract ${contract.name}.`);
307
+ }
308
+
309
+ return {
310
+ name: functionDao.name,
311
+ args: encodeArguments(functionDao, args),
312
+ selector: await FunctionSelector.fromNameAndParameters(functionDao.name, functionDao.parameters),
313
+ type: functionDao.functionType,
314
+ to,
315
+ hideMsgSender: false,
316
+ isStatic: functionDao.isStatic,
317
+ returnTypes: functionDao.returnTypes,
318
+ };
319
+ }
320
+
321
+ // Synchronize target contract data
322
+ public async syncPrivateState(
323
+ contractAddress: AztecAddress,
324
+ functionToInvokeAfterSync: FunctionSelector | null,
325
+ utilityExecutor: (privateSyncCall: FunctionCall) => Promise<any>,
326
+ ) {
327
+ // Protocol contracts don't have private state to sync
328
+ if (!isProtocolContract(contractAddress)) {
329
+ const syncPrivateStateFunctionCall = await this.getFunctionCall('sync_private_state', [], contractAddress);
330
+ if (functionToInvokeAfterSync && functionToInvokeAfterSync.equals(syncPrivateStateFunctionCall.selector)) {
331
+ throw new Error(
332
+ 'Forbidden `sync_private_state` invocation. `sync_private_state` can only be invoked by PXE, manual execution can lead to inconsistencies.',
333
+ );
334
+ }
335
+
336
+ return utilityExecutor(syncPrivateStateFunctionCall);
337
+ }
338
+ }
277
339
  }
@@ -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';