@aztec/pxe 0.0.1-commit.1142ef1 → 0.0.1-commit.11bf3dd6e

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 (302) hide show
  1. package/dest/bin/check_oracle_version.js +5 -5
  2. package/dest/block_synchronizer/block_synchronizer.d.ts +16 -6
  3. package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
  4. package/dest/block_synchronizer/block_synchronizer.js +91 -22
  5. package/dest/config/index.d.ts +4 -2
  6. package/dest/config/index.d.ts.map +1 -1
  7. package/dest/config/index.js +12 -2
  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 +66 -36
  13. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  14. package/dest/contract_function_simulator/contract_function_simulator.js +230 -89
  15. package/dest/contract_function_simulator/ephemeral_array_service.d.ts +28 -0
  16. package/dest/contract_function_simulator/ephemeral_array_service.d.ts.map +1 -0
  17. package/dest/contract_function_simulator/ephemeral_array_service.js +78 -0
  18. package/dest/contract_function_simulator/execution_note_cache.d.ts +18 -9
  19. package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
  20. package/dest/contract_function_simulator/execution_note_cache.js +45 -28
  21. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +7 -7
  22. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -1
  23. package/dest/contract_function_simulator/execution_tagging_index_cache.js +19 -11
  24. package/dest/contract_function_simulator/index.d.ts +3 -2
  25. package/dest/contract_function_simulator/index.d.ts.map +1 -1
  26. package/dest/contract_function_simulator/index.js +2 -1
  27. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +5 -7
  28. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
  29. package/dest/contract_function_simulator/noir-structs/event_validation_request.js +9 -11
  30. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +1 -1
  31. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.js +1 -1
  32. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +2 -2
  33. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
  34. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +2 -4
  35. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +5 -8
  36. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
  37. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +7 -12
  38. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +4 -10
  39. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -1
  40. package/dest/contract_function_simulator/noir-structs/utility_context.js +7 -18
  41. package/dest/contract_function_simulator/oracle/interfaces.d.ts +67 -47
  42. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
  43. package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.d.ts +9 -0
  44. package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.d.ts.map +1 -0
  45. package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.js +47 -0
  46. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +3 -1
  47. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
  48. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +6 -6
  49. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
  50. package/dest/contract_function_simulator/oracle/note_packing_utils.js +8 -8
  51. package/dest/contract_function_simulator/oracle/oracle.d.ts +75 -42
  52. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
  53. package/dest/contract_function_simulator/oracle/oracle.js +327 -119
  54. package/dest/contract_function_simulator/oracle/private_execution.d.ts +2 -26
  55. package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
  56. package/dest/contract_function_simulator/oracle/private_execution.js +5 -38
  57. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +59 -76
  58. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  59. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +125 -90
  60. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +140 -73
  61. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  62. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +347 -162
  63. package/dest/contract_function_simulator/pick_notes.d.ts +1 -1
  64. package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -1
  65. package/dest/contract_function_simulator/pick_notes.js +20 -3
  66. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +1 -1
  67. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -1
  68. package/dest/contract_function_simulator/proxied_contract_data_source.js +3 -0
  69. package/dest/contract_logging.d.ts +27 -0
  70. package/dest/contract_logging.d.ts.map +1 -0
  71. package/dest/contract_logging.js +38 -0
  72. package/dest/contract_sync/contract_sync_service.d.ts +44 -0
  73. package/dest/contract_sync/contract_sync_service.d.ts.map +1 -0
  74. package/dest/contract_sync/contract_sync_service.js +116 -0
  75. package/dest/contract_sync/helpers.d.ts +28 -0
  76. package/dest/contract_sync/helpers.d.ts.map +1 -0
  77. package/dest/contract_sync/helpers.js +60 -0
  78. package/dest/debug/pxe_debug_utils.d.ts +24 -10
  79. package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
  80. package/dest/debug/pxe_debug_utils.js +28 -17
  81. package/dest/entrypoints/client/bundle/index.d.ts +3 -1
  82. package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
  83. package/dest/entrypoints/client/bundle/index.js +2 -0
  84. package/dest/entrypoints/client/bundle/utils.d.ts +2 -2
  85. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  86. package/dest/entrypoints/client/bundle/utils.js +23 -9
  87. package/dest/entrypoints/client/lazy/index.d.ts +3 -1
  88. package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
  89. package/dest/entrypoints/client/lazy/index.js +2 -0
  90. package/dest/entrypoints/client/lazy/utils.d.ts +3 -3
  91. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  92. package/dest/entrypoints/client/lazy/utils.js +24 -10
  93. package/dest/entrypoints/pxe_creation_options.d.ts +5 -2
  94. package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
  95. package/dest/entrypoints/pxe_creation_options.js +3 -1
  96. package/dest/entrypoints/server/index.d.ts +5 -2
  97. package/dest/entrypoints/server/index.d.ts.map +1 -1
  98. package/dest/entrypoints/server/index.js +4 -1
  99. package/dest/entrypoints/server/utils.d.ts +2 -2
  100. package/dest/entrypoints/server/utils.d.ts.map +1 -1
  101. package/dest/entrypoints/server/utils.js +30 -11
  102. package/dest/events/event_service.d.ts +7 -6
  103. package/dest/events/event_service.d.ts.map +1 -1
  104. package/dest/events/event_service.js +33 -24
  105. package/dest/events/private_event_filter_validator.d.ts +6 -5
  106. package/dest/events/private_event_filter_validator.d.ts.map +1 -1
  107. package/dest/events/private_event_filter_validator.js +20 -6
  108. package/dest/job_coordinator/job_coordinator.d.ts +3 -2
  109. package/dest/job_coordinator/job_coordinator.d.ts.map +1 -1
  110. package/dest/job_coordinator/job_coordinator.js +3 -2
  111. package/dest/logs/log_service.d.ts +11 -9
  112. package/dest/logs/log_service.d.ts.map +1 -1
  113. package/dest/logs/log_service.js +52 -64
  114. package/dest/messages/message_context_service.d.ts +17 -0
  115. package/dest/messages/message_context_service.d.ts.map +1 -0
  116. package/dest/messages/message_context_service.js +36 -0
  117. package/dest/notes/note_service.d.ts +9 -9
  118. package/dest/notes/note_service.d.ts.map +1 -1
  119. package/dest/notes/note_service.js +45 -40
  120. package/dest/notes_filter.d.ts +24 -0
  121. package/dest/notes_filter.d.ts.map +1 -0
  122. package/dest/notes_filter.js +4 -0
  123. package/dest/oracle_version.d.ts +4 -3
  124. package/dest/oracle_version.d.ts.map +1 -1
  125. package/dest/oracle_version.js +20 -9
  126. package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts +4 -0
  127. package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts.map +1 -0
  128. package/dest/private_kernel/hints/{compute_tx_include_by_timestamp.js → compute_tx_expiration_timestamp.js} +12 -12
  129. package/dest/private_kernel/hints/index.d.ts +3 -3
  130. package/dest/private_kernel/hints/index.d.ts.map +1 -1
  131. package/dest/private_kernel/hints/index.js +2 -2
  132. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +29 -0
  133. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -0
  134. package/dest/private_kernel/hints/{build_private_kernel_reset_private_inputs.js → private_kernel_reset_private_inputs_builder.js} +140 -73
  135. package/dest/private_kernel/hints/test_utils.d.ts +122 -0
  136. package/dest/private_kernel/hints/test_utils.d.ts.map +1 -0
  137. package/dest/private_kernel/hints/test_utils.js +203 -0
  138. package/dest/private_kernel/private_kernel_execution_prover.d.ts +3 -2
  139. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
  140. package/dest/private_kernel/private_kernel_execution_prover.js +21 -16
  141. package/dest/private_kernel/private_kernel_oracle.d.ts +24 -25
  142. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
  143. package/dest/private_kernel/private_kernel_oracle.js +91 -2
  144. package/dest/pxe.d.ts +80 -59
  145. package/dest/pxe.d.ts.map +1 -1
  146. package/dest/pxe.js +163 -145
  147. package/dest/storage/address_store/address_store.d.ts +1 -1
  148. package/dest/storage/address_store/address_store.d.ts.map +1 -1
  149. package/dest/storage/address_store/address_store.js +12 -11
  150. package/dest/storage/anchor_block_store/anchor_block_store.d.ts +9 -1
  151. package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -1
  152. package/dest/storage/anchor_block_store/anchor_block_store.js +9 -2
  153. package/dest/storage/capsule_store/capsule_service.d.ts +21 -0
  154. package/dest/storage/capsule_store/capsule_service.d.ts.map +1 -0
  155. package/dest/storage/capsule_store/capsule_service.js +50 -0
  156. package/dest/storage/capsule_store/capsule_store.d.ts +25 -10
  157. package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -1
  158. package/dest/storage/capsule_store/capsule_store.js +143 -28
  159. package/dest/storage/capsule_store/index.d.ts +2 -1
  160. package/dest/storage/capsule_store/index.d.ts.map +1 -1
  161. package/dest/storage/capsule_store/index.js +1 -0
  162. package/dest/storage/contract_store/contract_store.d.ts +42 -16
  163. package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
  164. package/dest/storage/contract_store/contract_store.js +160 -85
  165. package/dest/storage/metadata.d.ts +1 -1
  166. package/dest/storage/metadata.js +1 -1
  167. package/dest/storage/note_store/note_store.d.ts +50 -51
  168. package/dest/storage/note_store/note_store.d.ts.map +1 -1
  169. package/dest/storage/note_store/note_store.js +284 -263
  170. package/dest/storage/note_store/stored_note.d.ts +16 -0
  171. package/dest/storage/note_store/stored_note.d.ts.map +1 -0
  172. package/dest/storage/note_store/stored_note.js +43 -0
  173. package/dest/storage/private_event_store/private_event_store.d.ts +43 -8
  174. package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -1
  175. package/dest/storage/private_event_store/private_event_store.js +229 -111
  176. package/dest/storage/private_event_store/stored_private_event.d.ts +23 -0
  177. package/dest/storage/private_event_store/stored_private_event.d.ts.map +1 -0
  178. package/dest/storage/private_event_store/stored_private_event.js +56 -0
  179. package/dest/storage/tagging_store/recipient_tagging_store.d.ts +16 -9
  180. package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -1
  181. package/dest/storage/tagging_store/recipient_tagging_store.js +88 -19
  182. package/dest/storage/tagging_store/sender_address_book_store.d.ts +1 -1
  183. package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +1 -1
  184. package/dest/storage/tagging_store/sender_address_book_store.js +20 -14
  185. package/dest/storage/tagging_store/sender_tagging_store.d.ts +43 -32
  186. package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
  187. package/dest/storage/tagging_store/sender_tagging_store.js +300 -122
  188. package/dest/tagging/get_all_logs_by_tags.d.ts +24 -0
  189. package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -0
  190. package/dest/tagging/get_all_logs_by_tags.js +60 -0
  191. package/dest/tagging/index.d.ts +4 -3
  192. package/dest/tagging/index.d.ts.map +1 -1
  193. package/dest/tagging/index.js +2 -1
  194. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +5 -5
  195. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -1
  196. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +12 -26
  197. package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +2 -2
  198. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +7 -7
  199. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -1
  200. package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +16 -12
  201. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +5 -8
  202. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
  203. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +18 -12
  204. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +4 -3
  205. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -1
  206. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +23 -16
  207. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +8 -7
  208. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -1
  209. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +44 -27
  210. package/package.json +27 -18
  211. package/src/bin/check_oracle_version.ts +5 -4
  212. package/src/block_synchronizer/block_synchronizer.ts +113 -35
  213. package/src/config/index.ts +9 -1
  214. package/src/config/package_info.ts +1 -1
  215. package/src/contract_function_simulator/benchmarked_node.ts +103 -0
  216. package/src/contract_function_simulator/contract_function_simulator.ts +392 -154
  217. package/src/contract_function_simulator/ephemeral_array_service.ts +110 -0
  218. package/src/contract_function_simulator/execution_note_cache.ts +44 -25
  219. package/src/contract_function_simulator/execution_tagging_index_cache.ts +19 -14
  220. package/src/contract_function_simulator/index.ts +2 -1
  221. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +10 -10
  222. package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +1 -1
  223. package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +2 -5
  224. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +5 -11
  225. package/src/contract_function_simulator/noir-structs/utility_context.ts +6 -25
  226. package/src/contract_function_simulator/oracle/interfaces.ts +97 -59
  227. package/src/contract_function_simulator/oracle/legacy_oracle_mappings.ts +104 -0
  228. package/src/contract_function_simulator/oracle/note_packing_utils.ts +10 -10
  229. package/src/contract_function_simulator/oracle/oracle.ts +422 -166
  230. package/src/contract_function_simulator/oracle/private_execution.ts +5 -71
  231. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +169 -185
  232. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +578 -193
  233. package/src/contract_function_simulator/pick_notes.ts +22 -3
  234. package/src/contract_function_simulator/proxied_contract_data_source.ts +8 -1
  235. package/src/contract_logging.ts +52 -0
  236. package/src/contract_sync/contract_sync_service.ts +176 -0
  237. package/src/contract_sync/helpers.ts +98 -0
  238. package/src/debug/pxe_debug_utils.ts +63 -18
  239. package/src/entrypoints/client/bundle/index.ts +2 -0
  240. package/src/entrypoints/client/bundle/utils.ts +18 -18
  241. package/src/entrypoints/client/lazy/index.ts +2 -0
  242. package/src/entrypoints/client/lazy/utils.ts +19 -18
  243. package/src/entrypoints/pxe_creation_options.ts +9 -1
  244. package/src/entrypoints/server/index.ts +4 -1
  245. package/src/entrypoints/server/utils.ts +24 -29
  246. package/src/events/event_service.ts +31 -26
  247. package/src/events/private_event_filter_validator.ts +23 -5
  248. package/src/job_coordinator/job_coordinator.ts +4 -3
  249. package/src/logs/log_service.ts +94 -104
  250. package/src/messages/message_context_service.ts +44 -0
  251. package/src/notes/note_service.ts +54 -48
  252. package/src/notes_filter.ts +24 -0
  253. package/src/oracle_version.ts +20 -9
  254. package/src/private_kernel/hints/{compute_tx_include_by_timestamp.ts → compute_tx_expiration_timestamp.ts} +13 -13
  255. package/src/private_kernel/hints/index.ts +2 -2
  256. package/src/private_kernel/hints/{build_private_kernel_reset_private_inputs.ts → private_kernel_reset_private_inputs_builder.ts} +195 -136
  257. package/src/private_kernel/hints/test_utils.ts +325 -0
  258. package/src/private_kernel/private_kernel_execution_prover.ts +25 -20
  259. package/src/private_kernel/private_kernel_oracle.ts +116 -37
  260. package/src/pxe.ts +297 -223
  261. package/src/storage/address_store/address_store.ts +15 -15
  262. package/src/storage/anchor_block_store/anchor_block_store.ts +9 -1
  263. package/src/storage/capsule_store/capsule_service.ts +90 -0
  264. package/src/storage/capsule_store/capsule_store.ts +183 -29
  265. package/src/storage/capsule_store/index.ts +1 -0
  266. package/src/storage/contract_store/contract_store.ts +193 -101
  267. package/src/storage/metadata.ts +1 -1
  268. package/src/storage/note_store/note_store.ts +323 -320
  269. package/src/storage/note_store/stored_note.ts +48 -0
  270. package/src/storage/private_event_store/private_event_store.ts +296 -124
  271. package/src/storage/private_event_store/stored_private_event.ts +73 -0
  272. package/src/storage/tagging_store/recipient_tagging_store.ts +111 -21
  273. package/src/storage/tagging_store/sender_address_book_store.ts +20 -14
  274. package/src/storage/tagging_store/sender_tagging_store.ts +366 -134
  275. package/src/tagging/get_all_logs_by_tags.ts +92 -0
  276. package/src/tagging/index.ts +3 -2
  277. package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +27 -29
  278. package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +2 -2
  279. package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +17 -16
  280. package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +31 -15
  281. package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +29 -26
  282. package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +42 -29
  283. package/dest/contract_function_simulator/proxied_node.d.ts +0 -9
  284. package/dest/contract_function_simulator/proxied_node.d.ts.map +0 -1
  285. package/dest/contract_function_simulator/proxied_node.js +0 -27
  286. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +0 -28
  287. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +0 -1
  288. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +0 -4
  289. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts.map +0 -1
  290. package/dest/private_kernel/private_kernel_oracle_impl.d.ts +0 -46
  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 -85
  293. package/dest/public_storage/public_storage_service.d.ts +0 -24
  294. package/dest/public_storage/public_storage_service.d.ts.map +0 -1
  295. package/dest/public_storage/public_storage_service.js +0 -26
  296. package/dest/tree_membership/tree_membership_service.d.ts +0 -52
  297. package/dest/tree_membership/tree_membership_service.d.ts.map +0 -1
  298. package/dest/tree_membership/tree_membership_service.js +0 -84
  299. package/src/contract_function_simulator/proxied_node.ts +0 -33
  300. package/src/private_kernel/private_kernel_oracle_impl.ts +0 -127
  301. package/src/public_storage/public_storage_service.ts +0 -33
  302. package/src/tree_membership/tree_membership_service.ts +0 -112
