@aztec/pxe 0.0.0-test.1 → 0.0.1-commit.03f7ef2

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 (402) hide show
  1. package/README.md +5 -5
  2. package/dest/bin/check_oracle_version.d.ts +2 -0
  3. package/dest/bin/check_oracle_version.d.ts.map +1 -0
  4. package/dest/bin/check_oracle_version.js +129 -0
  5. package/dest/block_synchronizer/block_synchronizer.d.ts +39 -0
  6. package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -0
  7. package/dest/{synchronizer/synchronizer.js → block_synchronizer/block_synchronizer.js} +36 -32
  8. package/dest/block_synchronizer/index.d.ts +2 -0
  9. package/dest/block_synchronizer/index.d.ts.map +1 -0
  10. package/dest/block_synchronizer/index.js +1 -0
  11. package/dest/config/index.d.ts +11 -24
  12. package/dest/config/index.d.ts.map +1 -1
  13. package/dest/config/index.js +18 -33
  14. package/dest/config/package_info.d.ts +1 -1
  15. package/dest/config/package_info.js +1 -1
  16. package/dest/contract_function_simulator/contract_function_simulator.d.ts +83 -0
  17. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -0
  18. package/dest/contract_function_simulator/contract_function_simulator.js +325 -0
  19. package/dest/contract_function_simulator/execution_note_cache.d.ts +95 -0
  20. package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -0
  21. package/dest/contract_function_simulator/execution_note_cache.js +191 -0
  22. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +16 -0
  23. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -0
  24. package/dest/contract_function_simulator/execution_tagging_index_cache.js +26 -0
  25. package/dest/contract_function_simulator/hashed_values_cache.d.ts +28 -0
  26. package/dest/contract_function_simulator/hashed_values_cache.d.ts.map +1 -0
  27. package/dest/contract_function_simulator/hashed_values_cache.js +36 -0
  28. package/dest/contract_function_simulator/index.d.ts +14 -0
  29. package/dest/contract_function_simulator/index.d.ts.map +1 -0
  30. package/dest/contract_function_simulator/index.js +12 -0
  31. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +20 -0
  32. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -0
  33. package/dest/contract_function_simulator/noir-structs/event_validation_request.js +37 -0
  34. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +16 -0
  35. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts.map +1 -0
  36. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.js +26 -0
  37. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +17 -0
  38. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -0
  39. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +65 -0
  40. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +24 -0
  41. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -0
  42. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +51 -0
  43. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +22 -0
  44. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -0
  45. package/dest/contract_function_simulator/noir-structs/utility_context.js +33 -0
  46. package/dest/contract_function_simulator/oracle/index.d.ts +14 -0
  47. package/dest/contract_function_simulator/oracle/index.d.ts.map +1 -0
  48. package/dest/contract_function_simulator/oracle/index.js +2 -0
  49. package/dest/contract_function_simulator/oracle/interfaces.d.ts +103 -0
  50. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -0
  51. package/dest/contract_function_simulator/oracle/interfaces.js +4 -0
  52. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +17 -0
  53. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -0
  54. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.js +24 -0
  55. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +28 -0
  56. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -0
  57. package/dest/contract_function_simulator/oracle/note_packing_utils.js +54 -0
  58. package/dest/contract_function_simulator/oracle/oracle.d.ts +58 -0
  59. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -0
  60. package/dest/contract_function_simulator/oracle/oracle.js +345 -0
  61. package/dest/contract_function_simulator/oracle/private_execution.d.ts +47 -0
  62. package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -0
  63. package/dest/contract_function_simulator/oracle/private_execution.js +123 -0
  64. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +240 -0
  65. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -0
  66. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +439 -0
  67. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +195 -0
  68. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -0
  69. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +372 -0
  70. package/dest/contract_function_simulator/pick_notes.d.ts +85 -0
  71. package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -0
  72. package/dest/contract_function_simulator/pick_notes.js +51 -0
  73. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +6 -0
  74. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -0
  75. package/dest/contract_function_simulator/proxied_contract_data_source.js +80 -0
  76. package/dest/contract_function_simulator/proxied_node.d.ts +9 -0
  77. package/dest/contract_function_simulator/proxied_node.d.ts.map +1 -0
  78. package/dest/contract_function_simulator/proxied_node.js +27 -0
  79. package/dest/debug/pxe_debug_utils.d.ts +31 -0
  80. package/dest/debug/pxe_debug_utils.d.ts.map +1 -0
  81. package/dest/debug/pxe_debug_utils.js +37 -0
  82. package/dest/entrypoints/client/bundle/index.d.ts +4 -3
  83. package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
  84. package/dest/entrypoints/client/bundle/index.js +2 -2
  85. package/dest/entrypoints/client/bundle/utils.d.ts +10 -10
  86. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  87. package/dest/entrypoints/client/bundle/utils.js +18 -12
  88. package/dest/entrypoints/client/lazy/index.d.ts +4 -3
  89. package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
  90. package/dest/entrypoints/client/lazy/index.js +2 -2
  91. package/dest/entrypoints/client/lazy/utils.d.ts +9 -9
  92. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  93. package/dest/entrypoints/client/lazy/utils.js +17 -11
  94. package/dest/entrypoints/pxe_creation_options.d.ts +16 -0
  95. package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -0
  96. package/dest/entrypoints/server/index.d.ts +6 -4
  97. package/dest/entrypoints/server/index.d.ts.map +1 -1
  98. package/dest/entrypoints/server/index.js +4 -3
  99. package/dest/entrypoints/server/utils.d.ts +8 -16
  100. package/dest/entrypoints/server/utils.d.ts.map +1 -1
  101. package/dest/entrypoints/server/utils.js +31 -36
  102. package/dest/error_enriching.d.ts +11 -0
  103. package/dest/error_enriching.d.ts.map +1 -0
  104. package/dest/{pxe_service/error_enriching.js → error_enriching.js} +26 -18
  105. package/dest/events/event_service.d.ts +15 -0
  106. package/dest/events/event_service.d.ts.map +1 -0
  107. package/dest/events/event_service.js +47 -0
  108. package/dest/events/index.d.ts +2 -0
  109. package/dest/events/index.d.ts.map +1 -0
  110. package/dest/events/index.js +1 -0
  111. package/dest/events/private_event_filter_validator.d.ts +9 -0
  112. package/dest/events/private_event_filter_validator.d.ts.map +1 -0
  113. package/dest/events/private_event_filter_validator.js +39 -0
  114. package/dest/logs/log_service.d.ts +43 -0
  115. package/dest/logs/log_service.d.ts.map +1 -0
  116. package/dest/logs/log_service.js +239 -0
  117. package/dest/notes/index.d.ts +2 -0
  118. package/dest/notes/index.d.ts.map +1 -0
  119. package/dest/notes/index.js +1 -0
  120. package/dest/notes/note_service.d.ts +48 -0
  121. package/dest/notes/note_service.d.ts.map +1 -0
  122. package/dest/notes/note_service.js +152 -0
  123. package/dest/oracle_version.d.ts +3 -0
  124. package/dest/oracle_version.d.ts.map +1 -0
  125. package/dest/oracle_version.js +10 -0
  126. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +28 -0
  127. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +1 -0
  128. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.js +271 -0
  129. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +4 -0
  130. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts.map +1 -0
  131. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.js +41 -0
  132. package/dest/private_kernel/hints/index.d.ts +3 -0
  133. package/dest/private_kernel/hints/index.d.ts.map +1 -0
  134. package/dest/{kernel_prover → private_kernel}/hints/index.js +1 -0
  135. package/dest/private_kernel/index.d.ts +3 -0
  136. package/dest/private_kernel/index.d.ts.map +1 -0
  137. package/dest/private_kernel/index.js +2 -0
  138. package/dest/private_kernel/private_kernel_execution_prover.d.ts +44 -0
  139. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -0
  140. package/dest/private_kernel/private_kernel_execution_prover.js +286 -0
  141. package/dest/private_kernel/private_kernel_oracle.d.ts +63 -0
  142. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -0
  143. package/dest/private_kernel/private_kernel_oracle.js +4 -0
  144. package/dest/private_kernel/private_kernel_oracle_impl.d.ts +46 -0
  145. package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +1 -0
  146. package/dest/{kernel_oracle/index.js → private_kernel/private_kernel_oracle_impl.js} +19 -9
  147. package/dest/public_storage/public_storage_service.d.ts +24 -0
  148. package/dest/public_storage/public_storage_service.d.ts.map +1 -0
  149. package/dest/public_storage/public_storage_service.js +26 -0
  150. package/dest/pxe.d.ts +231 -0
  151. package/dest/pxe.d.ts.map +1 -0
  152. package/dest/pxe.js +756 -0
  153. package/dest/storage/address_data_provider/address_data_provider.d.ts +2 -4
  154. package/dest/storage/address_data_provider/address_data_provider.d.ts.map +1 -1
  155. package/dest/storage/address_data_provider/address_data_provider.js +0 -3
  156. package/dest/storage/address_data_provider/index.d.ts +1 -1
  157. package/dest/storage/anchor_block_data_provider/anchor_block_data_provider.d.ts +9 -0
  158. package/dest/storage/anchor_block_data_provider/anchor_block_data_provider.d.ts.map +1 -0
  159. package/dest/storage/{sync_data_provider/sync_data_provider.js → anchor_block_data_provider/anchor_block_data_provider.js} +2 -12
  160. package/dest/storage/anchor_block_data_provider/index.d.ts +2 -0
  161. package/dest/storage/anchor_block_data_provider/index.d.ts.map +1 -0
  162. package/dest/storage/anchor_block_data_provider/index.js +1 -0
  163. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts +48 -7
  164. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +1 -1
  165. package/dest/storage/capsule_data_provider/capsule_data_provider.js +117 -28
  166. package/dest/storage/capsule_data_provider/index.d.ts +1 -1
  167. package/dest/storage/contract_data_provider/contract_data_provider.d.ts +16 -59
  168. package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +1 -1
  169. package/dest/storage/contract_data_provider/contract_data_provider.js +121 -80
  170. package/dest/storage/contract_data_provider/index.d.ts +1 -2
  171. package/dest/storage/contract_data_provider/index.d.ts.map +1 -1
  172. package/dest/storage/contract_data_provider/index.js +0 -1
  173. package/dest/storage/contract_data_provider/private_functions_tree.d.ts +3 -42
  174. package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +1 -1
  175. package/dest/storage/contract_data_provider/private_functions_tree.js +10 -62
  176. package/dest/storage/index.d.ts +4 -5
  177. package/dest/storage/index.d.ts.map +1 -1
  178. package/dest/storage/index.js +3 -4
  179. package/dest/storage/metadata.d.ts +2 -0
  180. package/dest/storage/metadata.d.ts.map +1 -0
  181. package/dest/storage/metadata.js +1 -0
  182. package/dest/storage/note_data_provider/index.d.ts +2 -2
  183. package/dest/storage/note_data_provider/index.d.ts.map +1 -1
  184. package/dest/storage/note_data_provider/index.js +1 -1
  185. package/dest/storage/note_data_provider/note_data_provider.d.ts +75 -11
  186. package/dest/storage/note_data_provider/note_data_provider.d.ts.map +1 -1
  187. package/dest/storage/note_data_provider/note_data_provider.js +155 -82
  188. package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +51 -0
  189. package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts.map +1 -0
  190. package/dest/storage/private_event_data_provider/private_event_data_provider.js +115 -0
  191. package/dest/storage/tagging_data_provider/index.d.ts +3 -2
  192. package/dest/storage/tagging_data_provider/index.d.ts.map +1 -1
  193. package/dest/storage/tagging_data_provider/index.js +2 -1
  194. package/dest/storage/tagging_data_provider/recipient_tagging_data_provider.d.ts +31 -0
  195. package/dest/storage/tagging_data_provider/recipient_tagging_data_provider.d.ts.map +1 -0
  196. package/dest/storage/tagging_data_provider/recipient_tagging_data_provider.js +65 -0
  197. package/dest/storage/tagging_data_provider/sender_tagging_data_provider.d.ts +67 -0
  198. package/dest/storage/tagging_data_provider/sender_tagging_data_provider.d.ts.map +1 -0
  199. package/dest/storage/tagging_data_provider/sender_tagging_data_provider.js +196 -0
  200. package/dest/tagging/constants.d.ts +2 -0
  201. package/dest/tagging/constants.d.ts.map +1 -0
  202. package/dest/tagging/constants.js +3 -0
  203. package/dest/tagging/index.d.ts +5 -0
  204. package/dest/tagging/index.d.ts.map +1 -0
  205. package/dest/tagging/index.js +3 -0
  206. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +14 -0
  207. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -0
  208. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +99 -0
  209. package/dest/tagging/recipient_sync/new_recipient_tagging_data_provider.d.ts +21 -0
  210. package/dest/tagging/recipient_sync/new_recipient_tagging_data_provider.d.ts.map +1 -0
  211. package/dest/tagging/recipient_sync/new_recipient_tagging_data_provider.js +42 -0
  212. package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts +12 -0
  213. package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts.map +1 -0
  214. package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +20 -0
  215. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +14 -0
  216. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -0
  217. package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +29 -0
  218. package/dest/tagging/sync/sync_sender_tagging_indexes.d.ts +21 -0
  219. package/dest/tagging/sync/sync_sender_tagging_indexes.d.ts.map +1 -0
  220. package/dest/tagging/sync/sync_sender_tagging_indexes.js +89 -0
  221. package/dest/tagging/sync/utils/get_status_change_of_pending.d.ts +11 -0
  222. package/dest/tagging/sync/utils/get_status_change_of_pending.d.ts.map +1 -0
  223. package/dest/tagging/sync/utils/get_status_change_of_pending.js +32 -0
  224. package/dest/tagging/sync/utils/load_and_store_new_tagging_indexes.d.ts +18 -0
  225. package/dest/tagging/sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -0
  226. package/dest/tagging/sync/utils/load_and_store_new_tagging_indexes.js +55 -0
  227. package/dest/tagging/utils.d.ts +18 -0
  228. package/dest/tagging/utils.d.ts.map +1 -0
  229. package/dest/tagging/utils.js +25 -0
  230. package/dest/tree_membership/tree_membership_service.d.ts +52 -0
  231. package/dest/tree_membership/tree_membership_service.d.ts.map +1 -0
  232. package/dest/tree_membership/tree_membership_service.js +84 -0
  233. package/package.json +37 -34
  234. package/src/bin/check_oracle_version.ts +160 -0
  235. package/src/{synchronizer/synchronizer.ts → block_synchronizer/block_synchronizer.ts} +39 -35
  236. package/src/block_synchronizer/index.ts +1 -0
  237. package/src/config/index.ts +27 -55
  238. package/src/config/package_info.ts +1 -1
  239. package/src/contract_function_simulator/contract_function_simulator.ts +618 -0
  240. package/src/contract_function_simulator/execution_note_cache.ts +233 -0
  241. package/src/contract_function_simulator/execution_tagging_index_cache.ts +32 -0
  242. package/src/contract_function_simulator/hashed_values_cache.ts +47 -0
  243. package/src/contract_function_simulator/index.ts +13 -0
  244. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +47 -0
  245. package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +28 -0
  246. package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +69 -0
  247. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +64 -0
  248. package/src/contract_function_simulator/noir-structs/utility_context.ts +42 -0
  249. package/src/contract_function_simulator/oracle/index.ts +16 -0
  250. package/src/contract_function_simulator/oracle/interfaces.ts +175 -0
  251. package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +23 -0
  252. package/src/contract_function_simulator/oracle/note_packing_utils.ts +68 -0
  253. package/src/contract_function_simulator/oracle/oracle.ts +605 -0
  254. package/src/contract_function_simulator/oracle/private_execution.ts +209 -0
  255. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +704 -0
  256. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +532 -0
  257. package/src/contract_function_simulator/pick_notes.ts +141 -0
  258. package/src/contract_function_simulator/proxied_contract_data_source.ts +83 -0
  259. package/src/contract_function_simulator/proxied_node.ts +33 -0
  260. package/src/debug/pxe_debug_utils.ts +48 -0
  261. package/src/entrypoints/client/bundle/index.ts +3 -2
  262. package/src/entrypoints/client/bundle/utils.ts +36 -36
  263. package/src/entrypoints/client/lazy/index.ts +3 -2
  264. package/src/entrypoints/client/lazy/utils.ts +36 -31
  265. package/src/entrypoints/pxe_creation_options.ts +12 -0
  266. package/src/entrypoints/server/index.ts +5 -3
  267. package/src/entrypoints/server/utils.ts +59 -51
  268. package/src/{pxe_service/error_enriching.ts → error_enriching.ts} +36 -27
  269. package/src/events/event_service.ts +77 -0
  270. package/src/events/index.ts +1 -0
  271. package/src/events/private_event_filter_validator.ts +48 -0
  272. package/src/logs/log_service.ts +364 -0
  273. package/src/notes/index.ts +1 -0
  274. package/src/notes/note_service.ts +200 -0
  275. package/src/oracle_version.ts +11 -0
  276. package/src/{kernel_prover → private_kernel}/hints/build_private_kernel_reset_private_inputs.ts +159 -147
  277. package/src/private_kernel/hints/compute_tx_include_by_timestamp.ts +58 -0
  278. package/src/{kernel_prover → private_kernel}/hints/index.ts +1 -0
  279. package/src/private_kernel/index.ts +2 -0
  280. package/src/private_kernel/private_kernel_execution_prover.ts +432 -0
  281. package/src/{kernel_prover/proving_data_oracle.ts → private_kernel/private_kernel_oracle.ts} +19 -30
  282. package/src/{kernel_oracle/index.ts → private_kernel/private_kernel_oracle_impl.ts} +33 -17
  283. package/src/public_storage/public_storage_service.ts +33 -0
  284. package/src/pxe.ts +1063 -0
  285. package/src/storage/address_data_provider/address_data_provider.ts +1 -7
  286. package/src/storage/{sync_data_provider/sync_data_provider.ts → anchor_block_data_provider/anchor_block_data_provider.ts} +2 -17
  287. package/src/storage/anchor_block_data_provider/index.ts +1 -0
  288. package/src/storage/capsule_data_provider/capsule_data_provider.ts +130 -31
  289. package/src/storage/contract_data_provider/contract_data_provider.ts +152 -94
  290. package/src/storage/contract_data_provider/index.ts +0 -1
  291. package/src/storage/contract_data_provider/private_functions_tree.ts +12 -76
  292. package/src/storage/index.ts +3 -5
  293. package/src/storage/metadata.ts +1 -0
  294. package/src/storage/note_data_provider/index.ts +1 -1
  295. package/src/storage/note_data_provider/note_data_provider.ts +188 -121
  296. package/src/storage/private_event_data_provider/private_event_data_provider.ts +162 -0
  297. package/src/storage/tagging_data_provider/index.ts +2 -1
  298. package/src/storage/tagging_data_provider/recipient_tagging_data_provider.ts +86 -0
  299. package/src/storage/tagging_data_provider/sender_tagging_data_provider.ts +244 -0
  300. package/src/tagging/constants.ts +3 -0
  301. package/src/tagging/index.ts +4 -0
  302. package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +129 -0
  303. package/src/tagging/recipient_sync/new_recipient_tagging_data_provider.ts +53 -0
  304. package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +34 -0
  305. package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +43 -0
  306. package/src/tagging/sync/sync_sender_tagging_indexes.ts +112 -0
  307. package/src/tagging/sync/utils/get_status_change_of_pending.ts +44 -0
  308. package/src/tagging/sync/utils/load_and_store_new_tagging_indexes.ts +72 -0
  309. package/src/tagging/utils.ts +32 -0
  310. package/src/tree_membership/tree_membership_service.ts +112 -0
  311. package/dest/bin/index.d.ts +0 -3
  312. package/dest/bin/index.d.ts.map +0 -1
  313. package/dest/bin/index.js +0 -28
  314. package/dest/entrypoints/client/pxe_creation_options.d.ts +0 -11
  315. package/dest/entrypoints/client/pxe_creation_options.d.ts.map +0 -1
  316. package/dest/kernel_oracle/index.d.ts +0 -45
  317. package/dest/kernel_oracle/index.d.ts.map +0 -1
  318. package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.d.ts +0 -28
  319. package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.d.ts.map +0 -1
  320. package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.js +0 -270
  321. package/dest/kernel_prover/hints/index.d.ts +0 -2
  322. package/dest/kernel_prover/hints/index.d.ts.map +0 -1
  323. package/dest/kernel_prover/index.d.ts +0 -3
  324. package/dest/kernel_prover/index.d.ts.map +0 -1
  325. package/dest/kernel_prover/index.js +0 -2
  326. package/dest/kernel_prover/kernel_prover.d.ts +0 -38
  327. package/dest/kernel_prover/kernel_prover.d.ts.map +0 -1
  328. package/dest/kernel_prover/kernel_prover.js +0 -217
  329. package/dest/kernel_prover/proving_data_oracle.d.ts +0 -73
  330. package/dest/kernel_prover/proving_data_oracle.d.ts.map +0 -1
  331. package/dest/kernel_prover/proving_data_oracle.js +0 -4
  332. package/dest/note_decryption_utils/add_public_values_to_payload.d.ts +0 -11
  333. package/dest/note_decryption_utils/add_public_values_to_payload.d.ts.map +0 -1
  334. package/dest/note_decryption_utils/add_public_values_to_payload.js +0 -47
  335. package/dest/pxe_http/index.d.ts +0 -2
  336. package/dest/pxe_http/index.d.ts.map +0 -1
  337. package/dest/pxe_http/index.js +0 -1
  338. package/dest/pxe_http/pxe_http_server.d.ts +0 -16
  339. package/dest/pxe_http/pxe_http_server.d.ts.map +0 -1
  340. package/dest/pxe_http/pxe_http_server.js +0 -27
  341. package/dest/pxe_oracle_interface/index.d.ts +0 -159
  342. package/dest/pxe_oracle_interface/index.d.ts.map +0 -1
  343. package/dest/pxe_oracle_interface/index.js +0 -692
  344. package/dest/pxe_oracle_interface/tagging_utils.d.ts +0 -17
  345. package/dest/pxe_oracle_interface/tagging_utils.d.ts.map +0 -1
  346. package/dest/pxe_oracle_interface/tagging_utils.js +0 -23
  347. package/dest/pxe_service/error_enriching.d.ts +0 -11
  348. package/dest/pxe_service/error_enriching.d.ts.map +0 -1
  349. package/dest/pxe_service/index.d.ts +0 -3
  350. package/dest/pxe_service/index.d.ts.map +0 -1
  351. package/dest/pxe_service/index.js +0 -2
  352. package/dest/pxe_service/pxe_service.d.ts +0 -111
  353. package/dest/pxe_service/pxe_service.d.ts.map +0 -1
  354. package/dest/pxe_service/pxe_service.js +0 -664
  355. package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.d.ts +0 -11
  356. package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.d.ts.map +0 -1
  357. package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.js +0 -20
  358. package/dest/storage/auth_witness_data_provider/index.d.ts +0 -2
  359. package/dest/storage/auth_witness_data_provider/index.d.ts.map +0 -1
  360. package/dest/storage/auth_witness_data_provider/index.js +0 -1
  361. package/dest/storage/data_provider.d.ts +0 -4
  362. package/dest/storage/data_provider.d.ts.map +0 -1
  363. package/dest/storage/data_provider.js +0 -1
  364. package/dest/storage/note_data_provider/note_dao.d.ts +0 -106
  365. package/dest/storage/note_data_provider/note_dao.d.ts.map +0 -1
  366. package/dest/storage/note_data_provider/note_dao.js +0 -106
  367. package/dest/storage/sync_data_provider/index.d.ts +0 -2
  368. package/dest/storage/sync_data_provider/index.d.ts.map +0 -1
  369. package/dest/storage/sync_data_provider/index.js +0 -1
  370. package/dest/storage/sync_data_provider/sync_data_provider.d.ts +0 -12
  371. package/dest/storage/sync_data_provider/sync_data_provider.d.ts.map +0 -1
  372. package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts +0 -18
  373. package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts.map +0 -1
  374. package/dest/storage/tagging_data_provider/tagging_data_provider.js +0 -65
  375. package/dest/synchronizer/index.d.ts +0 -2
  376. package/dest/synchronizer/index.d.ts.map +0 -1
  377. package/dest/synchronizer/index.js +0 -1
  378. package/dest/synchronizer/synchronizer.d.ts +0 -37
  379. package/dest/synchronizer/synchronizer.d.ts.map +0 -1
  380. package/dest/test/pxe_test_suite.d.ts +0 -3
  381. package/dest/test/pxe_test_suite.d.ts.map +0 -1
  382. package/dest/test/pxe_test_suite.js +0 -97
  383. package/src/bin/index.ts +0 -38
  384. package/src/entrypoints/client/pxe_creation_options.ts +0 -7
  385. package/src/kernel_prover/index.ts +0 -2
  386. package/src/kernel_prover/kernel_prover.ts +0 -351
  387. package/src/note_decryption_utils/add_public_values_to_payload.ts +0 -64
  388. package/src/pxe_http/index.ts +0 -1
  389. package/src/pxe_http/pxe_http_server.ts +0 -29
  390. package/src/pxe_oracle_interface/index.ts +0 -925
  391. package/src/pxe_oracle_interface/tagging_utils.ts +0 -32
  392. package/src/pxe_service/index.ts +0 -2
  393. package/src/pxe_service/pxe_service.ts +0 -949
  394. package/src/storage/auth_witness_data_provider/auth_witness_data_provider.ts +0 -34
  395. package/src/storage/auth_witness_data_provider/index.ts +0 -1
  396. package/src/storage/data_provider.ts +0 -3
  397. package/src/storage/note_data_provider/note_dao.ts +0 -162
  398. package/src/storage/sync_data_provider/index.ts +0 -1
  399. package/src/storage/tagging_data_provider/tagging_data_provider.ts +0 -92
  400. package/src/synchronizer/index.ts +0 -1
  401. package/src/test/pxe_test_suite.ts +0 -111
  402. /package/dest/entrypoints/{client/pxe_creation_options.js → pxe_creation_options.js} +0 -0
