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

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 (350) hide show
  1. package/dest/bin/check_oracle_version.d.ts +1 -1
  2. package/dest/bin/check_oracle_version.js +105 -15
  3. package/dest/block_synchronizer/block_synchronizer.d.ts +37 -0
  4. package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -0
  5. package/dest/{synchronizer/synchronizer.js → block_synchronizer/block_synchronizer.js} +20 -22
  6. package/dest/block_synchronizer/index.d.ts +2 -0
  7. package/dest/block_synchronizer/index.d.ts.map +1 -0
  8. package/dest/block_synchronizer/index.js +1 -0
  9. package/dest/config/index.d.ts +4 -12
  10. package/dest/config/index.d.ts.map +1 -1
  11. package/dest/config/index.js +7 -13
  12. package/dest/config/package_info.d.ts +1 -1
  13. package/dest/contract_function_simulator/contract_function_simulator.d.ts +43 -14
  14. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  15. package/dest/contract_function_simulator/contract_function_simulator.js +55 -29
  16. package/dest/contract_function_simulator/execution_note_cache.d.ts +9 -7
  17. package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
  18. package/dest/contract_function_simulator/execution_note_cache.js +21 -13
  19. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +2 -2
  20. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -1
  21. package/dest/contract_function_simulator/execution_tagging_index_cache.js +1 -1
  22. package/dest/contract_function_simulator/hashed_values_cache.d.ts +2 -2
  23. package/dest/contract_function_simulator/hashed_values_cache.d.ts.map +1 -1
  24. package/dest/contract_function_simulator/index.d.ts +1 -1
  25. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +2 -2
  26. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
  27. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +5 -4
  28. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts.map +1 -1
  29. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.js +7 -6
  30. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +3 -3
  31. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
  32. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +1 -1
  33. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +6 -4
  34. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
  35. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +12 -3
  36. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +2 -2
  37. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -1
  38. package/dest/contract_function_simulator/noir-structs/utility_context.js +1 -1
  39. package/dest/contract_function_simulator/oracle/index.d.ts +1 -1
  40. package/dest/contract_function_simulator/oracle/interfaces.d.ts +19 -13
  41. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
  42. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +2 -4
  43. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
  44. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.js +1 -1
  45. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +10 -4
  46. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
  47. package/dest/contract_function_simulator/oracle/note_packing_utils.js +10 -5
  48. package/dest/contract_function_simulator/oracle/oracle.d.ts +5 -4
  49. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
  50. package/dest/contract_function_simulator/oracle/oracle.js +34 -17
  51. package/dest/contract_function_simulator/oracle/private_execution.d.ts +9 -10
  52. package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
  53. package/dest/contract_function_simulator/oracle/private_execution.js +12 -12
  54. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +24 -18
  55. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  56. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +41 -18
  57. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +58 -17
  58. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  59. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +147 -40
  60. package/dest/contract_function_simulator/pick_notes.d.ts +2 -2
  61. package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -1
  62. package/dest/contract_function_simulator/pick_notes.js +1 -1
  63. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +4 -4
  64. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -1
  65. package/dest/contract_function_simulator/proxied_contract_data_source.js +23 -5
  66. package/dest/contract_function_simulator/proxied_node.d.ts +1 -1
  67. package/dest/contract_function_simulator/proxied_node.d.ts.map +1 -1
  68. package/dest/debug/pxe_debug_utils.d.ts +31 -0
  69. package/dest/debug/pxe_debug_utils.d.ts.map +1 -0
  70. package/dest/debug/pxe_debug_utils.js +37 -0
  71. package/dest/entrypoints/client/bundle/index.d.ts +1 -2
  72. package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
  73. package/dest/entrypoints/client/bundle/index.js +0 -1
  74. package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
  75. package/dest/entrypoints/client/bundle/utils.js +4 -4
  76. package/dest/entrypoints/client/lazy/index.d.ts +1 -2
  77. package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
  78. package/dest/entrypoints/client/lazy/index.js +0 -1
  79. package/dest/entrypoints/client/lazy/utils.d.ts +1 -1
  80. package/dest/entrypoints/client/lazy/utils.js +4 -4
  81. package/dest/entrypoints/pxe_creation_options.d.ts +3 -1
  82. package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
  83. package/dest/entrypoints/server/index.d.ts +2 -2
  84. package/dest/entrypoints/server/index.d.ts.map +1 -1
  85. package/dest/entrypoints/server/index.js +1 -1
  86. package/dest/entrypoints/server/utils.d.ts +1 -1
  87. package/dest/entrypoints/server/utils.d.ts.map +1 -1
  88. package/dest/entrypoints/server/utils.js +5 -16
  89. package/dest/error_enriching.d.ts +4 -4
  90. package/dest/error_enriching.d.ts.map +1 -1
  91. package/dest/error_enriching.js +6 -6
  92. package/dest/events/event_service.d.ts +15 -0
  93. package/dest/events/event_service.d.ts.map +1 -0
  94. package/dest/events/event_service.js +47 -0
  95. package/dest/events/index.d.ts +2 -0
  96. package/dest/events/index.d.ts.map +1 -0
  97. package/dest/events/index.js +1 -0
  98. package/dest/events/private_event_filter_validator.d.ts +9 -0
  99. package/dest/events/private_event_filter_validator.d.ts.map +1 -0
  100. package/dest/events/private_event_filter_validator.js +39 -0
  101. package/dest/logs/log_service.d.ts +26 -0
  102. package/dest/logs/log_service.d.ts.map +1 -0
  103. package/dest/logs/log_service.js +120 -0
  104. package/dest/notes/index.d.ts +2 -0
  105. package/dest/notes/index.d.ts.map +1 -0
  106. package/dest/notes/index.js +1 -0
  107. package/dest/notes/note_service.d.ts +48 -0
  108. package/dest/notes/note_service.d.ts.map +1 -0
  109. package/dest/notes/note_service.js +152 -0
  110. package/dest/oracle_version.d.ts +3 -3
  111. package/dest/oracle_version.js +2 -2
  112. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +3 -3
  113. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +1 -1
  114. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.js +7 -7
  115. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +1 -1
  116. package/dest/private_kernel/hints/index.d.ts +1 -1
  117. package/dest/private_kernel/index.d.ts +1 -1
  118. package/dest/private_kernel/private_kernel_execution_prover.d.ts +1 -1
  119. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
  120. package/dest/private_kernel/private_kernel_execution_prover.js +11 -10
  121. package/dest/private_kernel/private_kernel_oracle.d.ts +3 -2
  122. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
  123. package/dest/private_kernel/private_kernel_oracle_impl.d.ts +8 -7
  124. package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +1 -1
  125. package/dest/private_kernel/private_kernel_oracle_impl.js +7 -7
  126. package/dest/public_storage/public_storage_service.d.ts +24 -0
  127. package/dest/public_storage/public_storage_service.d.ts.map +1 -0
  128. package/dest/public_storage/public_storage_service.js +26 -0
  129. package/dest/pxe.d.ts +47 -48
  130. package/dest/pxe.d.ts.map +1 -1
  131. package/dest/pxe.js +142 -171
  132. package/dest/storage/address_store/address_store.d.ts +11 -0
  133. package/dest/storage/address_store/address_store.d.ts.map +1 -0
  134. package/dest/storage/{address_data_provider/address_data_provider.js → address_store/address_store.js} +1 -1
  135. package/dest/storage/address_store/index.d.ts +2 -0
  136. package/dest/storage/address_store/index.d.ts.map +1 -0
  137. package/dest/storage/address_store/index.js +1 -0
  138. package/dest/storage/anchor_block_store/anchor_block_store.d.ts +9 -0
  139. package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -0
  140. package/dest/storage/{sync_data_provider/sync_data_provider.js → anchor_block_store/anchor_block_store.js} +2 -9
  141. package/dest/storage/anchor_block_store/index.d.ts +2 -0
  142. package/dest/storage/anchor_block_store/index.d.ts.map +1 -0
  143. package/dest/storage/anchor_block_store/index.js +1 -0
  144. package/dest/storage/capsule_store/capsule_store.d.ts +57 -0
  145. package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -0
  146. package/dest/storage/{capsule_data_provider/capsule_data_provider.js → capsule_store/capsule_store.js} +34 -6
  147. package/dest/storage/capsule_store/index.d.ts +2 -0
  148. package/dest/storage/capsule_store/index.d.ts.map +1 -0
  149. package/dest/storage/capsule_store/index.js +1 -0
  150. package/dest/storage/{contract_data_provider/contract_data_provider.d.ts → contract_store/contract_store.d.ts} +7 -15
  151. package/dest/storage/contract_store/contract_store.d.ts.map +1 -0
  152. package/dest/storage/{contract_data_provider/contract_data_provider.js → contract_store/contract_store.js} +34 -15
  153. package/dest/storage/contract_store/index.d.ts +2 -0
  154. package/dest/storage/contract_store/index.d.ts.map +1 -0
  155. package/dest/storage/contract_store/index.js +1 -0
  156. package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.d.ts +1 -1
  157. package/dest/storage/contract_store/private_functions_tree.d.ts.map +1 -0
  158. package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.js +1 -1
  159. package/dest/storage/index.d.ts +8 -8
  160. package/dest/storage/index.d.ts.map +1 -1
  161. package/dest/storage/index.js +7 -7
  162. package/dest/storage/metadata.d.ts +1 -1
  163. package/dest/storage/note_store/index.d.ts +3 -0
  164. package/dest/storage/note_store/index.d.ts.map +1 -0
  165. package/dest/storage/note_store/index.js +2 -0
  166. package/dest/storage/{note_data_provider/note_data_provider.d.ts → note_store/note_store.d.ts} +14 -13
  167. package/dest/storage/note_store/note_store.d.ts.map +1 -0
  168. package/dest/storage/{note_data_provider/note_data_provider.js → note_store/note_store.js} +33 -19
  169. package/dest/storage/private_event_store/private_event_store.d.ts +51 -0
  170. package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -0
  171. package/dest/storage/{private_event_data_provider/private_event_data_provider.js → private_event_store/private_event_store.js} +39 -28
  172. package/dest/storage/tagging_store/index.d.ts +4 -0
  173. package/dest/storage/tagging_store/index.d.ts.map +1 -0
  174. package/dest/storage/tagging_store/index.js +3 -0
  175. package/dest/storage/tagging_store/recipient_tagging_store.d.ts +21 -0
  176. package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -0
  177. package/dest/storage/tagging_store/recipient_tagging_store.js +42 -0
  178. package/dest/storage/tagging_store/sender_address_book_store.d.ts +14 -0
  179. package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +1 -0
  180. package/dest/storage/tagging_store/sender_address_book_store.js +30 -0
  181. package/dest/storage/tagging_store/sender_tagging_store.d.ts +67 -0
  182. package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -0
  183. package/dest/storage/tagging_store/sender_tagging_store.js +196 -0
  184. package/dest/tagging/index.d.ts +15 -6
  185. package/dest/tagging/index.d.ts.map +1 -1
  186. package/dest/tagging/index.js +23 -5
  187. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +14 -0
  188. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -0
  189. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +99 -0
  190. package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts +12 -0
  191. package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts.map +1 -0
  192. package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +20 -0
  193. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +14 -0
  194. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -0
  195. package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +29 -0
  196. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +20 -0
  197. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -0
  198. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +74 -0
  199. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +11 -0
  200. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -0
  201. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +32 -0
  202. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +18 -0
  203. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -0
  204. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +55 -0
  205. package/dest/tree_membership/tree_membership_service.d.ts +52 -0
  206. package/dest/tree_membership/tree_membership_service.d.ts.map +1 -0
  207. package/dest/tree_membership/tree_membership_service.js +84 -0
  208. package/package.json +20 -19
  209. package/src/bin/check_oracle_version.ts +130 -20
  210. package/src/{synchronizer/synchronizer.ts → block_synchronizer/block_synchronizer.ts} +19 -22
  211. package/src/block_synchronizer/index.ts +1 -0
  212. package/src/config/index.ts +10 -25
  213. package/src/contract_function_simulator/contract_function_simulator.ts +95 -28
  214. package/src/contract_function_simulator/execution_note_cache.ts +22 -11
  215. package/src/contract_function_simulator/execution_tagging_index_cache.ts +1 -1
  216. package/src/contract_function_simulator/hashed_values_cache.ts +1 -1
  217. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +1 -1
  218. package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +6 -5
  219. package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +2 -2
  220. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +14 -2
  221. package/src/contract_function_simulator/noir-structs/utility_context.ts +1 -1
  222. package/src/contract_function_simulator/oracle/interfaces.ts +26 -11
  223. package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +1 -1
  224. package/src/contract_function_simulator/oracle/note_packing_utils.ts +21 -5
  225. package/src/contract_function_simulator/oracle/oracle.ts +43 -13
  226. package/src/contract_function_simulator/oracle/private_execution.ts +17 -15
  227. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +100 -23
  228. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +223 -47
  229. package/src/contract_function_simulator/pick_notes.ts +1 -1
  230. package/src/contract_function_simulator/proxied_contract_data_source.ts +24 -7
  231. package/src/debug/pxe_debug_utils.ts +48 -0
  232. package/src/entrypoints/client/bundle/index.ts +0 -1
  233. package/src/entrypoints/client/bundle/utils.ts +4 -4
  234. package/src/entrypoints/client/lazy/index.ts +0 -1
  235. package/src/entrypoints/client/lazy/utils.ts +4 -4
  236. package/src/entrypoints/pxe_creation_options.ts +2 -0
  237. package/src/entrypoints/server/index.ts +1 -1
  238. package/src/entrypoints/server/utils.ts +5 -19
  239. package/src/error_enriching.ts +7 -15
  240. package/src/events/event_service.ts +77 -0
  241. package/src/events/index.ts +1 -0
  242. package/src/events/private_event_filter_validator.ts +48 -0
  243. package/src/logs/log_service.ts +202 -0
  244. package/src/notes/index.ts +1 -0
  245. package/src/notes/note_service.ts +200 -0
  246. package/src/oracle_version.ts +2 -2
  247. package/src/private_kernel/hints/build_private_kernel_reset_private_inputs.ts +5 -9
  248. package/src/private_kernel/private_kernel_execution_prover.ts +12 -16
  249. package/src/private_kernel/private_kernel_oracle.ts +2 -1
  250. package/src/private_kernel/private_kernel_oracle_impl.ts +10 -9
  251. package/src/public_storage/public_storage_service.ts +33 -0
  252. package/src/pxe.ts +167 -223
  253. package/src/storage/{address_data_provider/address_data_provider.ts → address_store/address_store.ts} +1 -1
  254. package/src/storage/address_store/index.ts +1 -0
  255. package/src/storage/{sync_data_provider/sync_data_provider.ts → anchor_block_store/anchor_block_store.ts} +2 -11
  256. package/src/storage/anchor_block_store/index.ts +1 -0
  257. package/src/storage/{capsule_data_provider/capsule_data_provider.ts → capsule_store/capsule_store.ts} +34 -2
  258. package/src/storage/capsule_store/index.ts +1 -0
  259. package/src/storage/{contract_data_provider/contract_data_provider.ts → contract_store/contract_store.ts} +45 -20
  260. package/src/storage/contract_store/index.ts +1 -0
  261. package/src/storage/{contract_data_provider → contract_store}/private_functions_tree.ts +1 -1
  262. package/src/storage/index.ts +7 -7
  263. package/src/storage/note_store/index.ts +2 -0
  264. package/src/storage/{note_data_provider/note_data_provider.ts → note_store/note_store.ts} +41 -22
  265. package/src/storage/{private_event_data_provider/private_event_data_provider.ts → private_event_store/private_event_store.ts} +61 -47
  266. package/src/storage/tagging_store/index.ts +3 -0
  267. package/src/storage/tagging_store/recipient_tagging_store.ts +53 -0
  268. package/src/storage/tagging_store/sender_address_book_store.ts +42 -0
  269. package/src/storage/tagging_store/sender_tagging_store.ts +244 -0
  270. package/src/tagging/index.ts +27 -5
  271. package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +129 -0
  272. package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +34 -0
  273. package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +43 -0
  274. package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +96 -0
  275. package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +44 -0
  276. package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +72 -0
  277. package/src/tree_membership/tree_membership_service.ts +112 -0
  278. package/dest/contract_function_simulator/execution_data_provider.d.ts +0 -274
  279. package/dest/contract_function_simulator/execution_data_provider.d.ts.map +0 -1
  280. package/dest/contract_function_simulator/execution_data_provider.js +0 -14
  281. package/dest/contract_function_simulator/pxe_oracle_interface.d.ts +0 -122
  282. package/dest/contract_function_simulator/pxe_oracle_interface.d.ts.map +0 -1
  283. package/dest/contract_function_simulator/pxe_oracle_interface.js +0 -701
  284. package/dest/storage/address_data_provider/address_data_provider.d.ts +0 -11
  285. package/dest/storage/address_data_provider/address_data_provider.d.ts.map +0 -1
  286. package/dest/storage/address_data_provider/index.d.ts +0 -2
  287. package/dest/storage/address_data_provider/index.d.ts.map +0 -1
  288. package/dest/storage/address_data_provider/index.js +0 -1
  289. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts +0 -25
  290. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +0 -1
  291. package/dest/storage/capsule_data_provider/index.d.ts +0 -2
  292. package/dest/storage/capsule_data_provider/index.d.ts.map +0 -1
  293. package/dest/storage/capsule_data_provider/index.js +0 -1
  294. package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +0 -1
  295. package/dest/storage/contract_data_provider/index.d.ts +0 -2
  296. package/dest/storage/contract_data_provider/index.d.ts.map +0 -1
  297. package/dest/storage/contract_data_provider/index.js +0 -1
  298. package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +0 -1
  299. package/dest/storage/note_data_provider/index.d.ts +0 -3
  300. package/dest/storage/note_data_provider/index.d.ts.map +0 -1
  301. package/dest/storage/note_data_provider/index.js +0 -2
  302. package/dest/storage/note_data_provider/note_dao.d.ts +0 -100
  303. package/dest/storage/note_data_provider/note_dao.d.ts.map +0 -1
  304. package/dest/storage/note_data_provider/note_dao.js +0 -102
  305. package/dest/storage/note_data_provider/note_data_provider.d.ts.map +0 -1
  306. package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +0 -43
  307. package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts.map +0 -1
  308. package/dest/storage/sync_data_provider/index.d.ts +0 -2
  309. package/dest/storage/sync_data_provider/index.d.ts.map +0 -1
  310. package/dest/storage/sync_data_provider/index.js +0 -1
  311. package/dest/storage/sync_data_provider/sync_data_provider.d.ts +0 -10
  312. package/dest/storage/sync_data_provider/sync_data_provider.d.ts.map +0 -1
  313. package/dest/storage/tagging_data_provider/index.d.ts +0 -2
  314. package/dest/storage/tagging_data_provider/index.d.ts.map +0 -1
  315. package/dest/storage/tagging_data_provider/index.js +0 -1
  316. package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts +0 -40
  317. package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts.map +0 -1
  318. package/dest/storage/tagging_data_provider/tagging_data_provider.js +0 -89
  319. package/dest/synchronizer/index.d.ts +0 -2
  320. package/dest/synchronizer/index.d.ts.map +0 -1
  321. package/dest/synchronizer/index.js +0 -1
  322. package/dest/synchronizer/synchronizer.d.ts +0 -35
  323. package/dest/synchronizer/synchronizer.d.ts.map +0 -1
  324. package/dest/tagging/constants.d.ts +0 -2
  325. package/dest/tagging/constants.d.ts.map +0 -1
  326. package/dest/tagging/constants.js +0 -2
  327. package/dest/tagging/siloed_tag.d.ts +0 -14
  328. package/dest/tagging/siloed_tag.d.ts.map +0 -1
  329. package/dest/tagging/siloed_tag.js +0 -20
  330. package/dest/tagging/tag.d.ts +0 -12
  331. package/dest/tagging/tag.d.ts.map +0 -1
  332. package/dest/tagging/tag.js +0 -17
  333. package/dest/tagging/utils.d.ts +0 -18
  334. package/dest/tagging/utils.d.ts.map +0 -1
  335. package/dest/tagging/utils.js +0 -24
  336. package/src/contract_function_simulator/execution_data_provider.ts +0 -343
  337. package/src/contract_function_simulator/pxe_oracle_interface.ts +0 -1019
  338. package/src/storage/address_data_provider/index.ts +0 -1
  339. package/src/storage/capsule_data_provider/index.ts +0 -1
  340. package/src/storage/contract_data_provider/index.ts +0 -1
  341. package/src/storage/note_data_provider/index.ts +0 -2
  342. package/src/storage/note_data_provider/note_dao.ts +0 -154
  343. package/src/storage/sync_data_provider/index.ts +0 -1
  344. package/src/storage/tagging_data_provider/index.ts +0 -1
  345. package/src/storage/tagging_data_provider/tagging_data_provider.ts +0 -120
  346. package/src/synchronizer/index.ts +0 -1
  347. package/src/tagging/constants.ts +0 -2
  348. package/src/tagging/siloed_tag.ts +0 -22
  349. package/src/tagging/tag.ts +0 -16
  350. package/src/tagging/utils.ts +0 -31