package/package.json CHANGED
@@ -1,7 +1,16 @@
1
1
  {
2
2
  "name": "@aztec/pxe",
3
- "version": "0.0.1-commit.1142ef1",
3
+ "version": "0.0.1-commit.11bf3dd6e",
4
4
  "type": "module",
5
+ "typedocOptions": {
6
+ "entryPoints": [
7
+ "./src/entrypoints/server/index.ts",
8
+ "./src/entrypoints/client/lazy/index.ts",
9
+ "./src/config/index.ts"
10
+ ],
11
+ "name": "PXE",
12
+ "tsconfig": "./tsconfig.json"
13
+ },
5
14
  "exports": {
6
15
  "./server": "./dest/entrypoints/server/index.js",
7
16
  "./client/lazy": "./dest/entrypoints/client/lazy/index.js",
@@ -11,7 +20,7 @@
11
20
  },
12
21
  "bin": "./dest/bin/index.js",
13
22
  "scripts": {
14
- "build": "yarn clean && yarn generate && tsgo -b",
23
+ "build": "yarn clean && yarn generate && ../scripts/tsc.sh",
15
24
  "build:dev": "../scripts/tsc.sh --watch",
16
25
  "clean": "rm -rf ./dest .tsbuildinfo ./src/config/package_info.ts",
17
26
  "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}",
@@ -61,19 +70,19 @@
61
70
  ]
62
71
  },