package/README.md CHANGED
@@ -1,13 +1,13 @@
1
- # PXE Service & PXE
1
+ # PXE & PXE
2
2
 
3
- `PXE Service` (pronounced "pixie service") is a server-side software that provides a set of apis for interacting with the Aztec network. It acts as a bridge between the network and client applications by exposing methods to manage accounts, deploy contracts, create transactions, and retrieve public and account-specific information. It provides a secure environment for the execution of sensitive operations, ensuring private information and decrypted data are not accessible to unauthorized applications. The PXE Service is a critical component of the Aztec network, and its security and reliability are essential to the overall trustworthiness of user's data.
3
+ `PXE` (pronounced "pixie service") is a server-side software that provides a set of apis for interacting with the Aztec network. It acts as a bridge between the network and client applications by exposing methods to manage accounts, deploy contracts, create transactions, and retrieve public and account-specific information. It provides a secure environment for the execution of sensitive operations, ensuring private information and decrypted data are not accessible to unauthorized applications. The PXE is a critical component of the Aztec network, and its security and reliability are essential to the overall trustworthiness of user's data.
4
4
 
5
- `PXE` is the interface the PXE Service and every client-side instance implement. Various implementations of the client-side can exist, including those for different platforms such as mobile apps and web browsers. It is a relay between the dApps and the actual PXE Service.
5
+ `PXE` is the interface the PXE and every client-side instance implement. Various implementations of the client-side can exist, including those for different platforms such as mobile apps and web browsers. It is a relay between the dApps and the actual PXE.
6
6
 
