@aztec/pxe 0.0.0-test.0 → 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,162 +0,0 @@
1
- import { toBigIntBE } from '@aztec/foundation/bigint-buffer';
2
- import { Fr, Point } from '@aztec/foundation/fields';
3
- import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
4
- import type { NoteData } from '@aztec/simulator/client';
5
- import { NoteSelector } from '@aztec/stdlib/abi';
6
- import { AztecAddress } from '@aztec/stdlib/aztec-address';
7
- import type { PublicKey } from '@aztec/stdlib/keys';
8
- import { Note } from '@aztec/stdlib/note';
9
- import { TxHash } from '@aztec/stdlib/tx';
10
-
11
- /**
12
- * A Note Data Access Object, representing a note that was committed to the note hash tree, holding all of the
13
- * information required to use it during execution and manage its state.
14
- */
15
- export class NoteDao implements NoteData {
16
- constructor(
17
- // Note information
18
-
19
- /** The packed content of the note, as will be returned in the getNotes oracle. */
20
- public note: Note,
21
- /** The address of the contract that created the note (i.e. the address used by the kernel during siloing). */
22
- public contractAddress: AztecAddress,
23
- /**
24
- * The storage location of the note. This value is not used for anything in PXE, but we do index by storage slot
25
- * since contracts typically make queries based on it.
26
- * */
27
- public storageSlot: Fr,
28
- /** The kernel-provided nonce of the note, required to compute the uniqueNoteHash. */
29
- public nonce: Fr,
30
-
31
- // Computed values
32
- /**
33
- * The inner hash (non-unique, non-siloed) of the note. Each contract determines how the note is hashed. Can
34
- * be used alongside contractAddress and nonce to compute the uniqueNoteHash and the siloedNoteHash.
35
- */
36
- public noteHash: Fr,
37
- /**
38
- * The nullifier of the note, siloed by contract address.
39
- * Note: Might be set as 0 if the note was added to PXE as nullified.
40
- */
41
- public siloedNullifier: Fr,
42
-
43
- // Metadata
44
- /** The hash of the tx in which this note was created. Knowing the tx hash allows for efficient node queries e.g.
45
- * when searching for txEffects.
46
- */
47
- public txHash: TxHash,
48
- /** The L2 block number in which the tx with this note was included. Used for note management while processing
49
- * reorgs.*/
50
- public l2BlockNumber: number,
51
- /** The L2 block hash in which the tx with this note was included. Used for note management while processing
52
- * reorgs.*/
53
- public l2BlockHash: string,
54
- /** The index of the leaf in the global note hash tree the note is stored at */
55
- public index: bigint,
56
- /** The public key with which the note log was encrypted during delivery. */
57
- public addressPoint: PublicKey,
58
-
59
- /** The note type identifier for the contract.
60
- * TODO(#12013): remove
61
- */
62
- public noteTypeId: NoteSelector,
63
- ) {}
64
-
65
- toBuffer(): Buffer {
66
- return serializeToBuffer([
67
- this.note,
68
- this.contractAddress,
69
- this.storageSlot,
70
- this.nonce,
71
- this.noteHash,
72
- this.siloedNullifier,
73
- this.txHash,
74
- this.l2BlockNumber,
75
- Fr.fromHexString(this.l2BlockHash),
76
- this.index,
77
- this.addressPoint,
78
- this.noteTypeId,
79
- ]);
80
- }
81
-
82
- static fromBuffer(buffer: Buffer | BufferReader) {
83
- const reader = BufferReader.asReader(buffer);
84
-
85
- const note = Note.fromBuffer(reader);
86
- const contractAddress = AztecAddress.fromBuffer(reader);
87
- const storageSlot = Fr.fromBuffer(reader);
88
- const nonce = Fr.fromBuffer(reader);
89
- const noteHash = Fr.fromBuffer(reader);
90
- const siloedNullifier = Fr.fromBuffer(reader);
91
- const txHash = reader.readObject(TxHash);
92
- const l2BlockNumber = reader.readNumber();
93
- const l2BlockHash = Fr.fromBuffer(reader).toString();
94
- const index = toBigIntBE(reader.readBytes(32));
95
- const publicKey = Point.fromBuffer(reader);
96
- const noteTypeId = reader.readObject(NoteSelector);
97
-
98
- return new NoteDao(
99
- note,
100
- contractAddress,
101
- storageSlot,
102
- nonce,
103
- noteHash,
104
- siloedNullifier,
105
- txHash,
106
- l2BlockNumber,
107
- l2BlockHash,
108
- index,
109
- publicKey,
110
- noteTypeId,
111
- );
112
- }
113
-
114
- toString() {
115
- return '0x' + this.toBuffer().toString('hex');
116
- }
117
-
118
- static fromString(str: string) {
119
- const hex = str.replace(/^0x/, '');
120
- return NoteDao.fromBuffer(Buffer.from(hex, 'hex'));
121
- }
122
-
123
- /**
124
- * Returns the size in bytes of the Note Dao.
125
- * @returns - Its size in bytes.
126
- */
127
- public getSize() {
128
- const indexSize = Math.ceil(Math.log2(Number(this.index)));
129
- const noteSize = 4 + this.note.items.length * Fr.SIZE_IN_BYTES;
130
- return noteSize + AztecAddress.SIZE_IN_BYTES + Fr.SIZE_IN_BYTES * 4 + TxHash.SIZE + Point.SIZE_IN_BYTES + indexSize;
131
- }
132
-
133
- static async random({
134
- note = Note.random(),
135
- contractAddress = undefined,
136
- storageSlot = Fr.random(),
137
- nonce = Fr.random(),
138
- noteHash = Fr.random(),
139
- siloedNullifier = Fr.random(),
140
- txHash = TxHash.random(),
141
- l2BlockNumber = Math.floor(Math.random() * 1000),
142
- l2BlockHash = Fr.random().toString(),
143
- index = Fr.random().toBigInt(),
144
- addressPoint = undefined,
145
- noteTypeId = NoteSelector.random(),
146
- }: Partial<NoteDao> = {}) {
147
- return new NoteDao(
148
- note,
149
- contractAddress ?? (await AztecAddress.random()),
150
- storageSlot,
151
- nonce,
152
- noteHash,
153
- siloedNullifier,
154
- txHash,
155
- l2BlockNumber,
156
- l2BlockHash,
157
- index,
158
- addressPoint ?? (await Point.random()),
159
- noteTypeId,
160
- );
161
- }
162
- }
@@ -1,345 +0,0 @@
1
- import { toBufferBE } from '@aztec/foundation/bigint-buffer';
2
- import type { Fr, Point } from '@aztec/foundation/fields';
3
- import { toArray } from '@aztec/foundation/iterable';
4
- import type { AztecAsyncKVStore, AztecAsyncMap, AztecAsyncMultiMap } from '@aztec/kv-store';
5
- import { AztecAddress } from '@aztec/stdlib/aztec-address';
6
- import type { InBlock } from '@aztec/stdlib/block';
7
- import type { PublicKey } from '@aztec/stdlib/keys';
8
- import { NoteStatus, type NotesFilter } from '@aztec/stdlib/note';
9
-
10
- import type { DataProvider } from '../data_provider.js';
11
- import { NoteDao } from './note_dao.js';
12
-
13
- export class NoteDataProvider implements DataProvider {
14
- #store: AztecAsyncKVStore;
15
-
16
- #notes: AztecAsyncMap<string, Buffer>;
17
- #nullifiedNotes: AztecAsyncMap<string, Buffer>;
18
- #nullifierToNoteId: AztecAsyncMap<string, string>;
19
- #nullifiersByBlockNumber: AztecAsyncMultiMap<number, string>;
20
-
21
- #nullifiedNotesToScope: AztecAsyncMultiMap<string, string>;
22
- #nullifiedNotesByContract: AztecAsyncMultiMap<string, string>;
23
- #nullifiedNotesByStorageSlot: AztecAsyncMultiMap<string, string>;
24
- #nullifiedNotesByTxHash: AztecAsyncMultiMap<string, string>;
25
- #nullifiedNotesByAddressPoint: AztecAsyncMultiMap<string, string>;
26
- #nullifiedNotesByNullifier: AztecAsyncMap<string, string>;
27
-
28
- #scopes: AztecAsyncMap<string, true>;
29
- #notesToScope: AztecAsyncMultiMap<string, string>;
30
- #notesByContractAndScope: Map<string, AztecAsyncMultiMap<string, string>>;
31
- #notesByStorageSlotAndScope: Map<string, AztecAsyncMultiMap<string, string>>;
32
- #notesByTxHashAndScope: Map<string, AztecAsyncMultiMap<string, string>>;
33
- #notesByAddressPointAndScope: Map<string, AztecAsyncMultiMap<string, string>>;
34
-
35
- private constructor(store: AztecAsyncKVStore) {
36
- this.#store = store;
37
- this.#notes = store.openMap('notes');
38
- this.#nullifiedNotes = store.openMap('nullified_notes');
39
- this.#nullifierToNoteId = store.openMap('nullifier_to_note');
40
- this.#nullifiersByBlockNumber = store.openMultiMap('nullifier_to_block_number');
41
-
42
- this.#nullifiedNotesToScope = store.openMultiMap('nullified_notes_to_scope');
43
- this.#nullifiedNotesByContract = store.openMultiMap('nullified_notes_by_contract');
44
- this.#nullifiedNotesByStorageSlot = store.openMultiMap('nullified_notes_by_storage_slot');
45
- this.#nullifiedNotesByTxHash = store.openMultiMap('nullified_notes_by_tx_hash');
46
- this.#nullifiedNotesByAddressPoint = store.openMultiMap('nullified_notes_by_address_point');
47
- this.#nullifiedNotesByNullifier = store.openMap('nullified_notes_by_nullifier');
48
-
49
- this.#scopes = store.openMap('scopes');
50
- this.#notesToScope = store.openMultiMap('notes_to_scope');
51
- this.#notesByContractAndScope = new Map<string, AztecAsyncMultiMap<string, string>>();
52
- this.#notesByStorageSlotAndScope = new Map<string, AztecAsyncMultiMap<string, string>>();
53
- this.#notesByTxHashAndScope = new Map<string, AztecAsyncMultiMap<string, string>>();
54
- this.#notesByAddressPointAndScope = new Map<string, AztecAsyncMultiMap<string, string>>();
55
- }
56
-
57
- public static async create(store: AztecAsyncKVStore): Promise<NoteDataProvider> {
58
- const pxeDB = new NoteDataProvider(store);
59
- for await (const scope of pxeDB.#scopes.keysAsync()) {
60
- pxeDB.#notesByContractAndScope.set(scope, store.openMultiMap(`${scope}:notes_by_contract`));
61
- pxeDB.#notesByStorageSlotAndScope.set(scope, store.openMultiMap(`${scope}:notes_by_storage_slot`));
62
- pxeDB.#notesByTxHashAndScope.set(scope, store.openMultiMap(`${scope}:notes_by_tx_hash`));
63
- pxeDB.#notesByAddressPointAndScope.set(scope, store.openMultiMap(`${scope}:notes_by_address_point`));
64
- }
65
- return pxeDB;
66
- }
67
-
68
- public async addScope(scope: AztecAddress): Promise<boolean> {
69
- const scopeString = scope.toString();
70
-
71
- if (await this.#scopes.hasAsync(scopeString)) {
72
- return false;
73
- }
74
-
75
- await this.#scopes.set(scopeString, true);
76
- this.#notesByContractAndScope.set(scopeString, this.#store.openMultiMap(`${scopeString}:notes_by_contract`));
77
- this.#notesByStorageSlotAndScope.set(scopeString, this.#store.openMultiMap(`${scopeString}:notes_by_storage_slot`));
78
- this.#notesByTxHashAndScope.set(scopeString, this.#store.openMultiMap(`${scopeString}:notes_by_tx_hash`));
79
- this.#notesByAddressPointAndScope.set(
80
- scopeString,
81
- this.#store.openMultiMap(`${scopeString}:notes_by_address_point`),
82
- );
83
-
84
- return true;
85
- }
86
-
87
- async addNotes(notes: NoteDao[], scope: AztecAddress = AztecAddress.ZERO): Promise<void> {
88
- if (!(await this.#scopes.hasAsync(scope.toString()))) {
89
- await this.addScope(scope);
90
- }
91
-
92
- return this.#store.transactionAsync(async () => {
93
- for (const dao of notes) {
94
- // store notes by their index in the notes hash tree
95
- // this provides the uniqueness we need to store individual notes
96
- // and should also return notes in the order that they were created.
97
- // Had we stored them by their nullifier, they would be returned in random order
98
- const noteIndex = toBufferBE(dao.index, 32).toString('hex');
99
- await this.#notes.set(noteIndex, dao.toBuffer());
100
- await this.#notesToScope.set(noteIndex, scope.toString());
101
- await this.#nullifierToNoteId.set(dao.siloedNullifier.toString(), noteIndex);
102
-
103
- await this.#notesByContractAndScope.get(scope.toString())!.set(dao.contractAddress.toString(), noteIndex);
104
- await this.#notesByStorageSlotAndScope.get(scope.toString())!.set(dao.storageSlot.toString(), noteIndex);
105
- await this.#notesByTxHashAndScope.get(scope.toString())!.set(dao.txHash.toString(), noteIndex);
106
- await this.#notesByAddressPointAndScope.get(scope.toString())!.set(dao.addressPoint.toString(), noteIndex);
107
- }
108
- });
109
- }
110
-
111
- public removeNotesAfter(blockNumber: number): Promise<void> {
112
- return this.#store.transactionAsync(async () => {
113
- const notes = await toArray(this.#notes.valuesAsync());
114
- for (const note of notes) {
115
- const noteDao = NoteDao.fromBuffer(note);
116
- if (noteDao.l2BlockNumber > blockNumber) {
117
- const noteIndex = toBufferBE(noteDao.index, 32).toString('hex');
118
- await this.#notes.delete(noteIndex);
119
- await this.#notesToScope.delete(noteIndex);
120
- await this.#nullifierToNoteId.delete(noteDao.siloedNullifier.toString());
121
- const scopes = await toArray(this.#scopes.keysAsync());
122
- for (const scope of scopes) {
123
- await this.#notesByAddressPointAndScope.get(scope)!.deleteValue(noteDao.addressPoint.toString(), noteIndex);
124
- await this.#notesByTxHashAndScope.get(scope)!.deleteValue(noteDao.txHash.toString(), noteIndex);
125
- await this.#notesByContractAndScope.get(scope)!.deleteValue(noteDao.contractAddress.toString(), noteIndex);
126
- await this.#notesByStorageSlotAndScope.get(scope)!.deleteValue(noteDao.storageSlot.toString(), noteIndex);
127
- }
128
- }
129
- }
130
- });
131
- }
132
-
133
- public async unnullifyNotesAfter(blockNumber: number, synchedBlockNumber?: number): Promise<void> {
134
- const nullifiersToUndo: string[] = [];
135
- const currentBlockNumber = blockNumber + 1;
136
- const maxBlockNumber = synchedBlockNumber ?? currentBlockNumber;
137
- for (let i = currentBlockNumber; i <= maxBlockNumber; i++) {
138
- nullifiersToUndo.push(...(await toArray(this.#nullifiersByBlockNumber.getValuesAsync(i))));
139
- }
140
- const notesIndexesToReinsert = await Promise.all(
141
- nullifiersToUndo.map(nullifier => this.#nullifiedNotesByNullifier.getAsync(nullifier)),
142
- );
143
- const notNullNoteIndexes = notesIndexesToReinsert.filter(noteIndex => noteIndex != undefined);
144
- const nullifiedNoteBuffers = await Promise.all(
145
- notNullNoteIndexes.map(noteIndex => this.#nullifiedNotes.getAsync(noteIndex!)),
146
- );
147
- const noteDaos = nullifiedNoteBuffers
148
- .filter(buffer => buffer != undefined)
149
- .map(buffer => NoteDao.fromBuffer(buffer!));
150
-
151
- await this.#store.transactionAsync(async () => {
152
- for (const dao of noteDaos) {
153
- const noteIndex = toBufferBE(dao.index, 32).toString('hex');
154
- await this.#notes.set(noteIndex, dao.toBuffer());
155
- await this.#nullifierToNoteId.set(dao.siloedNullifier.toString(), noteIndex);
156
-
157
- let scopes = (await toArray(this.#nullifiedNotesToScope.getValuesAsync(noteIndex))) ?? [];
158
-
159
- if (scopes.length === 0) {
160
- scopes = [new AztecAddress(dao.addressPoint.x).toString()];
161
- }
162
-
163
- for (const scope of scopes) {
164
- await this.#notesByContractAndScope.get(scope.toString())!.set(dao.contractAddress.toString(), noteIndex);
165
- await this.#notesByStorageSlotAndScope.get(scope.toString())!.set(dao.storageSlot.toString(), noteIndex);
166
- await this.#notesByTxHashAndScope.get(scope.toString())!.set(dao.txHash.toString(), noteIndex);
167
- await this.#notesByAddressPointAndScope.get(scope.toString())!.set(dao.addressPoint.toString(), noteIndex);
168
- await this.#notesToScope.set(noteIndex, scope);
169
- }
170
-
171
- await this.#nullifiedNotes.delete(noteIndex);
172
- await this.#nullifiedNotesToScope.delete(noteIndex);
173
- await this.#nullifiersByBlockNumber.deleteValue(dao.l2BlockNumber, dao.siloedNullifier.toString());
174
- await this.#nullifiedNotesByContract.deleteValue(dao.contractAddress.toString(), noteIndex);
175
- await this.#nullifiedNotesByStorageSlot.deleteValue(dao.storageSlot.toString(), noteIndex);
176
- await this.#nullifiedNotesByTxHash.deleteValue(dao.txHash.toString(), noteIndex);
177
- await this.#nullifiedNotesByAddressPoint.deleteValue(dao.addressPoint.toString(), noteIndex);
178
- await this.#nullifiedNotesByNullifier.delete(dao.siloedNullifier.toString());
179
- }
180
- });
181
- }
182
-
183
- async getNotes(filter: NotesFilter): Promise<NoteDao[]> {
184
- const publicKey: PublicKey | undefined = filter.owner ? await filter.owner.toAddressPoint() : undefined;
185
-
186
- filter.status = filter.status ?? NoteStatus.ACTIVE;
187
-
188
- const candidateNoteSources = [];
189
-
190
- filter.scopes ??= (await toArray(this.#scopes.keysAsync())).map(addressString =>
191
- AztecAddress.fromString(addressString),
192
- );
193
-
194
- const activeNoteIdsPerScope: string[][] = [];
195
-
196
- for (const scope of new Set(filter.scopes)) {
197
- const formattedScopeString = scope.toString();
198
- if (!(await this.#scopes.hasAsync(formattedScopeString))) {
199
- throw new Error('Trying to get incoming notes of an scope that is not in the PXE database');
200
- }
201
-
202
- activeNoteIdsPerScope.push(
203
- publicKey
204
- ? await toArray(
205
- this.#notesByAddressPointAndScope.get(formattedScopeString)!.getValuesAsync(publicKey.toString()),
206
- )
207
- : filter.txHash
208
- ? await toArray(
209
- this.#notesByTxHashAndScope.get(formattedScopeString)!.getValuesAsync(filter.txHash.toString()),
210
- )
211
- : filter.contractAddress
212
- ? await toArray(
213
- this.#notesByContractAndScope
214
- .get(formattedScopeString)!
215
- .getValuesAsync(filter.contractAddress.toString()),
216
- )
217
- : filter.storageSlot
218
- ? await toArray(
219
- this.#notesByStorageSlotAndScope.get(formattedScopeString)!.getValuesAsync(filter.storageSlot.toString()),
220
- )
221
- : await toArray(this.#notesByAddressPointAndScope.get(formattedScopeString)!.valuesAsync()),
222
- );
223
- }
224
-
225
- candidateNoteSources.push({
226
- ids: new Set(activeNoteIdsPerScope.flat()),
227
- notes: this.#notes,
228
- });
229
-
230
- if (filter.status == NoteStatus.ACTIVE_OR_NULLIFIED) {
231
- candidateNoteSources.push({
232
- ids: publicKey
233
- ? await toArray(this.#nullifiedNotesByAddressPoint.getValuesAsync(publicKey.toString()))
234
- : filter.txHash
235
- ? await toArray(this.#nullifiedNotesByTxHash.getValuesAsync(filter.txHash.toString()))
236
- : filter.contractAddress
237
- ? await toArray(this.#nullifiedNotesByContract.getValuesAsync(filter.contractAddress.toString()))
238
- : filter.storageSlot
239
- ? await toArray(this.#nullifiedNotesByStorageSlot.getValuesAsync(filter.storageSlot.toString()))
240
- : await toArray(this.#nullifiedNotes.keysAsync()),
241
- notes: this.#nullifiedNotes,
242
- });
243
- }
244
-
245
- const result: NoteDao[] = [];
246
- for (const { ids, notes } of candidateNoteSources) {
247
- for (const id of ids) {
248
- const serializedNote = await notes.getAsync(id);
249
- if (!serializedNote) {
250
- continue;
251
- }
252
-
253
- const note = NoteDao.fromBuffer(serializedNote);
254
- if (filter.contractAddress && !note.contractAddress.equals(filter.contractAddress)) {
255
- continue;
256
- }
257
-
258
- if (filter.txHash && !note.txHash.equals(filter.txHash)) {
259
- continue;
260
- }
261
-
262
- if (filter.storageSlot && !note.storageSlot.equals(filter.storageSlot!)) {
263
- continue;
264
- }
265
-
266
- if (publicKey && !note.addressPoint.equals(publicKey)) {
267
- continue;
268
- }
269
-
270
- if (filter.siloedNullifier && !note.siloedNullifier.equals(filter.siloedNullifier)) {
271
- continue;
272
- }
273
-
274
- result.push(note);
275
- }
276
- }
277
-
278
- return result;
279
- }
280
-
281
- removeNullifiedNotes(nullifiers: InBlock<Fr>[], accountAddressPoint: Point): Promise<NoteDao[]> {
282
- if (nullifiers.length === 0) {
283
- return Promise.resolve([]);
284
- }
285
-
286
- return this.#store.transactionAsync(async () => {
287
- const nullifiedNotes: NoteDao[] = [];
288
-
289
- for (const blockScopedNullifier of nullifiers) {
290
- const { data: nullifier, l2BlockNumber: blockNumber } = blockScopedNullifier;
291
- const noteIndex = await this.#nullifierToNoteId.getAsync(nullifier.toString());
292
- if (!noteIndex) {
293
- continue;
294
- }
295
-
296
- const noteBuffer = noteIndex ? await this.#notes.getAsync(noteIndex) : undefined;
297
-
298
- if (!noteBuffer) {
299
- // note doesn't exist. Maybe it got nullified already
300
- continue;
301
- }
302
- const noteScopes = (await toArray(this.#notesToScope.getValuesAsync(noteIndex))) ?? [];
303
- const note = NoteDao.fromBuffer(noteBuffer);
304
- if (!note.addressPoint.equals(accountAddressPoint)) {
305
- // tried to nullify someone else's note
306
- continue;
307
- }
308
-
309
- nullifiedNotes.push(note);
310
-
311
- await this.#notes.delete(noteIndex);
312
- await this.#notesToScope.delete(noteIndex);
313
-
314
- const scopes = await toArray(this.#scopes.keysAsync());
315
-
316
- for (const scope of scopes) {
317
- await this.#notesByAddressPointAndScope.get(scope)!.deleteValue(accountAddressPoint.toString(), noteIndex);
318
- await this.#notesByTxHashAndScope.get(scope)!.deleteValue(note.txHash.toString(), noteIndex);
319
- await this.#notesByContractAndScope.get(scope)!.deleteValue(note.contractAddress.toString(), noteIndex);
320
- await this.#notesByStorageSlotAndScope.get(scope)!.deleteValue(note.storageSlot.toString(), noteIndex);
321
- }
322
-
323
- if (noteScopes !== undefined) {
324
- for (const scope of noteScopes) {
325
- await this.#nullifiedNotesToScope.set(noteIndex, scope);
326
- }
327
- }
328
- await this.#nullifiedNotes.set(noteIndex, note.toBuffer());
329
- await this.#nullifiersByBlockNumber.set(blockNumber, nullifier.toString());
330
- await this.#nullifiedNotesByContract.set(note.contractAddress.toString(), noteIndex);
331
- await this.#nullifiedNotesByStorageSlot.set(note.storageSlot.toString(), noteIndex);
332
- await this.#nullifiedNotesByTxHash.set(note.txHash.toString(), noteIndex);
333
- await this.#nullifiedNotesByAddressPoint.set(note.addressPoint.toString(), noteIndex);
334
- await this.#nullifiedNotesByNullifier.set(nullifier.toString(), noteIndex);
335
-
336
- await this.#nullifierToNoteId.delete(nullifier.toString());
337
- }
338
- return nullifiedNotes;
339
- });
340
- }
341
-
342
- async getSize() {
343
- return (await this.getNotes({})).reduce((sum, note) => sum + note.getSize(), 0);
344
- }
345
- }
@@ -1 +0,0 @@
1
- export { SyncDataProvider } from './sync_data_provider.js';
@@ -1 +0,0 @@
1
- export { TaggingDataProvider } from './tagging_data_provider.js';
@@ -1,92 +0,0 @@
1
- import type { Fr } from '@aztec/foundation/fields';
2
- import { toArray } from '@aztec/foundation/iterable';
3
- import type { AztecAsyncKVStore, AztecAsyncMap } from '@aztec/kv-store';
4
- import { AztecAddress } from '@aztec/stdlib/aztec-address';
5
- import type { IndexedTaggingSecret } from '@aztec/stdlib/logs';
6
-
7
- export class TaggingDataProvider {
8
- #store: AztecAsyncKVStore;
9
- #addressBook: AztecAsyncMap<string, true>;
10
-
11
- // Stores the last index used for each tagging secret, taking direction into account
12
- // This is necessary to avoid reusing the same index for the same secret, which happens if
13
- // sender and recipient are the same
14
- #taggingSecretIndexesForSenders: AztecAsyncMap<string, number>;
15
- #taggingSecretIndexesForRecipients: AztecAsyncMap<string, number>;
16
-
17
- constructor(store: AztecAsyncKVStore) {
18
- this.#store = store;
19
-
20
- this.#addressBook = this.#store.openMap('address_book');
21
-
22
- this.#taggingSecretIndexesForSenders = this.#store.openMap('tagging_secret_indexes_for_senders');
23
- this.#taggingSecretIndexesForRecipients = this.#store.openMap('tagging_secret_indexes_for_recipients');
24
- }
25
-
26
- async setTaggingSecretsIndexesAsSender(indexedSecrets: IndexedTaggingSecret[]): Promise<void> {
27
- await this.#setTaggingSecretsIndexes(indexedSecrets, this.#taggingSecretIndexesForSenders);
28
- }
29
-
30
- async setTaggingSecretsIndexesAsRecipient(indexedSecrets: IndexedTaggingSecret[]): Promise<void> {
31
- await this.#setTaggingSecretsIndexes(indexedSecrets, this.#taggingSecretIndexesForRecipients);
32
- }
33
-
34
- async #setTaggingSecretsIndexes(indexedSecrets: IndexedTaggingSecret[], storageMap: AztecAsyncMap<string, number>) {
35
- await Promise.all(
36
- indexedSecrets.map(indexedSecret =>
37
- storageMap.set(indexedSecret.appTaggingSecret.toString(), indexedSecret.index),
38
- ),
39
- );
40
- }
41
-
42
- async getTaggingSecretsIndexesAsRecipient(appTaggingSecrets: Fr[]) {
43
- return await this.#getTaggingSecretsIndexes(appTaggingSecrets, this.#taggingSecretIndexesForRecipients);
44
- }
45
-
46
- async getTaggingSecretsIndexesAsSender(appTaggingSecrets: Fr[]) {
47
- return await this.#getTaggingSecretsIndexes(appTaggingSecrets, this.#taggingSecretIndexesForSenders);
48
- }
49
-
50
- #getTaggingSecretsIndexes(appTaggingSecrets: Fr[], storageMap: AztecAsyncMap<string, number>): Promise<number[]> {
51
- return Promise.all(appTaggingSecrets.map(async secret => (await storageMap.getAsync(`${secret.toString()}`)) ?? 0));
52
- }
53
-
54
- resetNoteSyncData(): Promise<void> {
55
- return this.#store.transactionAsync(async () => {
56
- const recipients = await toArray(this.#taggingSecretIndexesForRecipients.keysAsync());
57
- await Promise.all(recipients.map(recipient => this.#taggingSecretIndexesForRecipients.delete(recipient)));
58
- const senders = await toArray(this.#taggingSecretIndexesForSenders.keysAsync());
59
- await Promise.all(senders.map(sender => this.#taggingSecretIndexesForSenders.delete(sender)));
60
- });
61
- }
62
-
63
- async addSenderAddress(address: AztecAddress): Promise<boolean> {
64
- if (await this.#addressBook.hasAsync(address.toString())) {
65
- return false;
66
- }
67
-
68
- await this.#addressBook.set(address.toString(), true);
69
-
70
- return true;
71
- }
72
-
73
- async getSenderAddresses(): Promise<AztecAddress[]> {
74
- return (await toArray(this.#addressBook.keysAsync())).map(AztecAddress.fromString);
75
- }
76
-
77
- async removeSenderAddress(address: AztecAddress): Promise<boolean> {
78
- if (!(await this.#addressBook.hasAsync(address.toString()))) {
79
- return false;
80
- }
81
-
82
- await this.#addressBook.delete(address.toString());
83
-
84
- return true;
85
- }
86
-
87
- async getSize() {
88
- const addressesCount = (await toArray(this.#addressBook.keysAsync())).length;
89
- // All keys are addresses
90
- return 3 * addressesCount * AztecAddress.SIZE_IN_BYTES;
91
- }
92
- }
@@ -1 +0,0 @@
1
- export * from './synchronizer.js';