63
72
  "dependencies": {
64
- "@aztec/bb-prover": "0.0.1-commit.1142ef1",
65
- "@aztec/bb.js": "0.0.1-commit.1142ef1",
66
- "@aztec/builder": "0.0.1-commit.1142ef1",
67
- "@aztec/constants": "0.0.1-commit.1142ef1",
68
- "@aztec/ethereum": "0.0.1-commit.1142ef1",
69
- "@aztec/foundation": "0.0.1-commit.1142ef1",
70
- "@aztec/key-store": "0.0.1-commit.1142ef1",
71
- "@aztec/kv-store": "0.0.1-commit.1142ef1",
72
- "@aztec/noir-protocol-circuits-types": "0.0.1-commit.1142ef1",
73
- "@aztec/noir-types": "0.0.1-commit.1142ef1",
74
- "@aztec/protocol-contracts": "0.0.1-commit.1142ef1",
75
- "@aztec/simulator": "0.0.1-commit.1142ef1",
76
- "@aztec/stdlib": "0.0.1-commit.1142ef1",
73
+ "@aztec/bb-prover": "0.0.1-commit.11bf3dd6e",
74
+ "@aztec/bb.js": "0.0.1-commit.11bf3dd6e",
75
+ "@aztec/builder": "0.0.1-commit.11bf3dd6e",
76
+ "@aztec/constants": "0.0.1-commit.11bf3dd6e",
77
+ "@aztec/ethereum": "0.0.1-commit.11bf3dd6e",
78
+ "@aztec/foundation": "0.0.1-commit.11bf3dd6e",
79
+ "@aztec/key-store": "0.0.1-commit.11bf3dd6e",
80
+ "@aztec/kv-store": "0.0.1-commit.11bf3dd6e",
81
+ "@aztec/noir-protocol-circuits-types": "0.0.1-commit.11bf3dd6e",
82
+ "@aztec/noir-types": "0.0.1-commit.11bf3dd6e",
83
+ "@aztec/protocol-contracts": "0.0.1-commit.11bf3dd6e",
84
+ "@aztec/simulator": "0.0.1-commit.11bf3dd6e",
85
+ "@aztec/stdlib": "0.0.1-commit.11bf3dd6e",
77
86
  "koa": "^2.16.1",
78
87
  "koa-router": "^13.1.1",
79
88
  "lodash.omit": "^4.5.0",
@@ -82,14 +91,14 @@
82
91
  "viem": "npm:@aztec/viem@2.38.2"
83
92
  },
