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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (402) hide show
  1. package/README.md +5 -5
  2. package/dest/bin/check_oracle_version.d.ts +2 -0
  3. package/dest/bin/check_oracle_version.d.ts.map +1 -0
  4. package/dest/bin/check_oracle_version.js +129 -0
  5. package/dest/block_synchronizer/block_synchronizer.d.ts +39 -0
  6. package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -0
  7. package/dest/{synchronizer/synchronizer.js → block_synchronizer/block_synchronizer.js} +36 -32
  8. package/dest/block_synchronizer/index.d.ts +2 -0
  9. package/dest/block_synchronizer/index.d.ts.map +1 -0
  10. package/dest/block_synchronizer/index.js +1 -0
  11. package/dest/config/index.d.ts +11 -24
  12. package/dest/config/index.d.ts.map +1 -1
  13. package/dest/config/index.js +18 -33
  14. package/dest/config/package_info.d.ts +1 -1
  15. package/dest/config/package_info.js +1 -1
  16. package/dest/contract_function_simulator/contract_function_simulator.d.ts +83 -0
  17. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -0
  18. package/dest/contract_function_simulator/contract_function_simulator.js +325 -0
  19. package/dest/contract_function_simulator/execution_note_cache.d.ts +95 -0
  20. package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -0
  21. package/dest/contract_function_simulator/execution_note_cache.js +191 -0
  22. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +16 -0
  23. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -0
  24. package/dest/contract_function_simulator/execution_tagging_index_cache.js +26 -0
  25. package/dest/contract_function_simulator/hashed_values_cache.d.ts +28 -0
  26. package/dest/contract_function_simulator/hashed_values_cache.d.ts.map +1 -0
  27. package/dest/contract_function_simulator/hashed_values_cache.js +36 -0
  28. package/dest/contract_function_simulator/index.d.ts +14 -0
  29. package/dest/contract_function_simulator/index.d.ts.map +1 -0
  30. package/dest/contract_function_simulator/index.js +12 -0
  31. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +20 -0
  32. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -0
  33. package/dest/contract_function_simulator/noir-structs/event_validation_request.js +37 -0
  34. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +16 -0
  35. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts.map +1 -0
  36. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.js +26 -0
  37. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +17 -0
  38. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -0
  39. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +65 -0
  40. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +24 -0
  41. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -0
  42. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +51 -0
  43. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +22 -0
  44. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -0
  45. package/dest/contract_function_simulator/noir-structs/utility_context.js +33 -0
  46. package/dest/contract_function_simulator/oracle/index.d.ts +14 -0
  47. package/dest/contract_function_simulator/oracle/index.d.ts.map +1 -0
  48. package/dest/contract_function_simulator/oracle/index.js +2 -0
  49. package/dest/contract_function_simulator/oracle/interfaces.d.ts +103 -0
  50. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -0
  51. package/dest/contract_function_simulator/oracle/interfaces.js +4 -0
  52. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +17 -0
  53. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -0
  54. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.js +24 -0
  55. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +28 -0
  56. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -0
  57. package/dest/contract_function_simulator/oracle/note_packing_utils.js +54 -0
  58. package/dest/contract_function_simulator/oracle/oracle.d.ts +58 -0
  59. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -0
  60. package/dest/contract_function_simulator/oracle/oracle.js +345 -0
  61. package/dest/contract_function_simulator/oracle/private_execution.d.ts +47 -0
  62. package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -0
  63. package/dest/contract_function_simulator/oracle/private_execution.js +123 -0
  64. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +240 -0
  65. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -0
  66. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +439 -0
  67. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +195 -0
  68. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -0
  69. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +372 -0
  70. package/dest/contract_function_simulator/pick_notes.d.ts +85 -0
  71. package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -0
  72. package/dest/contract_function_simulator/pick_notes.js +51 -0
  73. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +6 -0
  74. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -0
  75. package/dest/contract_function_simulator/proxied_contract_data_source.js +80 -0
  76. package/dest/contract_function_simulator/proxied_node.d.ts +9 -0
  77. package/dest/contract_function_simulator/proxied_node.d.ts.map +1 -0
  78. package/dest/contract_function_simulator/proxied_node.js +27 -0
  79. package/dest/debug/pxe_debug_utils.d.ts +31 -0
  80. package/dest/debug/pxe_debug_utils.d.ts.map +1 -0
  81. package/dest/debug/pxe_debug_utils.js +37 -0
  82. package/dest/entrypoints/client/bundle/index.d.ts +4 -3
  83. package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
  84. package/dest/entrypoints/client/bundle/index.js +2 -2
  85. package/dest/entrypoints/client/bundle/utils.d.ts +10 -10
  86. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  87. package/dest/entrypoints/client/bundle/utils.js +18 -12
  88. package/dest/entrypoints/client/lazy/index.d.ts +4 -3
  89. package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
  90. package/dest/entrypoints/client/lazy/index.js +2 -2
  91. package/dest/entrypoints/client/lazy/utils.d.ts +9 -9
  92. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  93. package/dest/entrypoints/client/lazy/utils.js +17 -11
  94. package/dest/entrypoints/pxe_creation_options.d.ts +16 -0
  95. package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -0
  96. package/dest/entrypoints/server/index.d.ts +6 -4
  97. package/dest/entrypoints/server/index.d.ts.map +1 -1
  98. package/dest/entrypoints/server/index.js +4 -3
  99. package/dest/entrypoints/server/utils.d.ts +8 -16
  100. package/dest/entrypoints/server/utils.d.ts.map +1 -1
  101. package/dest/entrypoints/server/utils.js +31 -36
  102. package/dest/error_enriching.d.ts +11 -0
  103. package/dest/error_enriching.d.ts.map +1 -0
  104. package/dest/{pxe_service/error_enriching.js → error_enriching.js} +26 -18
  105. package/dest/events/event_service.d.ts +15 -0
  106. package/dest/events/event_service.d.ts.map +1 -0
  107. package/dest/events/event_service.js +47 -0
  108. package/dest/events/index.d.ts +2 -0
  109. package/dest/events/index.d.ts.map +1 -0
  110. package/dest/events/index.js +1 -0
  111. package/dest/events/private_event_filter_validator.d.ts +9 -0
  112. package/dest/events/private_event_filter_validator.d.ts.map +1 -0
  113. package/dest/events/private_event_filter_validator.js +39 -0
  114. package/dest/logs/log_service.d.ts +43 -0
  115. package/dest/logs/log_service.d.ts.map +1 -0
  116. package/dest/logs/log_service.js +239 -0
  117. package/dest/notes/index.d.ts +2 -0
  118. package/dest/notes/index.d.ts.map +1 -0
  119. package/dest/notes/index.js +1 -0
  120. package/dest/notes/note_service.d.ts +48 -0
  121. package/dest/notes/note_service.d.ts.map +1 -0
  122. package/dest/notes/note_service.js +152 -0
  123. package/dest/oracle_version.d.ts +3 -0
  124. package/dest/oracle_version.d.ts.map +1 -0
  125. package/dest/oracle_version.js +10 -0
  126. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +28 -0
  127. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +1 -0
  128. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.js +271 -0
  129. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +4 -0
  130. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts.map +1 -0
  131. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.js +41 -0
  132. package/dest/private_kernel/hints/index.d.ts +3 -0
  133. package/dest/private_kernel/hints/index.d.ts.map +1 -0
  134. package/dest/{kernel_prover → private_kernel}/hints/index.js +1 -0
  135. package/dest/private_kernel/index.d.ts +3 -0
  136. package/dest/private_kernel/index.d.ts.map +1 -0
  137. package/dest/private_kernel/index.js +2 -0
  138. package/dest/private_kernel/private_kernel_execution_prover.d.ts +44 -0
  139. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -0
  140. package/dest/private_kernel/private_kernel_execution_prover.js +286 -0
  141. package/dest/private_kernel/private_kernel_oracle.d.ts +63 -0
  142. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -0
  143. package/dest/private_kernel/private_kernel_oracle.js +4 -0
  144. package/dest/private_kernel/private_kernel_oracle_impl.d.ts +46 -0
  145. package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +1 -0
  146. package/dest/{kernel_oracle/index.js → private_kernel/private_kernel_oracle_impl.js} +19 -9
  147. package/dest/public_storage/public_storage_service.d.ts +24 -0
  148. package/dest/public_storage/public_storage_service.d.ts.map +1 -0
  149. package/dest/public_storage/public_storage_service.js +26 -0
  150. package/dest/pxe.d.ts +231 -0
  151. package/dest/pxe.d.ts.map +1 -0
  152. package/dest/pxe.js +756 -0
  153. package/dest/storage/address_data_provider/address_data_provider.d.ts +2 -4
  154. package/dest/storage/address_data_provider/address_data_provider.d.ts.map +1 -1
  155. package/dest/storage/address_data_provider/address_data_provider.js +0 -3
  156. package/dest/storage/address_data_provider/index.d.ts +1 -1
  157. package/dest/storage/anchor_block_data_provider/anchor_block_data_provider.d.ts +9 -0
  158. package/dest/storage/anchor_block_data_provider/anchor_block_data_provider.d.ts.map +1 -0
  159. package/dest/storage/{sync_data_provider/sync_data_provider.js → anchor_block_data_provider/anchor_block_data_provider.js} +2 -12
  160. package/dest/storage/anchor_block_data_provider/index.d.ts +2 -0
  161. package/dest/storage/anchor_block_data_provider/index.d.ts.map +1 -0
  162. package/dest/storage/anchor_block_data_provider/index.js +1 -0
  163. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts +48 -7
  164. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +1 -1
  165. package/dest/storage/capsule_data_provider/capsule_data_provider.js +117 -28
  166. package/dest/storage/capsule_data_provider/index.d.ts +1 -1
  167. package/dest/storage/contract_data_provider/contract_data_provider.d.ts +16 -59
  168. package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +1 -1
  169. package/dest/storage/contract_data_provider/contract_data_provider.js +121 -80
  170. package/dest/storage/contract_data_provider/index.d.ts +1 -2
  171. package/dest/storage/contract_data_provider/index.d.ts.map +1 -1
  172. package/dest/storage/contract_data_provider/index.js +0 -1
  173. package/dest/storage/contract_data_provider/private_functions_tree.d.ts +3 -42
  174. package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +1 -1
  175. package/dest/storage/contract_data_provider/private_functions_tree.js +10 -62
  176. package/dest/storage/index.d.ts +4 -5
  177. package/dest/storage/index.d.ts.map +1 -1
  178. package/dest/storage/index.js +3 -4
  179. package/dest/storage/metadata.d.ts +2 -0
  180. package/dest/storage/metadata.d.ts.map +1 -0
  181. package/dest/storage/metadata.js +1 -0
  182. package/dest/storage/note_data_provider/index.d.ts +2 -2
  183. package/dest/storage/note_data_provider/index.d.ts.map +1 -1
  184. package/dest/storage/note_data_provider/index.js +1 -1
  185. package/dest/storage/note_data_provider/note_data_provider.d.ts +75 -11
  186. package/dest/storage/note_data_provider/note_data_provider.d.ts.map +1 -1
  187. package/dest/storage/note_data_provider/note_data_provider.js +155 -82
  188. package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +51 -0
  189. package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts.map +1 -0
  190. package/dest/storage/private_event_data_provider/private_event_data_provider.js +115 -0
  191. package/dest/storage/tagging_data_provider/index.d.ts +3 -2
  192. package/dest/storage/tagging_data_provider/index.d.ts.map +1 -1
  193. package/dest/storage/tagging_data_provider/index.js +2 -1
  194. package/dest/storage/tagging_data_provider/recipient_tagging_data_provider.d.ts +31 -0
  195. package/dest/storage/tagging_data_provider/recipient_tagging_data_provider.d.ts.map +1 -0
  196. package/dest/storage/tagging_data_provider/recipient_tagging_data_provider.js +65 -0
  197. package/dest/storage/tagging_data_provider/sender_tagging_data_provider.d.ts +67 -0
  198. package/dest/storage/tagging_data_provider/sender_tagging_data_provider.d.ts.map +1 -0
  199. package/dest/storage/tagging_data_provider/sender_tagging_data_provider.js +196 -0
  200. package/dest/tagging/constants.d.ts +2 -0
  201. package/dest/tagging/constants.d.ts.map +1 -0
  202. package/dest/tagging/constants.js +3 -0
  203. package/dest/tagging/index.d.ts +5 -0
  204. package/dest/tagging/index.d.ts.map +1 -0
  205. package/dest/tagging/index.js +3 -0
  206. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +14 -0
  207. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -0
  208. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +99 -0
  209. package/dest/tagging/recipient_sync/new_recipient_tagging_data_provider.d.ts +21 -0
  210. package/dest/tagging/recipient_sync/new_recipient_tagging_data_provider.d.ts.map +1 -0
  211. package/dest/tagging/recipient_sync/new_recipient_tagging_data_provider.js +42 -0
  212. package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts +12 -0
  213. package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts.map +1 -0
  214. package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +20 -0
  215. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +14 -0
  216. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -0
  217. package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +29 -0
  218. package/dest/tagging/sync/sync_sender_tagging_indexes.d.ts +21 -0
  219. package/dest/tagging/sync/sync_sender_tagging_indexes.d.ts.map +1 -0
  220. package/dest/tagging/sync/sync_sender_tagging_indexes.js +89 -0
  221. package/dest/tagging/sync/utils/get_status_change_of_pending.d.ts +11 -0
  222. package/dest/tagging/sync/utils/get_status_change_of_pending.d.ts.map +1 -0
  223. package/dest/tagging/sync/utils/get_status_change_of_pending.js +32 -0
  224. package/dest/tagging/sync/utils/load_and_store_new_tagging_indexes.d.ts +18 -0
  225. package/dest/tagging/sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -0
  226. package/dest/tagging/sync/utils/load_and_store_new_tagging_indexes.js +55 -0
  227. package/dest/tagging/utils.d.ts +18 -0
  228. package/dest/tagging/utils.d.ts.map +1 -0
  229. package/dest/tagging/utils.js +25 -0
  230. package/dest/tree_membership/tree_membership_service.d.ts +52 -0
  231. package/dest/tree_membership/tree_membership_service.d.ts.map +1 -0
  232. package/dest/tree_membership/tree_membership_service.js +84 -0
  233. package/package.json +37 -34
  234. package/src/bin/check_oracle_version.ts +160 -0
  235. package/src/{synchronizer/synchronizer.ts → block_synchronizer/block_synchronizer.ts} +39 -35
  236. package/src/block_synchronizer/index.ts +1 -0
  237. package/src/config/index.ts +27 -55
  238. package/src/config/package_info.ts +1 -1
  239. package/src/contract_function_simulator/contract_function_simulator.ts +618 -0
  240. package/src/contract_function_simulator/execution_note_cache.ts +233 -0
  241. package/src/contract_function_simulator/execution_tagging_index_cache.ts +32 -0
  242. package/src/contract_function_simulator/hashed_values_cache.ts +47 -0
  243. package/src/contract_function_simulator/index.ts +13 -0
  244. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +47 -0
  245. package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +28 -0
  246. package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +69 -0
  247. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +64 -0
  248. package/src/contract_function_simulator/noir-structs/utility_context.ts +42 -0
  249. package/src/contract_function_simulator/oracle/index.ts +16 -0
  250. package/src/contract_function_simulator/oracle/interfaces.ts +175 -0
  251. package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +23 -0
  252. package/src/contract_function_simulator/oracle/note_packing_utils.ts +68 -0
  253. package/src/contract_function_simulator/oracle/oracle.ts +605 -0
  254. package/src/contract_function_simulator/oracle/private_execution.ts +209 -0
  255. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +704 -0
  256. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +532 -0
  257. package/src/contract_function_simulator/pick_notes.ts +141 -0
  258. package/src/contract_function_simulator/proxied_contract_data_source.ts +83 -0
  259. package/src/contract_function_simulator/proxied_node.ts +33 -0
  260. package/src/debug/pxe_debug_utils.ts +48 -0
  261. package/src/entrypoints/client/bundle/index.ts +3 -2
  262. package/src/entrypoints/client/bundle/utils.ts +36 -36
  263. package/src/entrypoints/client/lazy/index.ts +3 -2
  264. package/src/entrypoints/client/lazy/utils.ts +36 -31
  265. package/src/entrypoints/pxe_creation_options.ts +12 -0
  266. package/src/entrypoints/server/index.ts +5 -3
  267. package/src/entrypoints/server/utils.ts +59 -51
  268. package/src/{pxe_service/error_enriching.ts → error_enriching.ts} +36 -27
  269. package/src/events/event_service.ts +77 -0
  270. package/src/events/index.ts +1 -0
  271. package/src/events/private_event_filter_validator.ts +48 -0
  272. package/src/logs/log_service.ts +364 -0
  273. package/src/notes/index.ts +1 -0
  274. package/src/notes/note_service.ts +200 -0
  275. package/src/oracle_version.ts +11 -0
  276. package/src/{kernel_prover → private_kernel}/hints/build_private_kernel_reset_private_inputs.ts +159 -147
  277. package/src/private_kernel/hints/compute_tx_include_by_timestamp.ts +58 -0
  278. package/src/{kernel_prover → private_kernel}/hints/index.ts +1 -0
  279. package/src/private_kernel/index.ts +2 -0
  280. package/src/private_kernel/private_kernel_execution_prover.ts +432 -0
  281. package/src/{kernel_prover/proving_data_oracle.ts → private_kernel/private_kernel_oracle.ts} +19 -30
  282. package/src/{kernel_oracle/index.ts → private_kernel/private_kernel_oracle_impl.ts} +33 -17
  283. package/src/public_storage/public_storage_service.ts +33 -0
  284. package/src/pxe.ts +1063 -0
  285. package/src/storage/address_data_provider/address_data_provider.ts +1 -7
  286. package/src/storage/{sync_data_provider/sync_data_provider.ts → anchor_block_data_provider/anchor_block_data_provider.ts} +2 -17
  287. package/src/storage/anchor_block_data_provider/index.ts +1 -0
  288. package/src/storage/capsule_data_provider/capsule_data_provider.ts +130 -31
  289. package/src/storage/contract_data_provider/contract_data_provider.ts +152 -94
  290. package/src/storage/contract_data_provider/index.ts +0 -1
  291. package/src/storage/contract_data_provider/private_functions_tree.ts +12 -76
  292. package/src/storage/index.ts +3 -5
  293. package/src/storage/metadata.ts +1 -0
  294. package/src/storage/note_data_provider/index.ts +1 -1
  295. package/src/storage/note_data_provider/note_data_provider.ts +188 -121
  296. package/src/storage/private_event_data_provider/private_event_data_provider.ts +162 -0
  297. package/src/storage/tagging_data_provider/index.ts +2 -1
  298. package/src/storage/tagging_data_provider/recipient_tagging_data_provider.ts +86 -0
  299. package/src/storage/tagging_data_provider/sender_tagging_data_provider.ts +244 -0
  300. package/src/tagging/constants.ts +3 -0
  301. package/src/tagging/index.ts +4 -0
  302. package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +129 -0
  303. package/src/tagging/recipient_sync/new_recipient_tagging_data_provider.ts +53 -0
  304. package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +34 -0
  305. package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +43 -0
  306. package/src/tagging/sync/sync_sender_tagging_indexes.ts +112 -0
  307. package/src/tagging/sync/utils/get_status_change_of_pending.ts +44 -0
  308. package/src/tagging/sync/utils/load_and_store_new_tagging_indexes.ts +72 -0
  309. package/src/tagging/utils.ts +32 -0
  310. package/src/tree_membership/tree_membership_service.ts +112 -0
  311. package/dest/bin/index.d.ts +0 -3
  312. package/dest/bin/index.d.ts.map +0 -1
  313. package/dest/bin/index.js +0 -28
  314. package/dest/entrypoints/client/pxe_creation_options.d.ts +0 -11
  315. package/dest/entrypoints/client/pxe_creation_options.d.ts.map +0 -1
  316. package/dest/kernel_oracle/index.d.ts +0 -45
  317. package/dest/kernel_oracle/index.d.ts.map +0 -1
  318. package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.d.ts +0 -28
  319. package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.d.ts.map +0 -1
  320. package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.js +0 -270
  321. package/dest/kernel_prover/hints/index.d.ts +0 -2
  322. package/dest/kernel_prover/hints/index.d.ts.map +0 -1
  323. package/dest/kernel_prover/index.d.ts +0 -3
  324. package/dest/kernel_prover/index.d.ts.map +0 -1
  325. package/dest/kernel_prover/index.js +0 -2
  326. package/dest/kernel_prover/kernel_prover.d.ts +0 -38
  327. package/dest/kernel_prover/kernel_prover.d.ts.map +0 -1
  328. package/dest/kernel_prover/kernel_prover.js +0 -217
  329. package/dest/kernel_prover/proving_data_oracle.d.ts +0 -73
  330. package/dest/kernel_prover/proving_data_oracle.d.ts.map +0 -1
  331. package/dest/kernel_prover/proving_data_oracle.js +0 -4
  332. package/dest/note_decryption_utils/add_public_values_to_payload.d.ts +0 -11
  333. package/dest/note_decryption_utils/add_public_values_to_payload.d.ts.map +0 -1
  334. package/dest/note_decryption_utils/add_public_values_to_payload.js +0 -47
  335. package/dest/pxe_http/index.d.ts +0 -2
  336. package/dest/pxe_http/index.d.ts.map +0 -1
  337. package/dest/pxe_http/index.js +0 -1
  338. package/dest/pxe_http/pxe_http_server.d.ts +0 -16
  339. package/dest/pxe_http/pxe_http_server.d.ts.map +0 -1
  340. package/dest/pxe_http/pxe_http_server.js +0 -27
  341. package/dest/pxe_oracle_interface/index.d.ts +0 -159
  342. package/dest/pxe_oracle_interface/index.d.ts.map +0 -1
  343. package/dest/pxe_oracle_interface/index.js +0 -692
  344. package/dest/pxe_oracle_interface/tagging_utils.d.ts +0 -17
  345. package/dest/pxe_oracle_interface/tagging_utils.d.ts.map +0 -1
  346. package/dest/pxe_oracle_interface/tagging_utils.js +0 -23
  347. package/dest/pxe_service/error_enriching.d.ts +0 -11
  348. package/dest/pxe_service/error_enriching.d.ts.map +0 -1
  349. package/dest/pxe_service/index.d.ts +0 -3
  350. package/dest/pxe_service/index.d.ts.map +0 -1
  351. package/dest/pxe_service/index.js +0 -2
  352. package/dest/pxe_service/pxe_service.d.ts +0 -111
  353. package/dest/pxe_service/pxe_service.d.ts.map +0 -1
  354. package/dest/pxe_service/pxe_service.js +0 -664
  355. package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.d.ts +0 -11
  356. package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.d.ts.map +0 -1
  357. package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.js +0 -20
  358. package/dest/storage/auth_witness_data_provider/index.d.ts +0 -2
  359. package/dest/storage/auth_witness_data_provider/index.d.ts.map +0 -1
  360. package/dest/storage/auth_witness_data_provider/index.js +0 -1
  361. package/dest/storage/data_provider.d.ts +0 -4
  362. package/dest/storage/data_provider.d.ts.map +0 -1
  363. package/dest/storage/data_provider.js +0 -1
  364. package/dest/storage/note_data_provider/note_dao.d.ts +0 -106
  365. package/dest/storage/note_data_provider/note_dao.d.ts.map +0 -1
  366. package/dest/storage/note_data_provider/note_dao.js +0 -106
  367. package/dest/storage/sync_data_provider/index.d.ts +0 -2
  368. package/dest/storage/sync_data_provider/index.d.ts.map +0 -1
  369. package/dest/storage/sync_data_provider/index.js +0 -1
  370. package/dest/storage/sync_data_provider/sync_data_provider.d.ts +0 -12
  371. package/dest/storage/sync_data_provider/sync_data_provider.d.ts.map +0 -1
  372. package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts +0 -18
  373. package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts.map +0 -1
  374. package/dest/storage/tagging_data_provider/tagging_data_provider.js +0 -65
  375. package/dest/synchronizer/index.d.ts +0 -2
  376. package/dest/synchronizer/index.d.ts.map +0 -1
  377. package/dest/synchronizer/index.js +0 -1
  378. package/dest/synchronizer/synchronizer.d.ts +0 -37
  379. package/dest/synchronizer/synchronizer.d.ts.map +0 -1
  380. package/dest/test/pxe_test_suite.d.ts +0 -3
  381. package/dest/test/pxe_test_suite.d.ts.map +0 -1
  382. package/dest/test/pxe_test_suite.js +0 -97
  383. package/src/bin/index.ts +0 -38
  384. package/src/entrypoints/client/pxe_creation_options.ts +0 -7
  385. package/src/kernel_prover/index.ts +0 -2
  386. package/src/kernel_prover/kernel_prover.ts +0 -351
  387. package/src/note_decryption_utils/add_public_values_to_payload.ts +0 -64
  388. package/src/pxe_http/index.ts +0 -1
  389. package/src/pxe_http/pxe_http_server.ts +0 -29
  390. package/src/pxe_oracle_interface/index.ts +0 -925
  391. package/src/pxe_oracle_interface/tagging_utils.ts +0 -32
  392. package/src/pxe_service/index.ts +0 -2
  393. package/src/pxe_service/pxe_service.ts +0 -949
  394. package/src/storage/auth_witness_data_provider/auth_witness_data_provider.ts +0 -34
  395. package/src/storage/auth_witness_data_provider/index.ts +0 -1
  396. package/src/storage/data_provider.ts +0 -3
  397. package/src/storage/note_data_provider/note_dao.ts +0 -162
  398. package/src/storage/sync_data_provider/index.ts +0 -1
  399. package/src/storage/tagging_data_provider/tagging_data_provider.ts +0 -92
  400. package/src/synchronizer/index.ts +0 -1
  401. package/src/test/pxe_test_suite.ts +0 -111
  402. /package/dest/entrypoints/{client/pxe_creation_options.js → pxe_creation_options.js} +0 -0