7
- ### Main Components in an PXE Service
7
+ ### Main Components in an PXE
8
8
 
9
9
  - [Simulator](../simulator/)
10
10
  - [Key Store](../key-store/)
11
11
  - [Account State](./src/account_state/account_state.ts): It coordinates other components to synchronize and decrypt data, simulate transactions, and generate kernel proofs, for a specific account.
12
12
 
13
- ![Pixie](./pixie.png)
13
+ ![Pixie](./pixie.png)
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hlY2tfb3JhY2xlX3ZlcnNpb24uZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9iaW4vY2hlY2tfb3JhY2xlX3ZlcnNpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check_oracle_version.d.ts","sourceRoot":"","sources":["../../src/bin/check_oracle_version.ts"],"names":[],"mappings":""}
@@ -0,0 +1,129 @@
1
+ import { keccak256String } from '@aztec/foundation/crypto/keccak';
2
+ import { readFileSync } from 'fs';
3
+ import { dirname, join } from 'path';
4
+ import ts from 'typescript';
5
+ import { fileURLToPath } from 'url';
6
+ import { ORACLE_INTERFACE_HASH } from '../oracle_version.js';
7
+ /**
8
+ * Verifies that the Oracle interface matches the expected interface hash.
9
+ *
10
+ * The Oracle interface needs to be versioned to ensure compatibility between Aztec.nr and PXE. This function computes
11
+ * a hash of the Oracle interface and compares it against a known hash. If they don't match, it means the interface has
12
+ * changed and the ORACLE_VERSION constant needs to be incremented and the ORACLE_INTERFACE_HASH constant needs to be
13
+ * updated.
14
+ *
15
+ * TODO(#16581): The following only takes into consideration changes to the oracles defined in Oracle.ts and omits TXE
16
+ * oracles. Ensure this checks TXE oracles as well. This hasn't been implemented yet since we don't have a clean TXE
17
+ * oracle interface like we do in PXE (i.e., there is no single Oracle class that contains only the oracles).
18
+ */ function assertOracleInterfaceMatches() {
19
+ const oracleInterfaceSignature = getOracleInterfaceSignature();
20
+ // We use keccak256 here just because we already have it in the dependencies.
21
+ const oracleInterfaceHash = keccak256String(oracleInterfaceSignature);
22
+ if (oracleInterfaceHash !== ORACLE_INTERFACE_HASH) {
23
+ // This check exists only to notify you when you need to update the ORACLE_VERSION constant.
24
+ throw new Error(`The Oracle interface has changed, which implies a breaking change in the aztec.nr/PXE oracle interface. Update ORACLE_INTERFACE_HASH to ${oracleInterfaceHash} and bump ORACLE_VERSION in pxe/src/oracle_version.ts.`);
25
+ }
26
+ }
27
+ /**
28
+ * Constructs a signature of the Oracle interface while ignoring methods that are not foreign call handlers.
29
+ */ function getOracleInterfaceSignature() {
30
+ const excludedProps = [
31
+ 'handler',
32
+ 'constructor',
33
+ 'toACIRCallback',
34
+ 'handlerAsMisc',
35
+ 'handlerAsUtility',
36
+ 'handlerAsPrivate'
37
+ ];
38
+ // Get the path to Oracle.ts source file
39
+ // The script runs from dest/bin/ after compilation, so we need to go up to the package root
40
+ // then into src/ to find the source file
41
+ const currentDir = dirname(fileURLToPath(import.meta.url));
42
+ // Go up from dest/bin/ or src/bin/ to the package root (pxe/), then into src/
43
+ const packageRoot = dirname(dirname(currentDir)); // Go up from bin/ to pxe/
44
+ const oracleSourcePath = join(packageRoot, 'src/contract_function_simulator/oracle/oracle.ts');
45
+ // Read and parse the TypeScript source file
46
+ const sourceCode = readFileSync(oracleSourcePath, 'utf-8');
47
+ const sourceFile = ts.createSourceFile('oracle.ts', sourceCode, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
48
+ // Extract method signatures from the Oracle class
49
+ const methodSignatures = [];
50
+ function visit(node) {
51
+ // Look for class declaration named "Oracle"
52
+ if (ts.isClassDeclaration(node) && node.name?.text === 'Oracle') {
53
+ // Visit all members of the class
54
+ node.members.forEach((member)=>{
55
+ if (ts.isMethodDeclaration(member) && member.name && ts.isIdentifier(member.name)) {
56
+ const methodName = member.name.text;
57
+ // Skip excluded methods
58
+ if (excludedProps.includes(methodName)) {
59
+ return;
60
+ }
61
+ // Extract parameter signatures
62
+ const paramSignatures = [];
63
+ member.parameters.forEach((param)=>{
64
+ const paramName = extractParameterName(param, sourceFile);
65
+ const paramType = extractTypeString(param.type, sourceFile);
66
+ paramSignatures.push(`${paramName}: ${paramType}`);
67
+ });
68
+ // Extract return type
69
+ const returnType = extractTypeString(member.type, sourceFile);
70
+ // Build full signature: methodName(param1: Type1, param2: Type2): ReturnType
71
+ const signature = `${methodName}(${paramSignatures.join(', ')}): ${returnType}`;
72
+ methodSignatures.push(signature);
73
+ }
74
+ });
75
+ }
76
+ ts.forEachChild(node, visit);
77
+ }
78
+ visit(sourceFile);
79
+ // Sort signatures alphabetically for consistent hashing
80
+ methodSignatures.sort();
81
+ // Create a hashable representation by concatenating all signatures
82
+ return methodSignatures.join('');
83
+ }
84
+ /**
85
+ * Extracts the parameter name from a parameter node, handling destructured parameters.
86
+ */ function extractParameterName(param, sourceFile) {
87
+ const name = param.name;
88
+ if (ts.isIdentifier(name)) {
89
+ return name.text;
90
+ }
91
+ if (ts.isArrayBindingPattern(name)) {
92
+ // Handle destructured parameters like [blockNumber]: ACVMField[]
93
+ // Extract the first element name
94
+ if (name.elements.length > 0) {
95
+ const element = name.elements[0];
96
+ if (ts.isBindingElement(element)) {
97
+ const elementName = element.name;
98
+ if (ts.isIdentifier(elementName)) {
99
+ return elementName.text;
100
+ }
101
+ // Nested destructuring - use text representation
102
+ if (ts.isArrayBindingPattern(elementName) || ts.isObjectBindingPattern(elementName)) {
103
+ return elementName.getText(sourceFile);
104
+ }
105
+ }
106
+ }
107
+ // Fallback: return the text representation
108
+ return name.getText(sourceFile);
109
+ }
110
+ if (ts.isObjectBindingPattern(name)) {
111
+ // Handle object destructuring
112
+ return name.getText(sourceFile);
113
+ }
114
+ // Fallback for any other case - this should never happen but TypeScript needs it
115
+ return name.getText(sourceFile);
116
+ }
117
+ /**
118
+ * Extracts the type string from a type node, normalizing whitespace.
119
+ */ function extractTypeString(typeNode, sourceFile) {
120
+ if (!typeNode) {
121
+ return 'void';
122
+ }
123
+ // Get the type text and normalize whitespace
124
+ let typeText = typeNode.getText(sourceFile);
125
+ // Normalize whitespace: remove extra spaces, newlines, and tabs
126
+ typeText = typeText.replace(/\s+/g, ' ').trim();
127
+ return typeText;
128
+ }
129
+ assertOracleInterfaceMatches();
@@ -0,0 +1,39 @@
1
+ import { type Logger } from '@aztec/foundation/log';
2
+ import type { L2TipsKVStore } from '@aztec/kv-store/stores';
3
+ import { L2BlockStream, type L2BlockStreamEvent, type L2BlockStreamEventHandler } from '@aztec/stdlib/block';
4
+ import type { AztecNode } from '@aztec/stdlib/interfaces/client';
5
+ import type { PXEConfig } from '../config/index.js';
6
+ import type { AnchorBlockDataProvider } from '../storage/anchor_block_data_provider/anchor_block_data_provider.js';
7
+ import type { NoteDataProvider } from '../storage/note_data_provider/note_data_provider.js';
8
+ import type { RecipientTaggingDataProvider } from '../storage/tagging_data_provider/recipient_tagging_data_provider.js';
9
+ /**
10
+ * The BlockSynchronizer class orchestrates synchronization between PXE and Aztec node, maintaining an up-to-date
11
+ * view of the L2 chain state. It handles block header retrieval, chain reorganizations, and provides an interface
12
+ * for querying sync status.
13
+ */
14
+ export declare class BlockSynchronizer implements L2BlockStreamEventHandler {
15
+ private node;
16
+ private anchorBlockDataProvider;
17
+ private noteDataProvider;
18
+ private recipientTaggingDataProvider;
19
+ private l2TipsStore;
20
+ private log;
21
+ private isSyncing;
22
+ protected readonly blockStream: L2BlockStream;
23
+ constructor(node: AztecNode, anchorBlockDataProvider: AnchorBlockDataProvider, noteDataProvider: NoteDataProvider, recipientTaggingDataProvider: RecipientTaggingDataProvider, l2TipsStore: L2TipsKVStore, config?: Partial<Pick<PXEConfig, 'l2BlockBatchSize'>>, loggerOrSuffix?: string | Logger);
24
+ protected createBlockStream(config: Partial<Pick<PXEConfig, 'l2BlockBatchSize'>>): L2BlockStream;
25
+ /** Handle events emitted by the block stream. */
26
+ handleBlockStreamEvent(event: L2BlockStreamEvent): Promise<void>;
27
+ /**
28
+ * Syncs PXE and the node by downloading the metadata of the latest blocks, allowing simulations to use
29
+ * recent data (e.g. notes), and handling any reorgs that might have occurred.
30
+ *
31
+ * Note this BlockSynchronizer is designed to let its users control when a synchronization is run,
32
+ * so this component doesn't proactively stay up to date with the blockchain.
33
+ *
34
+ * We do this so PXE can ensure data consistency.
35
+ */
36
+ sync(): Promise<void>;
37
+ private doSync;
38
+ }
39
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmxvY2tfc3luY2hyb25pemVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvYmxvY2tfc3luY2hyb25pemVyL2Jsb2NrX3N5bmNocm9uaXplci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjo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,OAAO,CAAC,uBAAuB;IAC/B,OAAO,CAAC,gBAAgB;IACxB,OAAO,CAAC,4BAA4B;IACpC,OAAO,CAAC,WAAW;IATrB,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,SAAS,CAA4B;IAC7C,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,aAAa,CAAC;IAE9C,YACU,IAAI,EAAE,SAAS,EACf,uBAAuB,EAAE,uBAAuB,EAChD,gBAAgB,EAAE,gBAAgB,EAClC,4BAA4B,EAAE,4BAA4B,EAC1D,WAAW,EAAE,aAAa,EAClC,MAAM,GAAE,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAM,EACzD,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,EAOjC;IAED,SAAS,CAAC,iBAAiB,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC,iBAO/E;IAED,iDAAiD;IACpC,sBAAsB,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAmC5E;IAED;;;;;;;;OAQG;IACU,IAAI,kBAehB;YAEa,MAAM;CAcrB"}
@@ -1,34 +1,34 @@
1
- import { INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
1
+ import { BlockNumber } from '@aztec/foundation/branded-types';
2
2
  import { createLogger } from '@aztec/foundation/log';
3
3
  import { L2BlockStream } from '@aztec/stdlib/block';
4
4
  /**
5
- * The Synchronizer class manages the synchronization with the aztec node, allowing PXE to retrieve the
6
- * latest block header and handle reorgs.
7
- * It provides methods to trigger a sync and get the block number we are syncec to
8
- * details, and fetch transactions by hash.
9
- */ export class Synchronizer {
5
+ * The BlockSynchronizer class orchestrates synchronization between PXE and Aztec node, maintaining an up-to-date
6
+ * view of the L2 chain state. It handles block header retrieval, chain reorganizations, and provides an interface
7
+ * for querying sync status.
8
+ */ export class BlockSynchronizer {
10
9
  node;
11
- syncDataProvider;
10
+ anchorBlockDataProvider;
12
11
  noteDataProvider;
13
- taggingDataProvider;
12
+ recipientTaggingDataProvider;
14
13
  l2TipsStore;
15
- initialSyncBlockNumber;
16
14
  log;
17
15
  isSyncing;
18
16
  blockStream;
19
- constructor(node, syncDataProvider, noteDataProvider, taggingDataProvider, l2TipsStore, config = {}, loggerOrSuffix){
17
+ constructor(node, anchorBlockDataProvider, noteDataProvider, recipientTaggingDataProvider, l2TipsStore, config = {}, loggerOrSuffix){
20
18
  this.node = node;
21
- this.syncDataProvider = syncDataProvider;
19
+ this.anchorBlockDataProvider = anchorBlockDataProvider;
22
20
  this.noteDataProvider = noteDataProvider;
23
- this.taggingDataProvider = taggingDataProvider;
21
+ this.recipientTaggingDataProvider = recipientTaggingDataProvider;
24
22
  this.l2TipsStore = l2TipsStore;
25
- this.initialSyncBlockNumber = INITIAL_L2_BLOCK_NUM - 1;
26
- this.log = !loggerOrSuffix || typeof loggerOrSuffix === 'string' ? createLogger(loggerOrSuffix ? `pxe:synchronizer:${loggerOrSuffix}` : `pxe:synchronizer`) : loggerOrSuffix;
23
+ this.log = !loggerOrSuffix || typeof loggerOrSuffix === 'string' ? createLogger(loggerOrSuffix ? `pxe:block_synchronizer:${loggerOrSuffix}` : `pxe:block_synchronizer`) : loggerOrSuffix;
27
24
  this.blockStream = this.createBlockStream(config);
28
25
  }
29
26
  createBlockStream(config) {
30
27
  return new L2BlockStream(this.node, this.l2TipsStore, this, createLogger('pxe:block_stream'), {
31
- startingBlock: config.l2StartingBlock
28
+ batchSize: config.l2BlockBatchSize,
29
+ // Skipping finalized blocks makes us sync much faster - we only need to download blocks other than the latest one
30
+ // in order to detect reorgs, and there can be no reorgs on finalized block, making this safe.
31
+ skipFinalized: true
32
32
  });
33
33
  }
34
34
  /** Handle events emitted by the block stream. */ async handleBlockStreamEvent(event) {
@@ -36,39 +36,46 @@ import { L2BlockStream } from '@aztec/stdlib/block';
36
36
  switch(event.type){
37
37
  case 'blocks-added':
38
38
  {
39
- const lastBlock = event.blocks.at(-1);
39
+ const lastBlock = event.blocks.at(-1).block;
40
40
  this.log.verbose(`Updated pxe last block to ${lastBlock.number}`, {
41
41
  blockHash: lastBlock.hash(),
42
42
  archive: lastBlock.archive.root.toString(),
43
43
  header: lastBlock.header.toInspect()
44
44
  });
45
- await this.syncDataProvider.setHeader(lastBlock.header);
45
+ await this.anchorBlockDataProvider.setHeader(lastBlock.getBlockHeader());
46
46
  break;
47
47
  }
48
48
  case 'chain-pruned':
49
49
  {
50
- this.log.warn(`Pruning data after block ${event.blockNumber} due to reorg`);
50
+ this.log.warn(`Pruning data after block ${event.block.number} due to reorg`);
51
51
  // We first unnullify and then remove so that unnullified notes that were created after the block number end up deleted.
52
- const lastSynchedBlockNumber = await this.syncDataProvider.getBlockNumber();
53
- await this.noteDataProvider.unnullifyNotesAfter(event.blockNumber, lastSynchedBlockNumber);
54
- await this.noteDataProvider.removeNotesAfter(event.blockNumber);
52
+ const lastSynchedBlockNumber = (await this.anchorBlockDataProvider.getBlockHeader()).getBlockNumber();
53
+ await this.noteDataProvider.rollbackNotesAndNullifiers(event.block.number, lastSynchedBlockNumber);
55
54
  // Remove all note tagging indexes to force a full resync. This is suboptimal, but unless we track the
56
55
  // block number in which each index is used it's all we can do.
57
- await this.taggingDataProvider.resetNoteSyncData();
56
+ // Note: This is now unnecessary for the sender tagging data provider because the new algorithm handles reorgs.
57
+ // TODO(#17775): Once this issue is implemented we will have the index-block number mapping, so we can
58
+ // implement this more intelligently.
59
+ await this.recipientTaggingDataProvider.resetNoteSyncData();
58
60
  // Update the header to the last block.
59
- const newHeader = await this.node.getBlockHeader(event.blockNumber);
61
+ const newHeader = await this.node.getBlockHeader(event.block.number);
60
62
  if (!newHeader) {
61
- this.log.error(`Block header not found for block number ${event.blockNumber} during chain prune`);
63
+ this.log.error(`Block header not found for block number ${event.block.number} during chain prune`);
62
64
  } else {
63
- await this.syncDataProvider.setHeader(newHeader);
65
+ await this.anchorBlockDataProvider.setHeader(newHeader);
64
66
  }
65
67
  break;
66
68
  }
67
69
  }
68
70
  }
69
71
  /**
70
- * Syncs PXE and the node by dowloading the metadata of the latest blocks, allowing simulations to use
72
+ * Syncs PXE and the node by downloading the metadata of the latest blocks, allowing simulations to use
71
73
  * recent data (e.g. notes), and handling any reorgs that might have occurred.
74
+ *
75
+ * Note this BlockSynchronizer is designed to let its users control when a synchronization is run,
76
+ * so this component doesn't proactively stay up to date with the blockchain.
77
+ *
78
+ * We do this so PXE can ensure data consistency.
72
79
  */ async sync() {
73
80
  if (this.isSyncing !== undefined) {
74
81
  this.log.debug(`Waiting for the ongoing sync to finish`);
@@ -87,17 +94,14 @@ import { L2BlockStream } from '@aztec/stdlib/block';
87
94
  async doSync() {
88
95
  let currentHeader;
89
96
  try {
90
- currentHeader = await this.syncDataProvider.getBlockHeader();
91
- } catch (e) {
97
+ currentHeader = await this.anchorBlockDataProvider.getBlockHeader();
98
+ } catch {
92
99
  this.log.debug('Header is not set, requesting from the node');
93
100
  }
94
101
  if (!currentHeader) {
95
102
  // REFACTOR: We should know the header of the genesis block without having to request it from the node.
96
- await this.syncDataProvider.setHeader(await this.node.getBlockHeader(0));
103
+ await this.anchorBlockDataProvider.setHeader(await this.node.getBlockHeader(BlockNumber.ZERO));
97
104
  }
98
105
  await this.blockStream.sync();
99
106
  }
100
- async getSynchedBlockNumber() {
101
- return await this.syncDataProvider.getBlockNumber() ?? this.initialSyncBlockNumber;
102
- }
103
107
  }
@@ -0,0 +1,2 @@
1
+ export * from './block_synchronizer.js';
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ibG9ja19zeW5jaHJvbml6ZXIvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyx5QkFBeUIsQ0FBQyJ9
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/block_synchronizer/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC"}
@@ -0,0 +1 @@
1
+ export * from './block_synchronizer.js';
@@ -1,16 +1,7 @@
1
1
  import { type ConfigMappingsType } from '@aztec/foundation/config';
2
2
  import { type DataStoreConfig } from '@aztec/kv-store/config';
3
3
  import { type ChainConfig } from '@aztec/stdlib/config';
4
- import type { Network } from '@aztec/stdlib/network';
5
4
  export { getPackageInfo } from './package_info.js';
6
- /**
7
- * Temporary configuration until WASM can be used instead of native
8
- */
9
- export interface BBProverConfig {
10
- bbWorkingDirectory?: string;
11
- bbBinaryPath?: string;
12
- bbSkipCleanup?: boolean;
13
- }
14
5
  /**
15
6
  * Configuration settings for the prover factory
16
7
  */
@@ -19,30 +10,26 @@ export interface KernelProverConfig {
19
10
  proverEnabled?: boolean;
20
11
  }
21
12
  /**
22
- * Configuration settings for the PXE.
13
+ * Configuration settings for the block synchronizer.
23
14
  */
24
- export interface PXEConfig {
25
- /** L2 block to start scanning from for new accounts */
26
- l2StartingBlock: number;
15
+ export interface BlockSynchronizerConfig {
16
+ /** Maximum amount of blocks to pull from the stream in one request when synchronizing */
17
+ l2BlockBatchSize: number;
27
18
  }
28
- export type PXEServiceConfig = PXEConfig & KernelProverConfig & BBProverConfig & DataStoreConfig & ChainConfig;
19
+ export type PXEConfig = KernelProverConfig & DataStoreConfig & ChainConfig & BlockSynchronizerConfig;
29
20
  export type CliPXEOptions = {
30
- /** External Aztec network to connect to. e.g. devnet */
31
- network?: Network;
32
- /** API Key required by the external network's node */
33
- apiKey?: string;
34
21
  /** Custom Aztec Node URL to connect to */
35
22
  nodeUrl?: string;
36
23
  };
37
- export declare const pxeConfigMappings: ConfigMappingsType<PXEServiceConfig>;
24
+ export declare const pxeConfigMappings: ConfigMappingsType<PXEConfig>;
38
25
  /**
39
- * Creates an instance of PXEServiceConfig out of environment variables using sensible defaults for integration testing if not set.
26
+ * Creates an instance of PXEConfig out of environment variables using sensible defaults for integration testing if not set.
40
27
  */
41
- export declare function getPXEServiceConfig(): PXEServiceConfig;
28
+ export declare function getPXEConfig(): PXEConfig;
42
29
  export declare const pxeCliConfigMappings: ConfigMappingsType<CliPXEOptions>;
43
- export declare const allPxeConfigMappings: ConfigMappingsType<CliPXEOptions & PXEServiceConfig>;
30
+ export declare const allPxeConfigMappings: ConfigMappingsType<CliPXEOptions & PXEConfig>;
44
31
  /**
45
32
  * Creates an instance of CliPxeOptions out of environment variables
46
33
  */
47
- export declare function getCliPXEOptions(): CliPXEOptions & PXEServiceConfig;
48
- //# sourceMappingURL=index.d.ts.map
34
+ export declare function getCliPXEOptions(): CliPXEOptions & PXEConfig;
35
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb25maWcvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUNMLEtBQUssa0JBQWtCLEVBS3hCLE1BQU0sMEJBQTBCLENBQUM7QUFDbEMsT0FBTyxFQUFFLEtBQUssZUFBZSxFQUFzQixNQUFNLHdCQUF3QixDQUFDO0FBQ2xGLE9BQU8sRUFBRSxLQUFLLFdBQVcsRUFBdUIsTUFBTSxzQkFBc0IsQ0FBQztBQUU3RSxPQUFPLEVBQUUsY0FBYyxFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFFbkQ7O0dBRUc7QUFDSCxNQUFNLFdBQVcsa0JBQWtCO0lBQ2pDLDhDQUE4QztJQUM5QyxhQUFhLENBQUMsRUFBRSxPQUFPLENBQUM7Q0FDekI7QUFFRDs7R0FFRztBQUNILE1BQU0sV0FBVyx1QkFBdUI7SUFDdEMseUZBQXlGO0lBQ3pGLGdCQUFnQixFQUFFLE1BQU0sQ0FBQztDQUMxQjtBQUVELE1BQU0sTUFBTSxTQUFTLEdBQUc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AM,MAAM,SAAS,GAAG,kBAAkB,GAAG,eAAe,GAAG,WAAW,GAAG,uBAAuB,CAAC;AAErG,MAAM,MAAM,aAAa,GAAG;IAC1B,2CAA2C;IAC3C,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,kBAAkB,CAAC,SAAS,CAoB3D,CAAC;AAEF;;GAEG;AACH,wBAAgB,YAAY,IAAI,SAAS,CAExC;AAED,eAAO,MAAM,oBAAoB,EAAE,kBAAkB,CAAC,aAAa,CAKlE,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,kBAAkB,CAAC,aAAa,GAAG,SAAS,CAW9E,CAAC;AAEF;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,aAAa,GAAG,SAAS,CAQ5D"}
@@ -1,4 +1,3 @@
1
- import { INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
2
1
  import { booleanConfigHelper, getConfigFromMappings, numberConfigHelper, parseBooleanEnv } from '@aztec/foundation/config';
3
2
  import { dataConfigMappings } from '@aztec/kv-store/config';
4
3
  import { chainConfigMappings } from '@aztec/stdlib/config';
@@ -6,45 +5,30 @@ export { getPackageInfo } from './package_info.js';
6
5
  export const pxeConfigMappings = {
7
6
  ...dataConfigMappings,
8
7
  ...chainConfigMappings,
9
- l2StartingBlock: {
10
- env: 'PXE_L2_STARTING_BLOCK',
11
- ...numberConfigHelper(INITIAL_L2_BLOCK_NUM),
12
- description: 'L2 block to start scanning from for new accounts'
13
- },
14
- bbBinaryPath: {
15
- env: 'BB_BINARY_PATH',
16
- description: 'Path to the BB binary'
17
- },
18
- bbWorkingDirectory: {
19
- env: 'BB_WORKING_DIRECTORY',
20
- description: 'Working directory for the BB binary'
21
- },
22
- bbSkipCleanup: {
23
- env: 'BB_SKIP_CLEANUP',
24
- description: 'True to skip cleanup of temporary files for debugging purposes',
25
- ...booleanConfigHelper()
8
+ l2BlockBatchSize: {
9
+ env: 'PXE_L2_BLOCK_BATCH_SIZE',
10
+ ...numberConfigHelper(50),
11
+ description: 'Maximum amount of blocks to pull from the stream in one request when synchronizing'
26
12
  },
13
+ // TODO: We're losing this feature in moving to bb.js api.
14
+ // Reimplement it as a setting that dumps the msgpack data on the bb.js backend if needed.
15
+ // bbSkipCleanup: {
16
+ // env: 'BB_SKIP_CLEANUP',
17
+ // description: 'True to skip cleanup of temporary files for debugging purposes',
18
+ // ...booleanConfigHelper(),
19
+ // },
27
20
  proverEnabled: {
28
21
  env: 'PXE_PROVER_ENABLED',
29
22
  description: 'Enable real proofs',
30
- ...booleanConfigHelper()
23
+ ...booleanConfigHelper(true)
31
24
  }
32
25
  };
33
26
  /**
34
- * Creates an instance of PXEServiceConfig out of environment variables using sensible defaults for integration testing if not set.
35
- */ export function getPXEServiceConfig() {
27
+ * Creates an instance of PXEConfig out of environment variables using sensible defaults for integration testing if not set.
28
+ */ export function getPXEConfig() {
36
29
  return getConfigFromMappings(pxeConfigMappings);
37
30
  }
38
31
  export const pxeCliConfigMappings = {
39
- network: {
40
- env: 'NETWORK',
41
- parseEnv: (val)=>val,
42
- description: 'External Aztec network to connect to. e.g. devnet'
43
- },
44
- apiKey: {
45
- env: 'API_KEY',
46
- description: "API Key required by the external network's node"
47
- },
48
32
  nodeUrl: {
49
33
  env: 'AZTEC_NODE_URL',
50
34
  description: 'Custom Aztec Node URL to connect to'
@@ -58,17 +42,18 @@ export const allPxeConfigMappings = {
58
42
  env: 'PXE_PROVER_ENABLED',
59
43
  parseEnv: (val)=>parseBooleanEnv(val) || !!process.env.NETWORK,
60
44
  description: 'Enable real proofs',
61
- isBoolean: true
45
+ isBoolean: true,
46
+ defaultValue: true
62
47
  }
63
48
  };
64
49
  /**
65
50
  * Creates an instance of CliPxeOptions out of environment variables
66
51
  */ export function getCliPXEOptions() {
67
- const pxeConfig = getPXEServiceConfig();
52
+ const pxeConfig = getPXEConfig();
68
53
  const cliOptions = getConfigFromMappings(pxeCliConfigMappings);
69
54
  return {
70
55
  ...pxeConfig,
71
56
  ...cliOptions,
72
- proverEnabled: pxeConfig.proverEnabled || !!cliOptions.network
57
+ proverEnabled: pxeConfig.proverEnabled
73
58
  };
74
59
  }
@@ -2,4 +2,4 @@ export declare function getPackageInfo(): {
2
2
  version: string;
3
3
  name: string;
4
4
  };
5
- //# sourceMappingURL=package_info.d.ts.map
5
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGFja2FnZV9pbmZvLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY29uZmlnL3BhY2thZ2VfaW5mby50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSx3QkFBZ0IsY0FBYzs7O0VBRTdCIn0=
@@ -1,6 +1,6 @@
1
1
  export function getPackageInfo() {
2
2
  return {
3
- version: '0.1.0',
3
+ version: '3.0.0',
4
4
  name: '@aztec/pxe'
5
5
  };
6
6
  }
@@ -0,0 +1,83 @@
1
+ import { Fr } from '@aztec/foundation/curves/bn254';
2
+ import type { KeyStore } from '@aztec/key-store';
3
+ import { type CircuitSimulator } from '@aztec/simulator/client';
4
+ import type { FunctionCall } from '@aztec/stdlib/abi';
5
+ import { FunctionSelector } from '@aztec/stdlib/abi';
6
+ import type { AuthWitness } from '@aztec/stdlib/auth-witness';
7
+ import { AztecAddress } from '@aztec/stdlib/aztec-address';
8
+ import type { AztecNode } from '@aztec/stdlib/interfaces/server';
9
+ import { type PrivateKernelExecutionProofOutput, PrivateKernelTailCircuitPublicInputs } from '@aztec/stdlib/kernel';
10
+ import { BlockHeader, PrivateExecutionResult, TxExecutionRequest } from '@aztec/stdlib/tx';
11
+ import type { AddressDataProvider } from '../storage/address_data_provider/address_data_provider.js';
12
+ import type { AnchorBlockDataProvider } from '../storage/anchor_block_data_provider/anchor_block_data_provider.js';
13
+ import type { CapsuleDataProvider } from '../storage/capsule_data_provider/capsule_data_provider.js';
14
+ import type { ContractDataProvider } from '../storage/contract_data_provider/contract_data_provider.js';
15
+ import type { NoteDataProvider } from '../storage/note_data_provider/note_data_provider.js';
16
+ import type { PrivateEventDataProvider } from '../storage/private_event_data_provider/private_event_data_provider.js';
17
+ import type { RecipientTaggingDataProvider } from '../storage/tagging_data_provider/recipient_tagging_data_provider.js';
18
+ import type { SenderTaggingDataProvider } from '../storage/tagging_data_provider/sender_tagging_data_provider.js';
19
+ /**
20
+ * The contract function simulator.
21
+ */
22
+ export declare class ContractFunctionSimulator {
23
+ private contractDataProvider;
24
+ private noteDataProvider;
25
+ private keyStore;
26
+ private addressDataProvider;
27
+ private aztecNode;
28
+ private anchorBlockDataProvider;
29
+ private senderTaggingDataProvider;
30
+ private recipientTaggingDataProvider;
31
+ private capsuleDataProvider;
32
+ private privateEventDataProvider;
33
+ private simulator;
34
+ private log;
35
+ constructor(contractDataProvider: ContractDataProvider, noteDataProvider: NoteDataProvider, keyStore: KeyStore, addressDataProvider: AddressDataProvider, aztecNode: AztecNode, anchorBlockDataProvider: AnchorBlockDataProvider, senderTaggingDataProvider: SenderTaggingDataProvider, recipientTaggingDataProvider: RecipientTaggingDataProvider, capsuleDataProvider: CapsuleDataProvider, privateEventDataProvider: PrivateEventDataProvider, simulator: CircuitSimulator);
36
+ /**
37
+ * Runs a private function.
38
+ * @param request - The transaction request.
39
+ * @param entryPointArtifact - The artifact of the entry point function.
40
+ * @param contractAddress - The address of the contract (should match request.origin)
41
+ * @param msgSender - The address calling the function. This can be replaced to simulate a call from another contract
42
+ * or a specific account.
43
+ * @param anchorBlockHeader - The block header to use as base state for this run.
44
+ * @param senderForTags - The address that is used as a tagging sender when emitting private logs. Returned from
45
+ * the `privateGetSenderForTags` oracle.
46
+ * @param scopes - The accounts whose notes we can access in this call. Currently optional and will default to all.
47
+ * @returns The result of the execution.
48
+ */
49
+ run(request: TxExecutionRequest, contractAddress: AztecAddress, selector: FunctionSelector, msgSender: AztecAddress | undefined, anchorBlockHeader: BlockHeader, senderForTags?: AztecAddress, scopes?: AztecAddress[]): Promise<PrivateExecutionResult>;
50
+ /**
51
+ * Runs a utility function.
52
+ * @param call - The function call to execute.
53
+ * @param authwits - Authentication witnesses required for the function call.
54
+ * @param anchorBlockHeader - The block header to use as base state for this run.
55
+ * @param scopes - Optional array of account addresses whose notes can be accessed in this call. Defaults to all
56
+ * accounts if not specified.
57
+ * @returns A return value of the utility function in a form as returned by the simulator (Noir fields)
58
+ */
59
+ runUtility(call: FunctionCall, authwits: AuthWitness[], anchorBlockHeader: BlockHeader, scopes?: AztecAddress[]): Promise<Fr[]>;
60
+ /**
61
+ * Returns the execution statistics collected during the simulator run.
62
+ * @returns The execution statistics.
63
+ */
64
+ getStats(): {
65
+ nodeRPCCalls: Partial<Record<keyof AztecNode, {
66
+ times: number[];
67
+ }>>;
68
+ };
69
+ }
70
+ /**
71
+ * Generates the final public inputs of the tail kernel circuit, an empty Chonk proof
72
+ * and the execution steps for a `PrivateExecutionResult` as if it had been
73
+ * processed by the private kernel prover. This skips many of the checks performed by the kernels
74
+ * (allowing state overrides) and is much faster, while still generating a valid
75
+ * output that can be sent to the node for public simulation
76
+ * @param privateExecutionResult - The result of the private execution.
77
+ * @param nonceGenerator - A nonce generator for note hashes. According to the protocol rules,
78
+ * it can either be the first nullifier in the tx or the hash of the initial tx request if there are none.
79
+ * @param contractDataProvider - A provider for contract data in order to get function names and debug info.
80
+ * @returns The simulated proving result.
81
+ */
82
+ export declare function generateSimulatedProvingResult(privateExecutionResult: PrivateExecutionResult, nonceGenerator: Fr, contractDataProvider: ContractDataProvider): Promise<PrivateKernelExecutionProofOutput<PrivateKernelTailCircuitPublicInputs>>;
83
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udHJhY3RfZnVuY3Rpb25fc2ltdWxhdG9yLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY29udHJhY3RfZnVuY3Rpb25fc2ltdWxhdG9yL2NvbnRyYWN0X2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DZCxPQUFPLEVBQUUsa0JBQWtCLEVBQzNCLGVBQWUsRUFBRSxZQUFZLEVBQzdCLFFBQVEsRUFBRSxnQkFBZ0IsRUFDMUIsU0FBUywwQkFBNkMsRUFDdEQsaUJBQWlCLEVBQUUsV0FBVyxFQUM5QixhQUFhLENBQUMsRUFBRSxZQUFZLEVBQzVCLE1BQU0sQ0FBQyxFQUFFLFlBQVksRUFBRSxHQUN0QixPQUFPLENBQUMsc0JBQXNCLENBQUMsQ0EyR2pDO0lBR0Q7Ozs7Ozs7O09BUUc7SUFDVSxVQUFVLENBQ3JCLElBQUksRUFBRSxZQUFZLEVBQ2xCLFFBQVEsRUFBRSxXQUFXLEVBQUUsRUFDdkIsaUJBQWlCLEVBQUUsV0FBVyxFQUM5QixNQUFNLENBQUMsRUFBRSxZQUFZLEVBQUUsR0FDdEIsT0FBTyxDQUFDLEVBQUUsRUFBRSxDQUFDLENBMERmO0lBR0Q7OztPQUdHO0lBQ0gsUUFBUTs7OztNQUtQO0NBQ0Y7QUFZRDs7Ozs7Ozs7Ozs7R0FXRztBQUNILHdCQUFzQiw4QkFBOEIsQ0FDbEQsc0JBQXNCLEVBQUUsc0JBQXNCLEVBQzlDLGNBQWMsRUFBRSxFQUFFLEVBQ2xCLG9CQUFvQixFQUFFLG9CQUFvQixHQUN6QyxPQUFPLENBQUMsaUNBQWlDLENBQUMsb0NBQW9DLENBQUMsQ0FBQyxDQWdObEYifQ==
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract_function_simulator.d.ts","sourceRoot":"","sources":["../../src/contract_function_simulator/contract_function_simulator.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAGpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGjD,OAAO,EACL,KAAK,gBAAgB,EAOtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;A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