84
93
  "devDependencies": {
85
- "@aztec/merkle-tree": "0.0.1-commit.1142ef1",
86
- "@aztec/noir-test-contracts.js": "0.0.1-commit.1142ef1",
94
+ "@aztec/noir-test-contracts.js": "0.0.1-commit.11bf3dd6e",
95
+ "@aztec/world-state": "0.0.1-commit.11bf3dd6e",
87
96
  "@jest/globals": "^30.0.0",
88
97
  "@types/jest": "^30.0.0",
89
98
  "@types/lodash.omit": "^4.5.7",
90
99
  "@types/lodash.times": "^4.3.9",
91
100
  "@types/node": "^22.15.17",
92
- "@typescript/native-preview": "7.0.0-dev.20251126.1",
101
+ "@typescript/native-preview": "7.0.0-dev.20260113.1",
93
102
  "jest": "^30.0.0",
94
103
  "jest-mock-extended": "^4.0.0",
95
104
  "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';
@@ -12,8 +13,9 @@ import { ORACLE_INTERFACE_HASH } from '../oracle_version.js';
12
13
  *
13
14
  * The Oracle interface needs to be versioned to ensure compatibility between Aztec.nr and PXE. This function computes
14
15
  * a hash of the Oracle interface and compares it against a known hash. If they don't match, it means the interface has
15
- * changed and the ORACLE_VERSION constant needs to be incremented and the ORACLE_INTERFACE_HASH constant needs to be
16
- * updated.
16
+ * changed and the oracle version needs to be bumped:
17
+ * - If the change is backward-breaking (e.g. removing/renaming an oracle), bump ORACLE_VERSION_MAJOR.
18
+ * - If the change is an oracle addition (non-breaking), bump ORACLE_VERSION_MINOR.
17
19
  *
18
20
  * TODO(#16581): The following only takes into consideration changes to the oracles defined in Oracle.ts and omits TXE
19
21
  * oracles. Ensure this checks TXE oracles as well. This hasn't been implemented yet since we don't have a clean TXE
@@ -25,9 +27,8 @@ function assertOracleInterfaceMatches(): void {
25
27
  // We use keccak256 here just because we already have it in the dependencies.
26
28
  const oracleInterfaceHash = keccak256String(oracleInterfaceSignature);
27
29
  if (oracleInterfaceHash !== ORACLE_INTERFACE_HASH) {
28
- // This check exists only to notify you when you need to update the ORACLE_VERSION constant.
29
30
  throw new Error(
30
- `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.`,
31
+ `The Oracle interface has changed. Update ORACLE_INTERFACE_HASH to ${oracleInterfaceHash} in pxe/src/oracle_version.ts and bump the oracle version (ORACLE_VERSION_MAJOR for breaking changes, ORACLE_VERSION_MINOR for oracle additions).`,
31
32
  );
32
33
  }
33
34
  }
@@ -1,10 +1,14 @@
1
1
  import { BlockNumber } from '@aztec/foundation/branded-types';
2
- import { type Logger, createLogger } from '@aztec/foundation/log';
2
+ import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
3
+ import { SerialQueue } from '@aztec/foundation/queue';
4
+ import type { AztecAsyncKVStore } from '@aztec/kv-store';
3
5
  import type { L2TipsKVStore } from '@aztec/kv-store/stores';
4
- import { L2BlockStream, type L2BlockStreamEvent, type L2BlockStreamEventHandler } from '@aztec/stdlib/block';
6
+ import { BlockHash, L2BlockStream, type L2BlockStreamEvent, type L2BlockStreamEventHandler } from '@aztec/stdlib/block';
5
7
  import type { AztecNode } from '@aztec/stdlib/interfaces/client';
8
+ import type { BlockHeader } from '@aztec/stdlib/tx';
6
9
 
7
- import type { PXEConfig } from '../config/index.js';
10
+ import type { BlockSynchronizerConfig } from '../config/index.js';
11
+ import type { ContractSyncService } from '../contract_sync/contract_sync_service.js';
8
12
  import type { AnchorBlockStore } from '../storage/anchor_block_store/anchor_block_store.js';
9
13
  import type { NoteStore } from '../storage/note_store/note_store.js';
10
14
  import type { PrivateEventStore } from '../storage/private_event_store/private_event_store.js';
@@ -17,66 +21,131 @@ import type { PrivateEventStore } from '../storage/private_event_store/private_e
17
21
  export class BlockSynchronizer implements L2BlockStreamEventHandler {
18
22
  private log: Logger;
19
23
  private isSyncing: Promise<void> | undefined;
24
+ private readonly eventQueue = new SerialQueue();
20
25
  protected readonly blockStream: L2BlockStream;
21
26
 
22
27
  constructor(
23
28
  private node: AztecNode,
29
+ private store: AztecAsyncKVStore,
24
30
  private anchorBlockStore: AnchorBlockStore,
25
31
  private noteStore: NoteStore,
26
32
  private privateEventStore: PrivateEventStore,
27
33
  private l2TipsStore: L2TipsKVStore,
28
- config: Partial<Pick<PXEConfig, 'l2BlockBatchSize'>> = {},
29
- loggerOrSuffix?: string | Logger,
34
+ private contractSyncService: ContractSyncService,
35
+ private config: Partial<BlockSynchronizerConfig> = {},
36
+ bindings?: LoggerBindings,
30
37
  ) {
31
- this.log =
32
- !loggerOrSuffix || typeof loggerOrSuffix === 'string'
33
- ? createLogger(loggerOrSuffix ? `pxe:block_synchronizer:${loggerOrSuffix}` : `pxe:block_synchronizer`)
34
- : loggerOrSuffix;
38
+ this.log = createLogger('pxe:block_synchronizer', bindings);
35
39
  this.blockStream = this.createBlockStream(config);
40
+ this.eventQueue.start();
36
41
  }
37
42
 
38
- protected createBlockStream(config: Partial<Pick<PXEConfig, 'l2BlockBatchSize'>>) {
39
- return new L2BlockStream(this.node, this.l2TipsStore, this, createLogger('pxe:block_stream'), {
40
- batchSize: config.l2BlockBatchSize,
41
- // Skipping finalized blocks makes us sync much faster - we only need to download blocks other than the latest one
42
- // in order to detect reorgs, and there can be no reorgs on finalized block, making this safe.
43
- skipFinalized: true,
44
- });
43
+ protected createBlockStream(config: Partial<BlockSynchronizerConfig>): L2BlockStream {
44
+ return new L2BlockStream(
45
+ this.node,
46
+ this.l2TipsStore,
47
+ this,
48
+ createLogger('pxe:block_stream', this.log.getBindings()),
49
+ {
50
+ batchSize: config.l2BlockBatchSize,
51
+ // Skipping finalized blocks makes us sync much faster - we only need to download blocks other than the latest one
52
+ // in order to detect reorgs, and there can be no reorgs on finalized block, making this safe.
53
+ skipFinalized: true,
54
+ },
55
+ );
45
56
  }
46
57
 
47
- /** Handle events emitted by the block stream. */
48
- public async handleBlockStreamEvent(event: L2BlockStreamEvent): Promise<void> {
58
+ /** Handle events emitted by the block stream. Serialized to prevent concurrent mutations to anchor state. */
59
+ public handleBlockStreamEvent(event: L2BlockStreamEvent): Promise<void> {
60
+ return this.eventQueue.put(() => this.doHandleBlockStreamEvent(event));
61
+ }
62
+
63
+ private async doHandleBlockStreamEvent(event: L2BlockStreamEvent): Promise<void> {
49
64
  await this.l2TipsStore.handleBlockStreamEvent(event);
50
65
 
51
66
  switch (event.type) {
52
67
  case 'blocks-added': {
53
- const lastBlock = event.blocks.at(-1)!;
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.anchorBlockStore.setHeader(lastBlock.header);
68
+ if (this.config.syncChainTip === undefined || this.config.syncChainTip === 'proposed') {
69
+ const lastBlock = event.blocks.at(-1)!;
70
+ await this.updateAnchorBlockHeader(lastBlock.header);
71
+ }
72
+ break;
73
+ }
74
+ case 'chain-checkpointed': {
75
+ if (this.config.syncChainTip === 'checkpointed') {
76
+ // Get the last block header from the checkpoint
77
+ const lastBlock = event.checkpoint.checkpoint.blocks.at(-1)!;
78
+ await this.updateAnchorBlockHeader(lastBlock.header);
79
+ }
80
+ break;
81
+ }
82
+ case 'chain-proven': {
83
+ if (this.config.syncChainTip === 'proven') {
84
+ const blockHeader = await this.node.getBlockHeader(BlockNumber(event.block.number));
85
+ if (blockHeader) {
86
+ await this.updateAnchorBlockHeader(blockHeader);
87
+ } else {
88
+ this.log.warn(`Block header not found for proven block ${event.block.number}, skipping anchor update`);
89
+ }
90
+ }
91
+ break;
92
+ }
93
+ case 'chain-finalized': {
94
+ if (this.config.syncChainTip === 'finalized') {
95
+ const blockHeader = await this.node.getBlockHeader(BlockNumber(event.block.number));
96
+ if (blockHeader) {
97
+ await this.updateAnchorBlockHeader(blockHeader);
98
+ } else {
99
+ this.log.warn(`Block header not found for finalized block ${event.block.number}, skipping anchor update`);
100
+ }
101
+ }
60
102
  break;
61
103
  }
62
104
  case 'chain-pruned': {
105
+ const currentAnchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
106
+ const currentAnchorBlockNumber = currentAnchorBlockHeader.getBlockNumber();
107
+ if (currentAnchorBlockNumber <= event.block.number) {
108
+ this.log.verbose(
109
+ `Ignoring prune event to block ${event.block.number} greater than current anchor block ${currentAnchorBlockNumber}`,
110
+ { pruneEvent: event, currentAnchorBlockHeader: currentAnchorBlockHeader.toInspect() },
111
+ );
112
+ return;
113
+ }
114
+
63
115
  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.anchorBlockStore.getBlockHeader()).getBlockNumber();
66
- await this.noteStore.rollbackNotesAndNullifiers(event.block.number, lastSynchedBlockNumber);
67
- await this.privateEventStore.rollbackEventsAfterBlock(event.block.number, lastSynchedBlockNumber);
68
- // Update the header to the last block.
69
- const newHeader = await this.node.getBlockHeader(event.block.number);
70
- if (!newHeader) {
71
- this.log.error(`Block header not found for block number ${event.block.number} during chain prune`);
72
- } else {
73
- await this.anchorBlockStore.setHeader(newHeader);
116
+
117
+ // Note that the following is not necessarily the anchor block that will be used in the transaction - if
118
+ // the chain has already moved past the reorg, we'll also see blocks-added events that will push the anchor
119
+ // forward.
120
+ const newAnchorBlockHeader = await this.node.getBlockHeader(BlockHash.fromString(event.block.hash));
121
+
122
+ if (!newAnchorBlockHeader) {
123
+ throw new Error(
124
+ `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.`,
125
+ );
74
126
  }
127
+
128
+ // Operations are wrapped in a single transaction to ensure atomicity.
129
+ await this.store.transactionAsync(async () => {
130
+ await this.noteStore.rollback(event.block.number, currentAnchorBlockNumber);
131
+ await this.privateEventStore.rollback(event.block.number, currentAnchorBlockNumber);
132
+ await this.updateAnchorBlockHeader(newAnchorBlockHeader);
133
+ });
75
134
  break;
76
135
  }
77
136
  }
78
137
  }
79
138
 
139
+ /** Updates the anchor block header to the target block */
140
+ private async updateAnchorBlockHeader(blockHeader: BlockHeader) {
141
+ // Whenever the anchor block header is updated, we need to synchronize the private state of contracts again.
142
+ // Therefore, we clear the contract synchronization cache here such that the sync is re-triggered upon new
143
+ // execution.
144
+ this.contractSyncService.wipe();
145
+ this.log.verbose(`Updated pxe last block to ${blockHeader.getBlockNumber()}`, blockHeader.toInspect());
146
+ await this.anchorBlockStore.setHeader(blockHeader);
147
+ }
148
+
80
149
  /**
81
150
  * Syncs PXE and the node by downloading the metadata of the latest blocks, allowing simulations to use
82
151
  * recent data (e.g. notes), and handling any reorgs that might have occurred.
@@ -94,6 +163,8 @@ export class BlockSynchronizer implements L2BlockStreamEventHandler {
94
163
  }
95
164
 
96
165
  this.log.debug(`Syncing PXE with the node`);
166
+ // Capture the promise locally so we always await the exact promise we created, even if this.isSyncing is modified
167
+ // between assignment and await (e.g. due to future refactors introducing a yield point).
97
168
  const isSyncing = this.doSync();
98
169
  this.isSyncing = isSyncing;
99
170
  try {
@@ -103,6 +174,13 @@ export class BlockSynchronizer implements L2BlockStreamEventHandler {
103
174
  }
104
175
  }
105
176
 
177
+ /** Stops the block synchronizer, waiting for any in-progress sync and queued events to complete. */
178
+ public async stop() {
179
+ await this.isSyncing;
180
+ await this.blockStream.stop();
181
+ await this.eventQueue.end();
182
+ }
183
+
106
184
  private async doSync() {
107
185
  let currentHeader;
108
186
 
@@ -1,12 +1,13 @@
1
1
  import {
2
2
  type ConfigMappingsType,
3
3
  booleanConfigHelper,
4
+ enumConfigHelper,
4
5
  getConfigFromMappings,
5
6
  numberConfigHelper,
6
7
  parseBooleanEnv,
7
8
  } from '@aztec/foundation/config';
8
- import { type DataStoreConfig, dataConfigMappings } from '@aztec/kv-store/config';
9
9
  import { type ChainConfig, chainConfigMappings } from '@aztec/stdlib/config';
10
+ import { type DataStoreConfig, dataConfigMappings } from '@aztec/stdlib/kv-store';
10
11
 
11
12
  export { getPackageInfo } from './package_info.js';
12
13
 
@@ -24,6 +25,8 @@ export interface KernelProverConfig {
24
25
  export interface BlockSynchronizerConfig {
25
26
  /** Maximum amount of blocks to pull from the stream in one request when synchronizing */
26
27
  l2BlockBatchSize: number;
28
+ /** Which chain tip to sync to (proposed, checkpointed, proven, finalized) */
29
+ syncChainTip?: 'proposed' | 'checkpointed' | 'proven' | 'finalized';
27
30
  }
28
31
 
29
32
  export type PXEConfig = KernelProverConfig & DataStoreConfig & ChainConfig & BlockSynchronizerConfig;
@@ -53,6 +56,11 @@ export const pxeConfigMappings: ConfigMappingsType<PXEConfig> = {
53
56
  description: 'Enable real proofs',
54
57
  ...booleanConfigHelper(true),
55
58
  },
59
+ syncChainTip: {
60
+ env: 'PXE_SYNC_CHAIN_TIP',
61
+ description: 'Which chain tip to sync to (proposed, checkpointed, proven, finalized)',
62
+ ...enumConfigHelper(['proposed', 'checkpointed', 'proven', 'finalized'], 'proposed'),
63
+ },
56
64
  };
57
65
 
58
66
  /**
@@ -1,3 +1,3 @@
1
1
  export function getPackageInfo() {
2
- return { version: '4.0.0', name: '@aztec/pxe' };
2
+ return { version: '5.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
+ }