@@ -0,0 +1,18 @@
1
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
2
+ import type { AztecNode } from '@aztec/stdlib/interfaces/server';
3
+ import type { DirectionalAppTaggingSecret } from '@aztec/stdlib/logs';
4
+ import type { SenderTaggingStore } from '../../../storage/tagging_store/sender_tagging_store.js';
5
+ /**
6
+ * Loads tagging indexes from the Aztec node and stores them in the tagging data provider.
7
+ * @remarks This function is one of two places by which a pending index can get to the tagging data provider. The other
8
+ * place is when a tx is being sent from this PXE.
9
+ * @param secret - The directional app tagging secret that's unique for (sender, recipient, contract) tuple.
10
+ * @param app - The address of the contract that the logs are tagged for. Used for siloing tags to match
11
+ * kernel circuit behavior.
12
+ * @param start - The starting index (inclusive) of the window to process.
13
+ * @param end - The ending index (exclusive) of the window to process.
14
+ * @param aztecNode - The Aztec node instance to query for logs.
15
+ * @param taggingStore - The data provider to store pending indexes.
16
+ */
17
+ export declare function loadAndStoreNewTaggingIndexes(secret: DirectionalAppTaggingSecret, app: AztecAddress, start: number, end: number, aztecNode: AztecNode, taggingStore: SenderTaggingStore): Promise<void>;
18
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9hZF9hbmRfc3RvcmVfbmV3X3RhZ2dpbmdfaW5kZXhlcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL3RhZ2dpbmcvc2VuZGVyX3N5bmMvdXRpbHMvbG9hZF9hbmRfc3RvcmVfbmV3X3RhZ2dpbmdfaW5kZXhlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUNoRSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNqRSxPQUFPLEtBQUssRUFBRSwyQkFBMkIsRUFBVSxNQUFNLG9CQUFvQixDQUFDO0FBSTlFLE9BQU8sS0FBSyxFQUFFLGtCQUFrQixFQUFFLE1BQU0sd0RBQXdELENBQUM7QUFFakc7Ozs7Ozs7Ozs7O0dBV0c7QUFDSCx3QkFBc0IsNkJBQTZCLENBQ2pELE1BQU0sRUFBRSwyQkFBMkIsRUFDbkMsR0FBRyxFQUFFLFlBQVksRUFDakIsS0FBSyxFQUFFLE1BQU0sRUFDYixHQUFHLEVBQUUsTUFBTSxFQUNYLFNBQVMsRUFBRSxTQUFTLEVBQ3BCLFlBQVksRUFBRSxrQkFBa0IsaUJBa0JqQyJ9
@@ -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,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,2BAA2B,EAAU,MAAM,oBAAoB,CAAC;AAI9E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wDAAwD,CAAC;AAEjG;;;;;;;;;;;GAWG;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,iBAkBjC"}
@@ -0,0 +1,55 @@
1
+ import { SiloedTag, Tag } from '@aztec/stdlib/logs';
2
+ import { TxHash } from '@aztec/stdlib/tx';
3
+ /**
4
+ * Loads tagging indexes from the Aztec node and stores them in the tagging data provider.
5
+ * @remarks This function is one of two places by which a pending index can get to the tagging data provider. The other
6
+ * place is when a tx is being sent from this PXE.
7
+ * @param secret - The directional app tagging secret that's unique for (sender, recipient, contract) tuple.
8
+ * @param app - The address of the contract that the logs are tagged for. Used for siloing tags to match
9
+ * kernel circuit behavior.
10
+ * @param start - The starting index (inclusive) of the window to process.
11
+ * @param end - The ending index (exclusive) of the window to process.
12
+ * @param aztecNode - The Aztec node instance to query for logs.
13
+ * @param taggingStore - The data provider to store pending indexes.
14
+ */ export async function loadAndStoreNewTaggingIndexes(secret, app, start, end, aztecNode, taggingStore) {
15
+ // We compute the tags for the current window of indexes
16
+ const preTagsForWindow = Array(end - start).fill(0).map((_, i)=>({
17
+ secret,
18
+ index: start + i
19
+ }));
20
+ const siloedTagsForWindow = await Promise.all(preTagsForWindow.map(async (preTag)=>SiloedTag.compute(await Tag.compute(preTag), app)));
21
+ const txsForTags = await getTxsContainingTags(siloedTagsForWindow, aztecNode);
22
+ const highestIndexMap = getTxHighestIndexMap(txsForTags, preTagsForWindow);
23
+ // Now we iterate over the map, reconstruct the preTags and tx hash and store them in the db.
24
+ for (const [txHashStr, highestIndex] of highestIndexMap.entries()){
25
+ const txHash = TxHash.fromString(txHashStr);
26
+ await taggingStore.storePendingIndexes([
27
+ {
28
+ secret,
29
+ index: highestIndex
30
+ }
31
+ ], txHash);
32
+ }
33
+ }
34
+ // Returns txs that used the given tags. A tag might have been used in multiple txs and for this reason we return
35
+ // an array for each tag.
36
+ async function getTxsContainingTags(tags, aztecNode) {
37
+ const allLogs = await aztecNode.getPrivateLogsByTags(tags);
38
+ return allLogs.map((logs)=>logs.map((log)=>log.txHash));
39
+ }
40
+ // Returns a map of txHash to the highest index for that txHash.
41
+ function getTxHighestIndexMap(txHashesForTags, preTagsForWindow) {
42
+ if (txHashesForTags.length !== preTagsForWindow.length) {
43
+ throw new Error(`Number of tx hashes arrays does not match number of pre-tags. ${txHashesForTags.length} !== ${preTagsForWindow.length}`);
44
+ }
45
+ const highestIndexMap = new Map();
46
+ for(let i = 0; i < txHashesForTags.length; i++){
47
+ const taggingIndex = preTagsForWindow[i].index;
48
+ const txHashesForTag = txHashesForTags[i];
49
+ for (const txHash of txHashesForTag){
50
+ const key = txHash.toString();
51
+ highestIndexMap.set(key, Math.max(highestIndexMap.get(key) ?? 0, taggingIndex));
52
+ }
53
+ }
54
+ return highestIndexMap;
55
+ }
@@ -0,0 +1,52 @@
1
+ import type { L1_TO_L2_MSG_TREE_HEIGHT } from '@aztec/constants';
2
+ import type { Fr } from '@aztec/foundation/curves/bn254';
3
+ import type { SiblingPath } from '@aztec/foundation/trees';
4
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
5
+ import type { BlockParameter } from '@aztec/stdlib/block';
6
+ import type { AztecNode } from '@aztec/stdlib/interfaces/server';
7
+ import { MerkleTreeId, NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
8
+ import type { AnchorBlockStore } from '../storage/anchor_block_store/anchor_block_store.js';
9
+ export declare class TreeMembershipService {
10
+ #private;
11
+ private readonly aztecNode;
12
+ private readonly anchorBlockStore;
13
+ constructor(aztecNode: AztecNode, anchorBlockStore: AnchorBlockStore);
14
+ /**
15
+ * Gets the index of a nullifier in the nullifier tree.
16
+ * @returns - The index of the nullifier. Undefined if it does not exist in the tree.
17
+ */
18
+ getNullifierIndex(nullifier: Fr): Promise<bigint | undefined>;
19
+ /**
20
+ * Fetches the index and sibling path of a leaf at a given block from a given tree.
21
+ * @param blockNumber - The block number at which to get the membership witness.
22
+ * @param treeId - Id of the tree to get the sibling path from.
23
+ * @param leafValue - The leaf value
24
+ * @returns The index and sibling path concatenated [index, sibling_path]
25
+ */
26
+ getMembershipWitness(blockNumber: BlockParameter, treeId: MerkleTreeId, leafValue: Fr): Promise<Fr[]>;
27
+ /**
28
+ * Returns a low nullifier membership witness for a given nullifier at a given block.
29
+ * @param blockNumber - The block number at which to get the index.
30
+ * @param nullifier - Nullifier we try to find the low nullifier witness for.
31
+ * @returns The low nullifier membership witness (if found).
32
+ * @remarks Low nullifier witness can be used to perform a nullifier non-inclusion proof by leveraging the "linked
33
+ * list structure" of leaves and proving that a lower nullifier is pointing to a bigger next value than the nullifier
34
+ * we are trying to prove non-inclusion for.
35
+ */
36
+ getLowNullifierMembershipWitness(blockNumber: BlockParameter, nullifier: Fr): Promise<NullifierMembershipWitness | undefined>;
37
+ /**
38
+ * Returns a witness for a given slot of the public data tree at a given block.
39
+ * @param blockNumber - The block number at which to get the witness.
40
+ * @param leafSlot - The slot of the public data in the public data tree.
41
+ */
42
+ getPublicDataWitness(blockNumber: BlockParameter, leafSlot: Fr): Promise<PublicDataWitness | undefined>;
43
+ /**
44
+ * Looks for the L1 to L2 membership witness of a message at the Aztec node, given its hash.
45
+ * @param contractAddress - Address of a contract by which the message was emitted.
46
+ * @dev Contract address and secret are only used to compute the nullifier to get non-nullified messages.
47
+ * The message nullifier is computed locally, so the secret is not sent to the node.
48
+ * @returns The l1 to l2 membership witness (index of message in the tree and sibling path).
49
+ */
50
+ getL1ToL2MembershipWitness(contractAddress: AztecAddress, messageHash: Fr, secret: Fr): Promise<[bigint, SiblingPath<typeof L1_TO_L2_MSG_TREE_HEIGHT>]>;
51
+ }
52
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJlZV9tZW1iZXJzaGlwX3NlcnZpY2UuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90cmVlX21lbWJlcnNoaXAvdHJlZV9tZW1iZXJzaGlwX3NlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsd0JBQXdCLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUNqRSxPQUFPLEtBQUssRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUN6RCxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUMzRCxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUNoRSxPQUFPLEtBQUssRUFBRSxjQUFjLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUMxRCxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUVqRSxPQUFPLEVBQUUsWUFBWSxFQUFFLDBCQUEwQixFQUFFLGlCQUFpQixFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFFbEcsT0FBTyxLQUFLLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxxREFBcUQsQ0FBQztBQUU1RixxQkFBYSxxQkFBcUI7O0lBRTlCLE9BQU8sQ0FBQyxRQUFRLENBQUMsU0FBUztJQUMxQixPQUFPLENBQUMsUUFBUSxDQUFDLGdCQUFnQjtJQUZuQyxZQUNtQixTQUFTLEVBQUUsU0FBUyxFQUNwQixnQkFBZ0IsRUFBRSxnQkFBZ0IsRUFDakQ7SUFFSjs7O09BR0c7SUFDSSxpQkFBaUIsQ0FBQyxTQUFTLEVBQUUsRUFBRSwrQkFFckM7SUFFRDs7Ozs7O09BTUc7SUFDVSxvQkFBb0IsQ0FBQyxXQUFXLEVBQUUsY0FBYyxFQUFFLE1BQU0sRUFBRSxZQUFZLEVBQUUsU0FBUyxFQUFFLEVBQUUsR0FBRyxPQUFPLENBQUMsRUFBRSxFQUFFLENBQUMsQ0FNakg7SUFFRDs7Ozs7Ozs7T0FRRztJQUNVLGdDQUFnQyxDQUMzQyxXQUFXLEVBQUUsY0FBYyxFQUMzQixTQUFTLEVBQUUsRUFBRSxHQUNaLE9BQU8sQ0FBQywwQkFBMEIsR0FBRyxTQUFTLENBQUMsQ0FNakQ7SUFFRDs7OztPQUlHO0lBQ1Usb0JBQW9CLENBQUMsV0FBVyxFQUFFLGNBQWMsRUFBRSxRQUFRLEVBQUUsRUFBRSxHQUFHLE9BQU8sQ0FBQyxpQkFBaUIsR0FBRyxTQUFTLENBQUMsQ0FNbkg7SUFFRDs7Ozs7O09BTUc7SUFDSSwwQkFBMEIsQ0FDL0IsZUFBZSxFQUFFLFlBQVksRUFDN0IsV0FBVyxFQUFFLEVBQUUsRUFDZixNQUFNLEVBQUUsRUFBRSxHQUNULE9BQU8sQ0FBQyxDQUFDLE1BQU0sRUFBRSxXQUFXLENBQUMsT0FBTyx3QkFBd0IsQ0FBQyxDQUFDLENBQUMsQ0FFakU7Q0F5QkYifQ==
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree_membership_service.d.ts","sourceRoot":"","sources":["../../src/tree_membership/tree_membership_service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,EAAE,YAAY,EAAE,0BAA0B,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAElG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qDAAqD,CAAC;AAE5F,qBAAa,qBAAqB;;IAE9B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAFnC,YACmB,SAAS,EAAE,SAAS,EACpB,gBAAgB,EAAE,gBAAgB,EACjD;IAEJ;;;OAGG;IACI,iBAAiB,CAAC,SAAS,EAAE,EAAE,+BAErC;IAED;;;;;;OAMG;IACU,oBAAoB,CAAC,WAAW,EAAE,cAAc,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,EAAE,GAAG,OAAO,CAAC,EAAE,EAAE,CAAC,CAMjH;IAED;;;;;;;;OAQG;IACU,gCAAgC,CAC3C,WAAW,EAAE,cAAc,EAC3B,SAAS,EAAE,EAAE,GACZ,OAAO,CAAC,0BAA0B,GAAG,SAAS,CAAC,CAMjD;IAED;;;;OAIG;IACU,oBAAoB,CAAC,WAAW,EAAE,cAAc,EAAE,QAAQ,EAAE,EAAE,GAAG,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC,CAMnH;IAED;;;;;;OAMG;IACI,0BAA0B,CAC/B,eAAe,EAAE,YAAY,EAC7B,WAAW,EAAE,EAAE,EACf,MAAM,EAAE,EAAE,GACT,OAAO,CAAC,CAAC,MAAM,EAAE,WAAW,CAAC,OAAO,wBAAwB,CAAC,CAAC,CAAC,CAEjE;CAyBF"}
@@ -0,0 +1,84 @@
1
+ import { getNonNullifiedL1ToL2MessageWitness } from '@aztec/stdlib/messaging';
2
+ import { MerkleTreeId } from '@aztec/stdlib/trees';
3
+ export class TreeMembershipService {
4
+ aztecNode;
5
+ anchorBlockStore;
6
+ constructor(aztecNode, anchorBlockStore){
7
+ this.aztecNode = aztecNode;
8
+ this.anchorBlockStore = anchorBlockStore;
9
+ }
10
+ /**
11
+ * Gets the index of a nullifier in the nullifier tree.
12
+ * @returns - The index of the nullifier. Undefined if it does not exist in the tree.
13
+ */ getNullifierIndex(nullifier) {
14
+ return this.#findLeafIndex('latest', MerkleTreeId.NULLIFIER_TREE, nullifier);
15
+ }
16
+ /**
17
+ * Fetches the index and sibling path of a leaf at a given block from a given tree.
18
+ * @param blockNumber - The block number at which to get the membership witness.
19
+ * @param treeId - Id of the tree to get the sibling path from.
20
+ * @param leafValue - The leaf value
21
+ * @returns The index and sibling path concatenated [index, sibling_path]
22
+ */ async getMembershipWitness(blockNumber, treeId, leafValue) {
23
+ const witness = await this.#tryGetMembershipWitness(blockNumber, treeId, leafValue);
24
+ if (!witness) {
25
+ throw new Error(`Leaf value ${leafValue} not found in tree ${MerkleTreeId[treeId]} at block ${blockNumber}`);
26
+ }
27
+ return witness;
28
+ }
29
+ /**
30
+ * Returns a low nullifier membership witness for a given nullifier at a given block.
31
+ * @param blockNumber - The block number at which to get the index.
32
+ * @param nullifier - Nullifier we try to find the low nullifier witness for.
33
+ * @returns The low nullifier membership witness (if found).
34
+ * @remarks Low nullifier witness can be used to perform a nullifier non-inclusion proof by leveraging the "linked
35
+ * list structure" of leaves and proving that a lower nullifier is pointing to a bigger next value than the nullifier
36
+ * we are trying to prove non-inclusion for.
37
+ */ async getLowNullifierMembershipWitness(blockNumber, nullifier) {
38
+ const anchorBlockNumber = (await this.anchorBlockStore.getBlockHeader()).getBlockNumber();
39
+ if (blockNumber !== 'latest' && blockNumber > anchorBlockNumber) {
40
+ throw new Error(`Block number ${blockNumber} is higher than current block ${anchorBlockNumber}`);
41
+ }
42
+ return this.aztecNode.getLowNullifierMembershipWitness(blockNumber, nullifier);
43
+ }
44
+ /**
45
+ * Returns a witness for a given slot of the public data tree at a given block.
46
+ * @param blockNumber - The block number at which to get the witness.
47
+ * @param leafSlot - The slot of the public data in the public data tree.
48
+ */ async getPublicDataWitness(blockNumber, leafSlot) {
49
+ const anchorBlockNumber = (await this.anchorBlockStore.getBlockHeader()).getBlockNumber();
50
+ if (blockNumber !== 'latest' && blockNumber > anchorBlockNumber) {
51
+ throw new Error(`Block number ${blockNumber} is higher than current block ${anchorBlockNumber}`);
52
+ }
53
+ return await this.aztecNode.getPublicDataWitness(blockNumber, leafSlot);
54
+ }
55
+ /**
56
+ * Looks for the L1 to L2 membership witness of a message at the Aztec node, given its hash.
57
+ * @param contractAddress - Address of a contract by which the message was emitted.
58
+ * @dev Contract address and secret are only used to compute the nullifier to get non-nullified messages.
59
+ * The message nullifier is computed locally, so the secret is not sent to the node.
60
+ * @returns The l1 to l2 membership witness (index of message in the tree and sibling path).
61
+ */ getL1ToL2MembershipWitness(contractAddress, messageHash, secret) {
62
+ return getNonNullifiedL1ToL2MessageWitness(this.aztecNode, contractAddress, messageHash, secret);
63
+ }
64
+ async #tryGetMembershipWitness(blockNumber, treeId, value) {
65
+ switch(treeId){
66
+ case MerkleTreeId.NULLIFIER_TREE:
67
+ return (await this.aztecNode.getNullifierMembershipWitness(blockNumber, value))?.withoutPreimage().toFields();
68
+ case MerkleTreeId.NOTE_HASH_TREE:
69
+ return (await this.aztecNode.getNoteHashMembershipWitness(blockNumber, value))?.toFields();
70
+ case MerkleTreeId.PUBLIC_DATA_TREE:
71
+ return (await this.aztecNode.getPublicDataWitness(blockNumber, value))?.withoutPreimage().toFields();
72
+ case MerkleTreeId.ARCHIVE:
73
+ return (await this.aztecNode.getArchiveMembershipWitness(blockNumber, value))?.toFields();
74
+ default:
75
+ throw new Error('Not implemented');
76
+ }
77
+ }
78
+ async #findLeafIndex(blockNumber, treeId, leafValue) {
79
+ const [leafIndex] = await this.aztecNode.findLeavesIndexes(blockNumber, treeId, [
80
+ leafValue
81
+ ]);
82
+ return leafIndex?.data;
83
+ }
84
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/pxe",
3
- "version": "0.0.1-commit.b655e406",
3
+ "version": "0.0.1-commit.c7c42ec",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./server": "./dest/entrypoints/server/index.js",
@@ -11,8 +11,8 @@
11
11
  },