@@ -0,0 +1,29 @@
1
+ import { SiloedTag, Tag } from '@aztec/stdlib/logs';
2
+ /**
3
+ * Gets private logs with their corresponding block timestamps and tagging indexes for the given index range, `app` and
4
+ * `secret`. At most load logs from blocks up to and including `anchorBlockNumber`. `start` is inclusive and `end` is
5
+ * exclusive.
6
+ */ export async function loadLogsForRange(secret, app, aztecNode, start, end, anchorBlockNumber) {
7
+ // Derive tags for the window
8
+ const preTags = Array(end - start).fill(0).map((_, i)=>({
9
+ secret,
10
+ index: start + i
11
+ }));
12
+ const siloedTags = await Promise.all(preTags.map((preTag)=>Tag.compute(preTag))).then((tags)=>Promise.all(tags.map((tag)=>SiloedTag.compute(tag, app))));
13
+ const logs = await aztecNode.getPrivateLogsByTags(siloedTags);
14
+ // Pair logs with their corresponding tagging indexes
15
+ const logsWithIndexes = [];
16
+ for(let i = 0; i < logs.length; i++){
17
+ const logsForTag = logs[i];
18
+ const taggingIndex = preTags[i].index;
19
+ for (const log of logsForTag){
20
+ if (log.blockNumber <= anchorBlockNumber) {
21
+ logsWithIndexes.push({
22
+ log,
23
+ taggingIndex
24
+ });
25
+ }
26
+ }
27
+ }
28
+ return logsWithIndexes;
29
+ }
@@ -0,0 +1,21 @@
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 { SenderTaggingDataProvider } from '../../storage/tagging_data_provider/sender_tagging_data_provider.js';
5
+ export declare const UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN = 95;
6
+ /**
7
+ * Syncs tagging indexes. This function needs to be called whenever a private log is being sent.
8
+ *
9
+ * @param secret - The secret that's unique for (sender, recipient, contract) tuple while the direction of
10
+ * sender -> recipient matters.
11
+ * @param app - The address of the contract that the logs are tagged for. Needs to be provided because we perform
12
+ * second round of siloing in this function which is necessary because kernels do it as well (they silo first field
13
+ * of the private log which corresponds to the tag).
14
+ * @remarks When syncing the indexes as sender we don't care about the log contents - we only care about the highest
15
+ * pending and highest finalized indexes as that guides the next index choice when sending a log. The next index choice
16
+ * is simply the highest pending index plus one (or finalized if pending is undefined).
17
+ * @dev This function looks for new indexes, adds them to pending, then it checks status of each pending index and
18
+ * updates its status accordingly.
19
+ */
20
+ export declare function syncSenderTaggingIndexes(secret: DirectionalAppTaggingSecret, app: AztecAddress, aztecNode: AztecNode, taggingDataProvider: SenderTaggingDataProvider): Promise<void>;
21
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3luY19zZW5kZXJfdGFnZ2luZ19pbmRleGVzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvdGFnZ2luZy9zeW5jL3N5bmNfc2VuZGVyX3RhZ2dpbmdfaW5kZXhlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUNoRSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNqRSxPQUFPLEtBQUssRUFBRSwyQkFBMkIsRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBRXRFLE9BQU8sS0FBSyxFQUFFLHlCQUF5QixFQUFFLE1BQU0scUVBQXFFLENBQUM7QUFtQnJILGVBQU8sTUFBTSxzQ0FBc0MsS0FBSyxDQUFDO0FBRXpEOzs7Ozs7Ozs7Ozs7O0dBYUc7QUFDSCx3QkFBc0Isd0JBQXdCLENBQzVDLE1BQU0sRUFBRSwyQkFBMkIsRUFDbkMsR0FBRyxFQUFFLFlBQVksRUFDakIsU0FBUyxFQUFFLFNBQVMsRUFDcEIsbUJBQW1CLEVBQUUseUJBQXlCLEdBQzdDLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FtRWYifQ==
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sync_sender_tagging_indexes.d.ts","sourceRoot":"","sources":["../../../src/tagging/sync/sync_sender_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,EAAE,MAAM,oBAAoB,CAAC;AAEtE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qEAAqE,CAAC;AAmBrH,eAAO,MAAM,sCAAsC,KAAK,CAAC;AAEzD;;;;;;;;;;;;;GAaG;AACH,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,2BAA2B,EACnC,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE,SAAS,EACpB,mBAAmB,EAAE,yBAAyB,GAC7C,OAAO,CAAC,IAAI,CAAC,CAmEf"}
@@ -0,0 +1,89 @@
1
+ import { getStatusChangeOfPending } from './utils/get_status_change_of_pending.js';
2
+ import { loadAndStoreNewTaggingIndexes } from './utils/load_and_store_new_tagging_indexes.js';
3
+ // This window has to be as large as the largest expected number of logs emitted in a tx for a given directional app
4
+ // tagging secret. If we get more tag indexes consumed than this window, an error is thrown in `PXE::proveTx` function.
5
+ // This is set to a larger value than MAX_PRIVATE_LOGS_PER_TX (currently 64) because there could be more than
6
+ // MAX_PRIVATE_LOGS_PER_TX indexes consumed in case the logs are squashed. This happens when the log contains a note
7
+ // and the note is nullified in the same tx.
8
+ //
9
+ // Rationale for value 95:
10
+ // - The `e2e_pending_note_hashes_contract` test's "Should handle overflowing the kernel data structures in nested
11
+ // calls" test case hits 95 tagging indexes emitted in a single transaction. This test creates and nullifies many
12
+ // notes recursively to test kernel reset circuit behavior, which causes logs to be squashed but still consume
13
+ // tagging indexes during the sync process. Since this is testing MAX_PRIVATE_LOGS_PER_TX overflow we can be
14
+ // reasonably certain that this value is large enough for standard use cases.
15
+ // - This value is below MAX_RPC_LEN (100) which is the limit for array parameters in the JSON RPC schema for
16
+ // `getLogsByTags`. Any test that would perform sync over JSON RPC (not by having access to the Aztec node instance
17
+ // directly) would error out if that maximum was hit (docs_examples.test.ts is an example of this).
18
+ export const UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN = 95;
19
+ /**
20
+ * Syncs tagging indexes. This function needs to be called whenever a private log is being sent.
21
+ *
22
+ * @param secret - The secret that's unique for (sender, recipient, contract) tuple while the direction of
23
+ * sender -> recipient matters.
24
+ * @param app - The address of the contract that the logs are tagged for. Needs to be provided because we perform
25
+ * second round of siloing in this function which is necessary because kernels do it as well (they silo first field
26
+ * of the private log which corresponds to the tag).
27
+ * @remarks When syncing the indexes as sender we don't care about the log contents - we only care about the highest
28
+ * pending and highest finalized indexes as that guides the next index choice when sending a log. The next index choice
29
+ * is simply the highest pending index plus one (or finalized if pending is undefined).
30
+ * @dev This function looks for new indexes, adds them to pending, then it checks status of each pending index and
31
+ * updates its status accordingly.
32
+ */ export async function syncSenderTaggingIndexes(secret, app, aztecNode, taggingDataProvider) {
33
+ // # Explanation of how syncing works
34
+ //
35
+ // When choosing an index, we select: highest pending index + 1 (or highest finalized index + 1 if no pending).
36
+ // If the chosen index is more than WINDOW_LEN from the highest finalized index, we throw an error. By having this
37
+ // hard limit we give a guarantee to a recipient that he doesn't need to look further than WINDOW_LEN ahead of the
38
+ // highest finalized index.
39
+ //
40
+ // This function synchronizes the finalized and pending indexes by iteratively querying the node for a window of
41
+ // indexes at a time, storing all those indexes as pending, and then checking the status of each pending index to
42
+ // update its finalization status accordingly. If we stumble upon a window with no indexes, we stop the loop.
43
+ //
44
+ // Stopping at that point is safe because of the limit described above - there can never be an index that is more
45
+ // than WINDOW_LEN from the highest finalized index.
46
+ //
47
+ // # Note on performance
48
+ // Each window advance requires two queries (logs + tx status). For example, syncing indexes 0–500 with a window of
49
+ // 100 takes at least 10 round trips (5 windows × 2 queries).
50
+ const finalizedIndex = await taggingDataProvider.getLastFinalizedIndex(secret);
51
+ let start = finalizedIndex === undefined ? 0 : finalizedIndex + 1;
52
+ let end = start + UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN;
53
+ let previousFinalizedIndex = finalizedIndex;
54
+ let newFinalizedIndex = undefined;
55
+ while(true){
56
+ // Load and store indexes for the current window. These indexes may already exist in the database if txs using
57
+ // them were previously sent from this PXE. Any duplicates are handled by the tagging data provider.
58
+ await loadAndStoreNewTaggingIndexes(secret, app, start, end, aztecNode, taggingDataProvider);
59
+ // Retrieve all indexes within the current window from storage and update their status accordingly.
60
+ const pendingTxHashes = await taggingDataProvider.getTxHashesOfPendingIndexes(secret, start, end);
61
+ if (pendingTxHashes.length === 0) {
62
+ break;
63
+ }
64
+ const { txHashesToFinalize, txHashesToDrop } = await getStatusChangeOfPending(pendingTxHashes, aztecNode);
65
+ await taggingDataProvider.dropPendingIndexes(txHashesToDrop);
66
+ await taggingDataProvider.finalizePendingIndexes(txHashesToFinalize);
67
+ // We check if the finalized index has been updated.
68
+ newFinalizedIndex = await taggingDataProvider.getLastFinalizedIndex(secret);
69
+ if (previousFinalizedIndex !== newFinalizedIndex) {
70
+ // A new finalized index was found, so we'll run the loop again. For example:
71
+ // - Previous finalized index: 10
72
+ // - New finalized index: 13
73
+ // - Window length: 10
74
+ //
75
+ // In the last iteration, we processed indexes 11-20. To avoid reprocessing the same logs,
76
+ // we'll only look at the new indexes 21-23:
77
+ //
78
+ // Previous window: [11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
79
+ // New window: [21, 22, 23]
80
+ const previousEnd = end;
81
+ // Add 1 because `end` is exclusive and the known finalized index is not included in the window.
82
+ end = newFinalizedIndex + UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN + 1;
83
+ start = previousEnd;
84
+ previousFinalizedIndex = newFinalizedIndex;
85
+ } else {
86
+ break;
87
+ }
88
+ }
89
+ }
@@ -0,0 +1,11 @@
1
+ import type { AztecNode } from '@aztec/stdlib/interfaces/server';
2
+ import { TxHash } from '@aztec/stdlib/tx';
3
+ /**
4
+ * Based on receipts obtained from `aztecNode` returns which pending transactions changed their status to finalized or
5
+ * dropped.
6
+ */
7
+ export declare function getStatusChangeOfPending(pending: TxHash[], aztecNode: AztecNode): Promise<{
8
+ txHashesToFinalize: TxHash[];
9
+ txHashesToDrop: TxHash[];
10
+ }>;
11
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0X3N0YXR1c19jaGFuZ2Vfb2ZfcGVuZGluZy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL3RhZ2dpbmcvc3luYy91dGlscy9nZXRfc3RhdHVzX2NoYW5nZV9vZl9wZW5kaW5nLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQ2pFLE9BQU8sRUFBRSxNQUFNLEVBQVksTUFBTSxrQkFBa0IsQ0FBQztBQUVwRDs7O0dBR0c7QUFDSCx3QkFBc0Isd0JBQXdCLENBQzVDLE9BQU8sRUFBRSxNQUFNLEVBQUUsRUFDakIsU0FBUyxFQUFFLFNBQVMsR0FDbkIsT0FBTyxDQUFDO0lBQUUsa0JBQWtCLEVBQUUsTUFBTSxFQUFFLENBQUM7SUFBQyxjQUFjLEVBQUUsTUFBTSxFQUFFLENBQUE7Q0FBRSxDQUFDLENBaUNyRSJ9
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get_status_change_of_pending.d.ts","sourceRoot":"","sources":["../../../../src/tagging/sync/utils/get_status_change_of_pending.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,MAAM,EAAY,MAAM,kBAAkB,CAAC;AAEpD;;;GAGG;AACH,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,MAAM,EAAE,EACjB,SAAS,EAAE,SAAS,GACnB,OAAO,CAAC;IAAE,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAAC,cAAc,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAiCrE"}
@@ -0,0 +1,32 @@
1
+ import { TxStatus } from '@aztec/stdlib/tx';
2
+ /**
3
+ * Based on receipts obtained from `aztecNode` returns which pending transactions changed their status to finalized or
4
+ * dropped.
5
+ */ export async function getStatusChangeOfPending(pending, aztecNode) {
6
+ // Get receipts for all pending tx hashes and the finalized block number.
7
+ const [receipts, { finalized }] = await Promise.all([
8
+ Promise.all(pending.map((pendingTxHash)=>aztecNode.getTxReceipt(pendingTxHash))),
9
+ aztecNode.getL2Tips()
10
+ ]);
11
+ const txHashesToFinalize = [];
12
+ const txHashesToDrop = [];
13
+ for(let i = 0; i < receipts.length; i++){
14
+ const receipt = receipts[i];
15
+ const txHash = pending[i];
16
+ if (receipt.status === TxStatus.SUCCESS && receipt.blockNumber && receipt.blockNumber <= finalized.number) {
17
+ // Tx has been included in a block and the corresponding block is finalized --> we mark the indexes as
18
+ // finalized.
19
+ txHashesToFinalize.push(txHash);
20
+ } else if (receipt.status === TxStatus.DROPPED || receipt.status === TxStatus.APP_LOGIC_REVERTED || receipt.status === TxStatus.TEARDOWN_REVERTED || receipt.status === TxStatus.BOTH_REVERTED) {
21
+ // Tx was dropped or reverted --> we drop the corresponding pending indexes.
22
+ // TODO(#17615): Don't drop pending indexes corresponding to non-revertible phases.
23
+ txHashesToDrop.push(txHash);
24
+ } else {
25
+ // Tx is still pending or the corresponding block is not yet finalized --> we don't do anything.
26
+ }
27
+ }
28
+ return {
29
+ txHashesToFinalize,
30
+ txHashesToDrop
31
+ };
32
+ }
@@ -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 { SenderTaggingDataProvider } from '../../../storage/tagging_data_provider/sender_tagging_data_provider.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 taggingDataProvider - The data provider to store pending indexes.
16
+ */
17
+ export declare function loadAndStoreNewTaggingIndexes(secret: DirectionalAppTaggingSecret, app: AztecAddress, start: number, end: number, aztecNode: AztecNode, taggingDataProvider: SenderTaggingDataProvider): Promise<void>;
18
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9hZF9hbmRfc3RvcmVfbmV3X3RhZ2dpbmdfaW5kZXhlcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL3RhZ2dpbmcvc3luYy91dGlscy9sb2FkX2FuZF9zdG9yZV9uZXdfdGFnZ2luZ19pbmRleGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBQ2hFLE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQ2pFLE9BQU8sS0FBSyxFQUFFLDJCQUEyQixFQUFVLE1BQU0sb0JBQW9CLENBQUM7QUFJOUUsT0FBTyxLQUFLLEVBQUUseUJBQXlCLEVBQUUsTUFBTSx3RUFBd0UsQ0FBQztBQUV4SDs7Ozs7Ozs7Ozs7R0FXRztBQUNILHdCQUFzQiw2QkFBNkIsQ0FDakQsTUFBTSxFQUFFLDJCQUEyQixFQUNuQyxHQUFHLEVBQUUsWUFBWSxFQUNqQixLQUFLLEVBQUUsTUFBTSxFQUNiLEdBQUcsRUFBRSxNQUFNLEVBQ1gsU0FBUyxFQUFFLFNBQVMsRUFDcEIsbUJBQW1CLEVBQUUseUJBQXlCLGlCQWtCL0MifQ==
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load_and_store_new_tagging_indexes.d.ts","sourceRoot":"","sources":["../../../../src/tagging/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,yBAAyB,EAAE,MAAM,wEAAwE,CAAC;AAExH;;;;;;;;;;;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,mBAAmB,EAAE,yBAAyB,iBAkB/C"}
@@ -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 taggingDataProvider - The data provider to store pending indexes.
14
+ */ export async function loadAndStoreNewTaggingIndexes(secret, app, start, end, aztecNode, taggingDataProvider) {
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 taggingDataProvider.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,18 @@
1
+ import type { DirectionalAppTaggingSecret, PreTag } from '@aztec/stdlib/logs';
2
+ export declare function getPreTagsForTheWindow(secretsAndWindows: {
3
+ secret: DirectionalAppTaggingSecret;
4
+ leftMostIndex: number;
5
+ rightMostIndex: number;
6
+ }[]): PreTag[];
7
+ /**
8
+ * Creates a map from directional app tagging secret to initial index.
9
+ * @param preTags - The pre-tags to get the initial indexes map from.
10
+ * @returns The map from directional app tagging secret to initial index.
11
+ */
12
+ export declare function getInitialIndexesMap(preTags: {
13
+ secret: DirectionalAppTaggingSecret;
14
+ index: number | undefined;
15
+ }[]): {
16
+ [k: string]: number;
17
+ };
18
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90YWdnaW5nL3V0aWxzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLDJCQUEyQixFQUFFLE1BQU0sRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBSTlFLHdCQUFnQixzQkFBc0IsQ0FDcEMsaUJBQWlCLEVBQUU7SUFBRSxNQUFNLEVBQUUsMkJBQTJCLENBQUM7SUFBQyxhQUFhLEVBQUUsTUFBTSxDQUFDO0lBQUMsY0FBYyxFQUFFLE1BQU0sQ0FBQTtDQUFFLEVBQUUsR0FDMUcsTUFBTSxFQUFFLENBUVY7QUFFRDs7OztHQUlHO0FBQ0gsd0JBQWdCLG9CQUFvQixDQUFDLE9BQU8sRUFBRTtJQUFFLE1BQU0sRUFBRSwyQkFBMkIsQ0FBQztJQUFDLEtBQUssRUFBRSxNQUFNLEdBQUcsU0FBUyxDQUFBO0NBQUUsRUFBRSxHQUFHO0lBQ25ILENBQUMsQ0FBQyxFQUFFLE1BQU0sR0FBRyxNQUFNLENBQUM7Q0FDckIsQ0FRQSJ9
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/tagging/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAI9E,wBAAgB,sBAAsB,CACpC,iBAAiB,EAAE;IAAE,MAAM,EAAE,2BAA2B,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,EAAE,GAC1G,MAAM,EAAE,CAQV;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE;IAAE,MAAM,EAAE,2BAA2B,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,EAAE,GAAG;IACnH,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACrB,CAQA"}
@@ -0,0 +1,25 @@
1
+ // TODO(#17775): If this does not get dropped when implementing the linked issue make this return tags instead. This
2
+ // will move some complexity from syncTaggedLogs to here.
3
+ export function getPreTagsForTheWindow(secretsAndWindows) {
4
+ const secrets = [];
5
+ for (const secretAndWindow of secretsAndWindows){
6
+ for(let i = secretAndWindow.leftMostIndex; i <= secretAndWindow.rightMostIndex; i++){
7
+ secrets.push({
8
+ secret: secretAndWindow.secret,
9
+ index: i
10
+ });
11
+ }
12
+ }
13
+ return secrets;
14
+ }
15
+ /**
16
+ * Creates a map from directional app tagging secret to initial index.
17
+ * @param preTags - The pre-tags to get the initial indexes map from.
18
+ * @returns The map from directional app tagging secret to initial index.
19
+ */ export function getInitialIndexesMap(preTags) {
20
+ const initialIndexes = {};
21
+ for (const preTag of preTags){
22
+ initialIndexes[preTag.secret.toString()] = preTag.index ?? 0;
23
+ }
24
+ return initialIndexes;
25
+ }
@@ -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 { AnchorBlockDataProvider } from '../storage/anchor_block_data_provider/anchor_block_data_provider.js';
9
+ export declare class TreeMembershipService {
10
+ #private;
11
+ private readonly aztecNode;
12
+ private readonly anchorBlockDataProvider;
13
+ constructor(aztecNode: AztecNode, anchorBlockDataProvider: AnchorBlockDataProvider);
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJlZV9tZW1iZXJzaGlwX3NlcnZpY2UuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90cmVlX21lbWJlcnNoaXAvdHJlZV9tZW1iZXJzaGlwX3NlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsd0JBQXdCLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUNqRSxPQUFPLEtBQUssRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUN6RCxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUMzRCxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUNoRSxPQUFPLEtBQUssRUFBRSxjQUFjLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUMxRCxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUVqRSxPQUFPLEVBQUUsWUFBWSxFQUFFLDBCQUEwQixFQUFFLGlCQUFpQixFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFFbEcsT0FBTyxLQUFLLEVBQUUsdUJBQXVCLEVBQUUsTUFBTSxxRUFBcUUsQ0FBQztBQUVuSCxxQkFBYSxxQkFBcUI7O0lBRTlCLE9BQU8sQ0FBQyxRQUFRLENBQUMsU0FBUztJQUMxQixPQUFPLENBQUMsUUFBUSxDQUFDLHVCQUF1QjtJQUYxQyxZQUNtQixTQUFTLEVBQUUsU0FBUyxFQUNwQix1QkFBdUIsRUFBRSx1QkFBdUIsRUFDL0Q7SUFFSjs7O09BR0c7SUFDSSxpQkFBaUIsQ0FBQyxTQUFTLEVBQUUsRUFBRSwrQkFFckM7SUFFRDs7Ozs7O09BTUc7SUFDVSxvQkFBb0IsQ0FBQyxXQUFXLEVBQUUsY0FBYyxFQUFFLE1BQU0sRUFBRSxZQUFZLEVBQUUsU0FBUyxFQUFFLEVBQUUsR0FBRyxPQUFPLENBQUMsRUFBRSxFQUFFLENBQUMsQ0FNakg7SUFFRDs7Ozs7Ozs7T0FRRztJQUNVLGdDQUFnQyxDQUMzQyxXQUFXLEVBQUUsY0FBYyxFQUMzQixTQUFTLEVBQUUsRUFBRSxHQUNaLE9BQU8sQ0FBQywwQkFBMEIsR0FBRyxTQUFTLENBQUMsQ0FNakQ7SUFFRDs7OztPQUlHO0lBQ1Usb0JBQW9CLENBQUMsV0FBVyxFQUFFLGNBQWMsRUFBRSxRQUFRLEVBQUUsRUFBRSxHQUFHLE9BQU8sQ0FBQyxpQkFBaUIsR0FBRyxTQUFTLENBQUMsQ0FNbkg7SUFFRDs7Ozs7O09BTUc7SUFDSSwwQkFBMEIsQ0FDL0IsZUFBZSxFQUFFLFlBQVksRUFDN0IsV0FBVyxFQUFFLEVBQUUsRUFDZixNQUFNLEVBQUUsRUFBRSxHQUNULE9BQU8sQ0FBQyxDQUFDLE1BQU0sRUFBRSxXQUFXLENBQUMsT0FBTyx3QkFBd0IsQ0FBQyxDQUFDLENBQUMsQ0FFakU7Q0F5QkYifQ==
@@ -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,uBAAuB,EAAE,MAAM,qEAAqE,CAAC;AAEnH,qBAAa,qBAAqB;;IAE9B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,uBAAuB;IAF1C,YACmB,SAAS,EAAE,SAAS,EACpB,uBAAuB,EAAE,uBAAuB,EAC/D;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
+ anchorBlockDataProvider;
6
+ constructor(aztecNode, anchorBlockDataProvider){
7
+ this.aztecNode = aztecNode;
8
+ this.anchorBlockDataProvider = anchorBlockDataProvider;
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.anchorBlockDataProvider.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.anchorBlockDataProvider.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,24 +1,22 @@
1
1
  {
2
2
  "name": "@aztec/pxe",
3
- "version": "0.0.0-test.0",
3
+ "version": "0.0.1-commit.03f7ef2",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./server": "./dest/entrypoints/server/index.js",
7
7
  "./client/lazy": "./dest/entrypoints/client/lazy/index.js",
8
8
  "./client/bundle": "./dest/entrypoints/client/bundle/index.js",
9
- "./config": "./dest/config/index.js",
10
- "./testing": "./dest/test/pxe_test_suite.js"
9
+ "./simulator": "./dest/contract_function_simulator/index.js",
10
+ "./config": "./dest/config/index.js"
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
- "formatting": "run -T prettier --check ./src && run -T eslint ./src",
18
- "formatting:fix": "run -T eslint --fix ./src && run -T prettier -w ./src",
19
17
  "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}",
20
- "start": "LOG_LEVEL=${LOG_LEVEL:-debug} && node ./dest/bin/index.js",
21
- "generate": "node ./scripts/generate_package_info.js"
18
+ "generate": "node ./scripts/generate_package_info.js",
19
+ "check_oracle_version": "node ./dest/bin/check_oracle_version.js"
22
20
  },
23
21
  "inherits": [
24
22
  "../package.common.json",
@@ -56,42 +54,47 @@
56
54
  "testTimeout": 120000,
57
55
  "setupFiles": [
58
56
  "../../foundation/src/jest/setup.mjs"
57
+ ],
58
+ "testEnvironment": "../../foundation/src/jest/env.mjs",
59
+ "setupFilesAfterEnv": [
60
+ "../../foundation/src/jest/setupAfterEnv.mjs"
59
61
  ]
60
62
  },
61
63
  "dependencies": {
62
- "@aztec/bb-prover": "0.0.0-test.0",
63
- "@aztec/bb.js": "0.0.0-test.0",
64
- "@aztec/builder": "0.0.0-test.0",
65
- "@aztec/constants": "0.0.0-test.0",
66
- "@aztec/ethereum": "0.0.0-test.0",
67
- "@aztec/foundation": "0.0.0-test.0",
68
- "@aztec/key-store": "0.0.0-test.0",
69
- "@aztec/kv-store": "0.0.0-test.0",
70
- "@aztec/noir-protocol-circuits-types": "0.0.0-test.0",
71
- "@aztec/protocol-contracts": "0.0.0-test.0",
72
- "@aztec/simulator": "0.0.0-test.0",
73
- "@aztec/stdlib": "0.0.0-test.0",
74
- "@msgpack/msgpack": "^3.0.0-beta2",
75
- "koa": "^2.14.2",
76
- "koa-router": "^12.0.0",
64
+ "@aztec/bb-prover": "0.0.1-commit.03f7ef2",
65
+ "@aztec/bb.js": "0.0.1-commit.03f7ef2",
66
+ "@aztec/builder": "0.0.1-commit.03f7ef2",
67
+ "@aztec/constants": "0.0.1-commit.03f7ef2",
68
+ "@aztec/ethereum": "0.0.1-commit.03f7ef2",
69
+ "@aztec/foundation": "0.0.1-commit.03f7ef2",
70
+ "@aztec/key-store": "0.0.1-commit.03f7ef2",
71
+ "@aztec/kv-store": "0.0.1-commit.03f7ef2",
72
+ "@aztec/noir-protocol-circuits-types": "0.0.1-commit.03f7ef2",
73
+ "@aztec/noir-types": "0.0.1-commit.03f7ef2",
74
+ "@aztec/protocol-contracts": "0.0.1-commit.03f7ef2",
75
+ "@aztec/simulator": "0.0.1-commit.03f7ef2",
76
+ "@aztec/stdlib": "0.0.1-commit.03f7ef2",
77
+ "koa": "^2.16.1",
78
+ "koa-router": "^13.1.1",
77
79
  "lodash.omit": "^4.5.0",
78
80
  "sha3": "^2.1.4",
79
81
  "tslib": "^2.4.0",
80
- "viem": "2.22.8",
81
- "@aztec/noir-types": "0.0.0-test.0"
82
+ "viem": "npm:@aztec/viem@2.38.2"
82
83
  },
83
84
  "devDependencies": {
84
- "@aztec/noir-contracts.js": "0.0.0-test.0",
85
- "@jest/globals": "^29.5.0",
86
- "@types/jest": "^29.5.0",
85
+ "@aztec/merkle-tree": "0.0.1-commit.03f7ef2",
86
+ "@aztec/noir-test-contracts.js": "0.0.1-commit.03f7ef2",
87
+ "@jest/globals": "^30.0.0",
88
+ "@types/jest": "^30.0.0",
87
89
  "@types/lodash.omit": "^4.5.7",
88
90
  "@types/lodash.times": "^4.3.9",
89
- "@types/node": "^18.7.23",
90
- "jest": "^29.5.0",
91
- "jest-mock-extended": "^3.0.3",
91
+ "@types/node": "^22.15.17",
92
+ "@typescript/native-preview": "7.0.0-dev.20251126.1",
93
+ "jest": "^30.0.0",
94
+ "jest-mock-extended": "^4.0.0",
92
95
  "lodash.times": "^4.3.2",
93
96
  "ts-node": "^10.9.1",
94
- "typescript": "^5.0.4"
97
+ "typescript": "^5.3.3"
95
98
  },
96
99
  "files": [
97
100
  "dest",
@@ -100,6 +103,6 @@
100
103
  ],
101
104
  "types": "./dest/index.d.ts",
102
105
  "engines": {
103
- "node": ">=18"
106
+ "node": ">=20.10"
104
107
  }
105
108
  }