@aztec/pxe 0.0.1-commit.03f7ef2 → 0.0.1-commit.0b941701

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 (328) hide show
  1. package/dest/bin/check_oracle_version.js +1 -1
  2. package/dest/block_synchronizer/block_synchronizer.d.ts +14 -10
  3. package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
  4. package/dest/block_synchronizer/block_synchronizer.js +72 -32
  5. package/dest/config/index.d.ts +3 -1
  6. package/dest/config/index.d.ts.map +1 -1
  7. package/dest/config/index.js +17 -0
  8. package/dest/config/package_info.js +1 -1
  9. package/dest/contract_function_simulator/benchmarked_node.d.ts +9 -0
  10. package/dest/contract_function_simulator/benchmarked_node.d.ts.map +1 -0
  11. package/dest/contract_function_simulator/benchmarked_node.js +77 -0
  12. package/dest/contract_function_simulator/contract_function_simulator.d.ts +28 -27
  13. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  14. package/dest/contract_function_simulator/contract_function_simulator.js +56 -40
  15. package/dest/contract_function_simulator/execution_note_cache.d.ts +18 -9
  16. package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
  17. package/dest/contract_function_simulator/execution_note_cache.js +45 -28
  18. package/dest/contract_function_simulator/index.d.ts +2 -2
  19. package/dest/contract_function_simulator/index.d.ts.map +1 -1
  20. package/dest/contract_function_simulator/index.js +1 -1
  21. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +4 -3
  22. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
  23. package/dest/contract_function_simulator/noir-structs/event_validation_request.js +6 -3
  24. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +1 -1
  25. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +1 -1
  26. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +4 -10
  27. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -1
  28. package/dest/contract_function_simulator/noir-structs/utility_context.js +7 -18
  29. package/dest/contract_function_simulator/oracle/interfaces.d.ts +15 -11
  30. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
  31. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +3 -1
  32. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
  33. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +6 -6
  34. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
  35. package/dest/contract_function_simulator/oracle/note_packing_utils.js +8 -8
  36. package/dest/contract_function_simulator/oracle/oracle.d.ts +10 -8
  37. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
  38. package/dest/contract_function_simulator/oracle/oracle.js +43 -32
  39. package/dest/contract_function_simulator/oracle/private_execution.d.ts +2 -26
  40. package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
  41. package/dest/contract_function_simulator/oracle/private_execution.js +1 -37
  42. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +26 -26
  43. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  44. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +28 -41
  45. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +44 -34
  46. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  47. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +92 -92
  48. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +4 -4
  49. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -1
  50. package/dest/contract_function_simulator/proxied_contract_data_source.js +5 -5
  51. package/dest/contract_sync/index.d.ts +23 -0
  52. package/dest/contract_sync/index.d.ts.map +1 -0
  53. package/dest/contract_sync/index.js +54 -0
  54. package/dest/debug/pxe_debug_utils.d.ts +6 -6
  55. package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
  56. package/dest/debug/pxe_debug_utils.js +8 -7
  57. package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
  58. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  59. package/dest/entrypoints/client/bundle/utils.js +10 -1
  60. package/dest/entrypoints/client/lazy/utils.d.ts +1 -1
  61. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  62. package/dest/entrypoints/client/lazy/utils.js +10 -1
  63. package/dest/entrypoints/pxe_creation_options.d.ts +3 -2
  64. package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
  65. package/dest/entrypoints/server/index.d.ts +3 -1
  66. package/dest/entrypoints/server/index.d.ts.map +1 -1
  67. package/dest/entrypoints/server/index.js +2 -0
  68. package/dest/entrypoints/server/utils.d.ts +1 -1
  69. package/dest/entrypoints/server/utils.d.ts.map +1 -1
  70. package/dest/entrypoints/server/utils.js +11 -7
  71. package/dest/error_enriching.d.ts +4 -4
  72. package/dest/error_enriching.d.ts.map +1 -1
  73. package/dest/error_enriching.js +6 -6
  74. package/dest/events/event_service.d.ts +8 -7
  75. package/dest/events/event_service.d.ts.map +1 -1
  76. package/dest/events/event_service.js +22 -24
  77. package/dest/events/private_event_filter_validator.d.ts +6 -6
  78. package/dest/events/private_event_filter_validator.d.ts.map +1 -1
  79. package/dest/events/private_event_filter_validator.js +5 -6
  80. package/dest/job_coordinator/job_coordinator.d.ts +74 -0
  81. package/dest/job_coordinator/job_coordinator.d.ts.map +1 -0
  82. package/dest/job_coordinator/job_coordinator.js +93 -0
  83. package/dest/logs/log_service.d.ts +15 -31
  84. package/dest/logs/log_service.d.ts.map +1 -1
  85. package/dest/logs/log_service.js +77 -188
  86. package/dest/notes/note_service.d.ts +10 -9
  87. package/dest/notes/note_service.d.ts.map +1 -1
  88. package/dest/notes/note_service.js +40 -44
  89. package/dest/oracle_version.d.ts +3 -3
  90. package/dest/oracle_version.d.ts.map +1 -1
  91. package/dest/oracle_version.js +4 -3
  92. package/dest/private_kernel/hints/index.d.ts +2 -2
  93. package/dest/private_kernel/hints/index.d.ts.map +1 -1
  94. package/dest/private_kernel/hints/index.js +1 -1
  95. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +28 -0
  96. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -0
  97. package/dest/private_kernel/hints/{build_private_kernel_reset_private_inputs.js → private_kernel_reset_private_inputs_builder.js} +13 -7
  98. package/dest/private_kernel/private_kernel_execution_prover.d.ts +1 -1
  99. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
  100. package/dest/private_kernel/private_kernel_execution_prover.js +4 -5
  101. package/dest/private_kernel/private_kernel_oracle.d.ts +24 -28
  102. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
  103. package/dest/private_kernel/private_kernel_oracle.js +90 -2
  104. package/dest/pxe.d.ts +17 -44
  105. package/dest/pxe.d.ts.map +1 -1
  106. package/dest/pxe.js +131 -147
  107. package/dest/storage/address_store/address_store.d.ts +11 -0
  108. package/dest/storage/address_store/address_store.d.ts.map +1 -0
  109. package/dest/storage/{address_data_provider/address_data_provider.js → address_store/address_store.js} +1 -1
  110. package/dest/storage/address_store/index.d.ts +2 -0
  111. package/dest/storage/address_store/index.d.ts.map +1 -0
  112. package/dest/storage/address_store/index.js +1 -0
  113. package/dest/storage/anchor_block_store/anchor_block_store.d.ts +9 -0
  114. package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -0
  115. package/dest/storage/{anchor_block_data_provider/anchor_block_data_provider.js → anchor_block_store/anchor_block_store.js} +1 -1
  116. package/dest/storage/anchor_block_store/index.d.ts +2 -0
  117. package/dest/storage/anchor_block_store/index.d.ts.map +1 -0
  118. package/dest/storage/anchor_block_store/index.js +1 -0
  119. package/dest/storage/capsule_store/capsule_store.d.ts +72 -0
  120. package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -0
  121. package/dest/storage/capsule_store/capsule_store.js +255 -0
  122. package/dest/storage/capsule_store/index.d.ts +2 -0
  123. package/dest/storage/capsule_store/index.d.ts.map +1 -0
  124. package/dest/storage/capsule_store/index.js +1 -0
  125. package/dest/storage/{contract_data_provider/contract_data_provider.d.ts → contract_store/contract_store.d.ts} +3 -3
  126. package/dest/storage/contract_store/contract_store.d.ts.map +1 -0
  127. package/dest/storage/{contract_data_provider/contract_data_provider.js → contract_store/contract_store.js} +2 -2
  128. package/dest/storage/contract_store/index.d.ts +2 -0
  129. package/dest/storage/contract_store/index.d.ts.map +1 -0
  130. package/dest/storage/contract_store/index.js +1 -0
  131. package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.d.ts +1 -1
  132. package/dest/storage/contract_store/private_functions_tree.d.ts.map +1 -0
  133. package/dest/storage/index.d.ts +8 -8
  134. package/dest/storage/index.d.ts.map +1 -1
  135. package/dest/storage/index.js +7 -7
  136. package/dest/storage/note_store/index.d.ts +3 -0
  137. package/dest/storage/note_store/index.d.ts.map +1 -0
  138. package/dest/storage/note_store/index.js +2 -0
  139. package/dest/storage/note_store/note_store.d.ts +73 -0
  140. package/dest/storage/note_store/note_store.d.ts.map +1 -0
  141. package/dest/storage/note_store/note_store.js +303 -0
  142. package/dest/storage/note_store/stored_note.d.ts +16 -0
  143. package/dest/storage/note_store/stored_note.d.ts.map +1 -0
  144. package/dest/storage/note_store/stored_note.js +43 -0
  145. package/dest/storage/private_event_store/private_event_store.d.ts +91 -0
  146. package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -0
  147. package/dest/storage/private_event_store/private_event_store.js +250 -0
  148. package/dest/storage/private_event_store/stored_private_event.d.ts +23 -0
  149. package/dest/storage/private_event_store/stored_private_event.d.ts.map +1 -0
  150. package/dest/storage/private_event_store/stored_private_event.js +56 -0
  151. package/dest/storage/tagging_store/index.d.ts +4 -0
  152. package/dest/storage/tagging_store/index.d.ts.map +1 -0
  153. package/dest/storage/tagging_store/index.js +3 -0
  154. package/dest/storage/tagging_store/recipient_tagging_store.d.ts +28 -0
  155. package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -0
  156. package/dest/storage/tagging_store/recipient_tagging_store.js +99 -0
  157. package/dest/storage/tagging_store/sender_address_book_store.d.ts +14 -0
  158. package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +1 -0
  159. package/dest/storage/tagging_store/sender_address_book_store.js +30 -0
  160. package/dest/storage/{tagging_data_provider/sender_tagging_data_provider.d.ts → tagging_store/sender_tagging_store.d.ts} +19 -9
  161. package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -0
  162. package/dest/storage/{tagging_data_provider/sender_tagging_data_provider.js → tagging_store/sender_tagging_store.js} +111 -29
  163. package/dest/tagging/constants.d.ts +2 -2
  164. package/dest/tagging/constants.d.ts.map +1 -1
  165. package/dest/tagging/constants.js +10 -3
  166. package/dest/tagging/get_all_logs_by_tags.d.ts +24 -0
  167. package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -0
  168. package/dest/tagging/get_all_logs_by_tags.js +46 -0
  169. package/dest/tagging/index.d.ts +15 -3
  170. package/dest/tagging/index.d.ts.map +1 -1
  171. package/dest/tagging/index.js +14 -2
  172. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +4 -3
  173. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -1
  174. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +8 -8
  175. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +3 -2
  176. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -1
  177. package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +5 -2
  178. package/dest/tagging/{sync → sender_sync}/sync_sender_tagging_indexes.d.ts +4 -4
  179. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -0
  180. package/dest/tagging/{sync → sender_sync}/sync_sender_tagging_indexes.js +8 -23
  181. package/dest/tagging/{sync → sender_sync}/utils/get_status_change_of_pending.d.ts +1 -1
  182. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -0
  183. package/dest/tagging/{sync → sender_sync}/utils/get_status_change_of_pending.js +5 -8
  184. package/dest/tagging/{sync → sender_sync}/utils/load_and_store_new_tagging_indexes.d.ts +7 -4
  185. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -0
  186. package/dest/tagging/{sync → sender_sync}/utils/load_and_store_new_tagging_indexes.js +12 -7
  187. package/package.json +18 -18
  188. package/src/bin/check_oracle_version.ts +1 -0
  189. package/src/block_synchronizer/block_synchronizer.ts +83 -34
  190. package/src/config/index.ts +14 -0
  191. package/src/config/package_info.ts +1 -1
  192. package/src/contract_function_simulator/benchmarked_node.ts +103 -0
  193. package/src/contract_function_simulator/contract_function_simulator.ts +79 -64
  194. package/src/contract_function_simulator/execution_note_cache.ts +44 -25
  195. package/src/contract_function_simulator/index.ts +1 -1
  196. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +5 -1
  197. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +1 -1
  198. package/src/contract_function_simulator/noir-structs/utility_context.ts +6 -25
  199. package/src/contract_function_simulator/oracle/interfaces.ts +20 -10
  200. package/src/contract_function_simulator/oracle/note_packing_utils.ts +10 -10
  201. package/src/contract_function_simulator/oracle/oracle.ts +56 -41
  202. package/src/contract_function_simulator/oracle/private_execution.ts +1 -69
  203. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +77 -78
  204. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +121 -105
  205. package/src/contract_function_simulator/proxied_contract_data_source.ts +7 -7
  206. package/src/contract_sync/index.ts +98 -0
  207. package/src/debug/pxe_debug_utils.ts +7 -6
  208. package/src/entrypoints/client/bundle/utils.ts +7 -1
  209. package/src/entrypoints/client/lazy/utils.ts +7 -2
  210. package/src/entrypoints/pxe_creation_options.ts +2 -1
  211. package/src/entrypoints/server/index.ts +2 -0
  212. package/src/entrypoints/server/utils.ts +11 -15
  213. package/src/error_enriching.ts +7 -15
  214. package/src/events/event_service.ts +23 -27
  215. package/src/events/private_event_filter_validator.ts +4 -6
  216. package/src/job_coordinator/job_coordinator.ts +149 -0
  217. package/src/logs/log_service.ts +116 -260
  218. package/src/notes/note_service.ts +43 -46
  219. package/src/oracle_version.ts +4 -3
  220. package/src/private_kernel/hints/index.ts +1 -1
  221. package/src/private_kernel/hints/{build_private_kernel_reset_private_inputs.ts → private_kernel_reset_private_inputs_builder.ts} +33 -22
  222. package/src/private_kernel/private_kernel_execution_prover.ts +3 -5
  223. package/src/private_kernel/private_kernel_oracle.ts +116 -36
  224. package/src/pxe.ts +189 -190
  225. package/src/storage/{address_data_provider/address_data_provider.ts → address_store/address_store.ts} +1 -1
  226. package/src/storage/address_store/index.ts +1 -0
  227. package/src/storage/{anchor_block_data_provider/anchor_block_data_provider.ts → anchor_block_store/anchor_block_store.ts} +1 -1
  228. package/src/storage/anchor_block_store/index.ts +1 -0
  229. package/src/storage/capsule_store/capsule_store.ts +315 -0
  230. package/src/storage/capsule_store/index.ts +1 -0
  231. package/src/storage/{contract_data_provider/contract_data_provider.ts → contract_store/contract_store.ts} +2 -2
  232. package/src/storage/contract_store/index.ts +1 -0
  233. package/src/storage/index.ts +7 -7
  234. package/src/storage/note_store/index.ts +2 -0
  235. package/src/storage/note_store/note_store.ts +381 -0
  236. package/src/storage/note_store/stored_note.ts +48 -0
  237. package/src/storage/private_event_store/private_event_store.ts +363 -0
  238. package/src/storage/private_event_store/stored_private_event.ts +73 -0
  239. package/src/storage/tagging_store/index.ts +3 -0
  240. package/src/storage/tagging_store/recipient_tagging_store.ts +129 -0
  241. package/src/storage/tagging_store/sender_address_book_store.ts +42 -0
  242. package/src/storage/{tagging_data_provider/sender_tagging_data_provider.ts → tagging_store/sender_tagging_store.ts} +129 -28
  243. package/src/tagging/constants.ts +10 -3
  244. package/src/tagging/get_all_logs_by_tags.ts +68 -0
  245. package/src/tagging/index.ts +17 -2
  246. package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +23 -9
  247. package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +7 -1
  248. package/src/tagging/{sync → sender_sync}/sync_sender_tagging_indexes.ts +12 -25
  249. package/src/tagging/{sync → sender_sync}/utils/get_status_change_of_pending.ts +5 -13
  250. package/src/tagging/{sync → sender_sync}/utils/load_and_store_new_tagging_indexes.ts +19 -7
  251. package/dest/contract_function_simulator/proxied_node.d.ts +0 -9
  252. package/dest/contract_function_simulator/proxied_node.d.ts.map +0 -1
  253. package/dest/contract_function_simulator/proxied_node.js +0 -27
  254. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +0 -28
  255. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +0 -1
  256. package/dest/private_kernel/private_kernel_oracle_impl.d.ts +0 -46
  257. package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +0 -1
  258. package/dest/private_kernel/private_kernel_oracle_impl.js +0 -86
  259. package/dest/public_storage/public_storage_service.d.ts +0 -24
  260. package/dest/public_storage/public_storage_service.d.ts.map +0 -1
  261. package/dest/public_storage/public_storage_service.js +0 -26
  262. package/dest/storage/address_data_provider/address_data_provider.d.ts +0 -11
  263. package/dest/storage/address_data_provider/address_data_provider.d.ts.map +0 -1
  264. package/dest/storage/address_data_provider/index.d.ts +0 -2
  265. package/dest/storage/address_data_provider/index.d.ts.map +0 -1
  266. package/dest/storage/address_data_provider/index.js +0 -1
  267. package/dest/storage/anchor_block_data_provider/anchor_block_data_provider.d.ts +0 -9
  268. package/dest/storage/anchor_block_data_provider/anchor_block_data_provider.d.ts.map +0 -1
  269. package/dest/storage/anchor_block_data_provider/index.d.ts +0 -2
  270. package/dest/storage/anchor_block_data_provider/index.d.ts.map +0 -1
  271. package/dest/storage/anchor_block_data_provider/index.js +0 -1
  272. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts +0 -57
  273. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +0 -1
  274. package/dest/storage/capsule_data_provider/capsule_data_provider.js +0 -146
  275. package/dest/storage/capsule_data_provider/index.d.ts +0 -2
  276. package/dest/storage/capsule_data_provider/index.d.ts.map +0 -1
  277. package/dest/storage/capsule_data_provider/index.js +0 -1
  278. package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +0 -1
  279. package/dest/storage/contract_data_provider/index.d.ts +0 -2
  280. package/dest/storage/contract_data_provider/index.d.ts.map +0 -1
  281. package/dest/storage/contract_data_provider/index.js +0 -1
  282. package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +0 -1
  283. package/dest/storage/note_data_provider/index.d.ts +0 -3
  284. package/dest/storage/note_data_provider/index.d.ts.map +0 -1
  285. package/dest/storage/note_data_provider/index.js +0 -2
  286. package/dest/storage/note_data_provider/note_data_provider.d.ts +0 -84
  287. package/dest/storage/note_data_provider/note_data_provider.d.ts.map +0 -1
  288. package/dest/storage/note_data_provider/note_data_provider.js +0 -322
  289. package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +0 -51
  290. package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts.map +0 -1
  291. package/dest/storage/private_event_data_provider/private_event_data_provider.js +0 -115
  292. package/dest/storage/tagging_data_provider/index.d.ts +0 -3
  293. package/dest/storage/tagging_data_provider/index.d.ts.map +0 -1
  294. package/dest/storage/tagging_data_provider/index.js +0 -2
  295. package/dest/storage/tagging_data_provider/recipient_tagging_data_provider.d.ts +0 -31
  296. package/dest/storage/tagging_data_provider/recipient_tagging_data_provider.d.ts.map +0 -1
  297. package/dest/storage/tagging_data_provider/recipient_tagging_data_provider.js +0 -65
  298. package/dest/storage/tagging_data_provider/sender_tagging_data_provider.d.ts.map +0 -1
  299. package/dest/tagging/recipient_sync/new_recipient_tagging_data_provider.d.ts +0 -21
  300. package/dest/tagging/recipient_sync/new_recipient_tagging_data_provider.d.ts.map +0 -1
  301. package/dest/tagging/recipient_sync/new_recipient_tagging_data_provider.js +0 -42
  302. package/dest/tagging/sync/sync_sender_tagging_indexes.d.ts.map +0 -1
  303. package/dest/tagging/sync/utils/get_status_change_of_pending.d.ts.map +0 -1
  304. package/dest/tagging/sync/utils/load_and_store_new_tagging_indexes.d.ts.map +0 -1
  305. package/dest/tagging/utils.d.ts +0 -18
  306. package/dest/tagging/utils.d.ts.map +0 -1
  307. package/dest/tagging/utils.js +0 -25
  308. package/dest/tree_membership/tree_membership_service.d.ts +0 -52
  309. package/dest/tree_membership/tree_membership_service.d.ts.map +0 -1
  310. package/dest/tree_membership/tree_membership_service.js +0 -84
  311. package/src/contract_function_simulator/proxied_node.ts +0 -33
  312. package/src/private_kernel/private_kernel_oracle_impl.ts +0 -133
  313. package/src/public_storage/public_storage_service.ts +0 -33
  314. package/src/storage/address_data_provider/index.ts +0 -1
  315. package/src/storage/anchor_block_data_provider/index.ts +0 -1
  316. package/src/storage/capsule_data_provider/capsule_data_provider.ts +0 -179
  317. package/src/storage/capsule_data_provider/index.ts +0 -1
  318. package/src/storage/contract_data_provider/index.ts +0 -1
  319. package/src/storage/note_data_provider/index.ts +0 -2
  320. package/src/storage/note_data_provider/note_data_provider.ts +0 -412
  321. package/src/storage/private_event_data_provider/private_event_data_provider.ts +0 -162
  322. package/src/storage/tagging_data_provider/index.ts +0 -2
  323. package/src/storage/tagging_data_provider/recipient_tagging_data_provider.ts +0 -86
  324. package/src/tagging/recipient_sync/new_recipient_tagging_data_provider.ts +0 -53
  325. package/src/tagging/utils.ts +0 -32
  326. package/src/tree_membership/tree_membership_service.ts +0 -112
  327. /package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.js +0 -0
  328. /package/src/storage/{contract_data_provider → contract_store}/private_functions_tree.ts +0 -0