12
12
  "bin": "./dest/bin/index.js",
13
13
  "scripts": {
14
- "build": "yarn clean && yarn generate && tsc -b",
15
- "build:dev": "tsc -b --watch",
14
+ "build": "yarn clean && yarn generate && tsgo -b",
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}",
18
18
  "generate": "node ./scripts/generate_package_info.js",
@@ -61,34 +61,35 @@
61
61
  ]
62
62
  },
63
63
  "dependencies": {
64
- "@aztec/bb-prover": "0.0.1-commit.b655e406",
65
- "@aztec/bb.js": "0.0.1-commit.b655e406",
66
- "@aztec/builder": "0.0.1-commit.b655e406",
67
- "@aztec/constants": "0.0.1-commit.b655e406",
68
- "@aztec/ethereum": "0.0.1-commit.b655e406",
69
- "@aztec/foundation": "0.0.1-commit.b655e406",
70
- "@aztec/key-store": "0.0.1-commit.b655e406",
71
- "@aztec/kv-store": "0.0.1-commit.b655e406",
72
- "@aztec/noir-protocol-circuits-types": "0.0.1-commit.b655e406",
73
- "@aztec/noir-types": "0.0.1-commit.b655e406",
74
- "@aztec/protocol-contracts": "0.0.1-commit.b655e406",
75
- "@aztec/simulator": "0.0.1-commit.b655e406",
76
- "@aztec/stdlib": "0.0.1-commit.b655e406",
64
+ "@aztec/bb-prover": "0.0.1-commit.c7c42ec",
65
+ "@aztec/bb.js": "0.0.1-commit.c7c42ec",
66
+ "@aztec/builder": "0.0.1-commit.c7c42ec",
67
+ "@aztec/constants": "0.0.1-commit.c7c42ec",
68
+ "@aztec/ethereum": "0.0.1-commit.c7c42ec",
69
+ "@aztec/foundation": "0.0.1-commit.c7c42ec",
70
+ "@aztec/key-store": "0.0.1-commit.c7c42ec",
71
+ "@aztec/kv-store": "0.0.1-commit.c7c42ec",
72
+ "@aztec/noir-protocol-circuits-types": "0.0.1-commit.c7c42ec",
73
+ "@aztec/noir-types": "0.0.1-commit.c7c42ec",
74
+ "@aztec/protocol-contracts": "0.0.1-commit.c7c42ec",
75
+ "@aztec/simulator": "0.0.1-commit.c7c42ec",
76
+ "@aztec/stdlib": "0.0.1-commit.c7c42ec",
77
77
  "koa": "^2.16.1",
78
78
  "koa-router": "^13.1.1",
79
79
  "lodash.omit": "^4.5.0",
80
80
  "sha3": "^2.1.4",
81
81
  "tslib": "^2.4.0",
82
- "viem": "npm:@spalladino/viem@2.38.2-eip7594.0"
82
+ "viem": "npm:@aztec/viem@2.38.2"
83
83
  },
