@aztec/pxe 0.0.1-commit.d3ec352c → 0.0.1-commit.f295ac2

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 (355) hide show
  1. package/dest/bin/check_oracle_version.js +105 -15
  2. package/dest/block_synchronizer/block_synchronizer.d.ts +41 -0
  3. package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -0
  4. package/dest/{synchronizer/synchronizer.js → block_synchronizer/block_synchronizer.js} +35 -30
  5. package/dest/block_synchronizer/index.d.ts +2 -0
  6. package/dest/block_synchronizer/index.d.ts.map +1 -0
  7. package/dest/block_synchronizer/index.js +1 -0
  8. package/dest/config/index.d.ts +4 -4
  9. package/dest/config/index.d.ts.map +1 -1
  10. package/dest/config/package_info.js +1 -1
  11. package/dest/contract_function_simulator/benchmarked_node.d.ts +9 -0
  12. package/dest/contract_function_simulator/benchmarked_node.d.ts.map +1 -0
  13. package/dest/contract_function_simulator/benchmarked_node.js +77 -0
  14. package/dest/contract_function_simulator/contract_function_simulator.d.ts +42 -14
  15. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  16. package/dest/contract_function_simulator/contract_function_simulator.js +73 -29
  17. package/dest/contract_function_simulator/execution_note_cache.d.ts +21 -12
  18. package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
  19. package/dest/contract_function_simulator/execution_note_cache.js +48 -31
  20. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +1 -1
  21. package/dest/contract_function_simulator/execution_tagging_index_cache.js +1 -1
  22. package/dest/contract_function_simulator/hashed_values_cache.d.ts +2 -2
  23. package/dest/contract_function_simulator/hashed_values_cache.d.ts.map +1 -1
  24. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +4 -3
  25. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
  26. package/dest/contract_function_simulator/noir-structs/event_validation_request.js +5 -2
  27. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +5 -4
  28. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts.map +1 -1
  29. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.js +7 -6
  30. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +2 -2
  31. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
  32. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +1 -1
  33. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +2 -2
  34. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
  35. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +4 -10
  36. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -1
  37. package/dest/contract_function_simulator/noir-structs/utility_context.js +7 -18
  38. package/dest/contract_function_simulator/oracle/interfaces.d.ts +14 -13
  39. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
  40. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +4 -2
  41. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
  42. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.js +1 -1
  43. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +9 -5
  44. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
  45. package/dest/contract_function_simulator/oracle/note_packing_utils.js +11 -7
  46. package/dest/contract_function_simulator/oracle/oracle.d.ts +7 -7
  47. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
  48. package/dest/contract_function_simulator/oracle/oracle.js +37 -25
  49. package/dest/contract_function_simulator/oracle/private_execution.d.ts +10 -16
  50. package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
  51. package/dest/contract_function_simulator/oracle/private_execution.js +19 -18
  52. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +25 -25
  53. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  54. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +29 -44
  55. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +63 -21
  56. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  57. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +162 -54
  58. package/dest/contract_function_simulator/pick_notes.d.ts +2 -2
  59. package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -1
  60. package/dest/contract_function_simulator/pick_notes.js +1 -1
  61. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +4 -4
  62. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -1
  63. package/dest/contract_function_simulator/proxied_contract_data_source.js +23 -5
  64. package/dest/debug/pxe_debug_utils.d.ts +31 -0
  65. package/dest/debug/pxe_debug_utils.d.ts.map +1 -0
  66. package/dest/debug/pxe_debug_utils.js +37 -0
  67. package/dest/entrypoints/client/bundle/index.d.ts +1 -2
  68. package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
  69. package/dest/entrypoints/client/bundle/index.js +0 -1
  70. package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
  71. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  72. package/dest/entrypoints/client/bundle/utils.js +12 -3
  73. package/dest/entrypoints/client/lazy/index.d.ts +1 -2
  74. package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
  75. package/dest/entrypoints/client/lazy/index.js +0 -1
  76. package/dest/entrypoints/client/lazy/utils.d.ts +1 -1
  77. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  78. package/dest/entrypoints/client/lazy/utils.js +12 -3
  79. package/dest/entrypoints/pxe_creation_options.d.ts +5 -2
  80. package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
  81. package/dest/entrypoints/server/index.d.ts +3 -2
  82. package/dest/entrypoints/server/index.d.ts.map +1 -1
  83. package/dest/entrypoints/server/index.js +2 -1
  84. package/dest/entrypoints/server/utils.d.ts +1 -1
  85. package/dest/entrypoints/server/utils.d.ts.map +1 -1
  86. package/dest/entrypoints/server/utils.js +12 -8
  87. package/dest/error_enriching.d.ts +4 -4
  88. package/dest/error_enriching.d.ts.map +1 -1
  89. package/dest/error_enriching.js +6 -6
  90. package/dest/events/event_service.d.ts +16 -0
  91. package/dest/events/event_service.d.ts.map +1 -0
  92. package/dest/events/event_service.js +45 -0
  93. package/dest/events/index.d.ts +2 -0
  94. package/dest/events/index.d.ts.map +1 -0
  95. package/dest/events/index.js +1 -0
  96. package/dest/events/private_event_filter_validator.d.ts +9 -0
  97. package/dest/events/private_event_filter_validator.d.ts.map +1 -0
  98. package/dest/events/private_event_filter_validator.js +38 -0
  99. package/dest/job_coordinator/job_coordinator.d.ts +74 -0
  100. package/dest/job_coordinator/job_coordinator.d.ts.map +1 -0
  101. package/dest/job_coordinator/job_coordinator.js +93 -0
  102. package/dest/logs/log_service.d.ts +27 -0
  103. package/dest/logs/log_service.d.ts.map +1 -0
  104. package/dest/logs/log_service.js +122 -0
  105. package/dest/notes/index.d.ts +2 -0
  106. package/dest/notes/index.d.ts.map +1 -0
  107. package/dest/notes/index.js +1 -0
  108. package/dest/notes/note_service.d.ts +48 -0
  109. package/dest/notes/note_service.d.ts.map +1 -0
  110. package/dest/notes/note_service.js +147 -0
  111. package/dest/oracle_version.d.ts +2 -2
  112. package/dest/oracle_version.js +2 -2
  113. package/dest/private_kernel/hints/index.d.ts +2 -2
  114. package/dest/private_kernel/hints/index.d.ts.map +1 -1
  115. package/dest/private_kernel/hints/index.js +1 -1
  116. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +28 -0
  117. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -0
  118. package/dest/private_kernel/hints/{build_private_kernel_reset_private_inputs.js → private_kernel_reset_private_inputs_builder.js} +13 -7
  119. package/dest/private_kernel/private_kernel_execution_prover.d.ts +1 -1
  120. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
  121. package/dest/private_kernel/private_kernel_execution_prover.js +8 -9
  122. package/dest/private_kernel/private_kernel_oracle.d.ts +26 -29
  123. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
  124. package/dest/private_kernel/private_kernel_oracle.js +90 -2
  125. package/dest/pxe.d.ts +45 -81
  126. package/dest/pxe.d.ts.map +1 -1
  127. package/dest/pxe.js +182 -215
  128. package/dest/storage/address_store/address_store.d.ts +11 -0
  129. package/dest/storage/address_store/address_store.d.ts.map +1 -0
  130. package/dest/storage/{address_data_provider/address_data_provider.js → address_store/address_store.js} +1 -1
  131. package/dest/storage/address_store/index.d.ts +2 -0
  132. package/dest/storage/address_store/index.d.ts.map +1 -0
  133. package/dest/storage/address_store/index.js +1 -0
  134. package/dest/storage/{sync_data_provider/sync_data_provider.d.ts → anchor_block_store/anchor_block_store.d.ts} +2 -4
  135. package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -0
  136. package/dest/storage/{sync_data_provider/sync_data_provider.js → anchor_block_store/anchor_block_store.js} +2 -9
  137. package/dest/storage/{sync_data_provider → anchor_block_store}/index.d.ts +2 -2
  138. package/dest/storage/anchor_block_store/index.d.ts.map +1 -0
  139. package/dest/storage/anchor_block_store/index.js +1 -0
  140. package/dest/storage/capsule_store/capsule_store.d.ts +72 -0
  141. package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -0
  142. package/dest/storage/capsule_store/capsule_store.js +255 -0
  143. package/dest/storage/capsule_store/index.d.ts +2 -0
  144. package/dest/storage/capsule_store/index.d.ts.map +1 -0
  145. package/dest/storage/capsule_store/index.js +1 -0
  146. package/dest/storage/{contract_data_provider/contract_data_provider.d.ts → contract_store/contract_store.d.ts} +8 -5
  147. package/dest/storage/contract_store/contract_store.d.ts.map +1 -0
  148. package/dest/storage/{contract_data_provider/contract_data_provider.js → contract_store/contract_store.js} +46 -3
  149. package/dest/storage/contract_store/index.d.ts +2 -0
  150. package/dest/storage/contract_store/index.d.ts.map +1 -0
  151. package/dest/storage/contract_store/index.js +1 -0
  152. package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.d.ts +1 -1
  153. package/dest/storage/contract_store/private_functions_tree.d.ts.map +1 -0
  154. package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.js +1 -1
  155. package/dest/storage/index.d.ts +8 -8
  156. package/dest/storage/index.d.ts.map +1 -1
  157. package/dest/storage/index.js +7 -7
  158. package/dest/storage/note_store/index.d.ts +3 -0
  159. package/dest/storage/note_store/index.d.ts.map +1 -0
  160. package/dest/storage/note_store/index.js +2 -0
  161. package/dest/storage/{note_data_provider/note_data_provider.d.ts → note_store/note_store.d.ts} +15 -13
  162. package/dest/storage/note_store/note_store.d.ts.map +1 -0
  163. package/dest/storage/{note_data_provider/note_data_provider.js → note_store/note_store.js} +105 -102
  164. package/dest/storage/private_event_store/private_event_store.d.ts +78 -0
  165. package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -0
  166. package/dest/storage/private_event_store/private_event_store.js +222 -0
  167. package/dest/storage/tagging_store/index.d.ts +4 -0
  168. package/dest/storage/tagging_store/index.d.ts.map +1 -0
  169. package/dest/storage/tagging_store/index.js +3 -0
  170. package/dest/storage/tagging_store/recipient_tagging_store.d.ts +28 -0
  171. package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -0
  172. package/dest/storage/tagging_store/recipient_tagging_store.js +99 -0
  173. package/dest/storage/tagging_store/sender_address_book_store.d.ts +14 -0
  174. package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +1 -0
  175. package/dest/storage/tagging_store/sender_address_book_store.js +30 -0
  176. package/dest/storage/tagging_store/sender_tagging_store.d.ts +77 -0
  177. package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -0
  178. package/dest/storage/tagging_store/sender_tagging_store.js +278 -0
  179. package/dest/tagging/constants.d.ts +2 -2
  180. package/dest/tagging/constants.d.ts.map +1 -1
  181. package/dest/tagging/constants.js +10 -2
  182. package/dest/tagging/index.d.ts +15 -6
  183. package/dest/tagging/index.d.ts.map +1 -1
  184. package/dest/tagging/index.js +14 -5
  185. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +14 -0
  186. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -0
  187. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +99 -0
  188. package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts +12 -0
  189. package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts.map +1 -0
  190. package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +20 -0
  191. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +14 -0
  192. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -0
  193. package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +29 -0
  194. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +20 -0
  195. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -0
  196. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +74 -0
  197. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +11 -0
  198. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -0
  199. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +32 -0
  200. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +20 -0
  201. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -0
  202. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +57 -0
  203. package/dest/tree_membership/tree_membership_service.d.ts +50 -0
  204. package/dest/tree_membership/tree_membership_service.d.ts.map +1 -0
  205. package/dest/tree_membership/tree_membership_service.js +75 -0
  206. package/package.json +18 -18
  207. package/src/bin/check_oracle_version.ts +130 -20
  208. package/src/{synchronizer/synchronizer.ts → block_synchronizer/block_synchronizer.ts} +44 -30
  209. package/src/block_synchronizer/index.ts +1 -0
  210. package/src/config/index.ts +3 -3
  211. package/src/config/package_info.ts +1 -1
  212. package/src/contract_function_simulator/benchmarked_node.ts +103 -0
  213. package/src/contract_function_simulator/contract_function_simulator.ts +118 -30
  214. package/src/contract_function_simulator/execution_note_cache.ts +51 -29
  215. package/src/contract_function_simulator/execution_tagging_index_cache.ts +1 -1
  216. package/src/contract_function_simulator/hashed_values_cache.ts +1 -1
  217. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +5 -1
  218. package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +6 -5
  219. package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +1 -1
  220. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +1 -1
  221. package/src/contract_function_simulator/noir-structs/utility_context.ts +6 -25
  222. package/src/contract_function_simulator/oracle/interfaces.ts +13 -12
  223. package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +1 -1
  224. package/src/contract_function_simulator/oracle/note_packing_utils.ts +23 -9
  225. package/src/contract_function_simulator/oracle/oracle.ts +44 -28
  226. package/src/contract_function_simulator/oracle/private_execution.ts +22 -30
  227. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +97 -58
  228. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +233 -63
  229. package/src/contract_function_simulator/pick_notes.ts +1 -1
  230. package/src/contract_function_simulator/proxied_contract_data_source.ts +24 -7
  231. package/src/debug/pxe_debug_utils.ts +48 -0
  232. package/src/entrypoints/client/bundle/index.ts +0 -1
  233. package/src/entrypoints/client/bundle/utils.ts +9 -3
  234. package/src/entrypoints/client/lazy/index.ts +0 -1
  235. package/src/entrypoints/client/lazy/utils.ts +9 -4
  236. package/src/entrypoints/pxe_creation_options.ts +4 -1
  237. package/src/entrypoints/server/index.ts +2 -1
  238. package/src/entrypoints/server/utils.ts +12 -16
  239. package/src/error_enriching.ts +7 -15
  240. package/src/events/event_service.ts +73 -0
  241. package/src/events/index.ts +1 -0
  242. package/src/events/private_event_filter_validator.ts +46 -0
  243. package/src/job_coordinator/job_coordinator.ts +149 -0
  244. package/src/logs/log_service.ts +204 -0
  245. package/src/notes/index.ts +1 -0
  246. package/src/notes/note_service.ts +194 -0
  247. package/src/oracle_version.ts +2 -2
  248. package/src/private_kernel/hints/index.ts +1 -1
  249. package/src/private_kernel/hints/{build_private_kernel_reset_private_inputs.ts → private_kernel_reset_private_inputs_builder.ts} +34 -23
  250. package/src/private_kernel/private_kernel_execution_prover.ts +7 -9
  251. package/src/private_kernel/private_kernel_oracle.ts +118 -37
  252. package/src/pxe.ts +233 -279
  253. package/src/storage/{address_data_provider/address_data_provider.ts → address_store/address_store.ts} +1 -1
  254. package/src/storage/address_store/index.ts +1 -0
  255. package/src/storage/{sync_data_provider/sync_data_provider.ts → anchor_block_store/anchor_block_store.ts} +2 -12
  256. package/src/storage/anchor_block_store/index.ts +1 -0
  257. package/src/storage/capsule_store/capsule_store.ts +315 -0
  258. package/src/storage/capsule_store/index.ts +1 -0
  259. package/src/storage/{contract_data_provider/contract_data_provider.ts → contract_store/contract_store.ts} +65 -3
  260. package/src/storage/contract_store/index.ts +1 -0
  261. package/src/storage/{contract_data_provider → contract_store}/private_functions_tree.ts +1 -1
  262. package/src/storage/index.ts +7 -7
  263. package/src/storage/note_store/index.ts +2 -0
  264. package/src/storage/{note_data_provider/note_data_provider.ts → note_store/note_store.ts} +117 -105
  265. package/src/storage/private_event_store/private_event_store.ts +324 -0
  266. package/src/storage/tagging_store/index.ts +3 -0
  267. package/src/storage/tagging_store/recipient_tagging_store.ts +129 -0
  268. package/src/storage/tagging_store/sender_address_book_store.ts +42 -0
  269. package/src/storage/tagging_store/sender_tagging_store.ts +345 -0
  270. package/src/tagging/constants.ts +10 -2
  271. package/src/tagging/index.ts +17 -5
  272. package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +133 -0
  273. package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +34 -0
  274. package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +43 -0
  275. package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +97 -0
  276. package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +48 -0
  277. package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +75 -0
  278. package/src/tree_membership/tree_membership_service.ts +97 -0
  279. package/dest/contract_function_simulator/execution_data_provider.d.ts +0 -267
  280. package/dest/contract_function_simulator/execution_data_provider.d.ts.map +0 -1
  281. package/dest/contract_function_simulator/execution_data_provider.js +0 -14
  282. package/dest/contract_function_simulator/proxied_node.d.ts +0 -9
  283. package/dest/contract_function_simulator/proxied_node.d.ts.map +0 -1
  284. package/dest/contract_function_simulator/proxied_node.js +0 -27
  285. package/dest/contract_function_simulator/pxe_oracle_interface.d.ts +0 -123
  286. package/dest/contract_function_simulator/pxe_oracle_interface.d.ts.map +0 -1
  287. package/dest/contract_function_simulator/pxe_oracle_interface.js +0 -696
  288. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +0 -28
  289. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +0 -1
  290. package/dest/private_kernel/private_kernel_oracle_impl.d.ts +0 -45
  291. package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +0 -1
  292. package/dest/private_kernel/private_kernel_oracle_impl.js +0 -86
  293. package/dest/storage/address_data_provider/address_data_provider.d.ts +0 -11
  294. package/dest/storage/address_data_provider/address_data_provider.d.ts.map +0 -1
  295. package/dest/storage/address_data_provider/index.d.ts +0 -2
  296. package/dest/storage/address_data_provider/index.d.ts.map +0 -1
  297. package/dest/storage/address_data_provider/index.js +0 -1
  298. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts +0 -25
  299. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +0 -1
  300. package/dest/storage/capsule_data_provider/capsule_data_provider.js +0 -118
  301. package/dest/storage/capsule_data_provider/index.d.ts +0 -2
  302. package/dest/storage/capsule_data_provider/index.d.ts.map +0 -1
  303. package/dest/storage/capsule_data_provider/index.js +0 -1
  304. package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +0 -1
  305. package/dest/storage/contract_data_provider/index.d.ts +0 -2
  306. package/dest/storage/contract_data_provider/index.d.ts.map +0 -1
  307. package/dest/storage/contract_data_provider/index.js +0 -1
  308. package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +0 -1
  309. package/dest/storage/note_data_provider/index.d.ts +0 -3
  310. package/dest/storage/note_data_provider/index.d.ts.map +0 -1
  311. package/dest/storage/note_data_provider/index.js +0 -2
  312. package/dest/storage/note_data_provider/note_data_provider.d.ts.map +0 -1
  313. package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +0 -37
  314. package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts.map +0 -1
  315. package/dest/storage/private_event_data_provider/private_event_data_provider.js +0 -105
  316. package/dest/storage/sync_data_provider/index.d.ts.map +0 -1
  317. package/dest/storage/sync_data_provider/index.js +0 -1
  318. package/dest/storage/sync_data_provider/sync_data_provider.d.ts.map +0 -1
  319. package/dest/storage/tagging_data_provider/index.d.ts +0 -2
  320. package/dest/storage/tagging_data_provider/index.d.ts.map +0 -1
  321. package/dest/storage/tagging_data_provider/index.js +0 -1
  322. package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts +0 -40
  323. package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts.map +0 -1
  324. package/dest/storage/tagging_data_provider/tagging_data_provider.js +0 -89
  325. package/dest/synchronizer/index.d.ts +0 -2
  326. package/dest/synchronizer/index.d.ts.map +0 -1
  327. package/dest/synchronizer/index.js +0 -1
  328. package/dest/synchronizer/synchronizer.d.ts +0 -36
  329. package/dest/synchronizer/synchronizer.d.ts.map +0 -1
  330. package/dest/tagging/siloed_tag.d.ts +0 -14
  331. package/dest/tagging/siloed_tag.d.ts.map +0 -1
  332. package/dest/tagging/siloed_tag.js +0 -20
  333. package/dest/tagging/tag.d.ts +0 -12
  334. package/dest/tagging/tag.d.ts.map +0 -1
  335. package/dest/tagging/tag.js +0 -17
  336. package/dest/tagging/utils.d.ts +0 -18
  337. package/dest/tagging/utils.d.ts.map +0 -1
  338. package/dest/tagging/utils.js +0 -24
  339. package/src/contract_function_simulator/execution_data_provider.ts +0 -342
  340. package/src/contract_function_simulator/proxied_node.ts +0 -33
  341. package/src/contract_function_simulator/pxe_oracle_interface.ts +0 -1023
  342. package/src/private_kernel/private_kernel_oracle_impl.ts +0 -132
  343. package/src/storage/address_data_provider/index.ts +0 -1
  344. package/src/storage/capsule_data_provider/capsule_data_provider.ts +0 -147
  345. package/src/storage/capsule_data_provider/index.ts +0 -1
  346. package/src/storage/contract_data_provider/index.ts +0 -1
  347. package/src/storage/note_data_provider/index.ts +0 -2
  348. package/src/storage/private_event_data_provider/private_event_data_provider.ts +0 -143
  349. package/src/storage/sync_data_provider/index.ts +0 -1
  350. package/src/storage/tagging_data_provider/index.ts +0 -1
  351. package/src/storage/tagging_data_provider/tagging_data_provider.ts +0 -120
  352. package/src/synchronizer/index.ts +0 -1
  353. package/src/tagging/siloed_tag.ts +0 -22
  354. package/src/tagging/tag.ts +0 -16
  355. package/src/tagging/utils.ts +0 -31
