@aztec/pxe 0.0.1-commit.b655e406 → 0.0.1-commit.c0b82b2

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 (422) hide show
  1. package/dest/access_scopes.d.ts +9 -0
  2. package/dest/access_scopes.d.ts.map +1 -0
  3. package/dest/access_scopes.js +6 -0
  4. package/dest/bin/check_oracle_version.d.ts +1 -1
  5. package/dest/bin/check_oracle_version.js +105 -15
  6. package/dest/block_synchronizer/block_synchronizer.d.ts +45 -0
  7. package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -0
  8. package/dest/block_synchronizer/block_synchronizer.js +153 -0
  9. package/dest/block_synchronizer/index.d.ts +2 -0
  10. package/dest/block_synchronizer/index.d.ts.map +1 -0
  11. package/dest/block_synchronizer/index.js +1 -0
  12. package/dest/config/index.d.ts +6 -12
  13. package/dest/config/index.d.ts.map +1 -1
  14. package/dest/config/index.js +24 -13
  15. package/dest/config/package_info.d.ts +1 -1
  16. package/dest/config/package_info.js +1 -1
  17. package/dest/contract_function_simulator/benchmarked_node.d.ts +9 -0
  18. package/dest/contract_function_simulator/benchmarked_node.d.ts.map +1 -0
  19. package/dest/contract_function_simulator/benchmarked_node.js +77 -0
  20. package/dest/contract_function_simulator/contract_function_simulator.d.ts +78 -26
  21. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  22. package/dest/contract_function_simulator/contract_function_simulator.js +226 -82
  23. package/dest/contract_function_simulator/execution_note_cache.d.ts +25 -14
  24. package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
  25. package/dest/contract_function_simulator/execution_note_cache.js +59 -34
  26. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +6 -6
  27. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -1
  28. package/dest/contract_function_simulator/execution_tagging_index_cache.js +4 -4
  29. package/dest/contract_function_simulator/hashed_values_cache.d.ts +2 -2
  30. package/dest/contract_function_simulator/hashed_values_cache.d.ts.map +1 -1
  31. package/dest/contract_function_simulator/index.d.ts +2 -2
  32. package/dest/contract_function_simulator/index.d.ts.map +1 -1
  33. package/dest/contract_function_simulator/index.js +1 -1
  34. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +5 -4
  35. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
  36. package/dest/contract_function_simulator/noir-structs/event_validation_request.js +7 -4
  37. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +5 -4
  38. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts.map +1 -1
  39. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.js +7 -6
  40. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +3 -3
  41. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
  42. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +1 -1
  43. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +7 -5
  44. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
  45. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +13 -4
  46. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +4 -10
  47. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -1
  48. package/dest/contract_function_simulator/noir-structs/utility_context.js +7 -18
  49. package/dest/contract_function_simulator/oracle/index.d.ts +1 -1
  50. package/dest/contract_function_simulator/oracle/interfaces.d.ts +30 -20
  51. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
  52. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +2 -2
  53. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
  54. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.js +1 -1
  55. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +14 -8
  56. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
  57. package/dest/contract_function_simulator/oracle/note_packing_utils.js +16 -11
  58. package/dest/contract_function_simulator/oracle/oracle.d.ts +15 -12
  59. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
  60. package/dest/contract_function_simulator/oracle/oracle.js +93 -53
  61. package/dest/contract_function_simulator/oracle/private_execution.d.ts +2 -27
  62. package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
  63. package/dest/contract_function_simulator/oracle/private_execution.js +2 -38
  64. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +56 -52
  65. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  66. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +120 -66
  67. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +114 -39
  68. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  69. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +214 -86
  70. package/dest/contract_function_simulator/pick_notes.d.ts +2 -2
  71. package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -1
  72. package/dest/contract_function_simulator/pick_notes.js +1 -1
  73. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +4 -4
  74. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -1
  75. package/dest/contract_function_simulator/proxied_contract_data_source.js +23 -5
  76. package/dest/contract_logging.d.ts +22 -0
  77. package/dest/contract_logging.d.ts.map +1 -0
  78. package/dest/contract_logging.js +23 -0
  79. package/dest/contract_sync/contract_sync_service.d.ts +43 -0
  80. package/dest/contract_sync/contract_sync_service.d.ts.map +1 -0
  81. package/dest/contract_sync/contract_sync_service.js +97 -0
  82. package/dest/contract_sync/helpers.d.ts +29 -0
  83. package/dest/contract_sync/helpers.d.ts.map +1 -0
  84. package/dest/contract_sync/helpers.js +55 -0
  85. package/dest/debug/pxe_debug_utils.d.ts +45 -0
  86. package/dest/debug/pxe_debug_utils.d.ts.map +1 -0
  87. package/dest/debug/pxe_debug_utils.js +48 -0
  88. package/dest/entrypoints/client/bundle/index.d.ts +4 -2
  89. package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
  90. package/dest/entrypoints/client/bundle/index.js +3 -1
  91. package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
  92. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  93. package/dest/entrypoints/client/bundle/utils.js +33 -10
  94. package/dest/entrypoints/client/lazy/index.d.ts +4 -2
  95. package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
  96. package/dest/entrypoints/client/lazy/index.js +3 -1
  97. package/dest/entrypoints/client/lazy/utils.d.ts +2 -2
  98. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  99. package/dest/entrypoints/client/lazy/utils.js +34 -11
  100. package/dest/entrypoints/pxe_creation_options.d.ts +7 -3
  101. package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
  102. package/dest/entrypoints/server/index.d.ts +6 -2
  103. package/dest/entrypoints/server/index.d.ts.map +1 -1
  104. package/dest/entrypoints/server/index.js +5 -1
  105. package/dest/entrypoints/server/utils.d.ts +1 -1
  106. package/dest/entrypoints/server/utils.d.ts.map +1 -1
  107. package/dest/entrypoints/server/utils.js +40 -28
  108. package/dest/error_enriching.d.ts +4 -4
  109. package/dest/error_enriching.d.ts.map +1 -1
  110. package/dest/error_enriching.js +6 -6
  111. package/dest/events/event_service.d.ts +15 -0
  112. package/dest/events/event_service.d.ts.map +1 -0
  113. package/dest/events/event_service.js +44 -0
  114. package/dest/events/index.d.ts +2 -0
  115. package/dest/events/index.d.ts.map +1 -0
  116. package/dest/events/index.js +1 -0
  117. package/dest/events/private_event_filter_validator.d.ts +9 -0
  118. package/dest/events/private_event_filter_validator.d.ts.map +1 -0
  119. package/dest/events/private_event_filter_validator.js +38 -0
  120. package/dest/job_coordinator/job_coordinator.d.ts +75 -0
  121. package/dest/job_coordinator/job_coordinator.d.ts.map +1 -0
  122. package/dest/job_coordinator/job_coordinator.js +94 -0
  123. package/dest/logs/log_service.d.ts +29 -0
  124. package/dest/logs/log_service.d.ts.map +1 -0
  125. package/dest/logs/log_service.js +118 -0
  126. package/dest/notes/index.d.ts +2 -0
  127. package/dest/notes/index.d.ts.map +1 -0
  128. package/dest/notes/index.js +1 -0
  129. package/dest/notes/note_service.d.ts +49 -0
  130. package/dest/notes/note_service.d.ts.map +1 -0
  131. package/dest/notes/note_service.js +148 -0
  132. package/dest/notes_filter.d.ts +25 -0
  133. package/dest/notes_filter.d.ts.map +1 -0
  134. package/dest/notes_filter.js +4 -0
  135. package/dest/oracle_version.d.ts +3 -3
  136. package/dest/oracle_version.d.ts.map +1 -1
  137. package/dest/oracle_version.js +4 -3
  138. package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts +4 -0
  139. package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts.map +1 -0
  140. package/dest/private_kernel/hints/{compute_tx_include_by_timestamp.js → compute_tx_expiration_timestamp.js} +12 -12
  141. package/dest/private_kernel/hints/index.d.ts +3 -3
  142. package/dest/private_kernel/hints/index.d.ts.map +1 -1
  143. package/dest/private_kernel/hints/index.js +2 -2
  144. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +29 -0
  145. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -0
  146. package/dest/private_kernel/hints/{build_private_kernel_reset_private_inputs.js → private_kernel_reset_private_inputs_builder.js} +144 -77
  147. package/dest/private_kernel/hints/test_utils.d.ts +122 -0
  148. package/dest/private_kernel/hints/test_utils.d.ts.map +1 -0
  149. package/dest/private_kernel/hints/test_utils.js +203 -0
  150. package/dest/private_kernel/index.d.ts +1 -1
  151. package/dest/private_kernel/private_kernel_execution_prover.d.ts +3 -2
  152. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
  153. package/dest/private_kernel/private_kernel_execution_prover.js +33 -25
  154. package/dest/private_kernel/private_kernel_oracle.d.ts +26 -25
  155. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
  156. package/dest/private_kernel/private_kernel_oracle.js +94 -2
  157. package/dest/pxe.d.ts +121 -103
  158. package/dest/pxe.d.ts.map +1 -1
  159. package/dest/pxe.js +268 -279
  160. package/dest/storage/address_store/address_store.d.ts +11 -0
  161. package/dest/storage/address_store/address_store.d.ts.map +1 -0
  162. package/dest/storage/{address_data_provider/address_data_provider.js → address_store/address_store.js} +13 -12
  163. package/dest/storage/address_store/index.d.ts +2 -0
  164. package/dest/storage/address_store/index.d.ts.map +1 -0
  165. package/dest/storage/address_store/index.js +1 -0
  166. package/dest/storage/anchor_block_store/anchor_block_store.d.ts +17 -0
  167. package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -0
  168. package/dest/storage/{sync_data_provider/sync_data_provider.js → anchor_block_store/anchor_block_store.js} +10 -10
  169. package/dest/storage/anchor_block_store/index.d.ts +2 -0
  170. package/dest/storage/anchor_block_store/index.d.ts.map +1 -0
  171. package/dest/storage/anchor_block_store/index.js +1 -0
  172. package/dest/storage/capsule_store/capsule_store.d.ts +72 -0
  173. package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -0
  174. package/dest/storage/capsule_store/capsule_store.js +253 -0
  175. package/dest/storage/capsule_store/index.d.ts +2 -0
  176. package/dest/storage/capsule_store/index.d.ts.map +1 -0
  177. package/dest/storage/capsule_store/index.js +1 -0
  178. package/dest/storage/contract_store/contract_store.d.ts +93 -0
  179. package/dest/storage/contract_store/contract_store.d.ts.map +1 -0
  180. package/dest/storage/contract_store/contract_store.js +309 -0
  181. package/dest/storage/contract_store/index.d.ts +2 -0
  182. package/dest/storage/contract_store/index.d.ts.map +1 -0
  183. package/dest/storage/contract_store/index.js +1 -0
  184. package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.d.ts +1 -1
  185. package/dest/storage/contract_store/private_functions_tree.d.ts.map +1 -0
  186. package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.js +1 -1
  187. package/dest/storage/index.d.ts +8 -8
  188. package/dest/storage/index.d.ts.map +1 -1
  189. package/dest/storage/index.js +7 -7
  190. package/dest/storage/metadata.d.ts +2 -2
  191. package/dest/storage/metadata.js +1 -1
  192. package/dest/storage/note_store/index.d.ts +3 -0
  193. package/dest/storage/note_store/index.d.ts.map +1 -0
  194. package/dest/storage/note_store/index.js +2 -0
  195. package/dest/storage/note_store/note_store.d.ts +83 -0
  196. package/dest/storage/note_store/note_store.d.ts.map +1 -0
  197. package/dest/storage/note_store/note_store.js +343 -0
  198. package/dest/storage/note_store/stored_note.d.ts +16 -0
  199. package/dest/storage/note_store/stored_note.d.ts.map +1 -0
  200. package/dest/storage/note_store/stored_note.js +43 -0
  201. package/dest/storage/private_event_store/private_event_store.d.ts +91 -0
  202. package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -0
  203. package/dest/storage/private_event_store/private_event_store.js +273 -0
  204. package/dest/storage/private_event_store/stored_private_event.d.ts +23 -0
  205. package/dest/storage/private_event_store/stored_private_event.d.ts.map +1 -0
  206. package/dest/storage/private_event_store/stored_private_event.js +56 -0
  207. package/dest/storage/tagging_store/index.d.ts +4 -0
  208. package/dest/storage/tagging_store/index.d.ts.map +1 -0
  209. package/dest/storage/tagging_store/index.js +3 -0
  210. package/dest/storage/tagging_store/recipient_tagging_store.d.ts +28 -0
  211. package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -0
  212. package/dest/storage/tagging_store/recipient_tagging_store.js +111 -0
  213. package/dest/storage/tagging_store/sender_address_book_store.d.ts +14 -0
  214. package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +1 -0
  215. package/dest/storage/tagging_store/sender_address_book_store.js +36 -0
  216. package/dest/storage/tagging_store/sender_tagging_store.d.ts +77 -0
  217. package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -0
  218. package/dest/storage/tagging_store/sender_tagging_store.js +348 -0
  219. package/dest/tagging/constants.d.ts +2 -2
  220. package/dest/tagging/constants.d.ts.map +1 -1
  221. package/dest/tagging/constants.js +10 -2
  222. package/dest/tagging/get_all_logs_by_tags.d.ts +24 -0
  223. package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -0
  224. package/dest/tagging/get_all_logs_by_tags.js +60 -0
  225. package/dest/tagging/index.d.ts +16 -6
  226. package/dest/tagging/index.d.ts.map +1 -1
  227. package/dest/tagging/index.js +15 -5
  228. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +14 -0
  229. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -0
  230. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +99 -0
  231. package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts +12 -0
  232. package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts.map +1 -0
  233. package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +20 -0
  234. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +14 -0
  235. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -0
  236. package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +33 -0
  237. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +17 -0
  238. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -0
  239. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +71 -0
  240. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +11 -0
  241. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -0
  242. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +29 -0
  243. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +18 -0
  244. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -0
  245. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +59 -0
  246. package/package.json +29 -19
  247. package/src/access_scopes.ts +9 -0
  248. package/src/bin/check_oracle_version.ts +131 -20
  249. package/src/block_synchronizer/block_synchronizer.ts +178 -0
  250. package/src/block_synchronizer/index.ts +1 -0
  251. package/src/config/index.ts +24 -25
  252. package/src/config/package_info.ts +1 -1
  253. package/src/contract_function_simulator/benchmarked_node.ts +103 -0
  254. package/src/contract_function_simulator/contract_function_simulator.ts +396 -116
  255. package/src/contract_function_simulator/execution_note_cache.ts +58 -28
  256. package/src/contract_function_simulator/execution_tagging_index_cache.ts +6 -6
  257. package/src/contract_function_simulator/hashed_values_cache.ts +1 -1
  258. package/src/contract_function_simulator/index.ts +1 -1
  259. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +7 -3
  260. package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +6 -5
  261. package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +2 -2
  262. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +15 -3
  263. package/src/contract_function_simulator/noir-structs/utility_context.ts +6 -25
  264. package/src/contract_function_simulator/oracle/interfaces.ts +43 -18
  265. package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +1 -1
  266. package/src/contract_function_simulator/oracle/note_packing_utils.ts +30 -14
  267. package/src/contract_function_simulator/oracle/oracle.ts +111 -49
  268. package/src/contract_function_simulator/oracle/private_execution.ts +2 -68
  269. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +166 -98
  270. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +350 -91
  271. package/src/contract_function_simulator/pick_notes.ts +1 -1
  272. package/src/contract_function_simulator/proxied_contract_data_source.ts +24 -7
  273. package/src/contract_logging.ts +39 -0
  274. package/src/contract_sync/contract_sync_service.ts +152 -0
  275. package/src/contract_sync/helpers.ts +98 -0
  276. package/src/debug/pxe_debug_utils.ts +93 -0
  277. package/src/entrypoints/client/bundle/index.ts +3 -1
  278. package/src/entrypoints/client/bundle/utils.ts +25 -18
  279. package/src/entrypoints/client/lazy/index.ts +3 -1
  280. package/src/entrypoints/client/lazy/utils.ts +26 -19
  281. package/src/entrypoints/pxe_creation_options.ts +6 -2
  282. package/src/entrypoints/server/index.ts +5 -1
  283. package/src/entrypoints/server/utils.ts +34 -56
  284. package/src/error_enriching.ts +7 -15
  285. package/src/events/event_service.ts +71 -0
  286. package/src/events/index.ts +1 -0
  287. package/src/events/private_event_filter_validator.ts +46 -0
  288. package/src/job_coordinator/job_coordinator.ts +150 -0
  289. package/src/logs/log_service.ts +213 -0
  290. package/src/notes/index.ts +1 -0
  291. package/src/notes/note_service.ts +196 -0
  292. package/src/notes_filter.ts +26 -0
  293. package/src/oracle_version.ts +4 -3
  294. package/src/private_kernel/hints/{compute_tx_include_by_timestamp.ts → compute_tx_expiration_timestamp.ts} +13 -13
  295. package/src/private_kernel/hints/index.ts +2 -2
  296. package/src/private_kernel/hints/{build_private_kernel_reset_private_inputs.ts → private_kernel_reset_private_inputs_builder.ts} +199 -145
  297. package/src/private_kernel/hints/test_utils.ts +325 -0
  298. package/src/private_kernel/private_kernel_execution_prover.ts +38 -34
  299. package/src/private_kernel/private_kernel_oracle.ts +118 -37
  300. package/src/pxe.ts +410 -382
  301. package/src/storage/{address_data_provider/address_data_provider.ts → address_store/address_store.ts} +16 -16
  302. package/src/storage/address_store/index.ts +1 -0
  303. package/src/storage/{sync_data_provider/sync_data_provider.ts → anchor_block_store/anchor_block_store.ts} +10 -11
  304. package/src/storage/anchor_block_store/index.ts +1 -0
  305. package/src/storage/capsule_store/capsule_store.ts +315 -0
  306. package/src/storage/capsule_store/index.ts +1 -0
  307. package/src/storage/contract_store/contract_store.ts +429 -0
  308. package/src/storage/contract_store/index.ts +1 -0
  309. package/src/storage/{contract_data_provider → contract_store}/private_functions_tree.ts +1 -1
  310. package/src/storage/index.ts +7 -7
  311. package/src/storage/metadata.ts +1 -1
  312. package/src/storage/note_store/index.ts +2 -0
  313. package/src/storage/note_store/note_store.ts +418 -0
  314. package/src/storage/note_store/stored_note.ts +48 -0
  315. package/src/storage/private_event_store/private_event_store.ts +384 -0
  316. package/src/storage/private_event_store/stored_private_event.ts +73 -0
  317. package/src/storage/tagging_store/index.ts +3 -0
  318. package/src/storage/tagging_store/recipient_tagging_store.ts +143 -0
  319. package/src/storage/tagging_store/sender_address_book_store.ts +48 -0
  320. package/src/storage/tagging_store/sender_tagging_store.ts +429 -0
  321. package/src/tagging/constants.ts +10 -2
  322. package/src/tagging/get_all_logs_by_tags.ts +92 -0
  323. package/src/tagging/index.ts +18 -5
  324. package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +140 -0
  325. package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +34 -0
  326. package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +44 -0
  327. package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +94 -0
  328. package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +36 -0
  329. package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +75 -0
  330. package/dest/contract_function_simulator/execution_data_provider.d.ts +0 -274
  331. package/dest/contract_function_simulator/execution_data_provider.d.ts.map +0 -1
  332. package/dest/contract_function_simulator/execution_data_provider.js +0 -14
  333. package/dest/contract_function_simulator/proxied_node.d.ts +0 -9
  334. package/dest/contract_function_simulator/proxied_node.d.ts.map +0 -1
  335. package/dest/contract_function_simulator/proxied_node.js +0 -27
  336. package/dest/contract_function_simulator/pxe_oracle_interface.d.ts +0 -122
  337. package/dest/contract_function_simulator/pxe_oracle_interface.d.ts.map +0 -1
  338. package/dest/contract_function_simulator/pxe_oracle_interface.js +0 -701
  339. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +0 -28
  340. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +0 -1
  341. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +0 -4
  342. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts.map +0 -1
  343. package/dest/private_kernel/private_kernel_oracle_impl.d.ts +0 -45
  344. package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +0 -1
  345. package/dest/private_kernel/private_kernel_oracle_impl.js +0 -86
  346. package/dest/storage/address_data_provider/address_data_provider.d.ts +0 -11
  347. package/dest/storage/address_data_provider/address_data_provider.d.ts.map +0 -1
  348. package/dest/storage/address_data_provider/index.d.ts +0 -2
  349. package/dest/storage/address_data_provider/index.d.ts.map +0 -1
  350. package/dest/storage/address_data_provider/index.js +0 -1
  351. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts +0 -25
  352. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +0 -1
  353. package/dest/storage/capsule_data_provider/capsule_data_provider.js +0 -118
  354. package/dest/storage/capsule_data_provider/index.d.ts +0 -2
  355. package/dest/storage/capsule_data_provider/index.d.ts.map +0 -1
  356. package/dest/storage/capsule_data_provider/index.js +0 -1
  357. package/dest/storage/contract_data_provider/contract_data_provider.d.ts +0 -74
  358. package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +0 -1
  359. package/dest/storage/contract_data_provider/contract_data_provider.js +0 -205
  360. package/dest/storage/contract_data_provider/index.d.ts +0 -2
  361. package/dest/storage/contract_data_provider/index.d.ts.map +0 -1
  362. package/dest/storage/contract_data_provider/index.js +0 -1
  363. package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +0 -1
  364. package/dest/storage/note_data_provider/index.d.ts +0 -3
  365. package/dest/storage/note_data_provider/index.d.ts.map +0 -1
  366. package/dest/storage/note_data_provider/index.js +0 -2
  367. package/dest/storage/note_data_provider/note_dao.d.ts +0 -100
  368. package/dest/storage/note_data_provider/note_dao.d.ts.map +0 -1
  369. package/dest/storage/note_data_provider/note_dao.js +0 -102
  370. package/dest/storage/note_data_provider/note_data_provider.d.ts +0 -83
  371. package/dest/storage/note_data_provider/note_data_provider.d.ts.map +0 -1
  372. package/dest/storage/note_data_provider/note_data_provider.js +0 -308
  373. package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +0 -43
  374. package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts.map +0 -1
  375. package/dest/storage/private_event_data_provider/private_event_data_provider.js +0 -104
  376. package/dest/storage/sync_data_provider/index.d.ts +0 -2
  377. package/dest/storage/sync_data_provider/index.d.ts.map +0 -1
  378. package/dest/storage/sync_data_provider/index.js +0 -1
  379. package/dest/storage/sync_data_provider/sync_data_provider.d.ts +0 -10
  380. package/dest/storage/sync_data_provider/sync_data_provider.d.ts.map +0 -1
  381. package/dest/storage/tagging_data_provider/index.d.ts +0 -2
  382. package/dest/storage/tagging_data_provider/index.d.ts.map +0 -1
  383. package/dest/storage/tagging_data_provider/index.js +0 -1
  384. package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts +0 -40
  385. package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts.map +0 -1
  386. package/dest/storage/tagging_data_provider/tagging_data_provider.js +0 -89
  387. package/dest/synchronizer/index.d.ts +0 -2
  388. package/dest/synchronizer/index.d.ts.map +0 -1
  389. package/dest/synchronizer/index.js +0 -1
  390. package/dest/synchronizer/synchronizer.d.ts +0 -35
  391. package/dest/synchronizer/synchronizer.d.ts.map +0 -1
  392. package/dest/synchronizer/synchronizer.js +0 -101
  393. package/dest/tagging/siloed_tag.d.ts +0 -14
  394. package/dest/tagging/siloed_tag.d.ts.map +0 -1
  395. package/dest/tagging/siloed_tag.js +0 -20
  396. package/dest/tagging/tag.d.ts +0 -12
  397. package/dest/tagging/tag.d.ts.map +0 -1
  398. package/dest/tagging/tag.js +0 -17
  399. package/dest/tagging/utils.d.ts +0 -18
  400. package/dest/tagging/utils.d.ts.map +0 -1
  401. package/dest/tagging/utils.js +0 -24
  402. package/src/contract_function_simulator/execution_data_provider.ts +0 -343
  403. package/src/contract_function_simulator/proxied_node.ts +0 -33
  404. package/src/contract_function_simulator/pxe_oracle_interface.ts +0 -1019
  405. package/src/private_kernel/private_kernel_oracle_impl.ts +0 -132
  406. package/src/storage/address_data_provider/index.ts +0 -1
  407. package/src/storage/capsule_data_provider/capsule_data_provider.ts +0 -147
  408. package/src/storage/capsule_data_provider/index.ts +0 -1
  409. package/src/storage/contract_data_provider/contract_data_provider.ts +0 -294
  410. package/src/storage/contract_data_provider/index.ts +0 -1
  411. package/src/storage/note_data_provider/index.ts +0 -2
  412. package/src/storage/note_data_provider/note_dao.ts +0 -154
  413. package/src/storage/note_data_provider/note_data_provider.ts +0 -393
  414. package/src/storage/private_event_data_provider/private_event_data_provider.ts +0 -148
  415. package/src/storage/sync_data_provider/index.ts +0 -1
  416. package/src/storage/tagging_data_provider/index.ts +0 -1
  417. package/src/storage/tagging_data_provider/tagging_data_provider.ts +0 -120
  418. package/src/synchronizer/index.ts +0 -1
  419. package/src/synchronizer/synchronizer.ts +0 -120
  420. package/src/tagging/siloed_tag.ts +0 -22
  421. package/src/tagging/tag.ts +0 -16
  422. package/src/tagging/utils.ts +0 -31