@@ -1,21 +1,6 @@
1
+ import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../constants.js';
1
2
  import { getStatusChangeOfPending } from './utils/get_status_change_of_pending.js';
2
3
  import { loadAndStoreNewTaggingIndexes } from './utils/load_and_store_new_tagging_indexes.js';
3
- // This window has to be as large as the largest expected number of logs emitted in a tx for a given directional app
4
- // tagging secret. If we get more tag indexes consumed than this window, an error is thrown in `PXE::proveTx` function.
5
- // This is set to a larger value than MAX_PRIVATE_LOGS_PER_TX (currently 64) because there could be more than
6
- // MAX_PRIVATE_LOGS_PER_TX indexes consumed in case the logs are squashed. This happens when the log contains a note
7
- // and the note is nullified in the same tx.
8
- //
9
- // Rationale for value 95:
10
- // - The `e2e_pending_note_hashes_contract` test's "Should handle overflowing the kernel data structures in nested
11
- // calls" test case hits 95 tagging indexes emitted in a single transaction. This test creates and nullifies many
12
- // notes recursively to test kernel reset circuit behavior, which causes logs to be squashed but still consume
13
- // tagging indexes during the sync process. Since this is testing MAX_PRIVATE_LOGS_PER_TX overflow we can be
14
- // reasonably certain that this value is large enough for standard use cases.
15
- // - This value is below MAX_RPC_LEN (100) which is the limit for array parameters in the JSON RPC schema for
16
- // `getLogsByTags`. Any test that would perform sync over JSON RPC (not by having access to the Aztec node instance
17
- // directly) would error out if that maximum was hit (docs_examples.test.ts is an example of this).
18
- export const UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN = 95;
19
4
  /**
20
5
  * Syncs tagging indexes. This function needs to be called whenever a private log is being sent.
21
6
  *
@@ -29,7 +14,7 @@ export const UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN = 95;
29
14
  * is simply the highest pending index plus one (or finalized if pending is undefined).
30
15
  * @dev This function looks for new indexes, adds them to pending, then it checks status of each pending index and
31
16
  * updates its status accordingly.
32
- */ export async function syncSenderTaggingIndexes(secret, app, aztecNode, taggingDataProvider) {
17
+ */ export async function syncSenderTaggingIndexes(secret, app, aztecNode, taggingStore, anchorBlockHash, jobId) {
33
18
  // # Explanation of how syncing works
34
19
  //
35
20
  // When choosing an index, we select: highest pending index + 1 (or highest finalized index + 1 if no pending).
@@ -47,7 +32,7 @@ export const UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN = 95;
47
32
  // # Note on performance
48
33
  // Each window advance requires two queries (logs + tx status). For example, syncing indexes 0–500 with a window of
49
34
  // 100 takes at least 10 round trips (5 windows × 2 queries).
50
- const finalizedIndex = await taggingDataProvider.getLastFinalizedIndex(secret);
35
+ const finalizedIndex = await taggingStore.getLastFinalizedIndex(secret, jobId);
51
36
  let start = finalizedIndex === undefined ? 0 : finalizedIndex + 1;
52
37
  let end = start + UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN;
53
38
  let previousFinalizedIndex = finalizedIndex;
@@ -55,17 +40,17 @@ export const UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN = 95;
55
40
  while(true){
56
41
  // Load and store indexes for the current window. These indexes may already exist in the database if txs using
57
42
  // them were previously sent from this PXE. Any duplicates are handled by the tagging data provider.
58
- await loadAndStoreNewTaggingIndexes(secret, app, start, end, aztecNode, taggingDataProvider);
43
+ await loadAndStoreNewTaggingIndexes(secret, app, start, end, aztecNode, taggingStore, anchorBlockHash, jobId);
59
44
  // Retrieve all indexes within the current window from storage and update their status accordingly.
60
- const pendingTxHashes = await taggingDataProvider.getTxHashesOfPendingIndexes(secret, start, end);
45
+ const pendingTxHashes = await taggingStore.getTxHashesOfPendingIndexes(secret, start, end, jobId);
61
46
  if (pendingTxHashes.length === 0) {
62
47
  break;
63
48
  }
64
49
  const { txHashesToFinalize, txHashesToDrop } = await getStatusChangeOfPending(pendingTxHashes, aztecNode);
65
- await taggingDataProvider.dropPendingIndexes(txHashesToDrop);
66
- await taggingDataProvider.finalizePendingIndexes(txHashesToFinalize);
50
+ await taggingStore.dropPendingIndexes(txHashesToDrop, jobId);
51
+ await taggingStore.finalizePendingIndexes(txHashesToFinalize, jobId);
67
52
  // We check if the finalized index has been updated.
68
- newFinalizedIndex = await taggingDataProvider.getLastFinalizedIndex(secret);
53
+ newFinalizedIndex = await taggingStore.getLastFinalizedIndex(secret, jobId);
69
54
  if (previousFinalizedIndex !== newFinalizedIndex) {
70
55
  // A new finalized index was found, so we'll run the loop again. For example:
71
56
  // - Previous finalized index: 10
@@ -8,4 +8,4 @@ export declare function getStatusChangeOfPending(pending: TxHash[], aztecNode: A
8
8
  txHashesToFinalize: TxHash[];
9
9
  txHashesToDrop: TxHash[];
10
10
  }>;
11
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0X3N0YXR1c19jaGFuZ2Vfb2ZfcGVuZGluZy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL3RhZ2dpbmcvc3luYy91dGlscy9nZXRfc3RhdHVzX2NoYW5nZV9vZl9wZW5kaW5nLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQ2pFLE9BQU8sRUFBRSxNQUFNLEVBQVksTUFBTSxrQkFBa0IsQ0FBQztBQUVwRDs7O0dBR0c7QUFDSCx3QkFBc0Isd0JBQXdCLENBQzVDLE9BQU8sRUFBRSxNQUFNLEVBQUUsRUFDakIsU0FBUyxFQUFFLFNBQVMsR0FDbkIsT0FBTyxDQUFDO0lBQUUsa0JBQWtCLEVBQUUsTUFBTSxFQUFFLENBQUM7SUFBQyxjQUFjLEVBQUUsTUFBTSxFQUFFLENBQUE7Q0FBRSxDQUFDLENBaUNyRSJ9
11
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0X3N0YXR1c19jaGFuZ2Vfb2ZfcGVuZGluZy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL3RhZ2dpbmcvc2VuZGVyX3N5bmMvdXRpbHMvZ2V0X3N0YXR1c19jaGFuZ2Vfb2ZfcGVuZGluZy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNqRSxPQUFPLEVBQUUsTUFBTSxFQUFZLE1BQU0sa0JBQWtCLENBQUM7QUFFcEQ7OztHQUdHO0FBQ0gsd0JBQXNCLHdCQUF3QixDQUM1QyxPQUFPLEVBQUUsTUFBTSxFQUFFLEVBQ2pCLFNBQVMsRUFBRSxTQUFTLEdBQ25CLE9BQU8sQ0FBQztJQUFFLGtCQUFrQixFQUFFLE1BQU0sRUFBRSxDQUFDO0lBQUMsY0FBYyxFQUFFLE1BQU0sRUFBRSxDQUFBO0NBQUUsQ0FBQyxDQXlCckUifQ==
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get_status_change_of_pending.d.ts","sourceRoot":"","sources":["../../../../src/tagging/sender_sync/utils/get_status_change_of_pending.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,MAAM,EAAY,MAAM,kBAAkB,CAAC;AAEpD;;;GAGG;AACH,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,MAAM,EAAE,EACjB,SAAS,EAAE,SAAS,GACnB,OAAO,CAAC;IAAE,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAAC,cAAc,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAyBrE"}
@@ -3,26 +3,23 @@ import { TxStatus } from '@aztec/stdlib/tx';
3
3
  * Based on receipts obtained from `aztecNode` returns which pending transactions changed their status to finalized or
4
4
  * dropped.
5
5
  */ export async function getStatusChangeOfPending(pending, aztecNode) {
6
- // Get receipts for all pending tx hashes and the finalized block number.
7
- const [receipts, { finalized }] = await Promise.all([
8
- Promise.all(pending.map((pendingTxHash)=>aztecNode.getTxReceipt(pendingTxHash))),
9
- aztecNode.getL2Tips()
10
- ]);
6
+ // Get receipts for all pending tx hashes.
7
+ const receipts = await Promise.all(pending.map((pendingTxHash)=>aztecNode.getTxReceipt(pendingTxHash)));
11
8
  const txHashesToFinalize = [];
12
9
  const txHashesToDrop = [];
13
10
  for(let i = 0; i < receipts.length; i++){
14
11
  const receipt = receipts[i];
15
12
  const txHash = pending[i];
16
- if (receipt.status === TxStatus.SUCCESS && receipt.blockNumber && receipt.blockNumber <= finalized.number) {
13
+ if (receipt.status === TxStatus.FINALIZED && receipt.hasExecutionSucceeded()) {
17
14
  // Tx has been included in a block and the corresponding block is finalized --> we mark the indexes as
18
15
  // finalized.
19
16
  txHashesToFinalize.push(txHash);
20
- } else if (receipt.status === TxStatus.DROPPED || receipt.status === TxStatus.APP_LOGIC_REVERTED || receipt.status === TxStatus.TEARDOWN_REVERTED || receipt.status === TxStatus.BOTH_REVERTED) {
17
+ } else if (receipt.isDropped() || receipt.hasExecutionReverted()) {
21
18
  // Tx was dropped or reverted --> we drop the corresponding pending indexes.
22
19
  // TODO(#17615): Don't drop pending indexes corresponding to non-revertible phases.
23
20
  txHashesToDrop.push(txHash);
24
21
  } else {
25
- // Tx is still pending or the corresponding block is not yet finalized --> we don't do anything.
22
+ // Tx is still pending, not yet finalized, or was mined successfully but not yet finalized --> we don't do anything.
26
23
  }
27
24
  }
28
25
  return {
@@ -1,7 +1,8 @@
1
1
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
2
+ import type { L2BlockHash } from '@aztec/stdlib/block';
2
3
  import type { AztecNode } from '@aztec/stdlib/interfaces/server';
3
4
  import type { DirectionalAppTaggingSecret } from '@aztec/stdlib/logs';
4
- import type { SenderTaggingDataProvider } from '../../../storage/tagging_data_provider/sender_tagging_data_provider.js';
5
+ import type { SenderTaggingStore } from '../../../storage/tagging_store/sender_tagging_store.js';
5
6
  /**
6
7
  * Loads tagging indexes from the Aztec node and stores them in the tagging data provider.
7
8
  * @remarks This function is one of two places by which a pending index can get to the tagging data provider. The other
@@ -12,7 +13,9 @@ import type { SenderTaggingDataProvider } from '../../../storage/tagging_data_pr
12
13
  * @param start - The starting index (inclusive) of the window to process.
13
14
  * @param end - The ending index (exclusive) of the window to process.
14
15
  * @param aztecNode - The Aztec node instance to query for logs.
15
- * @param taggingDataProvider - The data provider to store pending indexes.
16
+ * @param taggingStore - The data provider to store pending indexes.
17
+ * @param jobId - Job identifier, used to keep writes in-memory until they can be persisted in a data integrity
18
+ * preserving way.
16
19
  */
17
- export declare function loadAndStoreNewTaggingIndexes(secret: DirectionalAppTaggingSecret, app: AztecAddress, start: number, end: number, aztecNode: AztecNode, taggingDataProvider: SenderTaggingDataProvider): Promise<void>;
18
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9hZF9hbmRfc3RvcmVfbmV3X3RhZ2dpbmdfaW5kZXhlcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL3RhZ2dpbmcvc3luYy91dGlscy9sb2FkX2FuZF9zdG9yZV9uZXdfdGFnZ2luZ19pbmRleGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBQ2hFLE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQ2pFLE9BQU8sS0FBSyxFQUFFLDJCQUEyQixFQUFVLE1BQU0sb0JBQW9CLENBQUM7QUFJOUUsT0FBTyxLQUFLLEVBQUUseUJBQXlCLEVBQUUsTUFBTSx3RUFBd0UsQ0FBQztBQUV4SDs7Ozs7Ozs7Ozs7R0FXRztBQUNILHdCQUFzQiw2QkFBNkIsQ0FDakQsTUFBTSxFQUFFLDJCQUEyQixFQUNuQyxHQUFHLEVBQUUsWUFBWSxFQUNqQixLQUFLLEVBQUUsTUFBTSxFQUNiLEdBQUcsRUFBRSxNQUFNLEVBQ1gsU0FBUyxFQUFFLFNBQVMsRUFDcEIsbUJBQW1CLEVBQUUseUJBQXlCLGlCQWtCL0MifQ==
20
+ export declare function loadAndStoreNewTaggingIndexes(secret: DirectionalAppTaggingSecret, app: AztecAddress, start: number, end: number, aztecNode: AztecNode, taggingStore: SenderTaggingStore, anchorBlockHash: L2BlockHash, jobId: string): Promise<void>;
21
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9hZF9hbmRfc3RvcmVfbmV3X3RhZ2dpbmdfaW5kZXhlcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL3RhZ2dpbmcvc2VuZGVyX3N5bmMvdXRpbHMvbG9hZF9hbmRfc3RvcmVfbmV3X3RhZ2dpbmdfaW5kZXhlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUNoRSxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUN2RCxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNqRSxPQUFPLEtBQUssRUFBRSwyQkFBMkIsRUFBVSxNQUFNLG9CQUFvQixDQUFDO0FBSTlFLE9BQU8sS0FBSyxFQUFFLGtCQUFrQixFQUFFLE1BQU0sd0RBQXdELENBQUM7QUFHakc7Ozs7Ozs7Ozs7Ozs7R0FhRztBQUNILHdCQUFzQiw2QkFBNkIsQ0FDakQsTUFBTSxFQUFFLDJCQUEyQixFQUNuQyxHQUFHLEVBQUUsWUFBWSxFQUNqQixLQUFLLEVBQUUsTUFBTSxFQUNiLEdBQUcsRUFBRSxNQUFNLEVBQ1gsU0FBUyxFQUFFLFNBQVMsRUFDcEIsWUFBWSxFQUFFLGtCQUFrQixFQUNoQyxlQUFlLEVBQUUsV0FBVyxFQUM1QixLQUFLLEVBQUUsTUFBTSxpQkFrQmQifQ==
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load_and_store_new_tagging_indexes.d.ts","sourceRoot":"","sources":["../../../../src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,2BAA2B,EAAU,MAAM,oBAAoB,CAAC;AAI9E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wDAAwD,CAAC;AAGjG;;;;;;;;;;;;;GAaG;AACH,wBAAsB,6BAA6B,CACjD,MAAM,EAAE,2BAA2B,EACnC,GAAG,EAAE,YAAY,EACjB,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,kBAAkB,EAChC,eAAe,EAAE,WAAW,EAC5B,KAAK,EAAE,MAAM,iBAkBd"}
@@ -1,5 +1,6 @@
1
1
  import { SiloedTag, Tag } from '@aztec/stdlib/logs';
2
2
  import { TxHash } from '@aztec/stdlib/tx';
3
+ import { getAllPrivateLogsByTags } from '../../get_all_logs_by_tags.js';
3
4
  /**
4
5
  * Loads tagging indexes from the Aztec node and stores them in the tagging data provider.
5
6
  * @remarks This function is one of two places by which a pending index can get to the tagging data provider. The other
@@ -10,31 +11,35 @@ import { TxHash } from '@aztec/stdlib/tx';
10
11
  * @param start - The starting index (inclusive) of the window to process.
11
12
  * @param end - The ending index (exclusive) of the window to process.
12
13
  * @param aztecNode - The Aztec node instance to query for logs.
13
- * @param taggingDataProvider - The data provider to store pending indexes.
14
- */ export async function loadAndStoreNewTaggingIndexes(secret, app, start, end, aztecNode, taggingDataProvider) {
14
+ * @param taggingStore - The data provider to store pending indexes.
15
+ * @param jobId - Job identifier, used to keep writes in-memory until they can be persisted in a data integrity
16
+ * preserving way.
17
+ */ export async function loadAndStoreNewTaggingIndexes(secret, app, start, end, aztecNode, taggingStore, anchorBlockHash, jobId) {
15
18
  // We compute the tags for the current window of indexes
16
19
  const preTagsForWindow = Array(end - start).fill(0).map((_, i)=>({
17
20
  secret,
18
21
  index: start + i
19
22
  }));
20
23
  const siloedTagsForWindow = await Promise.all(preTagsForWindow.map(async (preTag)=>SiloedTag.compute(await Tag.compute(preTag), app)));
21
- const txsForTags = await getTxsContainingTags(siloedTagsForWindow, aztecNode);
24
+ const txsForTags = await getTxsContainingTags(siloedTagsForWindow, aztecNode, anchorBlockHash);
22
25
  const highestIndexMap = getTxHighestIndexMap(txsForTags, preTagsForWindow);
23
26
  // Now we iterate over the map, reconstruct the preTags and tx hash and store them in the db.
24
27
  for (const [txHashStr, highestIndex] of highestIndexMap.entries()){
25
28
  const txHash = TxHash.fromString(txHashStr);
26
- await taggingDataProvider.storePendingIndexes([
29
+ await taggingStore.storePendingIndexes([
27
30
  {
28
31
  secret,
29
32
  index: highestIndex
30
33
  }
31
- ], txHash);
34
+ ], txHash, jobId);
32
35
  }
33
36
  }
34
37
  // Returns txs that used the given tags. A tag might have been used in multiple txs and for this reason we return
35
38
  // an array for each tag.
36
- async function getTxsContainingTags(tags, aztecNode) {
37
- const allLogs = await aztecNode.getPrivateLogsByTags(tags);
39
+ async function getTxsContainingTags(tags, aztecNode, anchorBlockHash) {
40
+ // We use the utility function below to retrieve all logs for the tags across all pages, so we don't need to handle
41
+ // pagination here.
42
+ const allLogs = await getAllPrivateLogsByTags(aztecNode, tags, anchorBlockHash);
38
43
  return allLogs.map((logs)=>logs.map((log)=>log.txHash));
39
44
  }
40
45
  // Returns a map of txHash to the highest index for that txHash.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/pxe",
3
- "version": "0.0.1-commit.03f7ef2",
3
+ "version": "0.0.1-commit.0b941701",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./server": "./dest/entrypoints/server/index.js",
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "bin": "./dest/bin/index.js",
13
13
  "scripts": {
14
- "build": "yarn clean && yarn generate && tsgo -b",
14
+ "build": "yarn clean && yarn generate && ../scripts/tsc.sh",
15
15
  "build:dev": "../scripts/tsc.sh --watch",
16
16
  "clean": "rm -rf ./dest .tsbuildinfo ./src/config/package_info.ts",
17
17
  "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}",
@@ -61,19 +61,19 @@
61
61
  ]
62
62
  },
63
63
  "dependencies": {
64
- "@aztec/bb-prover": "0.0.1-commit.03f7ef2",
65
- "@aztec/bb.js": "0.0.1-commit.03f7ef2",
66
- "@aztec/builder": "0.0.1-commit.03f7ef2",
67
- "@aztec/constants": "0.0.1-commit.03f7ef2",
68
- "@aztec/ethereum": "0.0.1-commit.03f7ef2",
69
- "@aztec/foundation": "0.0.1-commit.03f7ef2",
70
- "@aztec/key-store": "0.0.1-commit.03f7ef2",
71
- "@aztec/kv-store": "0.0.1-commit.03f7ef2",
72
- "@aztec/noir-protocol-circuits-types": "0.0.1-commit.03f7ef2",
73
- "@aztec/noir-types": "0.0.1-commit.03f7ef2",
74
- "@aztec/protocol-contracts": "0.0.1-commit.03f7ef2",
75
- "@aztec/simulator": "0.0.1-commit.03f7ef2",
76
- "@aztec/stdlib": "0.0.1-commit.03f7ef2",
64
+ "@aztec/bb-prover": "0.0.1-commit.0b941701",
65
+ "@aztec/bb.js": "0.0.1-commit.0b941701",
66
+ "@aztec/builder": "0.0.1-commit.0b941701",
67
+ "@aztec/constants": "0.0.1-commit.0b941701",
68
+ "@aztec/ethereum": "0.0.1-commit.0b941701",
69
+ "@aztec/foundation": "0.0.1-commit.0b941701",
70
+ "@aztec/key-store": "0.0.1-commit.0b941701",
71
+ "@aztec/kv-store": "0.0.1-commit.0b941701",
72
+ "@aztec/noir-protocol-circuits-types": "0.0.1-commit.0b941701",
73
+ "@aztec/noir-types": "0.0.1-commit.0b941701",
74
+ "@aztec/protocol-contracts": "0.0.1-commit.0b941701",
75
+ "@aztec/simulator": "0.0.1-commit.0b941701",
76
+ "@aztec/stdlib": "0.0.1-commit.0b941701",
77
77
  "koa": "^2.16.1",
78
78
  "koa-router": "^13.1.1",
79
79
  "lodash.omit": "^4.5.0",
@@ -82,14 +82,14 @@
82
82
  "viem": "npm:@aztec/viem@2.38.2"
83
83
  },
84
84
  "devDependencies": {
85
- "@aztec/merkle-tree": "0.0.1-commit.03f7ef2",
86
- "@aztec/noir-test-contracts.js": "0.0.1-commit.03f7ef2",
85
+ "@aztec/merkle-tree": "0.0.1-commit.0b941701",
86
+ "@aztec/noir-test-contracts.js": "0.0.1-commit.0b941701",
87
87
  "@jest/globals": "^30.0.0",
88
88
  "@types/jest": "^30.0.0",
89
89
  "@types/lodash.omit": "^4.5.7",
90
90
  "@types/lodash.times": "^4.3.9",
91
91
  "@types/node": "^22.15.17",
92
- "@typescript/native-preview": "7.0.0-dev.20251126.1",
92
+ "@typescript/native-preview": "7.0.0-dev.20260113.1",
93
93
  "jest": "^30.0.0",
94
94
  "jest-mock-extended": "^4.0.0",
95
95
  "lodash.times": "^4.3.2",
@@ -1,3 +1,4 @@
1
+ /* eslint-disable import-x/no-named-as-default-member */
1
2
  import { keccak256String } from '@aztec/foundation/crypto/keccak';
2
3
 
3
4
  import { readFileSync } from 'fs';
@@ -1,13 +1,20 @@
1
1
  import { BlockNumber } from '@aztec/foundation/branded-types';
2
2
  import { type Logger, createLogger } from '@aztec/foundation/log';
3
+ import type { AztecAsyncKVStore } from '@aztec/kv-store';
3
4
  import type { L2TipsKVStore } from '@aztec/kv-store/stores';
4
- import { L2BlockStream, type L2BlockStreamEvent, type L2BlockStreamEventHandler } from '@aztec/stdlib/block';
5
+ import {
6
+ L2BlockHash,
7
+ L2BlockStream,
8
+ type L2BlockStreamEvent,
9
+ type L2BlockStreamEventHandler,
10
+ } from '@aztec/stdlib/block';
5
11
  import type { AztecNode } from '@aztec/stdlib/interfaces/client';
12
+ import type { BlockHeader } from '@aztec/stdlib/tx';
6
13
 
7
- import type { PXEConfig } from '../config/index.js';
8
- import type { AnchorBlockDataProvider } from '../storage/anchor_block_data_provider/anchor_block_data_provider.js';
9
- import type { NoteDataProvider } from '../storage/note_data_provider/note_data_provider.js';
10
- import type { RecipientTaggingDataProvider } from '../storage/tagging_data_provider/recipient_tagging_data_provider.js';
14
+ import type { BlockSynchronizerConfig } from '../config/index.js';
15
+ import type { AnchorBlockStore } from '../storage/anchor_block_store/anchor_block_store.js';
16
+ import type { NoteStore } from '../storage/note_store/note_store.js';
17
+ import type { PrivateEventStore } from '../storage/private_event_store/private_event_store.js';
11
18
 
12
19
  /**
13
20
  * The BlockSynchronizer class orchestrates synchronization between PXE and Aztec node, maintaining an up-to-date
@@ -21,11 +28,12 @@ export class BlockSynchronizer implements L2BlockStreamEventHandler {
21
28
 
22
29
  constructor(
23
30
  private node: AztecNode,
24
- private anchorBlockDataProvider: AnchorBlockDataProvider,
25
- private noteDataProvider: NoteDataProvider,
26
- private recipientTaggingDataProvider: RecipientTaggingDataProvider,
31
+ private store: AztecAsyncKVStore,
32
+ private anchorBlockStore: AnchorBlockStore,
33
+ private noteStore: NoteStore,
34
+ private privateEventStore: PrivateEventStore,
27
35
  private l2TipsStore: L2TipsKVStore,
28
- config: Partial<Pick<PXEConfig, 'l2BlockBatchSize'>> = {},
36
+ private config: Partial<BlockSynchronizerConfig> = {},
29
37
  loggerOrSuffix?: string | Logger,
30
38
  ) {
31
39
  this.log =
@@ -35,7 +43,7 @@ export class BlockSynchronizer implements L2BlockStreamEventHandler {
35
43
  this.blockStream = this.createBlockStream(config);
36
44
  }
37
45
 
38
- protected createBlockStream(config: Partial<Pick<PXEConfig, 'l2BlockBatchSize'>>) {
46
+ protected createBlockStream(config: Partial<BlockSynchronizerConfig>): L2BlockStream {
39
47
  return new L2BlockStream(this.node, this.l2TipsStore, this, createLogger('pxe:block_stream'), {
40
48
  batchSize: config.l2BlockBatchSize,
41
49
  // Skipping finalized blocks makes us sync much faster - we only need to download blocks other than the latest one
@@ -50,38 +58,79 @@ export class BlockSynchronizer implements L2BlockStreamEventHandler {
50
58
 
51
59
  switch (event.type) {
52
60
  case 'blocks-added': {
53
- const lastBlock = event.blocks.at(-1)!.block;
54
- this.log.verbose(`Updated pxe last block to ${lastBlock.number}`, {
55
- blockHash: lastBlock.hash(),
56
- archive: lastBlock.archive.root.toString(),
57
- header: lastBlock.header.toInspect(),
58
- });
59
- await this.anchorBlockDataProvider.setHeader(lastBlock.getBlockHeader());
61
+ if (this.config.syncChainTip === undefined || this.config.syncChainTip === 'proposed') {
62
+ const lastBlock = event.blocks.at(-1)!;
63
+ await this.updateAnchorBlockHeader(lastBlock.header);
64
+ }
65
+ break;
66
+ }
67
+ case 'chain-checkpointed': {
68
+ if (this.config.syncChainTip === 'checkpointed') {
69
+ // Get the last block header from the checkpoint
70
+ const lastBlock = event.checkpoint.checkpoint.blocks.at(-1)!;
71
+ await this.updateAnchorBlockHeader(lastBlock.header);
72
+ }
73
+ break;
74
+ }
75
+ case 'chain-proven': {
76
+ if (this.config.syncChainTip === 'proven') {
77
+ const blockHeader = await this.node.getBlockHeader(BlockNumber(event.block.number));
78
+ if (blockHeader) {
79
+ await this.updateAnchorBlockHeader(blockHeader);
80
+ }
81
+ }
82
+ break;
83
+ }
84
+ case 'chain-finalized': {
85
+ if (this.config.syncChainTip === 'finalized') {
86
+ const blockHeader = await this.node.getBlockHeader(BlockNumber(event.block.number));
87
+ if (blockHeader) {
88
+ await this.updateAnchorBlockHeader(blockHeader);
89
+ }
90
+ }
60
91
  break;
61
92
  }
62
93
  case 'chain-pruned': {
94
+ const currentAnchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
95
+ const currentAnchorBlockNumber = currentAnchorBlockHeader.getBlockNumber();
96
+ if (currentAnchorBlockNumber <= event.block.number) {
97
+ this.log.verbose(
98
+ `Ignoring prune event to block ${event.block.number} greater than current anchor block ${currentAnchorBlockNumber}`,
99
+ { pruneEvent: event, currentAnchorBlockHeader: currentAnchorBlockHeader.toInspect() },
100
+ );
101
+ return;
102
+ }
103
+
63
104
  this.log.warn(`Pruning data after block ${event.block.number} due to reorg`);
64
- // We first unnullify and then remove so that unnullified notes that were created after the block number end up deleted.
65
- const lastSynchedBlockNumber = (await this.anchorBlockDataProvider.getBlockHeader()).getBlockNumber();
66
- await this.noteDataProvider.rollbackNotesAndNullifiers(event.block.number, lastSynchedBlockNumber);
67
- // Remove all note tagging indexes to force a full resync. This is suboptimal, but unless we track the
68
- // block number in which each index is used it's all we can do.
69
- // Note: This is now unnecessary for the sender tagging data provider because the new algorithm handles reorgs.
70
- // TODO(#17775): Once this issue is implemented we will have the index-block number mapping, so we can
71
- // implement this more intelligently.
72
- await this.recipientTaggingDataProvider.resetNoteSyncData();
73
- // Update the header to the last block.
74
- const newHeader = await this.node.getBlockHeader(event.block.number);
75
- if (!newHeader) {
76
- this.log.error(`Block header not found for block number ${event.block.number} during chain prune`);
77
- } else {
78
- await this.anchorBlockDataProvider.setHeader(newHeader);
105
+
106
+ // Note that the following is not necessarily the anchor block that will be used in the transaction - if
107
+ // the chain has already moved past the reorg, we'll also see blocks-added events that will push the anchor
108
+ // forward.
109
+ const newAnchorBlockHeader = await this.node.getBlockHeader(L2BlockHash.fromString(event.block.hash));
110
+
111
+ if (!newAnchorBlockHeader) {
112
+ throw new Error(
113
+ `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.`,
114
+ );
79
115
  }
116
+
117
+ // Operations are wrapped in a single transaction to ensure atomicity.
118
+ await this.store.transactionAsync(async () => {
119
+ await this.noteStore.rollback(event.block.number, currentAnchorBlockNumber);
120
+ await this.privateEventStore.rollback(event.block.number, currentAnchorBlockNumber);
121
+ await this.updateAnchorBlockHeader(newAnchorBlockHeader);
122
+ });
80
123
  break;
81
124
  }
82
125
  }
83
126
  }
84
127
 
128
+ /** Updates the anchor block header to the target block */
129
+ private async updateAnchorBlockHeader(blockHeader: BlockHeader) {
130
+ this.log.verbose(`Updated pxe last block to ${blockHeader.getBlockNumber()}`, blockHeader.toInspect());
131
+ await this.anchorBlockStore.setHeader(blockHeader);
132
+ }
133
+
85
134
  /**
86
135
  * Syncs PXE and the node by downloading the metadata of the latest blocks, allowing simulations to use
87
136
  * recent data (e.g. notes), and handling any reorgs that might have occurred.
@@ -112,13 +161,13 @@ export class BlockSynchronizer implements L2BlockStreamEventHandler {
112
161
  let currentHeader;
113
162
 
114
163
  try {
115
- currentHeader = await this.anchorBlockDataProvider.getBlockHeader();
164
+ currentHeader = await this.anchorBlockStore.getBlockHeader();
116
165
  } catch {
117
166
  this.log.debug('Header is not set, requesting from the node');
118
167
  }
119
168
  if (!currentHeader) {
120
169
  // REFACTOR: We should know the header of the genesis block without having to request it from the node.
121
- await this.anchorBlockDataProvider.setHeader((await this.node.getBlockHeader(BlockNumber.ZERO))!);
170
+ await this.anchorBlockStore.setHeader((await this.node.getBlockHeader(BlockNumber.ZERO))!);
122
171
  }
123
172
  await this.blockStream.sync();
124
173
  }
@@ -24,6 +24,8 @@ export interface KernelProverConfig {
24
24
  export interface BlockSynchronizerConfig {
25
25
  /** Maximum amount of blocks to pull from the stream in one request when synchronizing */
26
26
  l2BlockBatchSize: number;
27
+ /** Which chain tip to sync to (proposed, checkpointed, proven, finalized) */
28
+ syncChainTip?: 'proposed' | 'checkpointed' | 'proven' | 'finalized';
27
29
  }
28
30
 
29
31
  export type PXEConfig = KernelProverConfig & DataStoreConfig & ChainConfig & BlockSynchronizerConfig;
@@ -53,6 +55,18 @@ export const pxeConfigMappings: ConfigMappingsType<PXEConfig> = {
53
55
  description: 'Enable real proofs',
54
56
  ...booleanConfigHelper(true),
55
57
  },
58
+ syncChainTip: {
59
+ env: 'PXE_SYNC_CHAIN_TIP',
60
+ description: 'Which chain tip to sync to (proposed, checkpointed, proven, finalized)',
61
+ defaultValue: 'proposed',
62
+ parseEnv: (val: string) => {
63
+ const allowedValues = ['proposed', 'checkpointed', 'proven', 'finalized'];
64
+ if (allowedValues.includes(val)) {
65
+ return val;
66
+ }
67
+ throw new Error(`Invalid value for PXE_SYNC_CHAIN_TIP: ${val}. Allowed values are: ${allowedValues.join(', ')}`);
68
+ },
69
+ },
56
70
  };
57
71
 
58
72
  /**
@@ -1,3 +1,3 @@
1
1
  export function getPackageInfo() {
2
- return { version: '3.0.0', name: '@aztec/pxe' };
2
+ return { version: '4.0.0', name: '@aztec/pxe' };
3
3
  }
@@ -0,0 +1,103 @@
1
+ import { Timer } from '@aztec/foundation/timer';
2
+ import type { AztecNode } from '@aztec/stdlib/interfaces/client';
3
+ import type { NodeStats, RoundTripStats } from '@aztec/stdlib/tx';
4
+
5
+ /*
6
+ * Proxy generator for an AztecNode that tracks the time taken for each RPC call and the number of round trips (actual
7
+ * blocking waits for node responses).
8
+ *
9
+ * A round trip is counted when we transition from 0 to 1 in-flight calls, and ends when all concurrent calls complete.
10
+ * This means parallel calls in Promise.all count as a single round trip.
11
+ *
12
+ * Note that batching of RPC calls in `safe_json_rpc_client.ts` could affect the round trip counts but in places we
13
+ * currently use this information we do not even use HTTP as we have direct access to the Aztec Node instance in TS
14
+ * (i.e. not running against external node) so this is not a problem for now.
15
+ *
16
+ * If you want to use this against external node and the info gets skewed by batching you can set the `maxBatchSize`
17
+ * value in `safe_json_rpc_client.ts` to 1 (the main motivation for batching was to get around parallel http requests
18
+ * limits in web browsers which is not a problem when debugging in node.js).
19
+ */
20
+ export type BenchmarkedNode = AztecNode & { getStats(): NodeStats };
21
+
22
+ export class BenchmarkedNodeFactory {
23
+ static create(node: AztecNode): BenchmarkedNode {
24
+ // Per-method call stats
25
+ const perMethod: Partial<Record<keyof AztecNode, { times: number[] }>> = {};
26
+
27
+ // Round trip tracking
28
+ let inFlightCount = 0;
29
+ let currentRoundTripTimer: Timer | null = null;
30
+ let currentRoundTripMethods: string[] = [];
31
+ const roundTrips: RoundTripStats = {
32
+ roundTrips: 0,
33
+ totalBlockingTime: 0,
34
+ roundTripDurations: [],
35
+ roundTripMethods: [],
36
+ };
37
+
38
+ return new Proxy(node, {
39
+ get(target, prop: keyof BenchmarkedNode) {
40
+ if (prop === 'getStats') {
41
+ return (): NodeStats => {
42
+ return { perMethod, roundTrips };
43
+ };
44
+ } else {
45
+ return function (...args: any[]) {
46
+ // Track per-method stats
47
+ if (!perMethod[prop]) {
48
+ perMethod[prop] = { times: [] };
49
+ }
50
+
51
+ // Start of a new round trip batch?
52
+ if (inFlightCount === 0) {
53
+ roundTrips.roundTrips++;
54
+ currentRoundTripTimer = new Timer();
55
+ currentRoundTripMethods = [];
56
+ }
57
+ inFlightCount++;
58
+ currentRoundTripMethods.push(prop);
59
+
60
+ const callTimer = new Timer();
61
+ const result = (target[prop] as any).apply(target, args);
62
+
63
+ // Handle completion - called when the call finishes (after Promise resolves)
64
+ const handleCompletion = () => {
65
+ const callTime = callTimer.ms();
66
+ perMethod[prop]!.times.push(callTime);
67
+
68
+ inFlightCount--;
69
+
70
+ // End of round trip batch - all concurrent calls completed
71
+ if (inFlightCount === 0 && currentRoundTripTimer) {
72
+ const roundTripTime = currentRoundTripTimer.ms();
73
+ roundTrips.totalBlockingTime += roundTripTime;
74
+ roundTrips.roundTripDurations.push(roundTripTime);
75
+ roundTrips.roundTripMethods.push(currentRoundTripMethods);
76
+ currentRoundTripTimer = null;
77
+ currentRoundTripMethods = [];
78
+ }
79
+ };
80
+
81
+ // If the result is a Promise, chain the completion handler
82
+ if (result && typeof result.then === 'function') {
83
+ return result.then(
84
+ (value: any) => {
85
+ handleCompletion();
86
+ return value;
87
+ },
88
+ (error: any) => {
89
+ handleCompletion();
90
+ throw error;
91
+ },
92
+ );
93
+ } else {
94
+ // Synchronous method - handle completion immediately
95
+ handleCompletion();
96
+ return result;
97
+ }
98
+ };
99
+ }
100
+ },
101
+ }) as BenchmarkedNode;
102
+ }
103
+ }