@@ -1,5 +1,8 @@
1
- import { keccak256String } from '@aztec/foundation/crypto';
2
- import { Oracle } from '../contract_function_simulator/oracle/oracle.js';
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';
3
6
  import { ORACLE_INTERFACE_HASH } from '../oracle_version.js';
4
7
  /**
5
8
  * Verifies that the Oracle interface matches the expected interface hash.
@@ -13,6 +16,17 @@ import { ORACLE_INTERFACE_HASH } from '../oracle_version.js';
13
16
  * oracles. Ensure this checks TXE oracles as well. This hasn't been implemented yet since we don't have a clean TXE
14
17
  * oracle interface like we do in PXE (i.e., there is no single Oracle class that contains only the oracles).
15
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() {
16
30
  const excludedProps = [
17
31
  'handler',
18
32
  'constructor',
@@ -21,19 +35,95 @@ import { ORACLE_INTERFACE_HASH } from '../oracle_version.js';
21
35
  'handlerAsUtility',
22
36
  'handlerAsPrivate'
23
37
  ];
24
- // Create a hashable representation of the oracle interface by concatenating its method names. Return values are
25
- // excluded from the hash calculation since they are typically arrays of fields and I didn't manage to reliably
26
- // stringify them.
27
- // TODO(#16581): we're only checking the functions implemented by the Oracle object, which is really an ACVM
28
- // translator, akin to TXE's RPC translator. This is correct in that it is ultimately the foreign interface that
29
- // matters, but incorrect in that it does not take into consideration TXE's extended interface. An improvement would
30
- // be to check RPCTranslator from TXE, though that still seems a bit fragile.
31
- const oracleInterfaceMethodNames = Object.getOwnPropertyNames(Oracle.prototype).filter((name)=>!excludedProps.includes(name)).sort().join('');
32
- // We use keccak256 here just because we already have it in the dependencies.
33
- const oracleInterfaceHash = keccak256String(oracleInterfaceMethodNames);
34
- if (oracleInterfaceHash !== ORACLE_INTERFACE_HASH) {
35
- // This check exists only to notify you when you need to update the ORACLE_VERSION constant.
36
- 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.`);
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';
37
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;
38
128
  }
39
129
  assertOracleInterfaceMatches();
@@ -0,0 +1,41 @@
1
+ import { type Logger } from '@aztec/foundation/log';
2
+ import type { AztecAsyncKVStore } from '@aztec/kv-store';
3
+ import type { L2TipsKVStore } from '@aztec/kv-store/stores';
4
+ import { L2BlockStream, type L2BlockStreamEvent, type L2BlockStreamEventHandler } from '@aztec/stdlib/block';
5
+ import type { AztecNode } from '@aztec/stdlib/interfaces/client';
6
+ import type { PXEConfig } from '../config/index.js';
7
+ import type { AnchorBlockStore } from '../storage/anchor_block_store/anchor_block_store.js';
8
+ import type { NoteStore } from '../storage/note_store/note_store.js';
9
+ import type { PrivateEventStore } from '../storage/private_event_store/private_event_store.js';
10
+ /**
11
+ * The BlockSynchronizer class orchestrates synchronization between PXE and Aztec node, maintaining an up-to-date
12
+ * view of the L2 chain state. It handles block header retrieval, chain reorganizations, and provides an interface
13
+ * for querying sync status.
14
+ */
15
+ export declare class BlockSynchronizer implements L2BlockStreamEventHandler {
16
+ private node;
17
+ private store;
18
+ private anchorBlockStore;
19
+ private noteStore;
20
+ private privateEventStore;
21
+ private l2TipsStore;
22
+ private log;
23
+ private isSyncing;
24
+ protected readonly blockStream: L2BlockStream;
25
+ constructor(node: AztecNode, store: AztecAsyncKVStore, anchorBlockStore: AnchorBlockStore, noteStore: NoteStore, privateEventStore: PrivateEventStore, l2TipsStore: L2TipsKVStore, config?: Partial<Pick<PXEConfig, 'l2BlockBatchSize'>>, loggerOrSuffix?: string | Logger);
26
+ protected createBlockStream(config: Partial<Pick<PXEConfig, 'l2BlockBatchSize'>>): L2BlockStream;
27
+ /** Handle events emitted by the block stream. */
28
+ handleBlockStreamEvent(event: L2BlockStreamEvent): Promise<void>;
29
+ /**
30
+ * Syncs PXE and the node by downloading the metadata of the latest blocks, allowing simulations to use
31
+ * recent data (e.g. notes), and handling any reorgs that might have occurred.
32
+ *
33
+ * Note this BlockSynchronizer is designed to let its users control when a synchronization is run,
34
+ * so this component doesn't proactively stay up to date with the blockchain.
35
+ *
36
+ * We do this so PXE can ensure data consistency.
37
+ */
38
+ sync(): Promise<void>;
39
+ private doSync;
40
+ }
41
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmxvY2tfc3luY2hyb25pemVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvYmxvY2tfc3luY2hyb25pemVyL2Jsb2NrX3N5bmNocm9uaXplci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQUFPLEVBQUUsS0FBSyxNQUFNLEVBQWdCLE1BQU0sdUJBQXVCLEN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AK,EAAE,iBAAiB,EAAE,MAAM,uDAAuD,CAAC;AAE/F;;;;GAIG;AACH,qBAAa,iBAAkB,YAAW,yBAAyB;IAM/D,OAAO,CAAC,IAAI;IACZ,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,gBAAgB;IACxB,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,iBAAiB;IACzB,OAAO,CAAC,WAAW;IAVrB,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,SAAS,CAA4B;IAC7C,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,aAAa,CAAC;IAE9C,YACU,IAAI,EAAE,SAAS,EACf,KAAK,EAAE,iBAAiB,EACxB,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,SAAS,EACpB,iBAAiB,EAAE,iBAAiB,EACpC,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,CAsC5E;IAED;;;;;;;;OAQG;IACU,IAAI,kBAehB;YAEa,MAAM;CAcrB"}
@@ -1,26 +1,28 @@
1
1
  import { BlockNumber } from '@aztec/foundation/branded-types';
