@aztec/pxe 0.0.0-test.1 → 0.0.1-commit.0208eb9

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 (458) 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 +43 -0
  6. package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -0
  7. package/dest/block_synchronizer/block_synchronizer.js +147 -0
  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 +13 -24
  12. package/dest/config/index.d.ts.map +1 -1
  13. package/dest/config/index.js +35 -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/benchmarked_node.d.ts +9 -0
  17. package/dest/contract_function_simulator/benchmarked_node.d.ts.map +1 -0
  18. package/dest/contract_function_simulator/benchmarked_node.js +77 -0
  19. package/dest/contract_function_simulator/contract_function_simulator.d.ts +82 -0
  20. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -0
  21. package/dest/contract_function_simulator/contract_function_simulator.js +339 -0
  22. package/dest/contract_function_simulator/execution_note_cache.d.ts +104 -0
  23. package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -0
  24. package/dest/contract_function_simulator/execution_note_cache.js +208 -0
  25. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +16 -0
  26. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -0
  27. package/dest/contract_function_simulator/execution_tagging_index_cache.js +26 -0
  28. package/dest/contract_function_simulator/hashed_values_cache.d.ts +28 -0
  29. package/dest/contract_function_simulator/hashed_values_cache.d.ts.map +1 -0
  30. package/dest/contract_function_simulator/hashed_values_cache.js +36 -0
  31. package/dest/contract_function_simulator/index.d.ts +14 -0
  32. package/dest/contract_function_simulator/index.d.ts.map +1 -0
  33. package/dest/contract_function_simulator/index.js +12 -0
  34. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +21 -0
  35. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -0
  36. package/dest/contract_function_simulator/noir-structs/event_validation_request.js +40 -0
  37. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +16 -0
  38. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts.map +1 -0
  39. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.js +26 -0
  40. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +17 -0
  41. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -0
  42. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +65 -0
  43. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +24 -0
  44. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -0
  45. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +51 -0
  46. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +16 -0
  47. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -0
  48. package/dest/contract_function_simulator/noir-structs/utility_context.js +22 -0
  49. package/dest/contract_function_simulator/oracle/index.d.ts +14 -0
  50. package/dest/contract_function_simulator/oracle/index.d.ts.map +1 -0
  51. package/dest/contract_function_simulator/oracle/index.js +2 -0
  52. package/dest/contract_function_simulator/oracle/interfaces.d.ts +107 -0
  53. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -0
  54. package/dest/contract_function_simulator/oracle/interfaces.js +4 -0
  55. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +19 -0
  56. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -0
  57. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.js +24 -0
  58. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +28 -0
  59. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -0
  60. package/dest/contract_function_simulator/oracle/note_packing_utils.js +54 -0
  61. package/dest/contract_function_simulator/oracle/oracle.d.ts +60 -0
  62. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -0
  63. package/dest/contract_function_simulator/oracle/oracle.js +368 -0
  64. package/dest/contract_function_simulator/oracle/private_execution.d.ts +23 -0
  65. package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -0
  66. package/dest/contract_function_simulator/oracle/private_execution.js +87 -0
  67. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +239 -0
  68. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -0
  69. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +426 -0
  70. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +208 -0
  71. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -0
  72. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +367 -0
  73. package/dest/contract_function_simulator/pick_notes.d.ts +85 -0
  74. package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -0
  75. package/dest/contract_function_simulator/pick_notes.js +51 -0
  76. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +6 -0
  77. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -0
  78. package/dest/contract_function_simulator/proxied_contract_data_source.js +80 -0
  79. package/dest/contract_sync/index.d.ts +24 -0
  80. package/dest/contract_sync/index.d.ts.map +1 -0
  81. package/dest/contract_sync/index.js +61 -0
  82. package/dest/debug/pxe_debug_utils.d.ts +41 -0
  83. package/dest/debug/pxe_debug_utils.d.ts.map +1 -0
  84. package/dest/debug/pxe_debug_utils.js +47 -0
  85. package/dest/entrypoints/client/bundle/index.d.ts +4 -3
  86. package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
  87. package/dest/entrypoints/client/bundle/index.js +2 -2
  88. package/dest/entrypoints/client/bundle/utils.d.ts +10 -10
  89. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  90. package/dest/entrypoints/client/bundle/utils.js +33 -12
  91. package/dest/entrypoints/client/lazy/index.d.ts +4 -3
  92. package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
  93. package/dest/entrypoints/client/lazy/index.js +2 -2
  94. package/dest/entrypoints/client/lazy/utils.d.ts +10 -10
  95. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  96. package/dest/entrypoints/client/lazy/utils.js +33 -12
  97. package/dest/entrypoints/pxe_creation_options.d.ts +18 -0
  98. package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -0
  99. package/dest/entrypoints/server/index.d.ts +8 -4
  100. package/dest/entrypoints/server/index.d.ts.map +1 -1
  101. package/dest/entrypoints/server/index.js +6 -3
  102. package/dest/entrypoints/server/utils.d.ts +8 -16
  103. package/dest/entrypoints/server/utils.d.ts.map +1 -1
  104. package/dest/entrypoints/server/utils.js +46 -36
  105. package/dest/error_enriching.d.ts +11 -0
  106. package/dest/error_enriching.d.ts.map +1 -0
  107. package/dest/{pxe_service/error_enriching.js → error_enriching.js} +30 -22
  108. package/dest/events/event_service.d.ts +15 -0
  109. package/dest/events/event_service.d.ts.map +1 -0
  110. package/dest/events/event_service.js +44 -0
  111. package/dest/events/index.d.ts +2 -0
  112. package/dest/events/index.d.ts.map +1 -0
  113. package/dest/events/index.js +1 -0
  114. package/dest/events/private_event_filter_validator.d.ts +9 -0
  115. package/dest/events/private_event_filter_validator.d.ts.map +1 -0
  116. package/dest/events/private_event_filter_validator.js +38 -0
  117. package/dest/job_coordinator/job_coordinator.d.ts +75 -0
  118. package/dest/job_coordinator/job_coordinator.d.ts.map +1 -0
  119. package/dest/job_coordinator/job_coordinator.js +94 -0
  120. package/dest/logs/log_service.d.ts +28 -0
  121. package/dest/logs/log_service.d.ts.map +1 -0
  122. package/dest/logs/log_service.js +123 -0
  123. package/dest/notes/index.d.ts +2 -0
  124. package/dest/notes/index.d.ts.map +1 -0
  125. package/dest/notes/index.js +1 -0
  126. package/dest/notes/note_service.d.ts +48 -0
  127. package/dest/notes/note_service.d.ts.map +1 -0
  128. package/dest/notes/note_service.js +147 -0
  129. package/dest/oracle_version.d.ts +3 -0
  130. package/dest/oracle_version.d.ts.map +1 -0
  131. package/dest/oracle_version.js +11 -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/private_kernel/hints/index.js +2 -0
  138. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +28 -0
  139. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -0
  140. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.js +277 -0
  141. package/dest/private_kernel/index.d.ts +3 -0
  142. package/dest/private_kernel/index.d.ts.map +1 -0
  143. package/dest/private_kernel/index.js +2 -0
  144. package/dest/private_kernel/private_kernel_execution_prover.d.ts +45 -0
  145. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -0
  146. package/dest/private_kernel/private_kernel_execution_prover.js +285 -0
  147. package/dest/private_kernel/private_kernel_oracle.d.ts +59 -0
  148. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -0
  149. package/dest/private_kernel/private_kernel_oracle.js +92 -0
  150. package/dest/pxe.d.ts +204 -0
  151. package/dest/pxe.d.ts.map +1 -0
  152. package/dest/pxe.js +742 -0
  153. package/dest/storage/address_store/address_store.d.ts +11 -0
  154. package/dest/storage/address_store/address_store.d.ts.map +1 -0
  155. package/dest/storage/{address_data_provider/address_data_provider.js → address_store/address_store.js} +13 -15
  156. package/dest/storage/address_store/index.d.ts +2 -0
  157. package/dest/storage/address_store/index.d.ts.map +1 -0
  158. package/dest/storage/address_store/index.js +1 -0
  159. package/dest/storage/anchor_block_store/anchor_block_store.d.ts +17 -0
  160. package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -0
  161. package/dest/storage/anchor_block_store/anchor_block_store.js +26 -0
  162. package/dest/storage/anchor_block_store/index.d.ts +2 -0
  163. package/dest/storage/anchor_block_store/index.d.ts.map +1 -0
  164. package/dest/storage/anchor_block_store/index.js +1 -0
  165. package/dest/storage/capsule_store/capsule_store.d.ts +72 -0
  166. package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -0
  167. package/dest/storage/capsule_store/capsule_store.js +253 -0
  168. package/dest/storage/capsule_store/index.d.ts +2 -0
  169. package/dest/storage/capsule_store/index.d.ts.map +1 -0
  170. package/dest/storage/capsule_store/index.js +1 -0
  171. package/dest/storage/contract_store/contract_store.d.ts +66 -0
  172. package/dest/storage/contract_store/contract_store.d.ts.map +1 -0
  173. package/dest/storage/contract_store/contract_store.js +233 -0
  174. package/dest/storage/contract_store/index.d.ts +2 -0
  175. package/dest/storage/contract_store/index.d.ts.map +1 -0
  176. package/dest/storage/contract_store/index.js +1 -0
  177. package/dest/storage/contract_store/private_functions_tree.d.ts +27 -0
  178. package/dest/storage/contract_store/private_functions_tree.d.ts.map +1 -0
  179. package/dest/storage/contract_store/private_functions_tree.js +47 -0
  180. package/dest/storage/index.d.ts +9 -10
  181. package/dest/storage/index.d.ts.map +1 -1
  182. package/dest/storage/index.js +8 -9
  183. package/dest/storage/metadata.d.ts +2 -0
  184. package/dest/storage/metadata.d.ts.map +1 -0
  185. package/dest/storage/metadata.js +1 -0
  186. package/dest/storage/note_store/index.d.ts +3 -0
  187. package/dest/storage/note_store/index.d.ts.map +1 -0
  188. package/dest/storage/note_store/index.js +2 -0
  189. package/dest/storage/note_store/note_store.d.ts +83 -0
  190. package/dest/storage/note_store/note_store.d.ts.map +1 -0
  191. package/dest/storage/note_store/note_store.js +341 -0
  192. package/dest/storage/note_store/stored_note.d.ts +16 -0
  193. package/dest/storage/note_store/stored_note.d.ts.map +1 -0
  194. package/dest/storage/note_store/stored_note.js +43 -0
  195. package/dest/storage/private_event_store/private_event_store.d.ts +91 -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 +273 -0
  198. package/dest/storage/private_event_store/stored_private_event.d.ts +23 -0
  199. package/dest/storage/private_event_store/stored_private_event.d.ts.map +1 -0
  200. package/dest/storage/private_event_store/stored_private_event.js +56 -0
  201. package/dest/storage/tagging_store/index.d.ts +4 -0
  202. package/dest/storage/tagging_store/index.d.ts.map +1 -0
  203. package/dest/storage/tagging_store/index.js +3 -0
  204. package/dest/storage/tagging_store/recipient_tagging_store.d.ts +28 -0
  205. package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -0
  206. package/dest/storage/tagging_store/recipient_tagging_store.js +111 -0
  207. package/dest/storage/tagging_store/sender_address_book_store.d.ts +14 -0
  208. package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +1 -0
  209. package/dest/storage/tagging_store/sender_address_book_store.js +36 -0
  210. package/dest/storage/tagging_store/sender_tagging_store.d.ts +77 -0
  211. package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -0
  212. package/dest/storage/tagging_store/sender_tagging_store.js +348 -0
  213. package/dest/tagging/constants.d.ts +2 -0
  214. package/dest/tagging/constants.d.ts.map +1 -0
  215. package/dest/tagging/constants.js +10 -0
  216. package/dest/tagging/get_all_logs_by_tags.d.ts +24 -0
  217. package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -0
  218. package/dest/tagging/get_all_logs_by_tags.js +46 -0
  219. package/dest/tagging/index.d.ts +17 -0
  220. package/dest/tagging/index.d.ts.map +1 -0
  221. package/dest/tagging/index.js +15 -0
  222. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +15 -0
  223. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -0
  224. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +99 -0
  225. package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts +12 -0
  226. package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts.map +1 -0
  227. package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +20 -0
  228. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +15 -0
  229. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -0
  230. package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +32 -0
  231. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +21 -0
  232. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -0
  233. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +74 -0
  234. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +11 -0
  235. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -0
  236. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +29 -0
  237. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +21 -0
  238. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -0
  239. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +60 -0
  240. package/package.json +37 -34
  241. package/src/bin/check_oracle_version.ts +161 -0
  242. package/src/block_synchronizer/block_synchronizer.ts +172 -0
  243. package/src/block_synchronizer/index.ts +1 -0
  244. package/src/config/index.ts +41 -55
  245. package/src/config/package_info.ts +1 -1
  246. package/src/contract_function_simulator/benchmarked_node.ts +103 -0
  247. package/src/contract_function_simulator/contract_function_simulator.ts +633 -0
  248. package/src/contract_function_simulator/execution_note_cache.ts +252 -0
  249. package/src/contract_function_simulator/execution_tagging_index_cache.ts +32 -0
  250. package/src/contract_function_simulator/hashed_values_cache.ts +47 -0
  251. package/src/contract_function_simulator/index.ts +13 -0
  252. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +51 -0
  253. package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +28 -0
  254. package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +69 -0
  255. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +64 -0
  256. package/src/contract_function_simulator/noir-structs/utility_context.ts +23 -0
  257. package/src/contract_function_simulator/oracle/index.ts +16 -0
  258. package/src/contract_function_simulator/oracle/interfaces.ts +185 -0
  259. package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +23 -0
  260. package/src/contract_function_simulator/oracle/note_packing_utils.ts +68 -0
  261. package/src/contract_function_simulator/oracle/oracle.ts +637 -0
  262. package/src/contract_function_simulator/oracle/private_execution.ts +141 -0
  263. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +701 -0
  264. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +544 -0
  265. package/src/contract_function_simulator/pick_notes.ts +141 -0
  266. package/src/contract_function_simulator/proxied_contract_data_source.ts +83 -0
  267. package/src/contract_sync/index.ts +119 -0
  268. package/src/debug/pxe_debug_utils.ts +63 -0
  269. package/src/entrypoints/client/bundle/index.ts +3 -2
  270. package/src/entrypoints/client/bundle/utils.ts +35 -36
  271. package/src/entrypoints/client/lazy/index.ts +3 -2
  272. package/src/entrypoints/client/lazy/utils.ts +36 -32
  273. package/src/entrypoints/pxe_creation_options.ts +14 -0
  274. package/src/entrypoints/server/index.ts +7 -3
  275. package/src/entrypoints/server/utils.ts +52 -52
  276. package/src/{pxe_service/error_enriching.ts → error_enriching.ts} +40 -39
  277. package/src/events/event_service.ts +71 -0
  278. package/src/events/index.ts +1 -0
  279. package/src/events/private_event_filter_validator.ts +46 -0
  280. package/src/job_coordinator/job_coordinator.ts +150 -0
  281. package/src/logs/log_service.ts +220 -0
  282. package/src/notes/index.ts +1 -0
  283. package/src/notes/note_service.ts +195 -0
  284. package/src/oracle_version.ts +12 -0
  285. package/src/private_kernel/hints/compute_tx_include_by_timestamp.ts +58 -0
  286. package/src/private_kernel/hints/index.ts +2 -0
  287. package/src/{kernel_prover/hints/build_private_kernel_reset_private_inputs.ts → private_kernel/hints/private_kernel_reset_private_inputs_builder.ts} +179 -156
  288. package/src/private_kernel/index.ts +2 -0
  289. package/src/private_kernel/private_kernel_execution_prover.ts +433 -0
  290. package/src/private_kernel/private_kernel_oracle.ts +152 -0
  291. package/src/pxe.ts +1076 -0
  292. package/src/storage/{address_data_provider/address_data_provider.ts → address_store/address_store.ts} +15 -21
  293. package/src/storage/address_store/index.ts +1 -0
  294. package/src/storage/{sync_data_provider/sync_data_provider.ts → anchor_block_store/anchor_block_store.ts} +10 -17
  295. package/src/storage/anchor_block_store/index.ts +1 -0
  296. package/src/storage/capsule_store/capsule_store.ts +315 -0
  297. package/src/storage/capsule_store/index.ts +1 -0
  298. package/src/storage/contract_store/contract_store.ts +330 -0
  299. package/src/storage/contract_store/index.ts +1 -0
  300. package/src/storage/contract_store/private_functions_tree.ts +67 -0
  301. package/src/storage/index.ts +8 -10
  302. package/src/storage/metadata.ts +1 -0
  303. package/src/storage/note_store/index.ts +2 -0
  304. package/src/storage/note_store/note_store.ts +411 -0
  305. package/src/storage/note_store/stored_note.ts +48 -0
  306. package/src/storage/private_event_store/private_event_store.ts +384 -0
  307. package/src/storage/private_event_store/stored_private_event.ts +73 -0
  308. package/src/storage/tagging_store/index.ts +3 -0
  309. package/src/storage/tagging_store/recipient_tagging_store.ts +139 -0
  310. package/src/storage/tagging_store/sender_address_book_store.ts +48 -0
  311. package/src/storage/tagging_store/sender_tagging_store.ts +429 -0
  312. package/src/tagging/constants.ts +10 -0
  313. package/src/tagging/get_all_logs_by_tags.ts +68 -0
  314. package/src/tagging/index.ts +19 -0
  315. package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +143 -0
  316. package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +34 -0
  317. package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +49 -0
  318. package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +99 -0
  319. package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +36 -0
  320. package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +84 -0
  321. package/dest/bin/index.d.ts +0 -3
  322. package/dest/bin/index.d.ts.map +0 -1
  323. package/dest/bin/index.js +0 -28
  324. package/dest/entrypoints/client/pxe_creation_options.d.ts +0 -11
  325. package/dest/entrypoints/client/pxe_creation_options.d.ts.map +0 -1
  326. package/dest/kernel_oracle/index.d.ts +0 -45
  327. package/dest/kernel_oracle/index.d.ts.map +0 -1
  328. package/dest/kernel_oracle/index.js +0 -76
  329. package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.d.ts +0 -28
  330. package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.d.ts.map +0 -1
  331. package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.js +0 -270
  332. package/dest/kernel_prover/hints/index.d.ts +0 -2
  333. package/dest/kernel_prover/hints/index.d.ts.map +0 -1
  334. package/dest/kernel_prover/hints/index.js +0 -1
  335. package/dest/kernel_prover/index.d.ts +0 -3
  336. package/dest/kernel_prover/index.d.ts.map +0 -1
  337. package/dest/kernel_prover/index.js +0 -2
  338. package/dest/kernel_prover/kernel_prover.d.ts +0 -38
  339. package/dest/kernel_prover/kernel_prover.d.ts.map +0 -1
  340. package/dest/kernel_prover/kernel_prover.js +0 -217
  341. package/dest/kernel_prover/proving_data_oracle.d.ts +0 -73
  342. package/dest/kernel_prover/proving_data_oracle.d.ts.map +0 -1
  343. package/dest/kernel_prover/proving_data_oracle.js +0 -4
  344. package/dest/note_decryption_utils/add_public_values_to_payload.d.ts +0 -11
  345. package/dest/note_decryption_utils/add_public_values_to_payload.d.ts.map +0 -1
  346. package/dest/note_decryption_utils/add_public_values_to_payload.js +0 -47
  347. package/dest/pxe_http/index.d.ts +0 -2
  348. package/dest/pxe_http/index.d.ts.map +0 -1
  349. package/dest/pxe_http/index.js +0 -1
  350. package/dest/pxe_http/pxe_http_server.d.ts +0 -16
  351. package/dest/pxe_http/pxe_http_server.d.ts.map +0 -1
  352. package/dest/pxe_http/pxe_http_server.js +0 -27
  353. package/dest/pxe_oracle_interface/index.d.ts +0 -159
  354. package/dest/pxe_oracle_interface/index.d.ts.map +0 -1
  355. package/dest/pxe_oracle_interface/index.js +0 -692
  356. package/dest/pxe_oracle_interface/tagging_utils.d.ts +0 -17
  357. package/dest/pxe_oracle_interface/tagging_utils.d.ts.map +0 -1
  358. package/dest/pxe_oracle_interface/tagging_utils.js +0 -23
  359. package/dest/pxe_service/error_enriching.d.ts +0 -11
  360. package/dest/pxe_service/error_enriching.d.ts.map +0 -1
  361. package/dest/pxe_service/index.d.ts +0 -3
  362. package/dest/pxe_service/index.d.ts.map +0 -1
  363. package/dest/pxe_service/index.js +0 -2
  364. package/dest/pxe_service/pxe_service.d.ts +0 -111
  365. package/dest/pxe_service/pxe_service.d.ts.map +0 -1
  366. package/dest/pxe_service/pxe_service.js +0 -664
  367. package/dest/storage/address_data_provider/address_data_provider.d.ts +0 -13
  368. package/dest/storage/address_data_provider/address_data_provider.d.ts.map +0 -1
  369. package/dest/storage/address_data_provider/index.d.ts +0 -2
  370. package/dest/storage/address_data_provider/index.d.ts.map +0 -1
  371. package/dest/storage/address_data_provider/index.js +0 -1
  372. package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.d.ts +0 -11
  373. package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.d.ts.map +0 -1
  374. package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.js +0 -20
  375. package/dest/storage/auth_witness_data_provider/index.d.ts +0 -2
  376. package/dest/storage/auth_witness_data_provider/index.d.ts.map +0 -1
  377. package/dest/storage/auth_witness_data_provider/index.js +0 -1
  378. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts +0 -16
  379. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +0 -1
  380. package/dest/storage/capsule_data_provider/capsule_data_provider.js +0 -57
  381. package/dest/storage/capsule_data_provider/index.d.ts +0 -2
  382. package/dest/storage/capsule_data_provider/index.d.ts.map +0 -1
  383. package/dest/storage/capsule_data_provider/index.js +0 -1
  384. package/dest/storage/contract_data_provider/contract_data_provider.d.ts +0 -109
  385. package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +0 -1
  386. package/dest/storage/contract_data_provider/contract_data_provider.js +0 -183
  387. package/dest/storage/contract_data_provider/index.d.ts +0 -3
  388. package/dest/storage/contract_data_provider/index.d.ts.map +0 -1
  389. package/dest/storage/contract_data_provider/index.js +0 -2
  390. package/dest/storage/contract_data_provider/private_functions_tree.d.ts +0 -66
  391. package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +0 -1
  392. package/dest/storage/contract_data_provider/private_functions_tree.js +0 -99
  393. package/dest/storage/data_provider.d.ts +0 -4
  394. package/dest/storage/data_provider.d.ts.map +0 -1
  395. package/dest/storage/data_provider.js +0 -1
  396. package/dest/storage/note_data_provider/index.d.ts +0 -3
  397. package/dest/storage/note_data_provider/index.d.ts.map +0 -1
  398. package/dest/storage/note_data_provider/index.js +0 -2
  399. package/dest/storage/note_data_provider/note_dao.d.ts +0 -106
  400. package/dest/storage/note_data_provider/note_dao.d.ts.map +0 -1
  401. package/dest/storage/note_data_provider/note_dao.js +0 -106
  402. package/dest/storage/note_data_provider/note_data_provider.d.ts +0 -20
  403. package/dest/storage/note_data_provider/note_data_provider.d.ts.map +0 -1
  404. package/dest/storage/note_data_provider/note_data_provider.js +0 -249
  405. package/dest/storage/sync_data_provider/index.d.ts +0 -2
  406. package/dest/storage/sync_data_provider/index.d.ts.map +0 -1
  407. package/dest/storage/sync_data_provider/index.js +0 -1
  408. package/dest/storage/sync_data_provider/sync_data_provider.d.ts +0 -12
  409. package/dest/storage/sync_data_provider/sync_data_provider.d.ts.map +0 -1
  410. package/dest/storage/sync_data_provider/sync_data_provider.js +0 -29
  411. package/dest/storage/tagging_data_provider/index.d.ts +0 -2
  412. package/dest/storage/tagging_data_provider/index.d.ts.map +0 -1
  413. package/dest/storage/tagging_data_provider/index.js +0 -1
  414. package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts +0 -18
  415. package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts.map +0 -1
  416. package/dest/storage/tagging_data_provider/tagging_data_provider.js +0 -65
  417. package/dest/synchronizer/index.d.ts +0 -2
  418. package/dest/synchronizer/index.d.ts.map +0 -1
  419. package/dest/synchronizer/index.js +0 -1
  420. package/dest/synchronizer/synchronizer.d.ts +0 -37
  421. package/dest/synchronizer/synchronizer.d.ts.map +0 -1
  422. package/dest/synchronizer/synchronizer.js +0 -103
  423. package/dest/test/pxe_test_suite.d.ts +0 -3
  424. package/dest/test/pxe_test_suite.d.ts.map +0 -1
  425. package/dest/test/pxe_test_suite.js +0 -97
  426. package/src/bin/index.ts +0 -38
  427. package/src/entrypoints/client/pxe_creation_options.ts +0 -7
  428. package/src/kernel_oracle/index.ts +0 -117
  429. package/src/kernel_prover/hints/index.ts +0 -1
  430. package/src/kernel_prover/index.ts +0 -2
  431. package/src/kernel_prover/kernel_prover.ts +0 -351
  432. package/src/kernel_prover/proving_data_oracle.ts +0 -83
  433. package/src/note_decryption_utils/add_public_values_to_payload.ts +0 -64
  434. package/src/pxe_http/index.ts +0 -1
  435. package/src/pxe_http/pxe_http_server.ts +0 -29
  436. package/src/pxe_oracle_interface/index.ts +0 -925
  437. package/src/pxe_oracle_interface/tagging_utils.ts +0 -32
  438. package/src/pxe_service/index.ts +0 -2
  439. package/src/pxe_service/pxe_service.ts +0 -949
  440. package/src/storage/address_data_provider/index.ts +0 -1
  441. package/src/storage/auth_witness_data_provider/auth_witness_data_provider.ts +0 -34
  442. package/src/storage/auth_witness_data_provider/index.ts +0 -1
  443. package/src/storage/capsule_data_provider/capsule_data_provider.ts +0 -80
  444. package/src/storage/capsule_data_provider/index.ts +0 -1
  445. package/src/storage/contract_data_provider/contract_data_provider.ts +0 -261
  446. package/src/storage/contract_data_provider/index.ts +0 -2
  447. package/src/storage/contract_data_provider/private_functions_tree.ts +0 -131
  448. package/src/storage/data_provider.ts +0 -3
  449. package/src/storage/note_data_provider/index.ts +0 -2
  450. package/src/storage/note_data_provider/note_dao.ts +0 -162
  451. package/src/storage/note_data_provider/note_data_provider.ts +0 -345
  452. package/src/storage/sync_data_provider/index.ts +0 -1
  453. package/src/storage/tagging_data_provider/index.ts +0 -1
  454. package/src/storage/tagging_data_provider/tagging_data_provider.ts +0 -92
  455. package/src/synchronizer/index.ts +0 -1
  456. package/src/synchronizer/synchronizer.ts +0 -121
  457. package/src/test/pxe_test_suite.ts +0 -111
  458. /package/dest/entrypoints/{client/pxe_creation_options.js → pxe_creation_options.js} +0 -0