@@ -1,205 +0,0 @@
1
- import { toArray } from '@aztec/foundation/iterable';
2
- import { FunctionSelector, FunctionType, contractArtifactFromBuffer, contractArtifactToBuffer, getFunctionDebugMetadata } from '@aztec/stdlib/abi';
3
- import { AztecAddress } from '@aztec/stdlib/aztec-address';
4
- import { SerializableContractInstance, getContractClassFromArtifact } from '@aztec/stdlib/contract';
5
- import { PrivateFunctionsTree } from './private_functions_tree.js';
6
- /**
7
- * ContractDataProvider serves as a data manager and retriever for Aztec.nr contracts.
8
- * It provides methods to obtain contract addresses, function ABI, bytecode, and membership witnesses
9
- * from a given contract address and function selector. The class maintains a cache of ContractTree instances
10
- * to efficiently serve the requested data. It interacts with the ContractDatabase and AztecNode to fetch
11
- * the required information and facilitate cryptographic proof generation.
12
- */ export class ContractDataProvider {
13
- /** Map from contract class id to private function tree. */ // TODO: Update it to be LRU cache so that it doesn't keep all the data all the time.
14
- #privateFunctionTrees = new Map();
15
- /** Map from contract address to contract class id */ #contractClassIdMap = new Map();
16
- #contractArtifacts;
17
- #contractInstances;
18
- constructor(store){
19
- this.#contractArtifacts = store.openMap('contract_artifacts');
20
- this.#contractInstances = store.openMap('contracts_instances');
21
- }
22
- // Setters
23
- async addContractArtifact(id, contract) {
24
- const privateFunctions = contract.functions.filter((functionArtifact)=>functionArtifact.functionType === FunctionType.PRIVATE);
25
- const privateSelectors = await Promise.all(privateFunctions.map(async (privateFunctionArtifact)=>(await FunctionSelector.fromNameAndParameters(privateFunctionArtifact.name, privateFunctionArtifact.parameters)).toString()));
26
- if (privateSelectors.length !== new Set(privateSelectors).size) {
27
- throw new Error('Repeated function selectors of private functions');
28
- }
29
- await this.#contractArtifacts.set(id.toString(), contractArtifactToBuffer(contract));
30
- }
31
- async addContractInstance(contract) {
32
- this.#contractClassIdMap.set(contract.address.toString(), contract.currentContractClassId);
33
- await this.#contractInstances.set(contract.address.toString(), new SerializableContractInstance(contract).toBuffer());
34
- }
35
- // Private getters
36
- async #getContractClassId(contractAddress) {
37
- if (!this.#contractClassIdMap.has(contractAddress.toString())) {
38
- const instance = await this.getContractInstance(contractAddress);
39
- if (!instance) {
40
- return;
41
- }
42
- this.#contractClassIdMap.set(contractAddress.toString(), instance.currentContractClassId);
43
- }
44
- return this.#contractClassIdMap.get(contractAddress.toString());
45
- }
46
- /**
47
- * Retrieve or create a ContractTree instance based on the provided class id.
48
- * If an existing tree with the same class id is found in the cache, it will be returned.
49
- * Otherwise, a new ContractTree instance will be created using the contract data from the database
50
- * and added to the cache before returning.
51
- *
52
- * @param classId - The class id of the contract for which the ContractTree is required.
53
- * @returns A ContractTree instance associated with the specified contract address.
54
- * @throws An Error if the contract is not found in the ContractDatabase.
55
- */ async #getPrivateFunctionTreeForClassId(classId) {
56
- if (!this.#privateFunctionTrees.has(classId.toString())) {
57
- const artifact = await this.getContractArtifact(classId);
58
- if (!artifact) {
59
- return;
60
- }
61
- const tree = await PrivateFunctionsTree.create(artifact);
62
- this.#privateFunctionTrees.set(classId.toString(), tree);
63
- }
64
- return this.#privateFunctionTrees.get(classId.toString());
65
- }
66
- async #getContractArtifactByAddress(contractAddress) {
67
- const contractClassId = await this.#getContractClassId(contractAddress);
68
- return contractClassId && this.getContractArtifact(contractClassId);
69
- }
70
- // Public getters
71
- async getContractsAddresses() {
72
- const keys = await toArray(this.#contractInstances.keysAsync());
73
- return keys.map(AztecAddress.fromString);
74
- }
75
- /** Returns a contract instance for a given address. Throws if not found. */ async getContractInstance(contractAddress) {
76
- const contract = await this.#contractInstances.getAsync(contractAddress.toString());
77
- return contract && SerializableContractInstance.fromBuffer(contract).withAddress(contractAddress);
78
- }
79
- async getContractArtifact(contractClassId) {
80
- const contract = await this.#contractArtifacts.getAsync(contractClassId.toString());
81
- // TODO(@spalladino): AztecAsyncMap lies and returns Uint8Arrays instead of Buffers, hence the extra Buffer.from.
82
- return contract && contractArtifactFromBuffer(Buffer.from(contract));
83
- }
84
- /** Returns a contract class for a given class id. Throws if not found. */ async getContractClass(contractClassId) {
85
- const artifact = await this.getContractArtifact(contractClassId);
86
- return artifact && getContractClassFromArtifact(artifact);
87
- }
88
- async getContract(address) {
89
- const instance = await this.getContractInstance(address);
90
- if (!instance) {
91
- return;
92
- }
93
- const artifact = await this.getContractArtifact(instance.currentContractClassId);
94
- if (!artifact) {
95
- return;
96
- }
97
- return {
98
- ...instance,
99
- ...artifact
100
- };
101
- }
102
- /**
103
- * Retrieves the artifact of a specified function within a given contract.
104
- * The function is identified by its selector, which is a unique code generated from the function's signature.
105
- * Throws an error if the contract address or function selector are invalid or not found.
106
- *
107
- * @param contractAddress - The AztecAddress representing the contract containing the function.
108
- * @param selector - The function selector.
109
- * @returns The corresponding function's artifact as an object.
110
- */ async getFunctionArtifact(contractAddress, selector) {
111
- const artifact = await this.#getContractArtifactByAddress(contractAddress);
112
- const fnArtifact = artifact && await this.#findFunctionArtifactBySelector(artifact, selector);
113
- return fnArtifact && {
114
- ...fnArtifact,
115
- contractName: artifact.name
116
- };
117
- }
118
- async getPublicFunctionArtifact(contractAddress) {
119
- const artifact = await this.#getContractArtifactByAddress(contractAddress);
120
- const fnArtifact = artifact && artifact.functions.find((fn)=>fn.functionType === FunctionType.PUBLIC);
121
- return fnArtifact && {
122
- ...fnArtifact,
123
- contractName: artifact.name
124
- };
125
- }
126
- /**
127
- * Retrieves the artifact of a specified function within a given contract.
128
- * The function is identified by its name, which is unique within a contract.
129
- * Throws if the contract has not been added to the database.
130
- *
131
- * @param contractAddress - The AztecAddress representing the contract containing the function.
132
- * @param functionName - The name of the function.
133
- * @returns The corresponding function's artifact as an object
134
- */ async getFunctionArtifactByName(contractAddress, functionName) {
135
- const artifact = await this.#getContractArtifactByAddress(contractAddress);
136
- return artifact?.functions.find((fn)=>fn.name === functionName);
137
- }
138
- async getFunctionAbi(contractAddress, selector) {
139
- const artifact = await this.#getContractArtifactByAddress(contractAddress);
140
- return artifact && await this.#findFunctionAbiBySelector(artifact, selector);
141
- }
142
- /**
143
- * Retrieves the debug metadata of a specified function within a given contract.
144
- * The function is identified by its selector, which is a unique code generated from the function's signature.
145
- * Returns undefined if the debug metadata for the given function is not found.
146
- * Throws if the contract has not been added to the database.
147
- *
148
- * @param contractAddress - The AztecAddress representing the contract containing the function.
149
- * @param selector - The function selector.
150
- * @returns The corresponding function's artifact as an object.
151
- */ async getFunctionDebugMetadata(contractAddress, selector) {
152
- const artifact = await this.#getContractArtifactByAddress(contractAddress);
153
- const fnArtifact = artifact && await this.#findFunctionArtifactBySelector(artifact, selector);
154
- return fnArtifact && getFunctionDebugMetadata(artifact, fnArtifact);
155
- }
156
- async getPublicFunctionDebugMetadata(contractAddress) {
157
- const artifact = await this.#getContractArtifactByAddress(contractAddress);
158
- const fnArtifact = artifact && artifact.functions.find((fn)=>fn.functionType === FunctionType.PUBLIC);
159
- return fnArtifact && getFunctionDebugMetadata(artifact, fnArtifact);
160
- }
161
- /**
162
- * Retrieve the function membership witness for the given contract class and function selector.
163
- * The function membership witness represents a proof that the function belongs to the specified contract.
164
- * Throws an error if the contract address or function selector is unknown.
165
- *
166
- * @param contractClassId - The id of the class.
167
- * @param selector - The function selector.
168
- * @returns A promise that resolves with the MembershipWitness instance for the specified contract's function.
169
- */ async getFunctionMembershipWitness(contractClassId, selector) {
170
- const tree = await this.#getPrivateFunctionTreeForClassId(contractClassId);
171
- return tree?.getFunctionMembershipWitness(selector);
172
- }
173
- async getDebugContractName(contractAddress) {
174
- const artifact = await this.#getContractArtifactByAddress(contractAddress);
175
- return artifact?.name;
176
- }
177
- async getDebugFunctionName(contractAddress, selector) {
178
- const artifact = await this.#getContractArtifactByAddress(contractAddress);
179
- const fnArtifact = artifact && await this.#findFunctionAbiBySelector(artifact, selector);
180
- return `${artifact?.name ?? contractAddress}:${fnArtifact?.name ?? selector}`;
181
- }
182
- async #findFunctionArtifactBySelector(artifact, selector) {
183
- const functions = artifact.functions;
184
- for(let i = 0; i < functions.length; i++){
185
- const fn = functions[i];
186
- const fnSelector = await FunctionSelector.fromNameAndParameters(fn.name, fn.parameters);
187
- if (fnSelector.equals(selector)) {
188
- return fn;
189
- }
190
- }
191
- }
192
- async #findFunctionAbiBySelector(artifact, selector) {
193
- const functions = [
194
- ...artifact.functions,
195
- ...artifact.nonDispatchPublicFunctions ?? []
196
- ];
197
- for(let i = 0; i < functions.length; i++){
198
- const fn = functions[i];
199
- const fnSelector = await FunctionSelector.fromNameAndParameters(fn.name, fn.parameters);
200
- if (fnSelector.equals(selector)) {
201
- return fn;
202
- }
203
- }
204
- }
205
- }
@@ -1,2 +0,0 @@
1
- export { ContractDataProvider } from './contract_data_provider.js';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/contract_data_provider/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC"}
@@ -1 +0,0 @@
1
- export { ContractDataProvider } from './contract_data_provider.js';
@@ -1 +0,0 @@
1
- {"version":3,"file":"private_functions_tree.d.ts","sourceRoot":"","sources":["../../../src/storage/contract_data_provider/private_functions_tree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAGxD,OAAO,EAAE,iBAAiB,EAAmB,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EAAE,KAAK,gBAAgB,EAAE,gBAAgB,EAAgB,MAAM,mBAAmB,CAAC;AAQ1F;;;;;GAKG;AACH,qBAAa,oBAAoB;IAGX,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAFrD,OAAO,CAAC,IAAI,CAAC,CAAa;IAE1B,OAAO;WAEM,MAAM,CAAC,QAAQ,EAAE,gBAAgB;IAS9C;;;;;;;;OAQG;IACU,4BAA4B,CACvC,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,iBAAiB,CAAC,OAAO,oBAAoB,CAAC,CAAC;YAiB5C,OAAO;CAMtB"}
@@ -1,3 +0,0 @@
1
- export { NoteDao } from './note_dao.js';
2
- export { NoteDataProvider } from './note_data_provider.js';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/note_data_provider/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC"}
@@ -1,2 +0,0 @@
1
- export { NoteDao } from './note_dao.js';
2
- export { NoteDataProvider } from './note_data_provider.js';
@@ -1,100 +0,0 @@
1
- import { Fr } from '@aztec/foundation/fields';
2
- import { BufferReader } from '@aztec/foundation/serialize';
3
- import { AztecAddress } from '@aztec/stdlib/aztec-address';
4
- import { Note } from '@aztec/stdlib/note';
5
- import { TxHash } from '@aztec/stdlib/tx';
6
- import type { NoteData } from '../../contract_function_simulator/oracle/interfaces.js';
7
- /**
8
- * A Note Data Access Object, representing a note that was committed to the note hash tree, holding all of the
9
- * information required to use it during execution and manage its state.
10
- */
11
- export declare class NoteDao implements NoteData {
12
- /** The packed content of the note, as will be returned in the getNotes oracle. */
13
- note: Note;
14
- /** The address of the contract that created the note (i.e. the address used by the kernel during siloing). */
15
- contractAddress: AztecAddress;
16
- /**
17
- * The storage location of the note. This value is not used for anything in PXE, but we do index by storage slot
18
- * since contracts typically make queries based on it.
19
- */
20
- storageSlot: Fr;
21
- /** The nonce that was injected into the note hash preimage in order to guarantee uniqueness. */
22
- noteNonce: Fr;
23
- /**
24
- * The inner hash (non-unique, non-siloed) of the note. Each contract determines how the note is hashed. Can
25
- * be used alongside contractAddress and nonce to compute the uniqueNoteHash and the siloedNoteHash.
26
- */
27
- noteHash: Fr;
28
- /**
29
- * The nullifier of the note, siloed by contract address.
30
- * Note: Might be set as 0 if the note was added to PXE as nullified.
31
- */
32
- siloedNullifier: Fr;
33
- /** The hash of the tx in which this note was created. Knowing the tx hash allows for efficient node queries e.g.
34
- * when searching for txEffects.
35
- */
36
- txHash: TxHash;
37
- /** The L2 block number in which the tx with this note was included. Used for note management while processing
38
- * reorgs.*/
39
- l2BlockNumber: number;
40
- /** The L2 block hash in which the tx with this note was included. Used for note management while processing
41
- * reorgs.*/
42
- l2BlockHash: string;
43
- /** The index of the leaf in the global note hash tree the note is stored at */
44
- index: bigint;
45
- /**
46
- * The address whose public key was used to encrypt the note log during delivery.
47
- * (This is the x-coordinate of the public key.)
48
- */
49
- recipient: AztecAddress;
50
- constructor(
51
- /** The packed content of the note, as will be returned in the getNotes oracle. */
52
- note: Note,
53
- /** The address of the contract that created the note (i.e. the address used by the kernel during siloing). */
54
- contractAddress: AztecAddress,
55
- /**
56
- * The storage location of the note. This value is not used for anything in PXE, but we do index by storage slot
57
- * since contracts typically make queries based on it.
58
- */
59
- storageSlot: Fr,
60
- /** The nonce that was injected into the note hash preimage in order to guarantee uniqueness. */
61
- noteNonce: Fr,
62
- /**
63
- * The inner hash (non-unique, non-siloed) of the note. Each contract determines how the note is hashed. Can
64
- * be used alongside contractAddress and nonce to compute the uniqueNoteHash and the siloedNoteHash.
65
- */
66
- noteHash: Fr,
67
- /**
68
- * The nullifier of the note, siloed by contract address.
69
- * Note: Might be set as 0 if the note was added to PXE as nullified.
70
- */
71
- siloedNullifier: Fr,
72
- /** The hash of the tx in which this note was created. Knowing the tx hash allows for efficient node queries e.g.
73
- * when searching for txEffects.
74
- */
75
- txHash: TxHash,
76
- /** The L2 block number in which the tx with this note was included. Used for note management while processing
77
- * reorgs.*/
78
- l2BlockNumber: number,
79
- /** The L2 block hash in which the tx with this note was included. Used for note management while processing
80
- * reorgs.*/
81
- l2BlockHash: string,
82
- /** The index of the leaf in the global note hash tree the note is stored at */
83
- index: bigint,
84
- /**
85
- * The address whose public key was used to encrypt the note log during delivery.
86
- * (This is the x-coordinate of the public key.)
87
- */
88
- recipient: AztecAddress);
89
- toBuffer(): Buffer;
90
- static fromBuffer(buffer: Buffer | BufferReader): NoteDao;
91
- toString(): string;
92
- static fromString(str: string): NoteDao;
93
- /**
94
- * Returns the size in bytes of the Note Dao.
95
- * @returns - Its size in bytes.
96
- */
97
- getSize(): number;
98
- static random({ note, contractAddress, storageSlot, noteNonce, noteHash, siloedNullifier, txHash, l2BlockNumber, l2BlockHash, index, recipient, }?: Partial<NoteDao>): Promise<NoteDao>;
99
- }
100
- //# sourceMappingURL=note_dao.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"note_dao.d.ts","sourceRoot":"","sources":["../../../src/storage/note_data_provider/note_dao.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAS,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wDAAwD,CAAC;AAEvF;;;GAGG;AACH,qBAAa,OAAQ,YAAW,QAAQ;IAIpC,kFAAkF;IAC3E,IAAI,EAAE,IAAI;IACjB,8GAA8G;IACvG,eAAe,EAAE,YAAY;IACpC;;;OAGG;IACI,WAAW,EAAE,EAAE;IACtB,gGAAgG;IACzF,SAAS,EAAE,EAAE;IAGpB;;;OAGG;IACI,QAAQ,EAAE,EAAE;IACnB;;;OAGG;IACI,eAAe,EAAE,EAAE;IAG1B;;OAEG;IACI,MAAM,EAAE,MAAM;IACrB;gBACY;IACL,aAAa,EAAE,MAAM;IAC5B;gBACY;IACL,WAAW,EAAE,MAAM;IAC1B,+EAA+E;IACxE,KAAK,EAAE,MAAM;IACpB;;;OAGG;IACI,SAAS,EAAE,YAAY;;IAzC9B,kFAAkF;IAC3E,IAAI,EAAE,IAAI;IACjB,8GAA8G;IACvG,eAAe,EAAE,YAAY;IACpC;;;OAGG;IACI,WAAW,EAAE,EAAE;IACtB,gGAAgG;IACzF,SAAS,EAAE,EAAE;IAGpB;;;OAGG;IACI,QAAQ,EAAE,EAAE;IACnB;;;OAGG;IACI,eAAe,EAAE,EAAE;IAG1B;;OAEG;IACI,MAAM,EAAE,MAAM;IACrB;gBACY;IACL,aAAa,EAAE,MAAM;IAC5B;gBACY;IACL,WAAW,EAAE,MAAM;IAC1B,+EAA+E;IACxE,KAAK,EAAE,MAAM;IACpB;;;OAGG;IACI,SAAS,EAAE,YAAY;IAGhC,QAAQ,IAAI,MAAM;IAgBlB,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY;IA8B/C,QAAQ;IAIR,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM;IAK7B;;;OAGG;IACI,OAAO;WAMD,MAAM,CAAC,EAClB,IAAoB,EACpB,eAA2B,EAC3B,WAAyB,EACzB,SAAuB,EACvB,QAAsB,EACtB,eAA6B,EAC7B,MAAwB,EACxB,aAAgD,EAChD,WAAoC,EACpC,KAA8B,EAC9B,SAAqB,GACtB,GAAE,OAAO,CAAC,OAAO,CAAM;CAezB"}
@@ -1,102 +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 { AztecAddress } from '@aztec/stdlib/aztec-address';
5
- import { Note } from '@aztec/stdlib/note';
6
- import { TxHash } from '@aztec/stdlib/tx';
7
- /**
8
- * A Note Data Access Object, representing a note that was committed to the note hash tree, holding all of the
9
- * information required to use it during execution and manage its state.
10
- */ export class NoteDao {
11
- note;
12
- contractAddress;
13
- storageSlot;
14
- noteNonce;
15
- noteHash;
16
- siloedNullifier;
17
- txHash;
18
- l2BlockNumber;
19
- l2BlockHash;
20
- index;
21
- recipient;
22
- constructor(// Note information
23
- /** The packed content of the note, as will be returned in the getNotes oracle. */ note, /** The address of the contract that created the note (i.e. the address used by the kernel during siloing). */ contractAddress, /**
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
- */ storageSlot, /** The nonce that was injected into the note hash preimage in order to guarantee uniqueness. */ noteNonce, // Computed values
27
- /**
28
- * The inner hash (non-unique, non-siloed) of the note. Each contract determines how the note is hashed. Can
29
- * be used alongside contractAddress and nonce to compute the uniqueNoteHash and the siloedNoteHash.
30
- */ noteHash, /**
31
- * The nullifier of the note, siloed by contract address.
32
- * Note: Might be set as 0 if the note was added to PXE as nullified.
33
- */ siloedNullifier, // Metadata
34
- /** The hash of the tx in which this note was created. Knowing the tx hash allows for efficient node queries e.g.
35
- * when searching for txEffects.
36
- */ txHash, /** The L2 block number in which the tx with this note was included. Used for note management while processing
37
- * reorgs.*/ l2BlockNumber, /** The L2 block hash in which the tx with this note was included. Used for note management while processing
38
- * reorgs.*/ l2BlockHash, /** The index of the leaf in the global note hash tree the note is stored at */ index, /**
39
- * The address whose public key was used to encrypt the note log during delivery.
40
- * (This is the x-coordinate of the public key.)
41
- */ recipient){
42
- this.note = note;
43
- this.contractAddress = contractAddress;
44
- this.storageSlot = storageSlot;
45
- this.noteNonce = noteNonce;
46
- this.noteHash = noteHash;
47
- this.siloedNullifier = siloedNullifier;
48
- this.txHash = txHash;
49
- this.l2BlockNumber = l2BlockNumber;
50
- this.l2BlockHash = l2BlockHash;
51
- this.index = index;
52
- this.recipient = recipient;
53
- }
54
- toBuffer() {
55
- return serializeToBuffer([
56
- this.note,
57
- this.contractAddress,
58
- this.storageSlot,
59
- this.noteNonce,
60
- this.noteHash,
61
- this.siloedNullifier,
62
- this.txHash,
63
- this.l2BlockNumber,
64
- Fr.fromHexString(this.l2BlockHash),
65
- this.index,
66
- this.recipient
67
- ]);
68
- }
69
- static fromBuffer(buffer) {
70
- const reader = BufferReader.asReader(buffer);
71
- const note = Note.fromBuffer(reader);
72
- const contractAddress = AztecAddress.fromBuffer(reader);
73
- const storageSlot = Fr.fromBuffer(reader);
74
- const noteNonce = Fr.fromBuffer(reader);
75
- const noteHash = Fr.fromBuffer(reader);
76
- const siloedNullifier = Fr.fromBuffer(reader);
77
- const txHash = reader.readObject(TxHash);
78
- const l2BlockNumber = reader.readNumber();
79
- const l2BlockHash = Fr.fromBuffer(reader).toString();
80
- const index = toBigIntBE(reader.readBytes(32));
81
- const recipient = AztecAddress.fromBuffer(reader);
82
- return new NoteDao(note, contractAddress, storageSlot, noteNonce, noteHash, siloedNullifier, txHash, l2BlockNumber, l2BlockHash, index, recipient);
83
- }
84
- toString() {
85
- return '0x' + this.toBuffer().toString('hex');
86
- }
87
- static fromString(str) {
88
- const hex = str.replace(/^0x/, '');
89
- return NoteDao.fromBuffer(Buffer.from(hex, 'hex'));
90
- }
91
- /**
92
- * Returns the size in bytes of the Note Dao.
93
- * @returns - Its size in bytes.
94
- */ getSize() {
95
- const indexSize = Math.ceil(Math.log2(Number(this.index)));
96
- const noteSize = 4 + this.note.items.length * Fr.SIZE_IN_BYTES;
97
- return noteSize + AztecAddress.SIZE_IN_BYTES + Fr.SIZE_IN_BYTES * 4 + TxHash.SIZE + Point.SIZE_IN_BYTES + indexSize;
98
- }
99
- static async random({ note = Note.random(), contractAddress = undefined, storageSlot = Fr.random(), noteNonce = Fr.random(), noteHash = Fr.random(), siloedNullifier = Fr.random(), txHash = TxHash.random(), l2BlockNumber = Math.floor(Math.random() * 1000), l2BlockHash = Fr.random().toString(), index = Fr.random().toBigInt(), recipient = undefined } = {}) {
100
- return new NoteDao(note, contractAddress ?? await AztecAddress.random(), storageSlot, noteNonce, noteHash, siloedNullifier, txHash, l2BlockNumber, l2BlockHash, index, recipient ?? await AztecAddress.random());
101
- }
102
- }
@@ -1,83 +0,0 @@
1
- import type { Fr } from '@aztec/foundation/fields';
2
- import type { AztecAsyncKVStore } from '@aztec/kv-store';
3
- import { AztecAddress } from '@aztec/stdlib/aztec-address';
4
- import type { InBlock } from '@aztec/stdlib/block';
5
- import { type NotesFilter } from '@aztec/stdlib/note';
6
- import { NoteDao } from './note_dao.js';
7
- /**
8
- * NoteDataProvider manages the storage and retrieval of notes.
9
- *
10
- * Notes can be active or nullified. This class processes new notes, nullifications,
11
- * and performs rollback handling in the case of a reorg.
12
- **/
13
- export declare class NoteDataProvider {
14
- #private;
15
- private constructor();
16
- /**
17
- * Creates and initializes a new NoteDataProvider instance.
18
- *
19
- * This factory method creates a NoteDataProvider and restores any existing
20
- * scope-specific indexes from the database.
21
- *
22
- * @param store - The key-value store to use for persistence
23
- * @returns Promise resolving to a fully initialized NoteDataProvider instance
24
- */
25
- static create(store: AztecAsyncKVStore): Promise<NoteDataProvider>;
26
- /**
27
- * Adds a new scope to the note data provider.
28
- *
29
- * Scopes provide privacy isolation by creating separate indexes for each user.
30
- * Each scope gets its own set of indexes for efficient note retrieval by various criteria.
31
- *
32
- * @param scope - The AztecAddress representing the scope/user to add
33
- * @returns Promise resolving to true if scope was added, false if it already existed
34
- */
35
- addScope(scope: AztecAddress): Promise<boolean>;
36
- /**
37
- * Adds multiple notes to the data provider under the specified scope.
38
- *
39
- * Notes are stored using their index from the notes hash tree as the key, which provides
40
- * uniqueness and maintains creation order. Each note is indexed by multiple criteria
41
- * for efficient retrieval.
42
- *
43
- * @param notes - Notes to store
44
- * @param scope - The scope (user/account) under which to store the notes
45
- */
46
- addNotes(notes: NoteDao[], scope: AztecAddress): Promise<void>;
47
- /**
48
- * Synchronizes notes and nullifiers to a specific block number.
49
- *
50
- * This method ensures that the state of notes and nullifiers is consistent with the
51
- * specified block number. It restores any notes that were nullified after the given block
52
- * and deletes any active notes created after that block.
53
- *
54
- * @param blockNumber - The new chain tip after a reorg
55
- * @param synchedBlockNumber - The block number up to which PXE managed to sync before the reorg happened.
56
- */
57
- rollbackNotesAndNullifiers(blockNumber: number, synchedBlockNumber: number): Promise<void>;
58
- /**
59
- * Retrieves notes based on the provided filter criteria.
60
- *
61
- * This method queries both active and optionally nullified notes based on the filter
62
- * parameters.
63
- *
64
- * @param filter - Filter criteria including contractAddress (required), and optional
65
- * storageSlot, status, scopes and siloedNullifier.
66
- * @returns Promise resolving to array of NoteDao objects matching the filter
67
- * @throws If filtering by an empty scopes array. Scopes have to be set to undefined or to a non-empty array.
68
- */
69
- getNotes(filter: NotesFilter): Promise<NoteDao[]>;
70
- /**
71
- * Transitions notes from "active" to "nullified" state.
72
- *
73
- * This operation processes a batch of nullifiers to mark the corresponding notes
74
- * as spent/nullified. The operation is atomic - if any nullifier is not found,
75
- * the entire operation fails and no notes are modified.
76
- *
77
- * @param nullifiers - Array of nullifiers with their block numbers to process
78
- * @returns Promise resolving to array of nullified NoteDao objects
79
- * @throws Error if any nullifier is not found in the active notes
80
- */
81
- applyNullifiers(nullifiers: InBlock<Fr>[]): Promise<NoteDao[]>;
82
- }
83
- //# sourceMappingURL=note_data_provider.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"note_data_provider.d.ts","sourceRoot":"","sources":["../../../src/storage/note_data_provider/note_data_provider.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAEnD,OAAO,KAAK,EAAE,iBAAiB,EAAqC,MAAM,iBAAiB,CAAC;AAC5F,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAc,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAElE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC;;;;;IAKI;AACJ,qBAAa,gBAAgB;;IAiB3B,OAAO;IAkBP;;;;;;;;OAQG;WACiB,MAAM,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAS/E;;;;;;;;OAQG;IACU,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC;IAc5D;;;;;;;;;OASG;IACH,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAkB9D;;;;;;;;;OASG;IACU,0BAA0B,CAAC,WAAW,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAwFvG;;;;;;;;;;OAUG;IACG,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IA8FvD;;;;;;;;;;OAUG;IACH,eAAe,CAAC,UAAU,EAAE,OAAO,CAAC,EAAE,CAAC,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;CA0D/D"}