2
2
  import { createLogger } from '@aztec/foundation/log';
3
- import { L2BlockStream } from '@aztec/stdlib/block';
3
+ import { L2BlockHash, L2BlockStream } from '@aztec/stdlib/block';
4
4
  /**
5
- * The Synchronizer class orchestrates synchronization between the PXE and Aztec node, maintaining an up-to-date
5
+ * The BlockSynchronizer class orchestrates synchronization between PXE and Aztec node, maintaining an up-to-date
6
6
  * view of the L2 chain state. It handles block header retrieval, chain reorganizations, and provides an interface
7
7
  * for querying sync status.
8
- */ export class Synchronizer {
8
+ */ export class BlockSynchronizer {
9
9
  node;
10
- syncDataProvider;
11
- noteDataProvider;
12
- taggingDataProvider;
10
+ store;
11
+ anchorBlockStore;
12
+ noteStore;
13
+ privateEventStore;
13
14
  l2TipsStore;
14
15
  log;
15
16
  isSyncing;
16
17
  blockStream;
17
- constructor(node, syncDataProvider, noteDataProvider, taggingDataProvider, l2TipsStore, config = {}, loggerOrSuffix){
18
+ constructor(node, store, anchorBlockStore, noteStore, privateEventStore, l2TipsStore, config = {}, loggerOrSuffix){
18
19
  this.node = node;
19
- this.syncDataProvider = syncDataProvider;
20
- this.noteDataProvider = noteDataProvider;
21
- this.taggingDataProvider = taggingDataProvider;
20
+ this.store = store;
21
+ this.anchorBlockStore = anchorBlockStore;
22
+ this.noteStore = noteStore;
23
+ this.privateEventStore = privateEventStore;
22
24
  this.l2TipsStore = l2TipsStore;
23
- this.log = !loggerOrSuffix || typeof loggerOrSuffix === 'string' ? createLogger(loggerOrSuffix ? `pxe:synchronizer:${loggerOrSuffix}` : `pxe:synchronizer`) : loggerOrSuffix;
25
+ this.log = !loggerOrSuffix || typeof loggerOrSuffix === 'string' ? createLogger(loggerOrSuffix ? `pxe:block_synchronizer:${loggerOrSuffix}` : `pxe:block_synchronizer`) : loggerOrSuffix;
24
26
  this.blockStream = this.createBlockStream(config);
25
27
  }
26
28
  createBlockStream(config) {
@@ -36,31 +38,32 @@ import { L2BlockStream } from '@aztec/stdlib/block';
36
38
  switch(event.type){
37
39
  case 'blocks-added':
38
40
  {
39
- const lastBlock = event.blocks.at(-1).block;
41
+ const lastBlock = event.blocks.at(-1);
40
42
  this.log.verbose(`Updated pxe last block to ${lastBlock.number}`, {
41
43
  blockHash: lastBlock.hash(),
42
44
  archive: lastBlock.archive.root.toString(),
43
45
  header: lastBlock.header.toInspect()
44
46
  });
45
- await this.syncDataProvider.setHeader(lastBlock.getBlockHeader());
47
+ await this.anchorBlockStore.setHeader(lastBlock.header);
46
48
  break;
47
49
  }
48
50
  case 'chain-pruned':
49
51
  {
50
52
  this.log.warn(`Pruning data after block ${event.block.number} due to reorg`);
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.rollbackNotesAndNullifiers(event.block.number, lastSynchedBlockNumber);
54
- // Remove all note tagging indexes to force a full resync. This is suboptimal, but unless we track the
55
- // block number in which each index is used it's all we can do.
56
- await this.taggingDataProvider.resetNoteSyncData();
57
- // Update the header to the last block.
58
- const newHeader = await this.node.getBlockHeader(event.block.number);
59
- if (!newHeader) {
60
- this.log.error(`Block header not found for block number ${event.block.number} during chain prune`);
61
- } else {
62
- await this.syncDataProvider.setHeader(newHeader);
53
+ const oldAnchorBlockNumber = (await this.anchorBlockStore.getBlockHeader()).getBlockNumber();
54
+ // Note that the following is not necessarily the anchor block that will be used in the transaction - if
55
+ // the chain has already moved past the reorg, we'll also see blocks-added events that will push the anchor
56
+ // forward.
57
+ const newAnchorBlockHeader = await this.node.getBlockHeader(L2BlockHash.fromString(event.block.hash));
58
+ if (!newAnchorBlockHeader) {
59
+ throw new Error(`Block header for block number ${event.block.number} and hash ${event.block.hash} not found during chain prune. This likely indicates a bug in the node, as we receive block stream events and fetch block headers from the same node.`);
63
60
  }
61
+ // Operations are wrapped in a single transaction to ensure atomicity.
62
+ await this.store.transactionAsync(async ()=>{
63
+ await this.noteStore.rollback(event.block.number, oldAnchorBlockNumber);
64
+ await this.privateEventStore.rollback(event.block.number, oldAnchorBlockNumber);
65
+ await this.anchorBlockStore.setHeader(newAnchorBlockHeader);
66
+ });
64
67
  break;
65
68
  }
66
69
  }
@@ -68,6 +71,11 @@ import { L2BlockStream } from '@aztec/stdlib/block';
68
71
  /**
69
72
  * Syncs PXE and the node by downloading the metadata of the latest blocks, allowing simulations to use
70
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.
71
79
  */ async sync() {
72
80
  if (this.isSyncing !== undefined) {
73
81
  this.log.debug(`Waiting for the ongoing sync to finish`);
@@ -86,17 +94,14 @@ import { L2BlockStream } from '@aztec/stdlib/block';
86
94
  async doSync() {
87
95
  let currentHeader;
88
96
  try {
89
- currentHeader = await this.syncDataProvider.getBlockHeader();
97
+ currentHeader = await this.anchorBlockStore.getBlockHeader();
90
98
  } catch {
91
99
  this.log.debug('Header is not set, requesting from the node');
92
100
  }
93
101
  if (!currentHeader) {
94
102
  // REFACTOR: We should know the header of the genesis block without having to request it from the node.
95
- await this.syncDataProvider.setHeader(await this.node.getBlockHeader(BlockNumber.ZERO));
103
+ await this.anchorBlockStore.setHeader(await this.node.getBlockHeader(BlockNumber.ZERO));
96
104
  }
97
105
  await this.blockStream.sync();
98
106
  }
99
- getSynchedBlockNumber() {
100
- return this.syncDataProvider.getBlockNumber();
101
- }
102
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';
@@ -10,13 +10,13 @@ export interface KernelProverConfig {
10
10
  proverEnabled?: boolean;
11
11
  }
12
12
  /**
13
- * Configuration settings for the synchronizer.
13
+ * Configuration settings for the block synchronizer.
14
14
  */
15
- export interface SynchronizerConfig {
15
+ export interface BlockSynchronizerConfig {
16
16
  /** Maximum amount of blocks to pull from the stream in one request when synchronizing */
17
17
  l2BlockBatchSize: number;
18
18
  }
19
- export type PXEConfig = KernelProverConfig & DataStoreConfig & ChainConfig & SynchronizerConfig;
19
+ export type PXEConfig = KernelProverConfig & DataStoreConfig & ChainConfig & BlockSynchronizerConfig;
20
20
  export type CliPXEOptions = {
21
21
  /** Custom Aztec Node URL to connect to */
22
22
  nodeUrl?: string;
@@ -32,4 +32,4 @@ export declare const allPxeConfigMappings: ConfigMappingsType<CliPXEOptions & PX
32
32
  * Creates an instance of CliPxeOptions out of environment variables
33
33
  */
34
34
  export declare function getCliPXEOptions(): CliPXEOptions & PXEConfig;
35
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb25maWcvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUNMLEtBQUssa0JBQWtCLEVBS3hCLE1BQU0sMEJBQTBCLENBQUM7QUFDbEMsT0FBTyxFQUFFLEtBQUssZUFBZSxFQUFzQixNQUFNLHdCQUF3QixDQUFDO0FBQ2xGLE9BQU8sRUFBRSxLQUFLLFdBQVcsRUFBdUIsTUFBTSxzQkFBc0IsQ0FBQztBQUU3RSxPQUFPLEVBQUUsY0FBYyxFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFFbkQ7O0dBRUc7QUFDSCxNQUFNLFdBQVcsa0JBQWtCO0lBQ2pDLDhDQUE4QztJQUM5QyxhQUFhLENBQUMsRUFBRSxPQUFPLENBQUM7Q0FDekI7QUFFRDs7R0FFRztBQUNILE1BQU0sV0FBVyxrQkFBa0I7SUFDakMseUZBQXlGO0lBQ3pGLGdCQUFnQixFQUFFLE1BQU0sQ0FBQ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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,6 +1,6 @@
1
1
  export function getPackageInfo() {
2
2
  return {
3
- version: '3.0.0',
3
+ version: '4.0.0',
4
4
  name: '@aztec/pxe'
5
5
  };
6
6
  }
@@ -0,0 +1,9 @@
1
+ import type { AztecNode } from '@aztec/stdlib/interfaces/client';
2
+ import type { NodeStats } from '@aztec/stdlib/tx';
3
+ export type BenchmarkedNode = AztecNode & {
4
+ getStats(): NodeStats;
5
+ };
6
+ export declare class BenchmarkedNodeFactory {
7
+ static create(node: AztecNode): BenchmarkedNode;
8
+ }
9
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmVuY2htYXJrZWRfbm9kZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbnRyYWN0X2Z1bmN0aW9uX3NpbXVsYXRvci9iZW5jaG1hcmtlZF9ub2RlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQ2pFLE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBa0IsTUFBTSxrQkFBa0IsQ0FBQztBQWlCbEUsTUFBTSxNQUFNLGVBQWUsR0FBRyxTQUFTLEdBQUc7SUFBRSxRQUFRLElBQUksU0FBUyxDQUFBO0NBQUUsQ0FBQztBQUVwRSxxQkFBYSxzQkFBc0I7SUFDakMsTUFBTSxDQUFDLE1BQU0sQ0FBQyxJQUFJLEVBQUUsU0FBUyxHQUFHLGVBQWUsQ0ErRTlDO0NBQ0YifQ==
@@ -0,0 +1 @@
1
+ {"version":3,"file":"benchmarked_node.d.ts","sourceRoot":"","sources":["../../src/contract_function_simulator/benchmarked_node.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,SAAS,EAAkB,MAAM,kBAAkB,CAAC;AAiBlE,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG;IAAE,QAAQ,IAAI,SAAS,CAAA;CAAE,CAAC;AAEpE,qBAAa,sBAAsB;IACjC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,eAAe,CA+E9C;CACF"}
@@ -0,0 +1,77 @@
1
+ import { Timer } from '@aztec/foundation/timer';
2
+ export class BenchmarkedNodeFactory {
3
+ static create(node) {
4
+ // Per-method call stats
5
+ const perMethod = {};
6
+ // Round trip tracking
7
+ let inFlightCount = 0;
8
+ let currentRoundTripTimer = null;
9
+ let currentRoundTripMethods = [];
10
+ const roundTrips = {
11
+ roundTrips: 0,
12
+ totalBlockingTime: 0,
13
+ roundTripDurations: [],
14
+ roundTripMethods: []
15
+ };
16
+ return new Proxy(node, {
17
+ get (target, prop) {
18
+ if (prop === 'getStats') {
19
+ return ()=>{
20
+ return {
21
+ perMethod,
22
+ roundTrips
23
+ };
24
+ };
25
+ } else {
26
+ return function(...args) {
27
+ // Track per-method stats
28
+ if (!perMethod[prop]) {
29
+ perMethod[prop] = {
30
+ times: []
31
+ };
32
+ }
33
+ // Start of a new round trip batch?
34
+ if (inFlightCount === 0) {
35
+ roundTrips.roundTrips++;
36
+ currentRoundTripTimer = new Timer();
37
+ currentRoundTripMethods = [];
38
+ }
39
+ inFlightCount++;
40
+ currentRoundTripMethods.push(prop);
41
+ const callTimer = new Timer();
42
+ const result = target[prop].apply(target, args);
43
+ // Handle completion - called when the call finishes (after Promise resolves)
44
+ const handleCompletion = ()=>{
45
+ const callTime = callTimer.ms();
46
+ perMethod[prop].times.push(callTime);
47
+ inFlightCount--;
48
+ // End of round trip batch - all concurrent calls completed
49
+ if (inFlightCount === 0 && currentRoundTripTimer) {
50
+ const roundTripTime = currentRoundTripTimer.ms();
51
+ roundTrips.totalBlockingTime += roundTripTime;
52
+ roundTrips.roundTripDurations.push(roundTripTime);
53
+ roundTrips.roundTripMethods.push(currentRoundTripMethods);
54
+ currentRoundTripTimer = null;
55
+ currentRoundTripMethods = [];
56
+ }
57
+ };
58
+ // If the result is a Promise, chain the completion handler
59
+ if (result && typeof result.then === 'function') {
60
+ return result.then((value)=>{
61
+ handleCompletion();
62
+ return value;
63
+ }, (error)=>{
64
+ handleCompletion();
65
+ throw error;
66
+ });
67
+ } else {
68
+ // Synchronous method - handle completion immediately
69
+ handleCompletion();
70
+ return result;
71
+ }
72
+ };
73
+ }
74
+ }
75
+ });
76
+ }
77
+ }
@@ -1,21 +1,40 @@
1
- import { Fr } from '@aztec/foundation/fields';
1
+ import { Fr } from '@aztec/foundation/curves/bn254';
2
+ import type { KeyStore } from '@aztec/key-store';
2
3
  import { type CircuitSimulator } from '@aztec/simulator/client';
3
4
  import type { FunctionCall } from '@aztec/stdlib/abi';
4
5
  import { FunctionSelector } from '@aztec/stdlib/abi';
5
6
  import type { AuthWitness } from '@aztec/stdlib/auth-witness';
6
7
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
8
+ import type { AztecNode } from '@aztec/stdlib/interfaces/server';
7
9
  import { type PrivateKernelExecutionProofOutput, PrivateKernelTailCircuitPublicInputs } from '@aztec/stdlib/kernel';
8
- import { PrivateExecutionResult, TxExecutionRequest } from '@aztec/stdlib/tx';
9
- import type { ContractDataProvider } from '../storage/index.js';
10
- import type { ExecutionDataProvider } from './execution_data_provider.js';
10
+ import { BlockHeader, PrivateExecutionResult, TxExecutionRequest } from '@aztec/stdlib/tx';
11
+ import type { AddressStore } from '../storage/address_store/address_store.js';
12
+ import type { AnchorBlockStore } from '../storage/anchor_block_store/anchor_block_store.js';
13
+ import type { CapsuleStore } from '../storage/capsule_store/capsule_store.js';
14
+ import type { ContractStore } from '../storage/contract_store/contract_store.js';
15
+ import type { NoteStore } from '../storage/note_store/note_store.js';
16
+ import type { PrivateEventStore } from '../storage/private_event_store/private_event_store.js';
17
+ import type { RecipientTaggingStore } from '../storage/tagging_store/recipient_tagging_store.js';
18
+ import type { SenderAddressBookStore } from '../storage/tagging_store/sender_address_book_store.js';
19
+ import type { SenderTaggingStore } from '../storage/tagging_store/sender_tagging_store.js';
11
20
  /**
12
21
  * The contract function simulator.
13
22
  */
14
23
  export declare class ContractFunctionSimulator {
15
- private executionDataProvider;
24
+ private contractStore;
25
+ private noteStore;
26
+ private keyStore;
27
+ private addressStore;
28
+ private aztecNode;
29
+ private anchorBlockStore;
30
+ private senderTaggingStore;
31
+ private recipientTaggingStore;
32
+ private senderAddressBookStore;
33
+ private capsuleStore;
34
+ private privateEventStore;
16
35
  private simulator;
17
36
  private log;
18
- constructor(executionDataProvider: ExecutionDataProvider, simulator: CircuitSimulator);
37
+ constructor(contractStore: ContractStore, noteStore: NoteStore, keyStore: KeyStore, addressStore: AddressStore, aztecNode: AztecNode, anchorBlockStore: AnchorBlockStore, senderTaggingStore: SenderTaggingStore, recipientTaggingStore: RecipientTaggingStore, senderAddressBookStore: SenderAddressBookStore, capsuleStore: CapsuleStore, privateEventStore: PrivateEventStore, simulator: CircuitSimulator);
19
38
  /**
20
39
  * Runs a private function.
21
40
  * @param request - The transaction request.
@@ -23,22 +42,31 @@ export declare class ContractFunctionSimulator {
23
42
  * @param contractAddress - The address of the contract (should match request.origin)
24
43
  * @param msgSender - The address calling the function. This can be replaced to simulate a call from another contract
25
44
  * or a specific account.
45
+ * @param anchorBlockHeader - The block header to use as base state for this run.
26
46
  * @param senderForTags - The address that is used as a tagging sender when emitting private logs. Returned from
27
47
  * the `privateGetSenderForTags` oracle.
28
48
  * @param scopes - The accounts whose notes we can access in this call. Currently optional and will default to all.
49
+ * @param jobId - The job ID for staged writes.
29
50
  * @returns The result of the execution.
30
51
  */
31
- run(request: TxExecutionRequest, contractAddress: AztecAddress, selector: FunctionSelector, msgSender?: AztecAddress, senderForTags?: AztecAddress, scopes?: AztecAddress[]): Promise<PrivateExecutionResult>;
52
+ run(request: TxExecutionRequest, contractAddress: AztecAddress, selector: FunctionSelector, msgSender: AztecAddress | undefined, anchorBlockHeader: BlockHeader, senderForTags: AztecAddress | undefined, scopes: AztecAddress[] | undefined, jobId: string): Promise<PrivateExecutionResult>;
32
53
  /**
33
54
  * Runs a utility function.
34
55
  * @param call - The function call to execute.
35
56
  * @param authwits - Authentication witnesses required for the function call.
57
+ * @param anchorBlockHeader - The block header to use as base state for this run.
36
58
  * @param scopes - Optional array of account addresses whose notes can be accessed in this call. Defaults to all
37
59
  * accounts if not specified.
38
60
  * @returns A return value of the utility function in a form as returned by the simulator (Noir fields)
39
61
  */
40
- runUtility(call: FunctionCall, authwits: AuthWitness[], scopes?: AztecAddress[]): Promise<Fr[]>;
41
- getStats(): import("./execution_data_provider.js").ExecutionStats;
62
+ runUtility(call: FunctionCall, authwits: AuthWitness[], anchorBlockHeader: BlockHeader, scopes: AztecAddress[] | undefined, jobId: string): Promise<Fr[]>;
63
+ /**
64
+ * Returns the execution statistics collected during the simulator run.
65
+ * @returns The execution statistics.
66
+ */
67
+ getStats(): {
68
+ nodeRPCCalls: import("@aztec/stdlib/tx").NodeStats;
69
+ };
42
70
  }
43
71
  /**
44
72
  * Generates the final public inputs of the tail kernel circuit, an empty Chonk proof
@@ -47,10 +75,10 @@ export declare class ContractFunctionSimulator {
47
75
  * (allowing state overrides) and is much faster, while still generating a valid
48
76
  * output that can be sent to the node for public simulation
49
77
  * @param privateExecutionResult - The result of the private execution.
50
- * @param nonceGenerator - A nonce generator for note hashes. According to the protocol rules,
51
- * it can either be the first nullifier in the tx or the hash of the initial tx request if there are none.
52
- * @param contractDataProvider - A provider for contract data in order to get function names and debug info.
78
+ * @param contractStore - A provider for contract data in order to get function names and debug info.
79
+ * @param minRevertibleSideEffectCounterOverride - Optional override for the min revertible side effect counter.
80
+ * Used by TXE to simulate account contract behavior (setting the counter before app execution).
53
81
  * @returns The simulated proving result.
54
82
  */
55
- export declare function generateSimulatedProvingResult(privateExecutionResult: PrivateExecutionResult, nonceGenerator: Fr, contractDataProvider: ContractDataProvider): Promise<PrivateKernelExecutionProofOutput<PrivateKernelTailCircuitPublicInputs>>;
56
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udHJhY3RfZnVuY3Rpb25fc2ltdWxhdG9yLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY29udHJhY3RfZnVuY3Rpb25fc2ltdWxhdG9yL2NvbnRyYWN0X2Z1bmN0aW9uX3NpbXVsYXRvci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFvQkEsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLDBCQUEwQixDQUFDO0FBSzlDLE9BQU8sRUFDTCxLQUFLLGdCQUFnQixFQU90QixNQUFNLHlCQUF5QixDQUFDO0FBQ2pDLE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBQ3RELE9BQU8sRUFBRSxnQkFBZ0IsRUFBZ0IsTUFBTSxtQkFBbUIsQ0FBQztBQUNuRSxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSw0QkFBNEIsQ0FBQztBQUM5RCxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFTM0QsT0FBTyxFQUlMLEtBQUssaUNBQWlDLEVBQ3RDLG9DQUFvQ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YyxFQUFFLEVBQUUsRUFDbEIsb0JBQW9CLEVBQUUsb0JBQW9CLEdBQ3pDLE9BQU8sQ0FBQyxpQ0FBaUMsQ0FBQyxvQ0FBb0MsQ0FBQyxDQUFDLENBZ05sRiJ9
83
+ export declare function generateSimulatedProvingResult(privateExecutionResult: PrivateExecutionResult, contractStore: ContractStore, minRevertibleSideEffectCounterOverride?: number): Promise<PrivateKernelExecutionProofOutput<PrivateKernelTailCircuitPublicInputs>>;
84
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udHJhY3RfZnVuY3Rpb25fc2ltdWxhdG9yLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY29udHJhY3RfZnVuY3Rpb25fc2ltdWxhdG9yL2NvbnRyYWN0X2Z1bmN0aW9uX3NpbXVsYXRvci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFvQkEsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBR3BELE9BQU8sS0FBSyxFQUFFLFFBQVEsRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBR2pELE9BQU8sRUFDTCxLQUFLLGdCQUFnQixFQU90QixNQUFNLHlCQUF5QixDQUFDO0FBQ2pDLE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBQ3RELE9BQU8sRUFBRSxnQkFBZ0IsRUFBZ0IsTUFBTSxtQkFBbUIsQ0FBQztBQUNuRSxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSw0QkFBNEIsQ0FBQztBQUM5RCxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFTM0QsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFDakUsT0FBTyxFQUlMLEtBQUssaUNBQWlDLEVBQ3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QUMsRUFBRSxFQUFFLENBQUMsQ0F3RGY7SUFHRDs7O09BR0c7SUFDSCxRQUFROztNQVVQO0NBQ0Y7QUFZRDs7Ozs7Ozs7Ozs7R0FXRztBQUNILHdCQUFzQiw4QkFBOEIsQ0FDbEQsc0JBQXNCLEVBQUUsc0JBQXNCLEVBQzlDLGFBQWEsRUFBRSxhQUFhLEVBQzVCLHNDQUFzQyxDQUFDLEVBQUUsTUFBTSxHQUM5QyxPQUFPLENBQUMsaUNBQWlDLENBQUMsb0NBQW9DLENBQUMsQ0FBQyxDQXdObEYifQ==
@@ -1 +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,0BAA0B,CAAC;AAK9C,OAAO,EACL,KAAK,gBAAgB,EAOtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAgB,MAAM,mBAAmB,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAS3D,OAAO,EAIL,KAAK,iCAAiC,EACtC,oCAAoC,EAKrC,MAAM,sBAAsB,CAAC;AAI9B,OAAO,EAGL,sBAAsB,EAEtB,kBAAkB,EAGnB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAS1E;;GAEG;AACH,qBAAa,yBAAyB;IAIlC,OAAO,CAAC,qBAAqB;IAC7B,OAAO,CAAC,SAAS;IAJnB,OAAO,CAAC,GAAG,CAAS;IAEpB,YACU,qBAAqB,EAAE,qBAAqB,EAC5C,SAAS,EAAE,gBAAgB,EAGpC;IAED;;;;;;;;;;;OAWG;IACU,GAAG,CACd,OAAO,EAAE,kBAAkB,EAC3B,eAAe,EAAE,YAAY,EAC7B,QAAQ,EAAE,gBAAgB,EAC1B,SAAS,eAA6C,EACtD,aAAa,CAAC,EAAE,YAAY,EAC5B,MAAM,CAAC,EAAE,YAAY,EAAE,GACtB,OAAO,CAAC,sBAAsB,CAAC,CAgGjC;IAGD;;;;;;;OAOG;IACU,UAAU,CAAC,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,EAAE,MAAM,CAAC,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,EAAE,EAAE,CAAC,CAsC3G;IAGD,QAAQ,0DAEP;CACF;AAYD;;;;;;;;;;;GAWG;AACH,wBAAsB,8BAA8B,CAClD,sBAAsB,EAAE,sBAAsB,EAC9C,cAAc,EAAE,EAAE,EAClB,oBAAoB,EAAE,oBAAoB,GACzC,OAAO,CAAC,iCAAiC,CAAC,oCAAoC,CAAC,CAAC,CAgNlF"}
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;AACtD,OAAO,EAAE,gBAAgB,EAAgB,MAAM,mBAAmB,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAS3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAIL,KAAK,iCAAiC,EACtC,oCAAoC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