@@ -1 +0,0 @@
1
- export { AddressDataProvider } from './address_data_provider.js';
@@ -1,34 +0,0 @@
1
- import { Fr } from '@aztec/foundation/fields';
2
- import { toArray } from '@aztec/foundation/iterable';
3
- import type { AztecAsyncKVStore, AztecAsyncMap } from '@aztec/kv-store';
4
-
5
- import type { DataProvider } from '../data_provider.js';
6
-
7
- export class AuthWitnessDataProvider implements DataProvider {
8
- #store: AztecAsyncKVStore;
9
- #authWitnesses: AztecAsyncMap<string, Buffer[]>;
10
-
11
- constructor(store: AztecAsyncKVStore) {
12
- this.#store = store;
13
- this.#authWitnesses = this.#store.openMap('auth_witnesses');
14
- }
15
-
16
- async addAuthWitness(messageHash: Fr, witness: Fr[]): Promise<void> {
17
- await this.#authWitnesses.set(
18
- messageHash.toString(),
19
- witness.map(w => w.toBuffer()),
20
- );
21
- }
22
-
23
- async getAuthWitness(messageHash: Fr): Promise<Fr[] | undefined> {
24
- const witness = await this.#authWitnesses.getAsync(messageHash.toString());
25
- return witness?.map(w => Fr.fromBuffer(w));
26
- }
27
-
28
- async getSize(): Promise<number> {
29
- return (await toArray(this.#authWitnesses.valuesAsync())).reduce(
30
- (sum, value) => sum + value.length * Fr.SIZE_IN_BYTES,
31
- 0,
32
- );
33
- }
34
- }
@@ -1 +0,0 @@
1
- export { AuthWitnessDataProvider } from './auth_witness_data_provider.js';
@@ -1,80 +0,0 @@
1
- import { Fr } from '@aztec/foundation/fields';
2
- import { toArray } from '@aztec/foundation/iterable';
3
- import { type LogFn, createDebugOnlyLogger } from '@aztec/foundation/log';
4
- import type { AztecAsyncKVStore, AztecAsyncMap } from '@aztec/kv-store';
5
- import type { AztecAddress } from '@aztec/stdlib/aztec-address';
6
-
7
- import type { DataProvider } from '../data_provider.js';
8
-
9
- export class CapsuleDataProvider implements DataProvider {
10
- #store: AztecAsyncKVStore;
11
-
12
- // Arbitrary data stored by contracts. Key is computed as `${contractAddress}:${key}`
13
- #capsules: AztecAsyncMap<string, Buffer>;
14
-
15
- debug: LogFn;
16
-
17
- constructor(store: AztecAsyncKVStore) {
18
- this.#store = store;
19
-
20
- this.#capsules = this.#store.openMap('capsules');
21
-
22
- this.debug = createDebugOnlyLogger('pxe:capsule-data-provider');
23
- }
24
-
25
- async storeCapsule(contractAddress: AztecAddress, slot: Fr, capsule: Fr[]): Promise<void> {
26
- await this.#capsules.set(dbSlotToKey(contractAddress, slot), Buffer.concat(capsule.map(value => value.toBuffer())));
27
- }
28
-
29
- async loadCapsule(contractAddress: AztecAddress, slot: Fr): Promise<Fr[] | null> {
30
- const dataBuffer = await this.#capsules.getAsync(dbSlotToKey(contractAddress, slot));
31
- if (!dataBuffer) {
32
- this.debug(`Data not found for contract ${contractAddress.toString()} and slot ${slot.toString()}`);
33
- return null;
34
- }
35
- const capsule: Fr[] = [];
36
- for (let i = 0; i < dataBuffer.length; i += Fr.SIZE_IN_BYTES) {
37
- capsule.push(Fr.fromBuffer(dataBuffer.subarray(i, i + Fr.SIZE_IN_BYTES)));
38
- }
39
- return capsule;
40
- }
41
-
42
- async deleteCapsule(contractAddress: AztecAddress, slot: Fr): Promise<void> {
43
- await this.#capsules.delete(dbSlotToKey(contractAddress, slot));
44
- }
45
-
46
- async copyCapsule(contractAddress: AztecAddress, srcSlot: Fr, dstSlot: Fr, numEntries: number): Promise<void> {
47
- // In order to support overlapping source and destination regions, we need to check the relative positions of source
48
- // and destination. If destination is ahead of source, then by the time we overwrite source elements using forward
49
- // indexes we'll have already read those. On the contrary, if source is ahead of destination we need to use backward
50
- // indexes to avoid reading elements that've been overwritten.
51
-
52
- const indexes = Array.from(Array(numEntries).keys());
53
- if (srcSlot.lt(dstSlot)) {
54
- indexes.reverse();
55
- }
56
-
57
- for (const i of indexes) {
58
- const currentSrcSlot = dbSlotToKey(contractAddress, srcSlot.add(new Fr(i)));
59
- const currentDstSlot = dbSlotToKey(contractAddress, dstSlot.add(new Fr(i)));
60
-
61
- const toCopy = await this.#capsules.getAsync(currentSrcSlot);
62
- if (!toCopy) {
63
- throw new Error(`Attempted to copy empty slot ${currentSrcSlot} for contract ${contractAddress.toString()}`);
64
- }
65
-
66
- await this.#capsules.set(currentDstSlot, toCopy);
67
- }
68
- }
69
-
70
- public async getSize() {
71
- return (await toArray(this.#capsules.valuesAsync())).reduce(
72
- (sum, value) => sum + value.length * Fr.SIZE_IN_BYTES,
73
- 0,
74
- );
75
- }
76
- }
77
-
78
- function dbSlotToKey(contractAddress: AztecAddress, slot: Fr): string {
79
- return `${contractAddress.toString()}:${slot.toString()}`;
80
- }
@@ -1 +0,0 @@
1
- export { CapsuleDataProvider } from './capsule_data_provider.js';
@@ -1,261 +0,0 @@
1
- import type { Fr } from '@aztec/foundation/fields';
2
- import { toArray } from '@aztec/foundation/iterable';
3
- import type { MembershipWitness } from '@aztec/foundation/trees';
4
- import type { AztecAsyncKVStore, AztecAsyncMap } from '@aztec/kv-store';
5
- import { ContractClassNotFoundError, ContractNotFoundError } from '@aztec/simulator/client';
6
- import {
7
- type ContractArtifact,
8
- type FunctionArtifact,
9
- type FunctionDebugMetadata,
10
- FunctionSelector,
11
- FunctionType,
12
- contractArtifactFromBuffer,
13
- contractArtifactToBuffer,
14
- getFunctionDebugMetadata,
15
- } from '@aztec/stdlib/abi';
16
- import { AztecAddress } from '@aztec/stdlib/aztec-address';
17
- import {
18
- type ContractClass,
19
- type ContractInstanceWithAddress,
20
- SerializableContractInstance,
21
- } from '@aztec/stdlib/contract';
22
-
23
- import type { DataProvider } from '../data_provider.js';
24
- import { PrivateFunctionsTree } from './private_functions_tree.js';
25
-
26
- /**
27
- * ContractDataProvider serves as a data manager and retriever for Aztec.nr contracts.
28
- * It provides methods to obtain contract addresses, function ABI, bytecode, and membership witnesses
29
- * from a given contract address and function selector. The class maintains a cache of ContractTree instances
30
- * to efficiently serve the requested data. It interacts with the ContractDatabase and AztecNode to fetch
31
- * the required information and facilitate cryptographic proof generation.
32
- */
33
- export class ContractDataProvider implements DataProvider {
34
- /** Map from contract class id to private function tree. */
35
- private contractClassesCache: Map<string, PrivateFunctionsTree> = new Map();
36
-
37
- #contractArtifacts: AztecAsyncMap<string, Buffer>;
38
- #contractInstances: AztecAsyncMap<string, Buffer>;
39
-
40
- constructor(store: AztecAsyncKVStore) {
41
- this.#contractArtifacts = store.openMap('contract_artifacts');
42
- this.#contractInstances = store.openMap('contracts_instances');
43
- }
44
-
45
- // Setters
46
-
47
- public async addContractArtifact(id: Fr, contract: ContractArtifact): Promise<void> {
48
- const privateFunctions = contract.functions.filter(
49
- functionArtifact => functionArtifact.functionType === FunctionType.PRIVATE,
50
- );
51
-
52
- const privateSelectors = await Promise.all(
53
- privateFunctions.map(async privateFunctionArtifact =>
54
- (
55
- await FunctionSelector.fromNameAndParameters(privateFunctionArtifact.name, privateFunctionArtifact.parameters)
56
- ).toString(),
57
- ),
58
- );
59
-
60
- if (privateSelectors.length !== new Set(privateSelectors).size) {
61
- throw new Error('Repeated function selectors of private functions');
62
- }
63
-
64
- await this.#contractArtifacts.set(id.toString(), contractArtifactToBuffer(contract));
65
- }
66
-
67
- async addContractInstance(contract: ContractInstanceWithAddress): Promise<void> {
68
- await this.#contractInstances.set(
69
- contract.address.toString(),
70
- new SerializableContractInstance(contract).toBuffer(),
71
- );
72
- }
73
-
74
- // Private getters
75
-
76
- async #getContractInstance(address: AztecAddress): Promise<ContractInstanceWithAddress | undefined> {
77
- const contract = await this.#contractInstances.getAsync(address.toString());
78
- return contract && SerializableContractInstance.fromBuffer(contract).withAddress(address);
79
- }
80
-
81
- async #getContractArtifact(id: Fr): Promise<ContractArtifact | undefined> {
82
- const contract = await this.#contractArtifacts.getAsync(id.toString());
83
- // TODO(@spalladino): AztecAsyncMap lies and returns Uint8Arrays instead of Buffers, hence the extra Buffer.from.
84
- return contract && contractArtifactFromBuffer(Buffer.from(contract));
85
- }
86
-
87
- /**
88
- * Retrieve or create a ContractTree instance based on the provided class id.
89
- * If an existing tree with the same class id is found in the cache, it will be returned.
90
- * Otherwise, a new ContractTree instance will be created using the contract data from the database
91
- * and added to the cache before returning.
92
- *
93
- * @param classId - The class id of the contract for which the ContractTree is required.
94
- * @returns A ContractTree instance associated with the specified contract address.
95
- * @throws An Error if the contract is not found in the ContractDatabase.
96
- */
97
- private async getTreeForClassId(classId: Fr): Promise<PrivateFunctionsTree> {
98
- if (!this.contractClassesCache.has(classId.toString())) {
99
- const artifact = await this.#getContractArtifact(classId);
100
- if (!artifact) {
101
- throw new ContractClassNotFoundError(classId.toString());
102
- }
103
- const tree = await PrivateFunctionsTree.create(artifact);
104
- this.contractClassesCache.set(classId.toString(), tree);
105
- }
106
- return this.contractClassesCache.get(classId.toString())!;
107
- }
108
-
109
- /**
110
- * Retrieve or create a ContractTree instance based on the provided AztecAddress.
111
- * If an existing tree with the same contract address is found in the cache, it will be returned.
112
- * Otherwise, a new ContractTree instance will be created using the contract data from the database
113
- * and added to the cache before returning.
114
- *
115
- * @param contractAddress - The AztecAddress of the contract for which the ContractTree is required.
116
- * @returns A ContractTree instance associated with the specified contract address.
117
- * @throws An Error if the contract is not found in the ContractDatabase.
118
- */
119
- private async getTreeForAddress(contractAddress: AztecAddress): Promise<PrivateFunctionsTree> {
120
- const instance = await this.getContractInstance(contractAddress);
121
- return this.getTreeForClassId(instance.currentContractClassId);
122
- }
123
-
124
- // Public getters
125
-
126
- async getContractsAddresses(): Promise<AztecAddress[]> {
127
- const keys = await toArray(this.#contractInstances.keysAsync());
128
- return keys.map(AztecAddress.fromString);
129
- }
130
-
131
- /** Returns a contract instance for a given address. Throws if not found. */
132
- public async getContractInstance(contractAddress: AztecAddress): Promise<ContractInstanceWithAddress> {
133
- const instance = await this.#getContractInstance(contractAddress);
134
- if (!instance) {
135
- throw new ContractNotFoundError(contractAddress.toString());
136
- }
137
- return instance;
138
- }
139
-
140
- public async getContractArtifact(contractClassId: Fr): Promise<ContractArtifact> {
141
- const tree = await this.getTreeForClassId(contractClassId);
142
- return tree.getArtifact();
143
- }
144
-
145
- /** Returns a contract class for a given class id. Throws if not found. */
146
- public async getContractClass(contractClassId: Fr): Promise<ContractClass> {
147
- const tree = await this.getTreeForClassId(contractClassId);
148
- return tree.getContractClass();
149
- }
150
-
151
- public async getContract(
152
- address: AztecAddress,
153
- ): Promise<(ContractInstanceWithAddress & ContractArtifact) | undefined> {
154
- const instance = await this.getContractInstance(address);
155
- const artifact = instance && (await this.getContractArtifact(instance?.currentContractClassId));
156
- if (!instance || !artifact) {
157
- return undefined;
158
- }
159
- return { ...instance, ...artifact };
160
- }
161
-
162
- /**
163
- * Retrieves the artifact of a specified function within a given contract.
164
- * The function is identified by its selector, which is a unique code generated from the function's signature.
165
- * Throws an error if the contract address or function selector are invalid or not found.
166
- *
167
- * @param contractAddress - The AztecAddress representing the contract containing the function.
168
- * @param selector - The function selector.
169
- * @returns The corresponding function's artifact as an object.
170
- */
171
- public async getFunctionArtifact(contractAddress: AztecAddress, selector: FunctionSelector) {
172
- const tree = await this.getTreeForAddress(contractAddress);
173
- return tree.getFunctionArtifact(selector);
174
- }
175
-
176
- /**
177
- * Retrieves the artifact of a specified function within a given contract.
178
- * The function is identified by its name, which is unique within a contract.
179
- * Throws if the contract has not been added to the database.
180
- *
181
- * @param contractAddress - The AztecAddress representing the contract containing the function.
182
- * @param functionName - The name of the function.
183
- * @returns The corresponding function's artifact as an object
184
- */
185
- public async getFunctionArtifactByName(
186
- contractAddress: AztecAddress,
187
- functionName: string,
188
- ): Promise<FunctionArtifact | undefined> {
189
- const tree = await this.getTreeForAddress(contractAddress);
190
- return tree.getArtifact().functions.find(f => f.name === functionName);
191
- }
192
-
193
- /**
194
- * Retrieves the debug metadata of a specified function within a given contract.
195
- * The function is identified by its selector, which is a unique code generated from the function's signature.
196
- * Returns undefined if the debug metadata for the given function is not found.
197
- * Throws if the contract has not been added to the database.
198
- *
199
- * @param contractAddress - The AztecAddress representing the contract containing the function.
200
- * @param selector - The function selector.
201
- * @returns The corresponding function's artifact as an object.
202
- */
203
- public async getFunctionDebugMetadata(
204
- contractAddress: AztecAddress,
205
- selector: FunctionSelector,
206
- ): Promise<FunctionDebugMetadata | undefined> {
207
- const tree = await this.getTreeForAddress(contractAddress);
208
- const artifact = await tree.getFunctionArtifact(selector);
209
- return getFunctionDebugMetadata(tree.getArtifact(), artifact);
210
- }
211
-
212
- /**
213
- * Retrieve the bytecode of a specific function in a contract at the given address.
214
- * The returned bytecode is required for executing and verifying the function's behavior
215
- * in the Aztec network. Throws an error if the contract or function cannot be found.
216
- *
217
- * @param contractAddress - The contract's address.
218
- * @param selector - The function selector.
219
- * @returns A Promise that resolves to a Buffer containing the bytecode of the specified function.
220
- * @throws Error if the contract address is unknown or not found.
221
- */
222
- public async getBytecode(contractAddress: AztecAddress, selector: FunctionSelector) {
223
- const tree = await this.getTreeForAddress(contractAddress);
224
- return tree.getBytecode(selector);
225
- }
226
-
227
- /**
228
- * Retrieve the function membership witness for the given contract class and function selector.
229
- * The function membership witness represents a proof that the function belongs to the specified contract.
230
- * Throws an error if the contract address or function selector is unknown.
231
- *
232
- * @param contractClassId - The id of the class.
233
- * @param selector - The function selector.
234
- * @returns A promise that resolves with the MembershipWitness instance for the specified contract's function.
235
- */
236
- public async getFunctionMembershipWitness(
237
- contractClassId: Fr,
238
- selector: FunctionSelector,
239
- ): Promise<MembershipWitness<5>> {
240
- const tree = await this.getTreeForClassId(contractClassId);
241
- return tree.getFunctionMembershipWitness(selector);
242
- }
243
-
244
- public async getDebugContractName(contractAddress: AztecAddress) {
245
- const tree = await this.getTreeForAddress(contractAddress);
246
- return tree.getArtifact().name;
247
- }
248
-
249
- public async getDebugFunctionName(contractAddress: AztecAddress, selector: FunctionSelector) {
250
- const tree = await this.getTreeForAddress(contractAddress);
251
- const { name: contractName } = tree.getArtifact();
252
- const { name: functionName } = await tree.getFunctionArtifact(selector);
253
- return `${contractName}:${functionName}`;
254
- }
255
-
256
- public async getSize() {
257
- return (await toArray(this.#contractInstances.valuesAsync()))
258
- .concat(await toArray(this.#contractArtifacts.valuesAsync()))
259
- .reduce((sum, value) => sum + value.length, 0);
260
- }
261
- }
@@ -1,2 +0,0 @@
1
- export { ContractDataProvider } from './contract_data_provider.js';
2
- export { PrivateFunctionsTree } from './private_functions_tree.js';
@@ -1,131 +0,0 @@
1
- import { FUNCTION_TREE_HEIGHT } from '@aztec/constants';
2
- import { Fr } from '@aztec/foundation/fields';
3
- import { assertLength } from '@aztec/foundation/serialize';
4
- import { MembershipWitness, type MerkleTree } from '@aztec/foundation/trees';
5
- import { type ContractArtifact, FunctionSelector } from '@aztec/stdlib/abi';
6
- import {
7
- type ContractClassWithId,
8
- computePrivateFunctionLeaf,
9
- computePrivateFunctionsTree,
10
- getContractClassFromArtifact,
11
- } from '@aztec/stdlib/contract';
12
-
13
- /**
14
- * Represents a Merkle tree of functions for a particular Contract Class.
15
- * It manages the construction of the function tree, computes its root, and generates membership witnesses
16
- * for constrained functions. This class also enables lookup of specific function artifact using selectors.
17
- * It is used in combination with the AztecNode to compute various data for executing private transactions.
18
- */
19
- export class PrivateFunctionsTree {
20
- private tree?: MerkleTree;
21
-
22
- private constructor(private readonly artifact: ContractArtifact, private contractClass: ContractClassWithId) {}
23
-
24
- static async create(artifact: ContractArtifact) {
25
- const contractClass = await getContractClassFromArtifact(artifact);
26
- return new PrivateFunctionsTree(artifact, contractClass);
27
- }
28
-
29
- /**
30
- * Retrieve the artifact of a given function.
31
- * The function is identified by its selector, which represents a unique identifier for the function's signature.
32
- * Throws an error if the function with the provided selector is not found in the contract.
33
- *
34
- * @param selector - The function selector.
35
- * @returns The artifact object containing relevant information about the targeted function.
36
- */
37
- public async getFunctionArtifact(selector: FunctionSelector) {
38
- const functionsAndSelectors = await Promise.all(
39
- this.artifact.functions.map(async f => ({
40
- f,
41
- selector: await FunctionSelector.fromNameAndParameters(f.name, f.parameters),
42
- })),
43
- );
44
- const artifact = functionsAndSelectors.find(f => selector.equals(f.selector))?.f;
45
- if (!artifact) {
46
- throw new Error(
47
- `Unknown function. Selector ${selector.toString()} not found in the artifact ${
48
- this.artifact.name
49
- } with class ${this.getContractClassId().toString()}.`,
50
- );
51
- }
52
- return artifact;
53
- }
54
-
55
- /**
56
- * Retrieve the bytecode of a function in the contract by its function selector.
57
- * The function selector is a unique identifier for each function in a contract.
58
- * Throws an error if the function with the given selector is not found in the contract.
59
- *
60
- * @param selector - The selector of a function to get bytecode for.
61
- * @returns The bytecode of the function as a string.
62
- */
63
- public async getBytecode(selector: FunctionSelector) {
64
- const artifact = await this.getFunctionArtifact(selector);
65
- return artifact.bytecode;
66
- }
67
-
68
- /**
69
- * Calculate and return the root of the function tree for the current contract.
70
- * This root is a cryptographic commitment to the set of constrained functions within the contract,
71
- * which is used in the Aztec node's proof system. The root will be cached after the first call.
72
- *
73
- * @returns A promise that resolves to the Fr (finite field element) representation of the function tree root.
74
- */
75
- public getFunctionTreeRoot() {
76
- return this.getTree();
77
- }
78
-
79
- /** Returns the contract class object. */
80
- public getContractClass() {
81
- return this.contractClass;
82
- }
83
-
84
- /** Returns the contract artifact. */
85
- public getArtifact() {
86
- return this.artifact;
87
- }
88
-
89
- /**
90
- * Returns the contract class identifier for the given artifact.
91
- */
92
- public getContractClassId() {
93
- return this.getContractClass().id;
94
- }
95
-
96
- /**
97
- * Retrieve the membership witness of a function within a contract's function tree.
98
- * A membership witness represents the position and authentication path of a target function
99
- * in the Merkle tree of constrained functions. It is required to prove the existence of the
100
- * function within the contract during execution. Throws if fn does not exist or is not private.
101
- *
102
- * @param selector - The function selector.
103
- * @returns A MembershipWitness instance representing the position and authentication path of the function in the function tree.
104
- */
105
- public async getFunctionMembershipWitness(
106
- selector: FunctionSelector,
107
- ): Promise<MembershipWitness<typeof FUNCTION_TREE_HEIGHT>> {
108
- const fn = this.getContractClass().privateFunctions.find(f => f.selector.equals(selector));
109
- if (!fn) {
110
- throw new Error(`Private function with selector ${selector.toString()} not found in contract class.`);
111
- }
112
-
113
- const leaf = await computePrivateFunctionLeaf(fn);
114
- const tree = await this.getTree();
115
- const index = tree.getIndex(leaf);
116
- const path = tree.getSiblingPath(index);
117
- return new MembershipWitness<typeof FUNCTION_TREE_HEIGHT>(
118
- FUNCTION_TREE_HEIGHT,
119
- BigInt(index),
120
- assertLength(path.map(Fr.fromBuffer), FUNCTION_TREE_HEIGHT),
121
- );
122
- }
123
-
124
- private async getTree() {
125
- if (!this.tree) {
126
- const fns = this.getContractClass().privateFunctions;
127
- this.tree = await computePrivateFunctionsTree(fns);
128
- }
129
- return this.tree;
130
- }
131
- }
@@ -1,3 +0,0 @@
1
- export interface DataProvider {
2
- getSize(): Promise<number>;
3
- }
@@ -1,2 +0,0 @@
1
- export { NoteDao } from './note_dao.js';
2
- export { NoteDataProvider } from './note_data_provider.js';