@aztec/pxe 0.0.0-test.1 → 0.0.1-commit.1142ef1

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 (445) hide show
  1. package/README.md +5 -5
  2. package/dest/bin/check_oracle_version.d.ts +2 -0
  3. package/dest/bin/check_oracle_version.d.ts.map +1 -0
  4. package/dest/bin/check_oracle_version.js +129 -0
  5. package/dest/block_synchronizer/block_synchronizer.d.ts +39 -0
  6. package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -0
  7. package/dest/{synchronizer/synchronizer.js → block_synchronizer/block_synchronizer.js} +34 -35
  8. package/dest/block_synchronizer/index.d.ts +2 -0
  9. package/dest/block_synchronizer/index.d.ts.map +1 -0
  10. package/dest/block_synchronizer/index.js +1 -0
  11. package/dest/config/index.d.ts +11 -24
  12. package/dest/config/index.d.ts.map +1 -1
  13. package/dest/config/index.js +18 -33
  14. package/dest/config/package_info.d.ts +1 -1
  15. package/dest/config/package_info.js +1 -1
  16. package/dest/contract_function_simulator/contract_function_simulator.d.ts +86 -0
  17. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -0
  18. package/dest/contract_function_simulator/contract_function_simulator.js +331 -0
  19. package/dest/contract_function_simulator/execution_note_cache.d.ts +95 -0
  20. package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -0
  21. package/dest/contract_function_simulator/execution_note_cache.js +191 -0
  22. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +16 -0
  23. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -0
  24. package/dest/contract_function_simulator/execution_tagging_index_cache.js +26 -0
  25. package/dest/contract_function_simulator/hashed_values_cache.d.ts +28 -0
  26. package/dest/contract_function_simulator/hashed_values_cache.d.ts.map +1 -0
  27. package/dest/contract_function_simulator/hashed_values_cache.js +36 -0
  28. package/dest/contract_function_simulator/index.d.ts +14 -0
  29. package/dest/contract_function_simulator/index.d.ts.map +1 -0
  30. package/dest/contract_function_simulator/index.js +12 -0
  31. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +21 -0
  32. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -0
  33. package/dest/contract_function_simulator/noir-structs/event_validation_request.js +40 -0
  34. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +16 -0
  35. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts.map +1 -0
  36. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.js +26 -0
  37. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +17 -0
  38. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -0
  39. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +65 -0
  40. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +24 -0
  41. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -0
  42. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +51 -0
  43. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +22 -0
  44. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -0
  45. package/dest/contract_function_simulator/noir-structs/utility_context.js +33 -0
  46. package/dest/contract_function_simulator/oracle/index.d.ts +14 -0
  47. package/dest/contract_function_simulator/oracle/index.d.ts.map +1 -0
  48. package/dest/contract_function_simulator/oracle/index.js +2 -0
  49. package/dest/contract_function_simulator/oracle/interfaces.d.ts +103 -0
  50. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -0
  51. package/dest/contract_function_simulator/oracle/interfaces.js +4 -0
  52. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +17 -0
  53. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -0
  54. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.js +24 -0
  55. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +28 -0
  56. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -0
  57. package/dest/contract_function_simulator/oracle/note_packing_utils.js +54 -0
  58. package/dest/contract_function_simulator/oracle/oracle.d.ts +58 -0
  59. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -0
  60. package/dest/contract_function_simulator/oracle/oracle.js +345 -0
  61. package/dest/contract_function_simulator/oracle/private_execution.d.ts +47 -0
  62. package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -0
  63. package/dest/contract_function_simulator/oracle/private_execution.js +122 -0
  64. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +231 -0
  65. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -0
  66. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +414 -0
  67. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +196 -0
  68. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -0
  69. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +374 -0
  70. package/dest/contract_function_simulator/pick_notes.d.ts +85 -0
  71. package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -0
  72. package/dest/contract_function_simulator/pick_notes.js +51 -0
  73. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +6 -0
  74. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -0
  75. package/dest/contract_function_simulator/proxied_contract_data_source.js +80 -0
  76. package/dest/contract_function_simulator/proxied_node.d.ts +9 -0
  77. package/dest/contract_function_simulator/proxied_node.d.ts.map +1 -0
  78. package/dest/contract_function_simulator/proxied_node.js +27 -0
  79. package/dest/debug/pxe_debug_utils.d.ts +31 -0
  80. package/dest/debug/pxe_debug_utils.d.ts.map +1 -0
  81. package/dest/debug/pxe_debug_utils.js +37 -0
  82. package/dest/entrypoints/client/bundle/index.d.ts +4 -3
  83. package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
  84. package/dest/entrypoints/client/bundle/index.js +2 -2
  85. package/dest/entrypoints/client/bundle/utils.d.ts +10 -10
  86. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  87. package/dest/entrypoints/client/bundle/utils.js +27 -12
  88. package/dest/entrypoints/client/lazy/index.d.ts +4 -3
  89. package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
  90. package/dest/entrypoints/client/lazy/index.js +2 -2
  91. package/dest/entrypoints/client/lazy/utils.d.ts +9 -9
  92. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  93. package/dest/entrypoints/client/lazy/utils.js +26 -11
  94. package/dest/entrypoints/pxe_creation_options.d.ts +17 -0
  95. package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -0
  96. package/dest/entrypoints/server/index.d.ts +6 -4
  97. package/dest/entrypoints/server/index.d.ts.map +1 -1
  98. package/dest/entrypoints/server/index.js +4 -3
  99. package/dest/entrypoints/server/utils.d.ts +8 -16
  100. package/dest/entrypoints/server/utils.d.ts.map +1 -1
  101. package/dest/entrypoints/server/utils.js +35 -36
  102. package/dest/error_enriching.d.ts +11 -0
  103. package/dest/error_enriching.d.ts.map +1 -0
  104. package/dest/{pxe_service/error_enriching.js → error_enriching.js} +30 -22
  105. package/dest/events/event_service.d.ts +15 -0
  106. package/dest/events/event_service.d.ts.map +1 -0
  107. package/dest/events/event_service.js +47 -0
  108. package/dest/events/index.d.ts +2 -0
  109. package/dest/events/index.d.ts.map +1 -0
  110. package/dest/events/index.js +1 -0
  111. package/dest/events/private_event_filter_validator.d.ts +9 -0
  112. package/dest/events/private_event_filter_validator.d.ts.map +1 -0
  113. package/dest/events/private_event_filter_validator.js +39 -0
  114. package/dest/job_coordinator/job_coordinator.d.ts +74 -0
  115. package/dest/job_coordinator/job_coordinator.d.ts.map +1 -0
  116. package/dest/job_coordinator/job_coordinator.js +93 -0
  117. package/dest/logs/log_service.d.ts +26 -0
  118. package/dest/logs/log_service.d.ts.map +1 -0
  119. package/dest/logs/log_service.js +120 -0
  120. package/dest/notes/index.d.ts +2 -0
  121. package/dest/notes/index.d.ts.map +1 -0
  122. package/dest/notes/index.js +1 -0
  123. package/dest/notes/note_service.d.ts +48 -0
  124. package/dest/notes/note_service.d.ts.map +1 -0
  125. package/dest/notes/note_service.js +152 -0
  126. package/dest/oracle_version.d.ts +3 -0
  127. package/dest/oracle_version.d.ts.map +1 -0
  128. package/dest/oracle_version.js +10 -0
  129. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +28 -0
  130. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +1 -0
  131. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.js +271 -0
  132. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +4 -0
  133. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts.map +1 -0
  134. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.js +41 -0
  135. package/dest/private_kernel/hints/index.d.ts +3 -0
  136. package/dest/private_kernel/hints/index.d.ts.map +1 -0
  137. package/dest/{kernel_prover → private_kernel}/hints/index.js +1 -0
  138. package/dest/private_kernel/index.d.ts +3 -0
  139. package/dest/private_kernel/index.d.ts.map +1 -0
  140. package/dest/private_kernel/index.js +2 -0
  141. package/dest/private_kernel/private_kernel_execution_prover.d.ts +44 -0
  142. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -0
  143. package/dest/private_kernel/private_kernel_execution_prover.js +285 -0
  144. package/dest/private_kernel/private_kernel_oracle.d.ts +64 -0
  145. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -0
  146. package/dest/private_kernel/private_kernel_oracle.js +4 -0
  147. package/dest/private_kernel/private_kernel_oracle_impl.d.ts +46 -0
  148. package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +1 -0
  149. package/dest/{kernel_oracle/index.js → private_kernel/private_kernel_oracle_impl.js} +27 -18
  150. package/dest/public_storage/public_storage_service.d.ts +24 -0
  151. package/dest/public_storage/public_storage_service.d.ts.map +1 -0
  152. package/dest/public_storage/public_storage_service.js +26 -0
  153. package/dest/pxe.d.ts +233 -0
  154. package/dest/pxe.d.ts.map +1 -0
  155. package/dest/pxe.js +782 -0
  156. package/dest/storage/address_store/address_store.d.ts +11 -0
  157. package/dest/storage/address_store/address_store.d.ts.map +1 -0
  158. package/dest/storage/{address_data_provider/address_data_provider.js → address_store/address_store.js} +1 -4
  159. package/dest/storage/address_store/index.d.ts +2 -0
  160. package/dest/storage/address_store/index.d.ts.map +1 -0
  161. package/dest/storage/address_store/index.js +1 -0
  162. package/dest/storage/anchor_block_store/anchor_block_store.d.ts +9 -0
  163. package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -0
  164. package/dest/storage/{sync_data_provider/sync_data_provider.js → anchor_block_store/anchor_block_store.js} +2 -12
  165. package/dest/storage/anchor_block_store/index.d.ts +2 -0
  166. package/dest/storage/anchor_block_store/index.d.ts.map +1 -0
  167. package/dest/storage/anchor_block_store/index.js +1 -0
  168. package/dest/storage/capsule_store/capsule_store.d.ts +57 -0
  169. package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -0
  170. package/dest/storage/capsule_store/capsule_store.js +146 -0
  171. package/dest/storage/capsule_store/index.d.ts +2 -0
  172. package/dest/storage/capsule_store/index.d.ts.map +1 -0
  173. package/dest/storage/capsule_store/index.js +1 -0
  174. package/dest/storage/contract_store/contract_store.d.ts +67 -0
  175. package/dest/storage/contract_store/contract_store.d.ts.map +1 -0
  176. package/dest/storage/contract_store/contract_store.js +236 -0
  177. package/dest/storage/contract_store/index.d.ts +2 -0
  178. package/dest/storage/contract_store/index.d.ts.map +1 -0
  179. package/dest/storage/contract_store/index.js +1 -0
  180. package/dest/storage/contract_store/private_functions_tree.d.ts +27 -0
  181. package/dest/storage/contract_store/private_functions_tree.d.ts.map +1 -0
  182. package/dest/storage/contract_store/private_functions_tree.js +47 -0
  183. package/dest/storage/index.d.ts +9 -10
  184. package/dest/storage/index.d.ts.map +1 -1
  185. package/dest/storage/index.js +8 -9
  186. package/dest/storage/metadata.d.ts +2 -0
  187. package/dest/storage/metadata.d.ts.map +1 -0
  188. package/dest/storage/metadata.js +1 -0
  189. package/dest/storage/note_store/index.d.ts +3 -0
  190. package/dest/storage/note_store/index.d.ts.map +1 -0
  191. package/dest/storage/note_store/index.js +2 -0
  192. package/dest/storage/note_store/note_store.d.ts +84 -0
  193. package/dest/storage/note_store/note_store.d.ts.map +1 -0
  194. package/dest/storage/note_store/note_store.js +322 -0
  195. package/dest/storage/private_event_store/private_event_store.d.ts +56 -0
  196. package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -0
  197. package/dest/storage/private_event_store/private_event_store.js +158 -0
  198. package/dest/storage/tagging_store/index.d.ts +4 -0
  199. package/dest/storage/tagging_store/index.d.ts.map +1 -0
  200. package/dest/storage/tagging_store/index.js +3 -0
  201. package/dest/storage/tagging_store/recipient_tagging_store.d.ts +21 -0
  202. package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -0
  203. package/dest/storage/tagging_store/recipient_tagging_store.js +42 -0
  204. package/dest/storage/tagging_store/sender_address_book_store.d.ts +14 -0
  205. package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +1 -0
  206. package/dest/storage/tagging_store/sender_address_book_store.js +30 -0
  207. package/dest/storage/tagging_store/sender_tagging_store.d.ts +67 -0
  208. package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -0
  209. package/dest/storage/tagging_store/sender_tagging_store.js +196 -0
  210. package/dest/tagging/constants.d.ts +2 -0
  211. package/dest/tagging/constants.d.ts.map +1 -0
  212. package/dest/tagging/constants.js +10 -0
  213. package/dest/tagging/index.d.ts +16 -0
  214. package/dest/tagging/index.d.ts.map +1 -0
  215. package/dest/tagging/index.js +14 -0
  216. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +14 -0
  217. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -0
  218. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +99 -0
  219. package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts +12 -0
  220. package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts.map +1 -0
  221. package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +20 -0
  222. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +14 -0
  223. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -0
  224. package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +29 -0
  225. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +20 -0
  226. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -0
  227. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +74 -0
  228. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +11 -0
  229. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -0
  230. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +32 -0
  231. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +18 -0
  232. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -0
  233. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +55 -0
  234. package/dest/tree_membership/tree_membership_service.d.ts +52 -0
  235. package/dest/tree_membership/tree_membership_service.d.ts.map +1 -0
  236. package/dest/tree_membership/tree_membership_service.js +84 -0
  237. package/package.json +37 -34
  238. package/src/bin/check_oracle_version.ts +160 -0
  239. package/src/{synchronizer/synchronizer.ts → block_synchronizer/block_synchronizer.ts} +37 -38
  240. package/src/block_synchronizer/index.ts +1 -0
  241. package/src/config/index.ts +27 -55
  242. package/src/config/package_info.ts +1 -1
  243. package/src/contract_function_simulator/contract_function_simulator.ts +627 -0
  244. package/src/contract_function_simulator/execution_note_cache.ts +233 -0
  245. package/src/contract_function_simulator/execution_tagging_index_cache.ts +32 -0
  246. package/src/contract_function_simulator/hashed_values_cache.ts +47 -0
  247. package/src/contract_function_simulator/index.ts +13 -0
  248. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +51 -0
  249. package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +28 -0
  250. package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +69 -0
  251. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +64 -0
  252. package/src/contract_function_simulator/noir-structs/utility_context.ts +42 -0
  253. package/src/contract_function_simulator/oracle/index.ts +16 -0
  254. package/src/contract_function_simulator/oracle/interfaces.ts +175 -0
  255. package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +23 -0
  256. package/src/contract_function_simulator/oracle/note_packing_utils.ts +68 -0
  257. package/src/contract_function_simulator/oracle/oracle.ts +605 -0
  258. package/src/contract_function_simulator/oracle/private_execution.ts +207 -0
  259. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +676 -0
  260. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +536 -0
  261. package/src/contract_function_simulator/pick_notes.ts +141 -0
  262. package/src/contract_function_simulator/proxied_contract_data_source.ts +83 -0
  263. package/src/contract_function_simulator/proxied_node.ts +33 -0
  264. package/src/debug/pxe_debug_utils.ts +48 -0
  265. package/src/entrypoints/client/bundle/index.ts +3 -2
  266. package/src/entrypoints/client/bundle/utils.ts +42 -36
  267. package/src/entrypoints/client/lazy/index.ts +3 -2
  268. package/src/entrypoints/client/lazy/utils.ts +41 -31
  269. package/src/entrypoints/pxe_creation_options.ts +13 -0
  270. package/src/entrypoints/server/index.ts +5 -3
  271. package/src/entrypoints/server/utils.ts +55 -51
  272. package/src/{pxe_service/error_enriching.ts → error_enriching.ts} +40 -39
  273. package/src/events/event_service.ts +79 -0
  274. package/src/events/index.ts +1 -0
  275. package/src/events/private_event_filter_validator.ts +48 -0
  276. package/src/job_coordinator/job_coordinator.ts +149 -0
  277. package/src/logs/log_service.ts +202 -0
  278. package/src/notes/index.ts +1 -0
  279. package/src/notes/note_service.ts +200 -0
  280. package/src/oracle_version.ts +11 -0
  281. package/src/{kernel_prover → private_kernel}/hints/build_private_kernel_reset_private_inputs.ts +159 -148
  282. package/src/private_kernel/hints/compute_tx_include_by_timestamp.ts +58 -0
  283. package/src/{kernel_prover → private_kernel}/hints/index.ts +1 -0
  284. package/src/private_kernel/index.ts +2 -0
  285. package/src/private_kernel/private_kernel_execution_prover.ts +430 -0
  286. package/src/{kernel_prover/proving_data_oracle.ts → private_kernel/private_kernel_oracle.ts} +19 -29
  287. package/src/{kernel_oracle/index.ts → private_kernel/private_kernel_oracle_impl.ts} +40 -30
  288. package/src/public_storage/public_storage_service.ts +33 -0
  289. package/src/pxe.ts +1111 -0
  290. package/src/storage/{address_data_provider/address_data_provider.ts → address_store/address_store.ts} +1 -7
  291. package/src/storage/address_store/index.ts +1 -0
  292. package/src/storage/{sync_data_provider/sync_data_provider.ts → anchor_block_store/anchor_block_store.ts} +2 -17
  293. package/src/storage/anchor_block_store/index.ts +1 -0
  294. package/src/storage/capsule_store/capsule_store.ts +179 -0
  295. package/src/storage/capsule_store/index.ts +1 -0
  296. package/src/storage/contract_store/contract_store.ts +339 -0
  297. package/src/storage/contract_store/index.ts +1 -0
  298. package/src/storage/contract_store/private_functions_tree.ts +67 -0
  299. package/src/storage/index.ts +8 -10
  300. package/src/storage/metadata.ts +1 -0
  301. package/src/storage/note_store/index.ts +2 -0
  302. package/src/storage/{note_data_provider/note_data_provider.ts → note_store/note_store.ts} +190 -123
  303. package/src/storage/private_event_store/private_event_store.ts +216 -0
  304. package/src/storage/tagging_store/index.ts +3 -0
  305. package/src/storage/tagging_store/recipient_tagging_store.ts +53 -0
  306. package/src/storage/tagging_store/sender_address_book_store.ts +42 -0
  307. package/src/storage/tagging_store/sender_tagging_store.ts +244 -0
  308. package/src/tagging/constants.ts +10 -0
  309. package/src/tagging/index.ts +18 -0
  310. package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +132 -0
  311. package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +34 -0
  312. package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +43 -0
  313. package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +96 -0
  314. package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +48 -0
  315. package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +72 -0
  316. package/src/tree_membership/tree_membership_service.ts +112 -0
  317. package/dest/bin/index.d.ts +0 -3
  318. package/dest/bin/index.d.ts.map +0 -1
  319. package/dest/bin/index.js +0 -28
  320. package/dest/entrypoints/client/pxe_creation_options.d.ts +0 -11
  321. package/dest/entrypoints/client/pxe_creation_options.d.ts.map +0 -1
  322. package/dest/kernel_oracle/index.d.ts +0 -45
  323. package/dest/kernel_oracle/index.d.ts.map +0 -1
  324. package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.d.ts +0 -28
  325. package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.d.ts.map +0 -1
  326. package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.js +0 -270
  327. package/dest/kernel_prover/hints/index.d.ts +0 -2
  328. package/dest/kernel_prover/hints/index.d.ts.map +0 -1
  329. package/dest/kernel_prover/index.d.ts +0 -3
  330. package/dest/kernel_prover/index.d.ts.map +0 -1
  331. package/dest/kernel_prover/index.js +0 -2
  332. package/dest/kernel_prover/kernel_prover.d.ts +0 -38
  333. package/dest/kernel_prover/kernel_prover.d.ts.map +0 -1
  334. package/dest/kernel_prover/kernel_prover.js +0 -217
  335. package/dest/kernel_prover/proving_data_oracle.d.ts +0 -73
  336. package/dest/kernel_prover/proving_data_oracle.d.ts.map +0 -1
  337. package/dest/kernel_prover/proving_data_oracle.js +0 -4
  338. package/dest/note_decryption_utils/add_public_values_to_payload.d.ts +0 -11
  339. package/dest/note_decryption_utils/add_public_values_to_payload.d.ts.map +0 -1
  340. package/dest/note_decryption_utils/add_public_values_to_payload.js +0 -47
  341. package/dest/pxe_http/index.d.ts +0 -2
  342. package/dest/pxe_http/index.d.ts.map +0 -1
  343. package/dest/pxe_http/index.js +0 -1
  344. package/dest/pxe_http/pxe_http_server.d.ts +0 -16
  345. package/dest/pxe_http/pxe_http_server.d.ts.map +0 -1
  346. package/dest/pxe_http/pxe_http_server.js +0 -27
  347. package/dest/pxe_oracle_interface/index.d.ts +0 -159
  348. package/dest/pxe_oracle_interface/index.d.ts.map +0 -1
  349. package/dest/pxe_oracle_interface/index.js +0 -692
  350. package/dest/pxe_oracle_interface/tagging_utils.d.ts +0 -17
  351. package/dest/pxe_oracle_interface/tagging_utils.d.ts.map +0 -1
  352. package/dest/pxe_oracle_interface/tagging_utils.js +0 -23
  353. package/dest/pxe_service/error_enriching.d.ts +0 -11
  354. package/dest/pxe_service/error_enriching.d.ts.map +0 -1
  355. package/dest/pxe_service/index.d.ts +0 -3
  356. package/dest/pxe_service/index.d.ts.map +0 -1
  357. package/dest/pxe_service/index.js +0 -2
  358. package/dest/pxe_service/pxe_service.d.ts +0 -111
  359. package/dest/pxe_service/pxe_service.d.ts.map +0 -1
  360. package/dest/pxe_service/pxe_service.js +0 -664
  361. package/dest/storage/address_data_provider/address_data_provider.d.ts +0 -13
  362. package/dest/storage/address_data_provider/address_data_provider.d.ts.map +0 -1
  363. package/dest/storage/address_data_provider/index.d.ts +0 -2
  364. package/dest/storage/address_data_provider/index.d.ts.map +0 -1
  365. package/dest/storage/address_data_provider/index.js +0 -1
  366. package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.d.ts +0 -11
  367. package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.d.ts.map +0 -1
  368. package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.js +0 -20
  369. package/dest/storage/auth_witness_data_provider/index.d.ts +0 -2
  370. package/dest/storage/auth_witness_data_provider/index.d.ts.map +0 -1
  371. package/dest/storage/auth_witness_data_provider/index.js +0 -1
  372. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts +0 -16
  373. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +0 -1
  374. package/dest/storage/capsule_data_provider/capsule_data_provider.js +0 -57
  375. package/dest/storage/capsule_data_provider/index.d.ts +0 -2
  376. package/dest/storage/capsule_data_provider/index.d.ts.map +0 -1
  377. package/dest/storage/capsule_data_provider/index.js +0 -1
  378. package/dest/storage/contract_data_provider/contract_data_provider.d.ts +0 -109
  379. package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +0 -1
  380. package/dest/storage/contract_data_provider/contract_data_provider.js +0 -183
  381. package/dest/storage/contract_data_provider/index.d.ts +0 -3
  382. package/dest/storage/contract_data_provider/index.d.ts.map +0 -1
  383. package/dest/storage/contract_data_provider/index.js +0 -2
  384. package/dest/storage/contract_data_provider/private_functions_tree.d.ts +0 -66
  385. package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +0 -1
  386. package/dest/storage/contract_data_provider/private_functions_tree.js +0 -99
  387. package/dest/storage/data_provider.d.ts +0 -4
  388. package/dest/storage/data_provider.d.ts.map +0 -1
  389. package/dest/storage/data_provider.js +0 -1
  390. package/dest/storage/note_data_provider/index.d.ts +0 -3
  391. package/dest/storage/note_data_provider/index.d.ts.map +0 -1
  392. package/dest/storage/note_data_provider/index.js +0 -2
  393. package/dest/storage/note_data_provider/note_dao.d.ts +0 -106
  394. package/dest/storage/note_data_provider/note_dao.d.ts.map +0 -1
  395. package/dest/storage/note_data_provider/note_dao.js +0 -106
  396. package/dest/storage/note_data_provider/note_data_provider.d.ts +0 -20
  397. package/dest/storage/note_data_provider/note_data_provider.d.ts.map +0 -1
  398. package/dest/storage/note_data_provider/note_data_provider.js +0 -249
  399. package/dest/storage/sync_data_provider/index.d.ts +0 -2
  400. package/dest/storage/sync_data_provider/index.d.ts.map +0 -1
  401. package/dest/storage/sync_data_provider/index.js +0 -1
  402. package/dest/storage/sync_data_provider/sync_data_provider.d.ts +0 -12
  403. package/dest/storage/sync_data_provider/sync_data_provider.d.ts.map +0 -1
  404. package/dest/storage/tagging_data_provider/index.d.ts +0 -2
  405. package/dest/storage/tagging_data_provider/index.d.ts.map +0 -1
  406. package/dest/storage/tagging_data_provider/index.js +0 -1
  407. package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts +0 -18
  408. package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts.map +0 -1
  409. package/dest/storage/tagging_data_provider/tagging_data_provider.js +0 -65
  410. package/dest/synchronizer/index.d.ts +0 -2
  411. package/dest/synchronizer/index.d.ts.map +0 -1
  412. package/dest/synchronizer/index.js +0 -1
  413. package/dest/synchronizer/synchronizer.d.ts +0 -37
  414. package/dest/synchronizer/synchronizer.d.ts.map +0 -1
  415. package/dest/test/pxe_test_suite.d.ts +0 -3
  416. package/dest/test/pxe_test_suite.d.ts.map +0 -1
  417. package/dest/test/pxe_test_suite.js +0 -97
  418. package/src/bin/index.ts +0 -38
  419. package/src/entrypoints/client/pxe_creation_options.ts +0 -7
  420. package/src/kernel_prover/index.ts +0 -2
  421. package/src/kernel_prover/kernel_prover.ts +0 -351
  422. package/src/note_decryption_utils/add_public_values_to_payload.ts +0 -64
  423. package/src/pxe_http/index.ts +0 -1
  424. package/src/pxe_http/pxe_http_server.ts +0 -29
  425. package/src/pxe_oracle_interface/index.ts +0 -925
  426. package/src/pxe_oracle_interface/tagging_utils.ts +0 -32
  427. package/src/pxe_service/index.ts +0 -2
  428. package/src/pxe_service/pxe_service.ts +0 -949
  429. package/src/storage/address_data_provider/index.ts +0 -1
  430. package/src/storage/auth_witness_data_provider/auth_witness_data_provider.ts +0 -34
  431. package/src/storage/auth_witness_data_provider/index.ts +0 -1
  432. package/src/storage/capsule_data_provider/capsule_data_provider.ts +0 -80
  433. package/src/storage/capsule_data_provider/index.ts +0 -1
  434. package/src/storage/contract_data_provider/contract_data_provider.ts +0 -261
  435. package/src/storage/contract_data_provider/index.ts +0 -2
  436. package/src/storage/contract_data_provider/private_functions_tree.ts +0 -131
  437. package/src/storage/data_provider.ts +0 -3
  438. package/src/storage/note_data_provider/index.ts +0 -2
  439. package/src/storage/note_data_provider/note_dao.ts +0 -162
  440. package/src/storage/sync_data_provider/index.ts +0 -1
  441. package/src/storage/tagging_data_provider/index.ts +0 -1
  442. package/src/storage/tagging_data_provider/tagging_data_provider.ts +0 -92
  443. package/src/synchronizer/index.ts +0 -1
  444. package/src/test/pxe_test_suite.ts +0 -111
  445. /package/dest/entrypoints/{client/pxe_creation_options.js → pxe_creation_options.js} +0 -0