84
84
  "devDependencies": {
85
- "@aztec/merkle-tree": "0.0.1-commit.b655e406",
86
- "@aztec/noir-test-contracts.js": "0.0.1-commit.b655e406",
85
+ "@aztec/merkle-tree": "0.0.1-commit.c7c42ec",
86
+ "@aztec/noir-test-contracts.js": "0.0.1-commit.c7c42ec",
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
93
  "jest": "^30.0.0",
93
94
  "jest-mock-extended": "^4.0.0",
94
95
  "lodash.times": "^4.3.2",
@@ -1,6 +1,10 @@
1
- import { keccak256String } from '@aztec/foundation/crypto';
1
+ import { keccak256String } from '@aztec/foundation/crypto/keccak';
2
+
3
+ import { readFileSync } from 'fs';
4
+ import { dirname, join } from 'path';
5
+ import ts from 'typescript';
6
+ import { fileURLToPath } from 'url';
2
7
 
3
- import { Oracle } from '../contract_function_simulator/oracle/oracle.js';
4
8
  import { ORACLE_INTERFACE_HASH } from '../oracle_version.js';
5
9
 
6
10
  /**
@@ -16,6 +20,22 @@ import { ORACLE_INTERFACE_HASH } from '../oracle_version.js';
16
20
  * oracle interface like we do in PXE (i.e., there is no single Oracle class that contains only the oracles).
17
21
  */
18
22
  function assertOracleInterfaceMatches(): void {
23
+ const oracleInterfaceSignature = getOracleInterfaceSignature();
24
+
25
+ // We use keccak256 here just because we already have it in the dependencies.
26
+ const oracleInterfaceHash = keccak256String(oracleInterfaceSignature);
27
+ if (oracleInterfaceHash !== ORACLE_INTERFACE_HASH) {
28
+ // This check exists only to notify you when you need to update the ORACLE_VERSION constant.
29
+ 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
+ );
32
+ }
33
+ }
34
+
35
+ /**
36
+ * Constructs a signature of the Oracle interface while ignoring methods that are not foreign call handlers.
37
+ */
38
+ function getOracleInterfaceSignature(): string {
19
39
  const excludedProps = [
20
40
  'handler',
21
41
  'constructor',
@@ -25,26 +45,116 @@ function assertOracleInterfaceMatches(): void {
25
45
  'handlerAsPrivate',
26
46
  ] as const;
27
47
 
28
- // Create a hashable representation of the oracle interface by concatenating its method names. Return values are
29
- // excluded from the hash calculation since they are typically arrays of fields and I didn't manage to reliably
30
- // stringify them.
31
- // TODO(#16581): we're only checking the functions implemented by the Oracle object, which is really an ACVM
32
- // translator, akin to TXE's RPC translator. This is correct in that it is ultimately the foreign interface that
33
- // matters, but incorrect in that it does not take into consideration TXE's extended interface. An improvement would
34
- // be to check RPCTranslator from TXE, though that still seems a bit fragile.
35
- const oracleInterfaceMethodNames = Object.getOwnPropertyNames(Oracle.prototype)
36
- .filter(name => !excludedProps.includes(name as (typeof excludedProps)[number]))
37
- .sort()
38
- .join('');
48
+ // Get the path to Oracle.ts source file
49
+ // The script runs from dest/bin/ after compilation, so we need to go up to the package root
50
+ // then into src/ to find the source file
51
+ const currentDir = dirname(fileURLToPath(import.meta.url));
52
+ // Go up from dest/bin/ or src/bin/ to the package root (pxe/), then into src/
53
+ const packageRoot = dirname(dirname(currentDir)); // Go up from bin/ to pxe/
54
+ const oracleSourcePath = join(packageRoot, 'src/contract_function_simulator/oracle/oracle.ts');
39
55
 
40
- // We use keccak256 here just because we already have it in the dependencies.
41
- const oracleInterfaceHash = keccak256String(oracleInterfaceMethodNames);
42
- if (oracleInterfaceHash !== ORACLE_INTERFACE_HASH) {
43
- // This check exists only to notify you when you need to update the ORACLE_VERSION constant.
44
- throw new Error(
45
- `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.`,
46
- );
56
+ // Read and parse the TypeScript source file
57
+ const sourceCode = readFileSync(oracleSourcePath, 'utf-8');
58
+ const sourceFile = ts.createSourceFile('oracle.ts', sourceCode, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
59
+
60
+ // Extract method signatures from the Oracle class
61
+ const methodSignatures: string[] = [];
62
+
63
+ function visit(node: ts.Node) {
64
+ // Look for class declaration named "Oracle"
65
+ if (ts.isClassDeclaration(node) && node.name?.text === 'Oracle') {
66
+ // Visit all members of the class
67
+ node.members.forEach(member => {
68
+ if (ts.isMethodDeclaration(member) && member.name && ts.isIdentifier(member.name)) {
69
+ const methodName = member.name.text;
70
+
71
+ // Skip excluded methods
72
+ if (excludedProps.includes(methodName as (typeof excludedProps)[number])) {
73
+ return;
74
+ }
75
+
76
+ // Extract parameter signatures
77
+ const paramSignatures: string[] = [];
78
+ member.parameters.forEach(param => {
79
+ const paramName = extractParameterName(param, sourceFile);
80
+ const paramType = extractTypeString(param.type, sourceFile);
81
+ paramSignatures.push(`${paramName}: ${paramType}`);
82
+ });
83
+
84
+ // Extract return type
85
+ const returnType = extractTypeString(member.type, sourceFile);
86
+
87
+ // Build full signature: methodName(param1: Type1, param2: Type2): ReturnType
88
+ const signature = `${methodName}(${paramSignatures.join(', ')}): ${returnType}`;
89
+ methodSignatures.push(signature);
90
+ }
91
+ });
92
+ }
93
+
94
+ ts.forEachChild(node, visit);
95
+ }
96
+
97
+ visit(sourceFile);
98
+
99
+ // Sort signatures alphabetically for consistent hashing
100
+ methodSignatures.sort();
101
+
102
+ // Create a hashable representation by concatenating all signatures
103
+ return methodSignatures.join('');
104
+ }
105
+
106
+ /**
107
+ * Extracts the parameter name from a parameter node, handling destructured parameters.
108
+ */
109
+ function extractParameterName(param: ts.ParameterDeclaration, sourceFile: ts.SourceFile): string {
110
+ const name = param.name;
111
+
112
+ if (ts.isIdentifier(name)) {
113
+ return name.text;
47
114
  }
115
+
116
+ if (ts.isArrayBindingPattern(name)) {
117
+ // Handle destructured parameters like [blockNumber]: ACVMField[]
118
+ // Extract the first element name
119
+ if (name.elements.length > 0) {
120
+ const element = name.elements[0];
121
+ if (ts.isBindingElement(element)) {
122
+ const elementName = element.name;
123
+ if (ts.isIdentifier(elementName)) {
124
+ return elementName.text;
125
+ }
126
+ // Nested destructuring - use text representation
127
+ if (ts.isArrayBindingPattern(elementName) || ts.isObjectBindingPattern(elementName)) {
128
+ return elementName.getText(sourceFile);
129
+ }
130
+ }
131
+ }
132
+ // Fallback: return the text representation
133
+ return name.getText(sourceFile);
134
+ }
135
+
136
+ if (ts.isObjectBindingPattern(name)) {
137
+ // Handle object destructuring
138
+ return name.getText(sourceFile);
139
+ }
140
+
141
+ // Fallback for any other case - this should never happen but TypeScript needs it
142
+ return (name as ts.Node).getText(sourceFile);
143
+ }
144
+
145
+ /**
146
+ * Extracts the type string from a type node, normalizing whitespace.
147
+ */
148
+ function extractTypeString(typeNode: ts.TypeNode | undefined, sourceFile: ts.SourceFile): string {
149
+ if (!typeNode) {
150
+ return 'void';
151
+ }
152
+
153
+ // Get the type text and normalize whitespace
154
+ let typeText = typeNode.getText(sourceFile);
155
+ // Normalize whitespace: remove extra spaces, newlines, and tabs
156
+ typeText = typeText.replace(/\s+/g, ' ').trim();
157
+ return typeText;
48
158
  }
49
159
 
50
160
  assertOracleInterfaceMatches();
@@ -1,35 +1,34 @@
1
+ import { BlockNumber } from '@aztec/foundation/branded-types';
1
2
  import { type Logger, createLogger } from '@aztec/foundation/log';
2
3
  import type { L2TipsKVStore } from '@aztec/kv-store/stores';
3
4
  import { L2BlockStream, type L2BlockStreamEvent, type L2BlockStreamEventHandler } from '@aztec/stdlib/block';
4
5
  import type { AztecNode } from '@aztec/stdlib/interfaces/client';
5
6
 
6
7
  import type { PXEConfig } from '../config/index.js';
7
- import type { NoteDataProvider } from '../storage/note_data_provider/note_data_provider.js';
8
- import type { SyncDataProvider } from '../storage/sync_data_provider/sync_data_provider.js';
9
- import type { TaggingDataProvider } from '../storage/tagging_data_provider/tagging_data_provider.js';
8
+ import type { AnchorBlockStore } from '../storage/anchor_block_store/anchor_block_store.js';
9
+ import type { NoteStore } from '../storage/note_store/note_store.js';
10
10
 
11
11
  /**
12
- * The Synchronizer class orchestrates synchronization between the PXE and Aztec node, maintaining an up-to-date
12
+ * The BlockSynchronizer class orchestrates synchronization between PXE and Aztec node, maintaining an up-to-date
13
13
  * view of the L2 chain state. It handles block header retrieval, chain reorganizations, and provides an interface
14
14
  * for querying sync status.
15
15
  */
16
- export class Synchronizer implements L2BlockStreamEventHandler {
16
+ export class BlockSynchronizer implements L2BlockStreamEventHandler {
17
17
  private log: Logger;
18
18
  private isSyncing: Promise<void> | undefined;
19
19
  protected readonly blockStream: L2BlockStream;
20
20
 
21
21
  constructor(
22
22
  private node: AztecNode,
23
- private syncDataProvider: SyncDataProvider,
24
- private noteDataProvider: NoteDataProvider,
25
- private taggingDataProvider: TaggingDataProvider,
23
+ private anchorBlockStore: AnchorBlockStore,
24
+ private noteStore: NoteStore,
26
25
  private l2TipsStore: L2TipsKVStore,
27
26
  config: Partial<Pick<PXEConfig, 'l2BlockBatchSize'>> = {},
28
27
  loggerOrSuffix?: string | Logger,
29
28
  ) {
30
29
  this.log =
31
30
  !loggerOrSuffix || typeof loggerOrSuffix === 'string'
32
- ? createLogger(loggerOrSuffix ? `pxe:synchronizer:${loggerOrSuffix}` : `pxe:synchronizer`)
31
+ ? createLogger(loggerOrSuffix ? `pxe:block_synchronizer:${loggerOrSuffix}` : `pxe:block_synchronizer`)
33
32
  : loggerOrSuffix;
34
33
  this.blockStream = this.createBlockStream(config);
35
34
  }
@@ -55,23 +54,20 @@ export class Synchronizer implements L2BlockStreamEventHandler {
55
54
  archive: lastBlock.archive.root.toString(),
56
55
  header: lastBlock.header.toInspect(),
57
56
  });
58
- await this.syncDataProvider.setHeader(lastBlock.getBlockHeader());
57
+ await this.anchorBlockStore.setHeader(lastBlock.getBlockHeader());
59
58
  break;
60
59
  }
61
60
  case 'chain-pruned': {
62
61
  this.log.warn(`Pruning data after block ${event.block.number} due to reorg`);
63
62
  // We first unnullify and then remove so that unnullified notes that were created after the block number end up deleted.
64
- const lastSynchedBlockNumber = await this.syncDataProvider.getBlockNumber();
65
- await this.noteDataProvider.rollbackNotesAndNullifiers(event.block.number, lastSynchedBlockNumber);
66
- // Remove all note tagging indexes to force a full resync. This is suboptimal, but unless we track the
67
- // block number in which each index is used it's all we can do.
68
- await this.taggingDataProvider.resetNoteSyncData();
63
+ const lastSynchedBlockNumber = (await this.anchorBlockStore.getBlockHeader()).getBlockNumber();
64
+ await this.noteStore.rollbackNotesAndNullifiers(event.block.number, lastSynchedBlockNumber);
69
65
  // Update the header to the last block.
70
66
  const newHeader = await this.node.getBlockHeader(event.block.number);
71
67
  if (!newHeader) {
72
68
  this.log.error(`Block header not found for block number ${event.block.number} during chain prune`);
73
69
  } else {
74
- await this.syncDataProvider.setHeader(newHeader);
70
+ await this.anchorBlockStore.setHeader(newHeader);
75
71
  }
76
72
  break;
77
73
  }
@@ -81,6 +77,11 @@ export class Synchronizer implements L2BlockStreamEventHandler {
81
77
  /**
82
78
  * Syncs PXE and the node by downloading the metadata of the latest blocks, allowing simulations to use
83
79
  * recent data (e.g. notes), and handling any reorgs that might have occurred.
80
+ *
81
+ * Note this BlockSynchronizer is designed to let its users control when a synchronization is run,
82
+ * so this component doesn't proactively stay up to date with the blockchain.
83
+ *
84
+ * We do this so PXE can ensure data consistency.
84
85
  */
85
86
  public async sync() {
86
87
  if (this.isSyncing !== undefined) {
@@ -103,18 +104,14 @@ export class Synchronizer implements L2BlockStreamEventHandler {
103
104
  let currentHeader;
104
105
 
105
106
  try {
106
- currentHeader = await this.syncDataProvider.getBlockHeader();
107
+ currentHeader = await this.anchorBlockStore.getBlockHeader();
107
108
  } catch {
108
109
  this.log.debug('Header is not set, requesting from the node');
109
110
  }
110
111
  if (!currentHeader) {
111
112
  // REFACTOR: We should know the header of the genesis block without having to request it from the node.
112
- await this.syncDataProvider.setHeader((await this.node.getBlockHeader(0))!);
113
+ await this.anchorBlockStore.setHeader((await this.node.getBlockHeader(BlockNumber.ZERO))!);
113
114
  }
114
115
  await this.blockStream.sync();
115
116
  }
116
-
117
- public getSynchedBlockNumber() {
118
- return this.syncDataProvider.getBlockNumber();
119
- }
120
117
  }
@@ -0,0 +1 @@
1
+ export * from './block_synchronizer.js';
@@ -10,15 +10,6 @@ import { type ChainConfig, chainConfigMappings } from '@aztec/stdlib/config';
10
10
 
11
11
  export { getPackageInfo } from './package_info.js';
12
12
 
13
- /**
14
- * Temporary configuration until WASM can be used instead of native
15
- */
16
- export interface BBProverConfig {
17
- bbWorkingDirectory?: string;
18
- bbBinaryPath?: string;
19
- bbSkipCleanup?: boolean;
20
- }
21
-
22
13
  /**
23
14
  * Configuration settings for the prover factory
24
15
  */
@@ -28,14 +19,14 @@ export interface KernelProverConfig {
28
19
  }
29
20
 
30
21
  /**
31
- * Configuration settings for the synchronizer.
22
+ * Configuration settings for the block synchronizer.
32
23
  */
33
- export interface SynchronizerConfig {
24
+ export interface BlockSynchronizerConfig {
34
25
  /** Maximum amount of blocks to pull from the stream in one request when synchronizing */
35
26
  l2BlockBatchSize: number;
36
27
  }
37
28
 
38
- export type PXEConfig = KernelProverConfig & BBProverConfig & DataStoreConfig & ChainConfig & SynchronizerConfig;
29
+ export type PXEConfig = KernelProverConfig & DataStoreConfig & ChainConfig & BlockSynchronizerConfig;
39
30
 
40
31
  export type CliPXEOptions = {
41
32
  /** Custom Aztec Node URL to connect to */
@@ -50,19 +41,13 @@ export const pxeConfigMappings: ConfigMappingsType<PXEConfig> = {
50
41
  ...numberConfigHelper(50),
51
42
  description: 'Maximum amount of blocks to pull from the stream in one request when synchronizing',
52
43
  },
53
- bbBinaryPath: {
54
- env: 'BB_BINARY_PATH',
55
- description: 'Path to the BB binary',
56
- },
57
- bbWorkingDirectory: {
58
- env: 'BB_WORKING_DIRECTORY',
59
- description: 'Working directory for the BB binary',
60
- },
61
- bbSkipCleanup: {
62
- env: 'BB_SKIP_CLEANUP',
63
- description: 'True to skip cleanup of temporary files for debugging purposes',
64
- ...booleanConfigHelper(),
65
- },
44
+ // TODO: We're losing this feature in moving to bb.js api.
45
+ // Reimplement it as a setting that dumps the msgpack data on the bb.js backend if needed.
46
+ // bbSkipCleanup: {
47
+ // env: 'BB_SKIP_CLEANUP',
48
+ // description: 'True to skip cleanup of temporary files for debugging purposes',
49
+ // ...booleanConfigHelper(),
50
+ // },
66
51
  proverEnabled: {
67
52
  env: 'PXE_PROVER_ENABLED',
68
53
  description: 'Enable real proofs',