@@ -0,0 +1,236 @@
1
+ import { toArray } from '@aztec/foundation/iterable';
2
+ import { isProtocolContract } from '@aztec/protocol-contracts';
3
+ import { FunctionSelector, FunctionType, contractArtifactFromBuffer, contractArtifactToBuffer, encodeArguments, getFunctionDebugMetadata } from '@aztec/stdlib/abi';
4
+ import { AztecAddress } from '@aztec/stdlib/aztec-address';
5
+ import { SerializableContractInstance, getContractClassFromArtifact } from '@aztec/stdlib/contract';
6
+ import { PrivateFunctionsTree } from './private_functions_tree.js';
7
+ /**
8
+ * ContractStore serves as a data manager and retriever for Aztec.nr contracts.
9
+ * It provides methods to obtain contract addresses, function ABI, bytecode, and membership witnesses
10
+ * from a given contract address and function selector. The class maintains a cache of ContractTree instances
11
+ * to efficiently serve the requested data. It interacts with the ContractDatabase and AztecNode to fetch
12
+ * the required information and facilitate cryptographic proof generation.
13
+ */ export class ContractStore {
14
+ /** Map from contract class id to private function tree. */ // TODO: Update it to be LRU cache so that it doesn't keep all the data all the time.
15
+ #privateFunctionTrees = new Map();
16
+ /** Map from contract address to contract class id */ #contractClassIdMap = new Map();
17
+ #contractArtifacts;
18
+ #contractInstances;
19
+ constructor(store){
20
+ this.#contractArtifacts = store.openMap('contract_artifacts');
21
+ this.#contractInstances = store.openMap('contracts_instances');
22
+ }
23
+ // Setters
24
+ async addContractArtifact(id, contract) {
25
+ const privateFunctions = contract.functions.filter((functionArtifact)=>functionArtifact.functionType === FunctionType.PRIVATE);
26
+ const privateSelectors = await Promise.all(privateFunctions.map(async (privateFunctionArtifact)=>(await FunctionSelector.fromNameAndParameters(privateFunctionArtifact.name, privateFunctionArtifact.parameters)).toString()));
27
+ if (privateSelectors.length !== new Set(privateSelectors).size) {
28
+ throw new Error('Repeated function selectors of private functions');
29
+ }
30
+ await this.#contractArtifacts.set(id.toString(), contractArtifactToBuffer(contract));
31
+ }
32
+ async addContractInstance(contract) {
33
+ this.#contractClassIdMap.set(contract.address.toString(), contract.currentContractClassId);
34
+ await this.#contractInstances.set(contract.address.toString(), new SerializableContractInstance(contract).toBuffer());
35
+ }
36
+ // Private getters
37
+ async #getContractClassId(contractAddress) {
38
+ if (!this.#contractClassIdMap.has(contractAddress.toString())) {
39
+ const instance = await this.getContractInstance(contractAddress);
40
+ if (!instance) {
41
+ return;
42
+ }
43
+ this.#contractClassIdMap.set(contractAddress.toString(), instance.currentContractClassId);
44
+ }
45
+ return this.#contractClassIdMap.get(contractAddress.toString());
46
+ }
47
+ /**
48
+ * Retrieve or create a ContractTree instance based on the provided class id.
49
+ * If an existing tree with the same class id is found in the cache, it will be returned.
50
+ * Otherwise, a new ContractTree instance will be created using the contract data from the database
51
+ * and added to the cache before returning.
52
+ *
53
+ * @param classId - The class id of the contract for which the ContractTree is required.
54
+ * @returns A ContractTree instance associated with the specified contract address.
55
+ * @throws An Error if the contract is not found in the ContractDatabase.
56
+ */ async #getPrivateFunctionTreeForClassId(classId) {
57
+ if (!this.#privateFunctionTrees.has(classId.toString())) {
58
+ const artifact = await this.getContractArtifact(classId);
59
+ if (!artifact) {
60
+ return;
61
+ }
62
+ const tree = await PrivateFunctionsTree.create(artifact);
63
+ this.#privateFunctionTrees.set(classId.toString(), tree);
64
+ }
65
+ return this.#privateFunctionTrees.get(classId.toString());
66
+ }
67
+ async #getContractArtifactByAddress(contractAddress) {
68
+ const contractClassId = await this.#getContractClassId(contractAddress);
69
+ return contractClassId && this.getContractArtifact(contractClassId);
70
+ }
71
+ // Public getters
72
+ async getContractsAddresses() {
73
+ const keys = await toArray(this.#contractInstances.keysAsync());
74
+ return keys.map(AztecAddress.fromString);
75
+ }
76
+ /** Returns a contract instance for a given address. Throws if not found. */ async getContractInstance(contractAddress) {
77
+ const contract = await this.#contractInstances.getAsync(contractAddress.toString());
78
+ return contract && SerializableContractInstance.fromBuffer(contract).withAddress(contractAddress);
79
+ }
80
+ async getContractArtifact(contractClassId) {
81
+ const contract = await this.#contractArtifacts.getAsync(contractClassId.toString());
82
+ // TODO(@spalladino): AztecAsyncMap lies and returns Uint8Arrays instead of Buffers, hence the extra Buffer.from.
83
+ return contract && contractArtifactFromBuffer(Buffer.from(contract));
84
+ }
85
+ /** Returns a contract class for a given class id. Throws if not found. */ async getContractClass(contractClassId) {
86
+ const artifact = await this.getContractArtifact(contractClassId);
87
+ return artifact && getContractClassFromArtifact(artifact);
88
+ }
89
+ async getContract(address) {
90
+ const instance = await this.getContractInstance(address);
91
+ if (!instance) {
92
+ return;
93
+ }
94
+ const artifact = await this.getContractArtifact(instance.currentContractClassId);
95
+ if (!artifact) {
96
+ return;
97
+ }
98
+ return {
99
+ ...instance,
100
+ ...artifact
101
+ };
102
+ }
103
+ /**
104
+ * Retrieves the artifact of a specified function within a given contract.
105
+ * The function is identified by its selector, which is a unique code generated from the function's signature.
106
+ * Throws an error if the contract address or function selector are invalid or not found.
107
+ *
108
+ * @param contractAddress - The AztecAddress representing the contract containing the function.
109
+ * @param selector - The function selector.
110
+ * @returns The corresponding function's artifact as an object.
111
+ */ async getFunctionArtifact(contractAddress, selector) {
112
+ const artifact = await this.#getContractArtifactByAddress(contractAddress);
113
+ const fnArtifact = artifact && await this.#findFunctionArtifactBySelector(artifact, selector);
114
+ return fnArtifact && {
115
+ ...fnArtifact,
116
+ contractName: artifact.name
117
+ };
118
+ }
119
+ async getFunctionArtifactWithDebugMetadata(contractAddress, selector) {
120
+ const artifact = await this.getFunctionArtifact(contractAddress, selector);
121
+ if (!artifact) {
122
+ throw new Error(`Function artifact not found for contract ${contractAddress} and selector ${selector}.`);
123
+ }
124
+ const debug = await this.getFunctionDebugMetadata(contractAddress, selector);
125
+ return {
126
+ ...artifact,
127
+ debug
128
+ };
129
+ }
130
+ async getPublicFunctionArtifact(contractAddress) {
131
+ const artifact = await this.#getContractArtifactByAddress(contractAddress);
132
+ const fnArtifact = artifact && artifact.functions.find((fn)=>fn.functionType === FunctionType.PUBLIC);
133
+ return fnArtifact && {
134
+ ...fnArtifact,
135
+ contractName: artifact.name
136
+ };
137
+ }
138
+ async getFunctionAbi(contractAddress, selector) {
139
+ const artifact = await this.#getContractArtifactByAddress(contractAddress);
140
+ return artifact && await this.#findFunctionAbiBySelector(artifact, selector);
141
+ }
142
+ /**
143
+ * Retrieves the debug metadata of a specified function within a given contract.
144
+ * The function is identified by its selector, which is a unique code generated from the function's signature.
145
+ * Returns undefined if the debug metadata for the given function is not found.
146
+ * Throws if the contract has not been added to the database.
147
+ *
148
+ * @param contractAddress - The AztecAddress representing the contract containing the function.
149
+ * @param selector - The function selector.
150
+ * @returns The corresponding function's artifact as an object.
151
+ */ async getFunctionDebugMetadata(contractAddress, selector) {
152
+ const artifact = await this.#getContractArtifactByAddress(contractAddress);
153
+ const fnArtifact = artifact && await this.#findFunctionArtifactBySelector(artifact, selector);
154
+ return fnArtifact && getFunctionDebugMetadata(artifact, fnArtifact);
155
+ }
156
+ async getPublicFunctionDebugMetadata(contractAddress) {
157
+ const artifact = await this.#getContractArtifactByAddress(contractAddress);
158
+ const fnArtifact = artifact && artifact.functions.find((fn)=>fn.functionType === FunctionType.PUBLIC);
159
+ return fnArtifact && getFunctionDebugMetadata(artifact, fnArtifact);
160
+ }
161
+ /**
162
+ * Retrieve the function membership witness for the given contract class and function selector.
163
+ * The function membership witness represents a proof that the function belongs to the specified contract.
164
+ * Throws an error if the contract address or function selector is unknown.
165
+ *
166
+ * @param contractClassId - The id of the class.
167
+ * @param selector - The function selector.
168
+ * @returns A promise that resolves with the MembershipWitness instance for the specified contract's function.
169
+ */ async getFunctionMembershipWitness(contractClassId, selector) {
170
+ const tree = await this.#getPrivateFunctionTreeForClassId(contractClassId);
171
+ return tree?.getFunctionMembershipWitness(selector);
172
+ }
173
+ async getDebugContractName(contractAddress) {
174
+ const artifact = await this.#getContractArtifactByAddress(contractAddress);
175
+ return artifact?.name;
176
+ }
177
+ async getDebugFunctionName(contractAddress, selector) {
178
+ const artifact = await this.#getContractArtifactByAddress(contractAddress);
179
+ const fnArtifact = artifact && await this.#findFunctionAbiBySelector(artifact, selector);
180
+ return `${artifact?.name ?? contractAddress}:${fnArtifact?.name ?? selector}`;
181
+ }
182
+ async #findFunctionArtifactBySelector(artifact, selector) {
183
+ const functions = artifact.functions;
184
+ for(let i = 0; i < functions.length; i++){
185
+ const fn = functions[i];
186
+ const fnSelector = await FunctionSelector.fromNameAndParameters(fn.name, fn.parameters);
187
+ if (fnSelector.equals(selector)) {
188
+ return fn;
189
+ }
190
+ }
191
+ }
192
+ async #findFunctionAbiBySelector(artifact, selector) {
193
+ const functions = [
194
+ ...artifact.functions,
195
+ ...artifact.nonDispatchPublicFunctions ?? []
196
+ ];
197
+ for(let i = 0; i < functions.length; i++){
198
+ const fn = functions[i];
199
+ const fnSelector = await FunctionSelector.fromNameAndParameters(fn.name, fn.parameters);
200
+ if (fnSelector.equals(selector)) {
201
+ return fn;
202
+ }
203
+ }
204
+ }
205
+ async getFunctionCall(functionName, args, to) {
206
+ const contract = await this.getContract(to);
207
+ if (!contract) {
208
+ throw new Error(`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`);
209
+ }
210
+ const functionDao = contract.functions.find((f)=>f.name === functionName);
211
+ if (!functionDao) {
212
+ throw new Error(`Unknown function ${functionName} in contract ${contract.name}.`);
213
+ }
214
+ return {
215
+ name: functionDao.name,
216
+ args: encodeArguments(functionDao, args),
217
+ selector: await FunctionSelector.fromNameAndParameters(functionDao.name, functionDao.parameters),
218
+ type: functionDao.functionType,
219
+ to,
220
+ hideMsgSender: false,
221
+ isStatic: functionDao.isStatic,
222
+ returnTypes: functionDao.returnTypes
223
+ };
224
+ }
225
+ // Synchronize target contract data
226
+ async syncPrivateState(contractAddress, functionToInvokeAfterSync, utilityExecutor) {
227
+ // Protocol contracts don't have private state to sync
228
+ if (!isProtocolContract(contractAddress)) {
229
+ const syncPrivateStateFunctionCall = await this.getFunctionCall('sync_private_state', [], contractAddress);
230
+ if (functionToInvokeAfterSync && functionToInvokeAfterSync.equals(syncPrivateStateFunctionCall.selector)) {
231
+ throw new Error('Forbidden `sync_private_state` invocation. `sync_private_state` can only be invoked by PXE, manual execution can lead to inconsistencies.');
232
+ }
233
+ return utilityExecutor(syncPrivateStateFunctionCall);
234
+ }
235
+ }
236
+ }
@@ -0,0 +1,2 @@
1
+ export { ContractStore } from './contract_store.js';
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zdG9yYWdlL2NvbnRyYWN0X3N0b3JlL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxhQUFhLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQyJ9
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/contract_store/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1 @@
1
+ export { ContractStore } from './contract_store.js';
@@ -0,0 +1,27 @@
1
+ import { FUNCTION_TREE_HEIGHT } from '@aztec/constants';
2
+ import { MembershipWitness } from '@aztec/foundation/trees';
3
+ import { type ContractArtifact, FunctionSelector } from '@aztec/stdlib/abi';
4
+ /**
5
+ * Represents a Merkle tree of functions for a particular Contract Class.
6
+ * It manages the construction of the function tree, computes its root, and generates membership witnesses
7
+ * for constrained functions. This class also enables lookup of specific function artifact using selectors.
8
+ * It is used in combination with the AztecNode to compute various data for executing private transactions.
9
+ */
10
+ export declare class PrivateFunctionsTree {
11
+ private readonly privateFunctions;
12
+ private tree?;
13
+ private constructor();
14
+ static create(artifact: ContractArtifact): Promise<PrivateFunctionsTree>;
15
+ /**
16
+ * Retrieve the membership witness of a function within a contract's function tree.
17
+ * A membership witness represents the position and authentication path of a target function
18
+ * in the Merkle tree of constrained functions. It is required to prove the existence of the
19
+ * function within the contract during execution. Throws if fn does not exist or is not private.
20
+ *
21
+ * @param selector - The function selector.
22
+ * @returns A MembershipWitness instance representing the position and authentication path of the function in the function tree.
23
+ */
24
+ getFunctionMembershipWitness(selector: FunctionSelector): Promise<MembershipWitness<typeof FUNCTION_TREE_HEIGHT>>;
25
+ private getTree;
26
+ }
27
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJpdmF0ZV9mdW5jdGlvbnNfdHJlZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3N0b3JhZ2UvY29udHJhY3Rfc3RvcmUvcHJpdmF0ZV9mdW5jdGlvbnNfdHJlZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsb0JBQW9CLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUd4RCxPQUFPLEVBQUUsaUJBQWlCLEVBQW1CLE1BQU0seUJBQXlCLENBQUM7QUFDN0UsT0FBTyxFQUFFLEtBQUssZ0JBQWdCLEVBQUUsZ0JBQWdCLEVBQWdCLE1BQU0sbUJBQW1CLENBQUM7QUFRMUY7Ozs7O0dBS0c7QUFDSCxxQkFBYSxvQkFBb0I7SUFHWCxPQUFPLENBQUMsUUFBUSxDQUFDLGdCQUFnQjtJQUZyRCxPQUFPLENBQUMsSUFBSSxDQUFDLENBQWE7SUFFMUIsT0FBTyxlQUFxRTtJQUU1RSxPQUFhLE1BQU0sQ0FBQyxRQUFRLEVBQUUsZ0JBQWdCLGlDQU83QztJQUVEOzs7Ozs7OztPQVFHO0lBQ1UsNEJBQTRCLENBQ3ZDLFFBQVEsRUFBRSxnQkFBZ0IsR0FDekIsT0FBTyxDQUFDLGlCQUFpQixDQUFDLE9BQU8sb0JBQW9CLENBQUMsQ0FBQyxDQWV6RDtZQUVhLE9BQU87Q0FNdEIifQ==
@@ -0,0 +1 @@
1
+ {"version":3,"file":"private_functions_tree.d.ts","sourceRoot":"","sources":["../../../src/storage/contract_store/private_functions_tree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAGxD,OAAO,EAAE,iBAAiB,EAAmB,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EAAE,KAAK,gBAAgB,EAAE,gBAAgB,EAAgB,MAAM,mBAAmB,CAAC;AAQ1F;;;;;GAKG;AACH,qBAAa,oBAAoB;IAGX,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAFrD,OAAO,CAAC,IAAI,CAAC,CAAa;IAE1B,OAAO,eAAqE;IAE5E,OAAa,MAAM,CAAC,QAAQ,EAAE,gBAAgB,iCAO7C;IAED;;;;;;;;OAQG;IACU,4BAA4B,CACvC,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,iBAAiB,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAezD;YAEa,OAAO;CAMtB"}
@@ -0,0 +1,47 @@
1
+ import { FUNCTION_TREE_HEIGHT } from '@aztec/constants';
2
+ import { Fr } from '@aztec/foundation/curves/bn254';
3
+ import { assertLength } from '@aztec/foundation/serialize';
4
+ import { MembershipWitness } from '@aztec/foundation/trees';
5
+ import { FunctionType } from '@aztec/stdlib/abi';
6
+ import { computePrivateFunctionLeaf, computePrivateFunctionsTree, getContractClassPrivateFunctionFromArtifact } from '@aztec/stdlib/contract';
7
+ /**
8
+ * Represents a Merkle tree of functions for a particular Contract Class.
9
+ * It manages the construction of the function tree, computes its root, and generates membership witnesses
10
+ * for constrained functions. This class also enables lookup of specific function artifact using selectors.
11
+ * It is used in combination with the AztecNode to compute various data for executing private transactions.
12
+ */ export class PrivateFunctionsTree {
13
+ privateFunctions;
14
+ tree;
15
+ constructor(privateFunctions){
16
+ this.privateFunctions = privateFunctions;
17
+ }
18
+ static async create(artifact) {
19
+ const privateFunctions = await Promise.all(artifact.functions.filter((fn)=>fn.functionType === FunctionType.PRIVATE).map(getContractClassPrivateFunctionFromArtifact));
20
+ return new PrivateFunctionsTree(privateFunctions);
21
+ }
22
+ /**
23
+ * Retrieve the membership witness of a function within a contract's function tree.
24
+ * A membership witness represents the position and authentication path of a target function
25
+ * in the Merkle tree of constrained functions. It is required to prove the existence of the
26
+ * function within the contract during execution. Throws if fn does not exist or is not private.
27
+ *
28
+ * @param selector - The function selector.
29
+ * @returns A MembershipWitness instance representing the position and authentication path of the function in the function tree.
30
+ */ async getFunctionMembershipWitness(selector) {
31
+ const fn = this.privateFunctions.find((f)=>f.selector.equals(selector));
32
+ if (!fn) {
33
+ throw new Error(`Private function with selector ${selector.toString()} not found in contract class.`);
34
+ }
35
+ const leaf = await computePrivateFunctionLeaf(fn);
36
+ const tree = await this.getTree();
37
+ const index = tree.getIndex(leaf);
38
+ const path = tree.getSiblingPath(index);
39
+ return new MembershipWitness(FUNCTION_TREE_HEIGHT, BigInt(index), assertLength(path.map(Fr.fromBuffer), FUNCTION_TREE_HEIGHT));
40
+ }
41
+ async getTree() {
42
+ if (!this.tree) {
43
+ this.tree = await computePrivateFunctionsTree(this.privateFunctions);
44
+ }
45
+ return this.tree;
46
+ }
47
+ }
@@ -1,10 +1,9 @@
1
- export * from './address_data_provider/index.js';
2
- export * from './auth_witness_data_provider/index.js';
3
- export * from './capsule_data_provider/index.js';
4
- export * from './contract_data_provider/index.js';
5
- export * from './note_data_provider/index.js';
6
- export * from './sync_data_provider/index.js';
7
- export * from './tagging_data_provider/index.js';
8
- export * from './data_provider.js';
9
- export declare const PXE_DATA_SCHEMA_VERSION = 2;
10
- //# sourceMappingURL=index.d.ts.map
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
+ export * from './metadata.js';
8
+ export * from './private_event_store/private_event_store.js';
9
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zdG9yYWdlL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsMEJBQTBCLENBQUM7QUFDekMsY0FBYywwQkFBMEIsQ0FBQztBQUN6QyxjQUFjLDJCQUEyQixDQUFDO0FBQzFDLGNBQWMsdUJBQXVCLENBQUM7QUFDdEMsY0FBYywrQkFBK0IsQ0FBQztBQUM5QyxjQUFjLDBCQUEwQixDQUFDO0FBQ3pDLGNBQWMsZUFBZSxDQUFDO0FBQzlCLGNBQWMsOENBQThDLENBQUMifQ==
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,uCAAuC,CAAC;AACtD,cAAc,kCAAkC,CAAC;AACjD,cAAc,mCAAmC,CAAC;AAClD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,oBAAoB,CAAC;AAEnC,eAAO,MAAM,uBAAuB,IAAI,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,8CAA8C,CAAC"}
@@ -1,9 +1,8 @@
1
- export * from './address_data_provider/index.js';
2
- export * from './auth_witness_data_provider/index.js';
3
- export * from './capsule_data_provider/index.js';
4
- export * from './contract_data_provider/index.js';
5
- export * from './note_data_provider/index.js';
6
- export * from './sync_data_provider/index.js';
7
- export * from './tagging_data_provider/index.js';
8
- export * from './data_provider.js';
9
- export const PXE_DATA_SCHEMA_VERSION = 2;
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
+ export * from './metadata.js';
8
+ export * from './private_event_store/private_event_store.js';
@@ -0,0 +1,2 @@
1
+ export declare const PXE_DATA_SCHEMA_VERSION = 2;
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWV0YWRhdGEuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zdG9yYWdlL21ldGFkYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGVBQU8sTUFBTSx1QkFBdUIsSUFBSSxDQUFDIn0=
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../src/storage/metadata.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,IAAI,CAAC"}
@@ -0,0 +1 @@
1
+ export const PXE_DATA_SCHEMA_VERSION = 2;
@@ -0,0 +1,3 @@
1
+ export { NoteDao } from '@aztec/stdlib/note';
2
+ export { NoteStore } from './note_store.js';
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zdG9yYWdlL25vdGVfc3RvcmUvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLE9BQU8sRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBQzdDLE9BQU8sRUFBRSxTQUFTLEVBQUUsTUFBTSxpQkFBaUIsQ0FBQyJ9
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/note_store/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { NoteDao } from '@aztec/stdlib/note';
2
+ export { NoteStore } from './note_store.js';
@@ -0,0 +1,84 @@
1
+ import type { Fr } from '@aztec/foundation/curves/bn254';
2
+ import type { AztecAsyncKVStore } from '@aztec/kv-store';
3
+ import { AztecAddress } from '@aztec/stdlib/aztec-address';
4
+ import type { DataInBlock } from '@aztec/stdlib/block';
5
+ import { type NotesFilter } from '@aztec/stdlib/note';
6
+ import { NoteDao } from '@aztec/stdlib/note';
7
+ /**
8
+ * NoteStore manages the storage and retrieval of notes.
9
+ *
10
+ * Notes can be active or nullified. This class processes new notes, nullifications,
11
+ * and performs rollback handling in the case of a reorg.
12
+ **/
13
+ export declare class NoteStore {
14
+ #private;
15
+ private constructor();
16
+ /**
17
+ * Creates and initializes a new NoteStore instance.
18
+ *
19
+ * This factory method creates a NoteStore and restores any existing
20
+ * scope-specific indexes from the database.
21
+ *
22
+ * @param store - The key-value store to use for persistence
23
+ * @returns Promise resolving to a fully initialized NoteStore instance
24
+ */
25
+ static create(store: AztecAsyncKVStore): Promise<NoteStore>;
26
+ /**
27
+ * Adds a new scope to the note data provider.
28
+ *
29
+ * Scopes provide privacy isolation by creating separate indexes for each user.
30
+ * Each scope gets its own set of indexes for efficient note retrieval by various criteria.
31
+ *
32
+ * @param scope - The AztecAddress representing the scope/user to add
33
+ * @returns Promise resolving to true if scope was added, false if it already existed
34
+ */
35
+ addScope(scope: AztecAddress): Promise<boolean>;
36
+ /**
37
+ * Adds multiple notes to the data provider under the specified scope.
38
+ *
39
+ * Notes are stored using their index from the notes hash tree as the key, which provides
40
+ * uniqueness and maintains creation order. Each note is indexed by multiple criteria
41
+ * for efficient retrieval.
42
+ *
43
+ * @param notes - Notes to store
44
+ * @param scope - The scope (user/account) under which to store the notes
45
+ */
46
+ addNotes(notes: NoteDao[], scope: AztecAddress): Promise<void>;
47
+ /**
48
+ * Synchronizes notes and nullifiers to a specific block number.
49
+ *
50
+ * This method ensures that the state of notes and nullifiers is consistent with the
51
+ * specified block number. It restores any notes that were nullified after the given block
52
+ * and deletes any active notes created after that block.
53
+ *
54
+ * @param blockNumber - The new chain tip after a reorg
55
+ * @param synchedBlockNumber - The block number up to which PXE managed to sync before the reorg happened.
56
+ */
57
+ rollbackNotesAndNullifiers(blockNumber: number, synchedBlockNumber: number): Promise<void>;
58
+ /**
59
+ * Retrieves notes based on the provided filter criteria.
60
+ *
61
+ * This method queries both active and optionally nullified notes based on the filter
62
+ * parameters.
63
+ *
64
+ * @param filter - Filter criteria including contractAddress (required), and optional
65
+ * owner, storageSlot, status, scopes, and siloedNullifier.
66
+ * @returns Filtered and deduplicated notes (a note might be present in multiple scopes - we ensure it is only
67
+ * returned once if this is the case)
68
+ * @throws If filtering by an empty scopes array. Scopes have to be set to undefined or to a non-empty array.
69
+ */
70
+ getNotes(filter: NotesFilter): Promise<NoteDao[]>;
71
+ /**
72
+ * Transitions notes from "active" to "nullified" state.
73
+ *
74
+ * This operation processes a batch of nullifiers to mark the corresponding notes
75
+ * as spent/nullified. The operation is atomic - if any nullifier is not found,
76
+ * the entire operation fails and no notes are modified.
77
+ *
78
+ * @param nullifiers - Array of nullifiers with their block numbers to process
79
+ * @returns Promise resolving to array of nullified NoteDao objects
80
+ * @throws Error if any nullifier is not found in the active notes
81
+ */
82
+ applyNullifiers(nullifiers: DataInBlock<Fr>[]): Promise<NoteDao[]>;
83
+ }
84
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm90ZV9zdG9yZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3N0b3JhZ2Uvbm90ZV9zdG9yZS9ub3RlX3N0b3JlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sS0FBSyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBRXpELE9BQU8sS0FBSyxFQUFFLGlCQUFpQixFQUFxQyxNQUFNLGlCQUFpQixDQUFDO0FBQzVGLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUMzRCxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUN2RCxPQUFPLEVBQWMsS0FBSyxXQUFXLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUNsRSxPQUFPLEVBQUUsT0FBTyxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFFN0M7Ozs7O0lBS0k7QUFDSixxQkFBYSxTQUFTOztJQWlCcEIsT0FBTyxlQWdCTjtJQUVEOzs7Ozs7OztPQVFHO0lBQ0gsT0FBb0IsTUFBTSxDQUFDLEtBQUssRUFBRSxpQkFBaUIsR0FBRyxPQUFPLENBQUMsU0FBUyxDQUFDLENBT3ZFO0lBRUQ7Ozs7Ozs7O09BUUc7SUFDVSxRQUFRLENBQUMsS0FBSyxFQUFFLFlBQVksR0FBRyxPQUFPLENBQUMsT0FBTyxDQUFDLENBWTNEO0lBRUQ7Ozs7Ozs7OztPQVNHO0lBQ0gsUUFBUSxDQUFDLEtBQUssRUFBRSxPQUFPLEVBQUUsRUFBRSxLQUFLLEVBQUUsWUFBWSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FnQjdEO0lBRUQ7Ozs7Ozs7OztPQVNHO0lBQ1UsMEJBQTBCLENBQUMsV0FBVyxFQUFFLE1BQU0sRUFBRSxrQkFBa0IsRUFBRSxNQUFNLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxDQUd0RztJQXVGRDs7Ozs7Ozs7Ozs7T0FXRztJQUNHLFFBQVEsQ0FBQyxNQUFNLEVBQUUsV0FBVyxHQUFHLE9BQU8sQ0FBQyxPQUFPLEVBQUUsQ0FBQyxDQXdHdEQ7SUFFRDs7Ozs7Ozs7OztPQVVHO0lBQ0gsZUFBZSxDQUFDLFVBQVUsRUFBRSxXQUFXLENBQUMsRUFBRSxDQUFDLEVBQUUsR0FBRyxPQUFPLENBQUMsT0FBTyxFQUFFLENBQUMsQ0E4RGpFO0NBQ0YifQ==
@@ -0,0 +1 @@
1
+ {"version":3,"file":"note_store.d.ts","sourceRoot":"","sources":["../../../src/storage/note_store/note_store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAEzD,OAAO,KAAK,EAAE,iBAAiB,EAAqC,MAAM,iBAAiB,CAAC;AAC5F,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAc,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C;;;;;IAKI;AACJ,qBAAa,SAAS;;IAiBpB,OAAO,eAgBN;IAED;;;;;;;;OAQG;IACH,OAAoB,MAAM,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,SAAS,CAAC,CAOvE;IAED;;;;;;;;OAQG;IACU,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CAY3D;IAED;;;;;;;;;OASG;IACH,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAgB7D;IAED;;;;;;;;;OASG;IACU,0BAA0B,CAAC,WAAW,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGtG;IAuFD;;;;;;;;;;;OAWG;IACG,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAwGtD;IAED;;;;;;;;;;OAUG;IACH,eAAe,CAAC,UAAU,EAAE,WAAW,CAAC,EAAE,CAAC,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CA8DjE;CACF"}