@aztec/pxe 0.0.0-test.1 → 0.0.1-commit.017a351

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 (573) 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 +73 -0
  5. package/dest/bin/index.d.ts +2 -3
  6. package/dest/bin/index.d.ts.map +1 -1
  7. package/dest/bin/index.js +1 -28
  8. package/dest/bin/oracle_version_helpers.d.ts +26 -0
  9. package/dest/bin/oracle_version_helpers.d.ts.map +1 -0
  10. package/dest/bin/oracle_version_helpers.js +93 -0
  11. package/dest/block_synchronizer/block_stream_source.d.ts +10 -0
  12. package/dest/block_synchronizer/block_stream_source.d.ts.map +1 -0
  13. package/dest/block_synchronizer/block_stream_source.js +62 -0
  14. package/dest/block_synchronizer/block_synchronizer.d.ts +49 -0
  15. package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -0
  16. package/dest/block_synchronizer/block_synchronizer.js +173 -0
  17. package/dest/block_synchronizer/index.d.ts +2 -0
  18. package/dest/block_synchronizer/index.d.ts.map +1 -0
  19. package/dest/block_synchronizer/index.js +1 -0
  20. package/dest/config/index.d.ts +20 -25
  21. package/dest/config/index.d.ts.map +1 -1
  22. package/dest/config/index.js +35 -35
  23. package/dest/config/package_info.d.ts +1 -1
  24. package/dest/config/package_info.js +1 -1
  25. package/dest/contract_function_simulator/benchmarked_node.d.ts +9 -0
  26. package/dest/contract_function_simulator/benchmarked_node.d.ts.map +1 -0
  27. package/dest/contract_function_simulator/benchmarked_node.js +77 -0
  28. package/dest/contract_function_simulator/contract_function_simulator.d.ts +119 -0
  29. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -0
  30. package/dest/contract_function_simulator/contract_function_simulator.js +480 -0
  31. package/dest/contract_function_simulator/ephemeral_array_service.d.ts +28 -0
  32. package/dest/contract_function_simulator/ephemeral_array_service.d.ts.map +1 -0
  33. package/dest/contract_function_simulator/ephemeral_array_service.js +78 -0
  34. package/dest/contract_function_simulator/execution_note_cache.d.ts +104 -0
  35. package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -0
  36. package/dest/contract_function_simulator/execution_note_cache.js +208 -0
  37. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +12 -0
  38. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -0
  39. package/dest/contract_function_simulator/execution_tagging_index_cache.js +30 -0
  40. package/dest/contract_function_simulator/hashed_values_cache.d.ts +28 -0
  41. package/dest/contract_function_simulator/hashed_values_cache.d.ts.map +1 -0
  42. package/dest/contract_function_simulator/hashed_values_cache.js +36 -0
  43. package/dest/contract_function_simulator/index.d.ts +26 -0
  44. package/dest/contract_function_simulator/index.d.ts.map +1 -0
  45. package/dest/contract_function_simulator/index.js +23 -0
  46. package/dest/contract_function_simulator/noir-structs/bounded_vec.d.ts +48 -0
  47. package/dest/contract_function_simulator/noir-structs/bounded_vec.d.ts.map +1 -0
  48. package/dest/contract_function_simulator/noir-structs/bounded_vec.js +45 -0
  49. package/dest/contract_function_simulator/noir-structs/ephemeral_array.d.ts +37 -0
  50. package/dest/contract_function_simulator/noir-structs/ephemeral_array.d.ts.map +1 -0
  51. package/dest/contract_function_simulator/noir-structs/ephemeral_array.js +59 -0
  52. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +20 -0
  53. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -0
  54. package/dest/contract_function_simulator/noir-structs/event_validation_request.js +39 -0
  55. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +26 -0
  56. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts.map +1 -0
  57. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.js +57 -0
  58. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +17 -0
  59. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -0
  60. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +63 -0
  61. package/dest/contract_function_simulator/noir-structs/note_data.d.ts +27 -0
  62. package/dest/contract_function_simulator/noir-structs/note_data.d.ts.map +1 -0
  63. package/dest/contract_function_simulator/noir-structs/note_data.js +3 -0
  64. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +22 -0
  65. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -0
  66. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +47 -0
  67. package/dest/contract_function_simulator/noir-structs/option.d.ts +61 -0
  68. package/dest/contract_function_simulator/noir-structs/option.d.ts.map +1 -0
  69. package/dest/contract_function_simulator/noir-structs/option.js +62 -0
  70. package/dest/contract_function_simulator/noir-structs/provided_secret.d.ts +11 -0
  71. package/dest/contract_function_simulator/noir-structs/provided_secret.d.ts.map +1 -0
  72. package/dest/contract_function_simulator/noir-structs/provided_secret.js +24 -0
  73. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +16 -0
  74. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -0
  75. package/dest/contract_function_simulator/noir-structs/utility_context.js +22 -0
  76. package/dest/contract_function_simulator/oracle/index.d.ts +14 -0
  77. package/dest/contract_function_simulator/oracle/index.d.ts.map +1 -0
  78. package/dest/contract_function_simulator/oracle/index.js +2 -0
  79. package/dest/contract_function_simulator/oracle/interfaces.d.ts +25 -0
  80. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -0
  81. package/dest/contract_function_simulator/oracle/interfaces.js +4 -0
  82. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +19 -0
  83. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -0
  84. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.js +24 -0
  85. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +28 -0
  86. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -0
  87. package/dest/contract_function_simulator/oracle/note_packing_utils.js +54 -0
  88. package/dest/contract_function_simulator/oracle/oracle.d.ts +89 -0
  89. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -0
  90. package/dest/contract_function_simulator/oracle/oracle.js +552 -0
  91. package/dest/contract_function_simulator/oracle/oracle_registry.d.ts +127 -0
  92. package/dest/contract_function_simulator/oracle/oracle_registry.d.ts.map +1 -0
  93. package/dest/contract_function_simulator/oracle/oracle_registry.js +786 -0
  94. package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts +139 -0
  95. package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts.map +1 -0
  96. package/dest/contract_function_simulator/oracle/oracle_type_mappings.js +560 -0
  97. package/dest/contract_function_simulator/oracle/private_execution.d.ts +23 -0
  98. package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -0
  99. package/dest/contract_function_simulator/oracle/private_execution.js +89 -0
  100. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +212 -0
  101. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -0
  102. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +457 -0
  103. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +283 -0
  104. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -0
  105. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +654 -0
  106. package/dest/contract_function_simulator/pick_notes.d.ts +85 -0
  107. package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -0
  108. package/dest/contract_function_simulator/pick_notes.js +68 -0
  109. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +6 -0
  110. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -0
  111. package/dest/contract_function_simulator/proxied_contract_data_source.js +51 -0
  112. package/dest/contract_logging.d.ts +27 -0
  113. package/dest/contract_logging.d.ts.map +1 -0
  114. package/dest/contract_logging.js +38 -0
  115. package/dest/contract_sync/contract_sync_service.d.ts +42 -0
  116. package/dest/contract_sync/contract_sync_service.d.ts.map +1 -0
  117. package/dest/contract_sync/contract_sync_service.js +135 -0
  118. package/dest/contract_sync/helpers.d.ts +27 -0
  119. package/dest/contract_sync/helpers.d.ts.map +1 -0
  120. package/dest/contract_sync/helpers.js +53 -0
  121. package/dest/debug/pxe_debug_utils.d.ts +40 -0
  122. package/dest/debug/pxe_debug_utils.d.ts.map +1 -0
  123. package/dest/debug/pxe_debug_utils.js +42 -0
  124. package/dest/entrypoints/client/bundle/index.d.ts +6 -3
  125. package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
  126. package/dest/entrypoints/client/bundle/index.js +4 -2
  127. package/dest/entrypoints/client/bundle/utils.d.ts +10 -10
  128. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  129. package/dest/entrypoints/client/bundle/utils.js +51 -14
  130. package/dest/entrypoints/client/lazy/index.d.ts +6 -3
  131. package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
  132. package/dest/entrypoints/client/lazy/index.js +4 -2
  133. package/dest/entrypoints/client/lazy/utils.d.ts +10 -10
  134. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  135. package/dest/entrypoints/client/lazy/utils.js +51 -14
  136. package/dest/entrypoints/pxe_creation_options.d.ts +26 -0
  137. package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -0
  138. package/dest/entrypoints/pxe_creation_options.js +3 -0
  139. package/dest/entrypoints/server/index.d.ts +10 -4
  140. package/dest/entrypoints/server/index.d.ts.map +1 -1
  141. package/dest/entrypoints/server/index.js +8 -3
  142. package/dest/entrypoints/server/utils.d.ts +9 -16
  143. package/dest/entrypoints/server/utils.d.ts.map +1 -1
  144. package/dest/entrypoints/server/utils.js +62 -36
  145. package/dest/error_enriching.d.ts +11 -0
  146. package/dest/error_enriching.d.ts.map +1 -0
  147. package/dest/{pxe_service/error_enriching.js → error_enriching.js} +30 -22
  148. package/dest/events/event_service.d.ts +24 -0
  149. package/dest/events/event_service.d.ts.map +1 -0
  150. package/dest/events/event_service.js +77 -0
  151. package/dest/events/index.d.ts +2 -0
  152. package/dest/events/index.d.ts.map +1 -0
  153. package/dest/events/index.js +1 -0
  154. package/dest/events/private_event_filter_validator.d.ts +10 -0
  155. package/dest/events/private_event_filter_validator.d.ts.map +1 -0
  156. package/dest/events/private_event_filter_validator.js +53 -0
  157. package/dest/hooks/authorize_utility_call.d.ts +41 -0
  158. package/dest/hooks/authorize_utility_call.d.ts.map +1 -0
  159. package/dest/hooks/authorize_utility_call.js +4 -0
  160. package/dest/hooks/execution_hooks.d.ts +42 -0
  161. package/dest/hooks/execution_hooks.d.ts.map +1 -0
  162. package/dest/hooks/execution_hooks.js +9 -0
  163. package/dest/hooks/index.d.ts +4 -0
  164. package/dest/hooks/index.d.ts.map +1 -0
  165. package/dest/hooks/index.js +1 -0
  166. package/dest/job_coordinator/job_coordinator.d.ts +75 -0
  167. package/dest/job_coordinator/job_coordinator.d.ts.map +1 -0
  168. package/dest/job_coordinator/job_coordinator.js +94 -0
  169. package/dest/logs/log_service.d.ts +29 -0
  170. package/dest/logs/log_service.d.ts.map +1 -0
  171. package/dest/logs/log_service.js +172 -0
  172. package/dest/messages/message_context_service.d.ts +17 -0
  173. package/dest/messages/message_context_service.d.ts.map +1 -0
  174. package/dest/messages/message_context_service.js +55 -0
  175. package/dest/notes/index.d.ts +2 -0
  176. package/dest/notes/index.d.ts.map +1 -0
  177. package/dest/notes/index.js +1 -0
  178. package/dest/notes/note_service.d.ts +70 -0
  179. package/dest/notes/note_service.d.ts.map +1 -0
  180. package/dest/notes/note_service.js +172 -0
  181. package/dest/notes_filter.d.ts +24 -0
  182. package/dest/notes_filter.d.ts.map +1 -0
  183. package/dest/notes_filter.js +4 -0
  184. package/dest/oracle_version.d.ts +4 -0
  185. package/dest/oracle_version.d.ts.map +1 -0
  186. package/dest/oracle_version.js +21 -0
  187. package/dest/private_kernel/batch_planner.d.ts +47 -0
  188. package/dest/private_kernel/batch_planner.d.ts.map +1 -0
  189. package/dest/private_kernel/batch_planner.js +104 -0
  190. package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts +4 -0
  191. package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts.map +1 -0
  192. package/dest/private_kernel/hints/compute_tx_expiration_timestamp.js +41 -0
  193. package/dest/private_kernel/hints/index.d.ts +3 -0
  194. package/dest/private_kernel/hints/index.d.ts.map +1 -0
  195. package/dest/private_kernel/hints/index.js +2 -0
  196. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +29 -0
  197. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -0
  198. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.js +338 -0
  199. package/dest/private_kernel/hints/test_utils.d.ts +122 -0
  200. package/dest/private_kernel/hints/test_utils.d.ts.map +1 -0
  201. package/dest/private_kernel/hints/test_utils.js +202 -0
  202. package/dest/private_kernel/index.d.ts +3 -0
  203. package/dest/private_kernel/index.d.ts.map +1 -0
  204. package/dest/private_kernel/index.js +2 -0
  205. package/dest/private_kernel/private_kernel_execution_prover.d.ts +49 -0
  206. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -0
  207. package/dest/private_kernel/private_kernel_execution_prover.js +386 -0
  208. package/dest/private_kernel/private_kernel_oracle.d.ts +63 -0
  209. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -0
  210. package/dest/private_kernel/private_kernel_oracle.js +98 -0
  211. package/dest/pxe.d.ts +300 -0
  212. package/dest/pxe.d.ts.map +1 -0
  213. package/dest/pxe.js +839 -0
  214. package/dest/storage/address_store/address_store.d.ts +11 -0
  215. package/dest/storage/address_store/address_store.d.ts.map +1 -0
  216. package/dest/storage/{address_data_provider/address_data_provider.js → address_store/address_store.js} +13 -15
  217. package/dest/storage/address_store/index.d.ts +2 -0
  218. package/dest/storage/address_store/index.d.ts.map +1 -0
  219. package/dest/storage/address_store/index.js +1 -0
  220. package/dest/storage/anchor_block_store/anchor_block_store.d.ts +17 -0
  221. package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -0
  222. package/dest/storage/anchor_block_store/anchor_block_store.js +26 -0
  223. package/dest/storage/anchor_block_store/index.d.ts +2 -0
  224. package/dest/storage/anchor_block_store/index.d.ts.map +1 -0
  225. package/dest/storage/anchor_block_store/index.js +1 -0
  226. package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.d.ts +42 -0
  227. package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.d.ts.map +1 -0
  228. package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.js +93 -0
  229. package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts +15 -0
  230. package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts.map +1 -0
  231. package/dest/storage/backwards_compatibility_tests/schema_tests.js +591 -0
  232. package/dest/storage/backwards_compatibility_tests/store_spy.d.ts +19 -0
  233. package/dest/storage/backwards_compatibility_tests/store_spy.d.ts.map +1 -0
  234. package/dest/storage/backwards_compatibility_tests/store_spy.js +63 -0
  235. package/dest/storage/capsule_store/capsule_service.d.ts +21 -0
  236. package/dest/storage/capsule_store/capsule_service.d.ts.map +1 -0
  237. package/dest/storage/capsule_store/capsule_service.js +50 -0
  238. package/dest/storage/capsule_store/capsule_store.d.ts +72 -0
  239. package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -0
  240. package/dest/storage/capsule_store/capsule_store.js +261 -0
  241. package/dest/storage/capsule_store/index.d.ts +3 -0
  242. package/dest/storage/capsule_store/index.d.ts.map +1 -0
  243. package/dest/storage/capsule_store/index.js +2 -0
  244. package/dest/storage/contract_store/contract_store.d.ts +93 -0
  245. package/dest/storage/contract_store/contract_store.d.ts.map +1 -0
  246. package/dest/storage/contract_store/contract_store.js +292 -0
  247. package/dest/storage/contract_store/index.d.ts +2 -0
  248. package/dest/storage/contract_store/index.d.ts.map +1 -0
  249. package/dest/storage/contract_store/index.js +1 -0
  250. package/dest/storage/contract_store/private_functions_tree.d.ts +27 -0
  251. package/dest/storage/contract_store/private_functions_tree.d.ts.map +1 -0
  252. package/dest/storage/contract_store/private_functions_tree.js +47 -0
  253. package/dest/storage/index.d.ts +9 -10
  254. package/dest/storage/index.d.ts.map +1 -1
  255. package/dest/storage/index.js +8 -9
  256. package/dest/storage/metadata.d.ts +2 -0
  257. package/dest/storage/metadata.d.ts.map +1 -0
  258. package/dest/storage/metadata.js +1 -0
  259. package/dest/storage/note_store/index.d.ts +3 -0
  260. package/dest/storage/note_store/index.d.ts.map +1 -0
  261. package/dest/storage/note_store/index.js +2 -0
  262. package/dest/storage/note_store/note_store.d.ts +83 -0
  263. package/dest/storage/note_store/note_store.d.ts.map +1 -0
  264. package/dest/storage/note_store/note_store.js +343 -0
  265. package/dest/storage/note_store/stored_note.d.ts +16 -0
  266. package/dest/storage/note_store/stored_note.d.ts.map +1 -0
  267. package/dest/storage/note_store/stored_note.js +43 -0
  268. package/dest/storage/open_pxe_stores.d.ts +33 -0
  269. package/dest/storage/open_pxe_stores.d.ts.map +1 -0
  270. package/dest/storage/open_pxe_stores.js +27 -0
  271. package/dest/storage/private_event_store/private_event_store.d.ts +91 -0
  272. package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -0
  273. package/dest/storage/private_event_store/private_event_store.js +276 -0
  274. package/dest/storage/private_event_store/stored_private_event.d.ts +23 -0
  275. package/dest/storage/private_event_store/stored_private_event.d.ts.map +1 -0
  276. package/dest/storage/private_event_store/stored_private_event.js +56 -0
  277. package/dest/storage/tagging_store/index.d.ts +4 -0
  278. package/dest/storage/tagging_store/index.d.ts.map +1 -0
  279. package/dest/storage/tagging_store/index.js +3 -0
  280. package/dest/storage/tagging_store/recipient_tagging_store.d.ts +28 -0
  281. package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -0
  282. package/dest/storage/tagging_store/recipient_tagging_store.js +111 -0
  283. package/dest/storage/tagging_store/sender_address_book_store.d.ts +14 -0
  284. package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +1 -0
  285. package/dest/storage/tagging_store/sender_address_book_store.js +36 -0
  286. package/dest/storage/tagging_store/sender_tagging_store.d.ts +78 -0
  287. package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -0
  288. package/dest/storage/tagging_store/sender_tagging_store.js +374 -0
  289. package/dest/tagging/constants.d.ts +2 -0
  290. package/dest/tagging/constants.d.ts.map +1 -0
  291. package/dest/tagging/constants.js +10 -0
  292. package/dest/tagging/get_all_logs_by_tags.d.ts +48 -0
  293. package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -0
  294. package/dest/tagging/get_all_logs_by_tags.js +59 -0
  295. package/dest/tagging/index.d.ts +18 -0
  296. package/dest/tagging/index.d.ts.map +1 -0
  297. package/dest/tagging/index.js +16 -0
  298. package/dest/tagging/persist_sender_tagging_index_ranges.d.ts +29 -0
  299. package/dest/tagging/persist_sender_tagging_index_ranges.d.ts.map +1 -0
  300. package/dest/tagging/persist_sender_tagging_index_ranges.js +42 -0
  301. package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts +56 -0
  302. package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts.map +1 -0
  303. package/dest/tagging/recipient_sync/sync_tagged_private_logs.js +163 -0
  304. package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts +12 -0
  305. package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts.map +1 -0
  306. package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +20 -0
  307. package/dest/tagging/reconcile_tagging_index_ranges.d.ts +36 -0
  308. package/dest/tagging/reconcile_tagging_index_ranges.d.ts.map +1 -0
  309. package/dest/tagging/reconcile_tagging_index_ranges.js +74 -0
  310. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +16 -0
  311. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -0
  312. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +92 -0
  313. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +17 -0
  314. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -0
  315. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +60 -0
  316. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +19 -0
  317. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -0
  318. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +72 -0
  319. package/package.json +48 -33
  320. package/src/bin/check_oracle_version.ts +88 -0
  321. package/src/bin/index.ts +1 -38
  322. package/src/bin/oracle_version_helpers.ts +121 -0
  323. package/src/block_synchronizer/block_stream_source.ts +81 -0
  324. package/src/block_synchronizer/block_synchronizer.ts +200 -0
  325. package/src/block_synchronizer/index.ts +1 -0
  326. package/src/config/index.ts +48 -56
  327. package/src/config/package_info.ts +1 -1
  328. package/src/contract_function_simulator/benchmarked_node.ts +103 -0
  329. package/src/contract_function_simulator/contract_function_simulator.ts +888 -0
  330. package/src/contract_function_simulator/ephemeral_array_service.ts +110 -0
  331. package/src/contract_function_simulator/execution_note_cache.ts +252 -0
  332. package/src/contract_function_simulator/execution_tagging_index_cache.ts +33 -0
  333. package/src/contract_function_simulator/hashed_values_cache.ts +47 -0
  334. package/src/contract_function_simulator/index.ts +63 -0
  335. package/src/contract_function_simulator/noir-structs/bounded_vec.ts +55 -0
  336. package/src/contract_function_simulator/noir-structs/ephemeral_array.ts +66 -0
  337. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +52 -0
  338. package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +61 -0
  339. package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +66 -0
  340. package/src/contract_function_simulator/noir-structs/note_data.ts +27 -0
  341. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +59 -0
  342. package/src/contract_function_simulator/noir-structs/option.ts +69 -0
  343. package/src/contract_function_simulator/noir-structs/provided_secret.ts +27 -0
  344. package/src/contract_function_simulator/noir-structs/utility_context.ts +23 -0
  345. package/src/contract_function_simulator/oracle/index.ts +16 -0
  346. package/src/contract_function_simulator/oracle/interfaces.ts +21 -0
  347. package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +23 -0
  348. package/src/contract_function_simulator/oracle/note_packing_utils.ts +68 -0
  349. package/src/contract_function_simulator/oracle/oracle.ts +711 -0
  350. package/src/contract_function_simulator/oracle/oracle_registry.ts +585 -0
  351. package/src/contract_function_simulator/oracle/oracle_type_mappings.ts +553 -0
  352. package/src/contract_function_simulator/oracle/private_execution.ts +141 -0
  353. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +667 -0
  354. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +967 -0
  355. package/src/contract_function_simulator/pick_notes.ts +160 -0
  356. package/src/contract_function_simulator/proxied_contract_data_source.ts +60 -0
  357. package/src/contract_logging.ts +52 -0
  358. package/src/contract_sync/contract_sync_service.ts +189 -0
  359. package/src/contract_sync/helpers.ts +86 -0
  360. package/src/debug/pxe_debug_utils.ts +85 -0
  361. package/src/entrypoints/client/bundle/index.ts +5 -2
  362. package/src/entrypoints/client/bundle/utils.ts +47 -35
  363. package/src/entrypoints/client/lazy/index.ts +5 -2
  364. package/src/entrypoints/client/lazy/utils.ts +48 -31
  365. package/src/entrypoints/pxe_creation_options.ts +28 -0
  366. package/src/entrypoints/server/index.ts +9 -3
  367. package/src/entrypoints/server/utils.ts +65 -56
  368. package/src/{pxe_service/error_enriching.ts → error_enriching.ts} +40 -39
  369. package/src/events/event_service.ts +119 -0
  370. package/src/events/index.ts +1 -0
  371. package/src/events/private_event_filter_validator.ts +66 -0
  372. package/src/hooks/authorize_utility_call.ts +44 -0
  373. package/src/hooks/execution_hooks.ts +48 -0
  374. package/src/hooks/index.ts +7 -0
  375. package/src/job_coordinator/job_coordinator.ts +150 -0
  376. package/src/logs/log_service.ts +237 -0
  377. package/src/messages/message_context_service.ts +62 -0
  378. package/src/notes/index.ts +1 -0
  379. package/src/notes/note_service.ts +230 -0
  380. package/src/notes_filter.ts +24 -0
  381. package/src/oracle_version.ts +22 -0
  382. package/src/private_kernel/batch_planner.ts +169 -0
  383. package/src/private_kernel/hints/compute_tx_expiration_timestamp.ts +58 -0
  384. package/src/private_kernel/hints/index.ts +2 -0
  385. package/src/private_kernel/hints/private_kernel_reset_private_inputs_builder.ts +542 -0
  386. package/src/private_kernel/hints/test_utils.ts +318 -0
  387. package/src/private_kernel/index.ts +2 -0
  388. package/src/private_kernel/private_kernel_execution_prover.ts +598 -0
  389. package/src/private_kernel/private_kernel_oracle.ts +162 -0
  390. package/src/pxe.ts +1305 -0
  391. package/src/storage/{address_data_provider/address_data_provider.ts → address_store/address_store.ts} +15 -21
  392. package/src/storage/address_store/index.ts +1 -0
  393. package/src/storage/anchor_block_store/anchor_block_store.ts +33 -0
  394. package/src/storage/anchor_block_store/index.ts +1 -0
  395. package/src/storage/backwards_compatibility_tests/__snapshots__/AddressStore.json +22 -0
  396. package/src/storage/backwards_compatibility_tests/__snapshots__/AnchorBlockStore.json +3 -0
  397. package/src/storage/backwards_compatibility_tests/__snapshots__/CapsuleStore.json +16 -0
  398. package/src/storage/backwards_compatibility_tests/__snapshots__/ContractStore.json +28 -0
  399. package/src/storage/backwards_compatibility_tests/__snapshots__/KeyStore.json +52 -0
  400. package/src/storage/backwards_compatibility_tests/__snapshots__/L2TipsKVStore.json +46 -0
  401. package/src/storage/backwards_compatibility_tests/__snapshots__/NoteStore.json +36 -0
  402. package/src/storage/backwards_compatibility_tests/__snapshots__/PrivateEventStore.json +44 -0
  403. package/src/storage/backwards_compatibility_tests/__snapshots__/RecipientTaggingStore.json +18 -0
  404. package/src/storage/backwards_compatibility_tests/__snapshots__/SenderAddressBookStore.json +16 -0
  405. package/src/storage/backwards_compatibility_tests/__snapshots__/SenderTaggingStore.json +22 -0
  406. package/src/storage/backwards_compatibility_tests/__snapshots__/opened_stores.json +97 -0
  407. package/src/storage/backwards_compatibility_tests/kv_store_snapshot.ts +122 -0
  408. package/src/storage/backwards_compatibility_tests/schema_tests.ts +712 -0
  409. package/src/storage/backwards_compatibility_tests/store_spy.ts +73 -0
  410. package/src/storage/capsule_store/capsule_service.ts +90 -0
  411. package/src/storage/capsule_store/capsule_store.ts +333 -0
  412. package/src/storage/capsule_store/index.ts +2 -0
  413. package/src/storage/contract_store/contract_store.ts +408 -0
  414. package/src/storage/contract_store/index.ts +1 -0
  415. package/src/storage/contract_store/private_functions_tree.ts +67 -0
  416. package/src/storage/index.ts +8 -10
  417. package/src/storage/metadata.ts +1 -0
  418. package/src/storage/note_store/index.ts +2 -0
  419. package/src/storage/note_store/note_store.ts +415 -0
  420. package/src/storage/note_store/stored_note.ts +48 -0
  421. package/src/storage/open_pxe_stores.ts +49 -0
  422. package/src/storage/private_event_store/private_event_store.ts +388 -0
  423. package/src/storage/private_event_store/stored_private_event.ts +73 -0
  424. package/src/storage/tagging_store/index.ts +3 -0
  425. package/src/storage/tagging_store/recipient_tagging_store.ts +139 -0
  426. package/src/storage/tagging_store/sender_address_book_store.ts +48 -0
  427. package/src/storage/tagging_store/sender_tagging_store.ts +476 -0
  428. package/src/tagging/constants.ts +10 -0
  429. package/src/tagging/get_all_logs_by_tags.ts +120 -0
  430. package/src/tagging/index.ts +20 -0
  431. package/src/tagging/persist_sender_tagging_index_ranges.ts +57 -0
  432. package/src/tagging/recipient_sync/sync_tagged_private_logs.ts +240 -0
  433. package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +34 -0
  434. package/src/tagging/reconcile_tagging_index_ranges.ts +102 -0
  435. package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +134 -0
  436. package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +66 -0
  437. package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +84 -0
  438. package/dest/entrypoints/client/pxe_creation_options.d.ts +0 -11
  439. package/dest/entrypoints/client/pxe_creation_options.d.ts.map +0 -1
  440. package/dest/entrypoints/client/pxe_creation_options.js +0 -1
  441. package/dest/kernel_oracle/index.d.ts +0 -45
  442. package/dest/kernel_oracle/index.d.ts.map +0 -1
  443. package/dest/kernel_oracle/index.js +0 -76
  444. package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.d.ts +0 -28
  445. package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.d.ts.map +0 -1
  446. package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.js +0 -270
  447. package/dest/kernel_prover/hints/index.d.ts +0 -2
  448. package/dest/kernel_prover/hints/index.d.ts.map +0 -1
  449. package/dest/kernel_prover/hints/index.js +0 -1
  450. package/dest/kernel_prover/index.d.ts +0 -3
  451. package/dest/kernel_prover/index.d.ts.map +0 -1
  452. package/dest/kernel_prover/index.js +0 -2
  453. package/dest/kernel_prover/kernel_prover.d.ts +0 -38
  454. package/dest/kernel_prover/kernel_prover.d.ts.map +0 -1
  455. package/dest/kernel_prover/kernel_prover.js +0 -217
  456. package/dest/kernel_prover/proving_data_oracle.d.ts +0 -73
  457. package/dest/kernel_prover/proving_data_oracle.d.ts.map +0 -1
  458. package/dest/kernel_prover/proving_data_oracle.js +0 -4
  459. package/dest/note_decryption_utils/add_public_values_to_payload.d.ts +0 -11
  460. package/dest/note_decryption_utils/add_public_values_to_payload.d.ts.map +0 -1
  461. package/dest/note_decryption_utils/add_public_values_to_payload.js +0 -47
  462. package/dest/pxe_http/index.d.ts +0 -2
  463. package/dest/pxe_http/index.d.ts.map +0 -1
  464. package/dest/pxe_http/index.js +0 -1
  465. package/dest/pxe_http/pxe_http_server.d.ts +0 -16
  466. package/dest/pxe_http/pxe_http_server.d.ts.map +0 -1
  467. package/dest/pxe_http/pxe_http_server.js +0 -27
  468. package/dest/pxe_oracle_interface/index.d.ts +0 -159
  469. package/dest/pxe_oracle_interface/index.d.ts.map +0 -1
  470. package/dest/pxe_oracle_interface/index.js +0 -692
  471. package/dest/pxe_oracle_interface/tagging_utils.d.ts +0 -17
  472. package/dest/pxe_oracle_interface/tagging_utils.d.ts.map +0 -1
  473. package/dest/pxe_oracle_interface/tagging_utils.js +0 -23
  474. package/dest/pxe_service/error_enriching.d.ts +0 -11
  475. package/dest/pxe_service/error_enriching.d.ts.map +0 -1
  476. package/dest/pxe_service/index.d.ts +0 -3
  477. package/dest/pxe_service/index.d.ts.map +0 -1
  478. package/dest/pxe_service/index.js +0 -2
  479. package/dest/pxe_service/pxe_service.d.ts +0 -111
  480. package/dest/pxe_service/pxe_service.d.ts.map +0 -1
  481. package/dest/pxe_service/pxe_service.js +0 -664
  482. package/dest/storage/address_data_provider/address_data_provider.d.ts +0 -13
  483. package/dest/storage/address_data_provider/address_data_provider.d.ts.map +0 -1
  484. package/dest/storage/address_data_provider/index.d.ts +0 -2
  485. package/dest/storage/address_data_provider/index.d.ts.map +0 -1
  486. package/dest/storage/address_data_provider/index.js +0 -1
  487. package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.d.ts +0 -11
  488. package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.d.ts.map +0 -1
  489. package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.js +0 -20
  490. package/dest/storage/auth_witness_data_provider/index.d.ts +0 -2
  491. package/dest/storage/auth_witness_data_provider/index.d.ts.map +0 -1
  492. package/dest/storage/auth_witness_data_provider/index.js +0 -1
  493. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts +0 -16
  494. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +0 -1
  495. package/dest/storage/capsule_data_provider/capsule_data_provider.js +0 -57
  496. package/dest/storage/capsule_data_provider/index.d.ts +0 -2
  497. package/dest/storage/capsule_data_provider/index.d.ts.map +0 -1
  498. package/dest/storage/capsule_data_provider/index.js +0 -1
  499. package/dest/storage/contract_data_provider/contract_data_provider.d.ts +0 -109
  500. package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +0 -1
  501. package/dest/storage/contract_data_provider/contract_data_provider.js +0 -183
  502. package/dest/storage/contract_data_provider/index.d.ts +0 -3
  503. package/dest/storage/contract_data_provider/index.d.ts.map +0 -1
  504. package/dest/storage/contract_data_provider/index.js +0 -2
  505. package/dest/storage/contract_data_provider/private_functions_tree.d.ts +0 -66
  506. package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +0 -1
  507. package/dest/storage/contract_data_provider/private_functions_tree.js +0 -99
  508. package/dest/storage/data_provider.d.ts +0 -4
  509. package/dest/storage/data_provider.d.ts.map +0 -1
  510. package/dest/storage/data_provider.js +0 -1
  511. package/dest/storage/note_data_provider/index.d.ts +0 -3
  512. package/dest/storage/note_data_provider/index.d.ts.map +0 -1
  513. package/dest/storage/note_data_provider/index.js +0 -2
  514. package/dest/storage/note_data_provider/note_dao.d.ts +0 -106
  515. package/dest/storage/note_data_provider/note_dao.d.ts.map +0 -1
  516. package/dest/storage/note_data_provider/note_dao.js +0 -106
  517. package/dest/storage/note_data_provider/note_data_provider.d.ts +0 -20
  518. package/dest/storage/note_data_provider/note_data_provider.d.ts.map +0 -1
  519. package/dest/storage/note_data_provider/note_data_provider.js +0 -249
  520. package/dest/storage/sync_data_provider/index.d.ts +0 -2
  521. package/dest/storage/sync_data_provider/index.d.ts.map +0 -1
  522. package/dest/storage/sync_data_provider/index.js +0 -1
  523. package/dest/storage/sync_data_provider/sync_data_provider.d.ts +0 -12
  524. package/dest/storage/sync_data_provider/sync_data_provider.d.ts.map +0 -1
  525. package/dest/storage/sync_data_provider/sync_data_provider.js +0 -29
  526. package/dest/storage/tagging_data_provider/index.d.ts +0 -2
  527. package/dest/storage/tagging_data_provider/index.d.ts.map +0 -1
  528. package/dest/storage/tagging_data_provider/index.js +0 -1
  529. package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts +0 -18
  530. package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts.map +0 -1
  531. package/dest/storage/tagging_data_provider/tagging_data_provider.js +0 -65
  532. package/dest/synchronizer/index.d.ts +0 -2
  533. package/dest/synchronizer/index.d.ts.map +0 -1
  534. package/dest/synchronizer/index.js +0 -1
  535. package/dest/synchronizer/synchronizer.d.ts +0 -37
  536. package/dest/synchronizer/synchronizer.d.ts.map +0 -1
  537. package/dest/synchronizer/synchronizer.js +0 -103
  538. package/dest/test/pxe_test_suite.d.ts +0 -3
  539. package/dest/test/pxe_test_suite.d.ts.map +0 -1
  540. package/dest/test/pxe_test_suite.js +0 -97
  541. package/src/entrypoints/client/pxe_creation_options.ts +0 -7
  542. package/src/kernel_oracle/index.ts +0 -117
  543. package/src/kernel_prover/hints/build_private_kernel_reset_private_inputs.ts +0 -472
  544. package/src/kernel_prover/hints/index.ts +0 -1
  545. package/src/kernel_prover/index.ts +0 -2
  546. package/src/kernel_prover/kernel_prover.ts +0 -351
  547. package/src/kernel_prover/proving_data_oracle.ts +0 -83
  548. package/src/note_decryption_utils/add_public_values_to_payload.ts +0 -64
  549. package/src/pxe_http/index.ts +0 -1
  550. package/src/pxe_http/pxe_http_server.ts +0 -29
  551. package/src/pxe_oracle_interface/index.ts +0 -925
  552. package/src/pxe_oracle_interface/tagging_utils.ts +0 -32
  553. package/src/pxe_service/index.ts +0 -2
  554. package/src/pxe_service/pxe_service.ts +0 -949
  555. package/src/storage/address_data_provider/index.ts +0 -1
  556. package/src/storage/auth_witness_data_provider/auth_witness_data_provider.ts +0 -34
  557. package/src/storage/auth_witness_data_provider/index.ts +0 -1
  558. package/src/storage/capsule_data_provider/capsule_data_provider.ts +0 -80
  559. package/src/storage/capsule_data_provider/index.ts +0 -1
  560. package/src/storage/contract_data_provider/contract_data_provider.ts +0 -261
  561. package/src/storage/contract_data_provider/index.ts +0 -2
  562. package/src/storage/contract_data_provider/private_functions_tree.ts +0 -131
  563. package/src/storage/data_provider.ts +0 -3
  564. package/src/storage/note_data_provider/index.ts +0 -2
  565. package/src/storage/note_data_provider/note_dao.ts +0 -162
  566. package/src/storage/note_data_provider/note_data_provider.ts +0 -345
  567. package/src/storage/sync_data_provider/index.ts +0 -1
  568. package/src/storage/sync_data_provider/sync_data_provider.ts +0 -40
  569. package/src/storage/tagging_data_provider/index.ts +0 -1
  570. package/src/storage/tagging_data_provider/tagging_data_provider.ts +0 -92
  571. package/src/synchronizer/index.ts +0 -1
  572. package/src/synchronizer/synchronizer.ts +0 -121
  573. package/src/test/pxe_test_suite.ts +0 -111
@@ -0,0 +1,78 @@
1
+ import type { AztecAsyncKVStore } from '@aztec/kv-store';
2
+ import { AppTaggingSecret, type TaggingIndexRange } from '@aztec/stdlib/logs';
3
+ import { TxEffect, TxHash } from '@aztec/stdlib/tx';
4
+ import type { StagedStore } from '../../job_coordinator/job_coordinator.js';
5
+ /**
6
+ * Data provider of tagging data used when syncing the sender tagging indexes. The recipient counterpart of this class
7
+ * is called RecipientTaggingStore. We have the data stores separate for sender and recipient because
8
+ * the algorithms are completely disjoint and there is not data reuse between the two.
9
+ */
10
+ export declare class SenderTaggingStore implements StagedStore {
11
+ #private;
12
+ readonly storeName = "sender_tagging";
13
+ constructor(store: AztecAsyncKVStore);
14
+ /**
15
+ * Writes all job-specific in-memory data to persistent storage.
16
+ *
17
+ * @remark This method must run in a DB transaction context. It's designed to be called from JobCoordinator#commitJob.
18
+ */
19
+ commit(jobId: string): Promise<void>;
20
+ discardStaged(jobId: string): Promise<void>;
21
+ /**
22
+ * Stores pending index ranges.
23
+ * @remarks If the same (secret, txHash) pair already exists in the db with an equal range, it's a no-op. This is
24
+ * expected to happen because whenever we start sync we start from the last finalized index and we can have pending
25
+ * ranges already stored from previous syncs. If the ranges differ, it throws an error as that indicates a bug.
26
+ * @param ranges - The tagging index ranges containing the directional app tagging secrets and the index ranges that are
27
+ * to be stored in the db.
28
+ * @param txHash - The tx in which the tagging indexes were used in private logs.
29
+ * @param jobId - job context for staged writes to this store. See `JobCoordinator` for more details.
30
+ * @throws If the highestIndex is further than window length from the highest finalized index for the same secret.
31
+ * @throws If the lowestIndex is lower than or equal to the last finalized index for the same secret.
32
+ * @throws If a different range already exists for the same (secret, txHash) pair.
33
+ */
34
+ storePendingIndexes(ranges: TaggingIndexRange[], txHash: TxHash, jobId: string): Promise<void>;
35
+ /**
36
+ * Returns the transaction hashes of all pending transactions that contain highest indexes within a specified range
37
+ * for a given directional app tagging secret. We check based on the highest indexes only as that is the relevant
38
+ * information for the caller of this function.
39
+ * @param secret - The directional app tagging secret to query pending indexes for.
40
+ * @param startIndex - The lower bound of the index range (inclusive).
41
+ * @param endIndex - The upper bound of the index range (exclusive).
42
+ * @returns An array of unique transaction hashes for pending transactions that contain indexes in the range
43
+ * [startIndex, endIndex). Returns an empty array if no pending indexes exist in the range.
44
+ */
45
+ getTxHashesOfPendingIndexes(secret: AppTaggingSecret, startIndex: number, endIndex: number, jobId: string): Promise<TxHash[]>;
46
+ /**
47
+ * Returns the last (highest) finalized index for a given secret.
48
+ * @param secret - The secret to get the last finalized index for.
49
+ * @returns The last (highest) finalized index for the given secret.
50
+ */
51
+ getLastFinalizedIndex(secret: AppTaggingSecret, jobId: string): Promise<number | undefined>;
52
+ /**
53
+ * Returns the last used index for a given directional app tagging secret, considering both finalized and pending
54
+ * indexes.
55
+ * @param secret - The directional app tagging secret to query the last used index for.
56
+ * @returns The last used index.
57
+ */
58
+ getLastUsedIndex(secret: AppTaggingSecret, jobId: string): Promise<number | undefined>;
59
+ /**
60
+ * Drops all pending indexes corresponding to the given transaction hashes.
61
+ */
62
+ dropPendingIndexes(txHashes: TxHash[], jobId: string): Promise<void>;
63
+ /**
64
+ * Updates pending indexes corresponding to the given transaction hashes to be finalized and prunes any lower pending
65
+ * indexes.
66
+ */
67
+ finalizePendingIndexes(txHashes: TxHash[], jobId: string): Promise<void>;
68
+ /**
69
+ * Handles finalization of pending indexes for a transaction whose execution was partially reverted.
70
+ * Recomputes the siloed tags for each pending index of the given tx and checks which ones appear in the
71
+ * TxEffect's private logs (i.e., which ones made it onchain). Those that survived are finalized; those that
72
+ * didn't are dropped.
73
+ * @param txEffect - The tx effect of the partially reverted transaction.
74
+ * @param jobId - job context for staged writes to this store. See `JobCoordinator` for more details.
75
+ */
76
+ finalizePendingIndexesOfAPart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2CnE;IA4CD;;;OAGG;IACG,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAsD7E;IAED;;;;;;;OAOG;IACG,4CAA4C,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAgDnG;CACF"}
@@ -0,0 +1,374 @@
1
+ import { AppTaggingSecret, SiloedTag } from '@aztec/stdlib/logs';
2
+ import { TxHash } from '@aztec/stdlib/tx';
3
+ import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../../tagging/constants.js';
4
+ /**
5
+ * Data provider of tagging data used when syncing the sender tagging indexes. The recipient counterpart of this class
6
+ * is called RecipientTaggingStore. We have the data stores separate for sender and recipient because
7
+ * the algorithms are completely disjoint and there is not data reuse between the two.
8
+ */ export class SenderTaggingStore {
9
+ storeName = 'sender_tagging';
10
+ #store;
11
+ // Stores the pending index ranges for each directional app tagging secret. Pending here means that the tx that
12
+ // contained the private logs with tags corresponding to these indexes has not been finalized yet.
13
+ //
14
+ // We store the full range (lowestIndex, highestIndex) for each secret-tx pair because transactions can partially
15
+ // revert, in which case only some logs (from the non-revertible phase) survive onchain. By storing the range,
16
+ // we can expand it and check each individual siloed tag against the TxEffect to determine which indexes made it
17
+ // onchain.
18
+ //
19
+ // directional app tagging secret => { lowestIndex, highestIndex, txHash }[]
20
+ #pendingIndexes;
21
+ // jobId => directional app tagging secret => { lowestIndex, highestIndex, txHash }[]
22
+ #pendingIndexesForJob;
23
+ // Stores the last (highest) finalized index for each directional app tagging secret. We care only about the last
24
+ // index because unlike the pending indexes, it will never happen that a finalized index would be removed and hence
25
+ // we don't need to store the history.
26
+ //
27
+ // directional app tagging secret => highest finalized index
28
+ #lastFinalizedIndexes;
29
+ // jobId => directional app tagging secret => highest finalized index
30
+ #lastFinalizedIndexesForJob;
31
+ constructor(store){
32
+ this.#store = store;
33
+ this.#pendingIndexes = this.#store.openMap('pending_indexes');
34
+ this.#lastFinalizedIndexes = this.#store.openMap('last_finalized_indexes');
35
+ this.#pendingIndexesForJob = new Map();
36
+ this.#lastFinalizedIndexesForJob = new Map();
37
+ }
38
+ #getPendingIndexesForJob(jobId) {
39
+ let pendingIndexesForJob = this.#pendingIndexesForJob.get(jobId);
40
+ if (!pendingIndexesForJob) {
41
+ pendingIndexesForJob = new Map();
42
+ this.#pendingIndexesForJob.set(jobId, pendingIndexesForJob);
43
+ }
44
+ return pendingIndexesForJob;
45
+ }
46
+ #getLastFinalizedIndexesForJob(jobId) {
47
+ let jobStagedLastFinalizedIndexes = this.#lastFinalizedIndexesForJob.get(jobId);
48
+ if (!jobStagedLastFinalizedIndexes) {
49
+ jobStagedLastFinalizedIndexes = new Map();
50
+ this.#lastFinalizedIndexesForJob.set(jobId, jobStagedLastFinalizedIndexes);
51
+ }
52
+ return jobStagedLastFinalizedIndexes;
53
+ }
54
+ async #readPendingIndexes(jobId, secret) {
55
+ // Always issue DB read to keep IndexedDB transaction alive (they auto-commit when a new micro-task starts and there
56
+ // are no pending read requests). The staged value still takes precedence if it exists.
57
+ const dbValue = await this.#pendingIndexes.getAsync(secret);
58
+ const staged = this.#getPendingIndexesForJob(jobId).get(secret);
59
+ return staged !== undefined ? staged : dbValue ?? [];
60
+ }
61
+ #writePendingIndexes(jobId, secret, pendingIndexes) {
62
+ this.#getPendingIndexesForJob(jobId).set(secret, pendingIndexes);
63
+ }
64
+ async #readLastFinalizedIndex(jobId, secret) {
65
+ // Always issue DB read to keep IndexedDB transaction alive (they auto-commit when a new micro-task starts and there
66
+ // are no pending read requests). The staged value still takes precedence if it exists.
67
+ const dbValue = await this.#lastFinalizedIndexes.getAsync(secret);
68
+ const staged = this.#getLastFinalizedIndexesForJob(jobId).get(secret);
69
+ return staged ?? dbValue;
70
+ }
71
+ #writeLastFinalizedIndex(jobId, secret, lastFinalizedIndex) {
72
+ this.#getLastFinalizedIndexesForJob(jobId).set(secret, lastFinalizedIndex);
73
+ }
74
+ /**
75
+ * Writes all job-specific in-memory data to persistent storage.
76
+ *
77
+ * @remark This method must run in a DB transaction context. It's designed to be called from JobCoordinator#commitJob.
78
+ */ async commit(jobId) {
79
+ const pendingIndexesForJob = this.#pendingIndexesForJob.get(jobId);
80
+ if (pendingIndexesForJob) {
81
+ for (const [secret, pendingIndexes] of pendingIndexesForJob.entries()){
82
+ if (pendingIndexes.length === 0) {
83
+ await this.#pendingIndexes.delete(secret);
84
+ } else {
85
+ await this.#pendingIndexes.set(secret, pendingIndexes);
86
+ }
87
+ }
88
+ }
89
+ const lastFinalizedIndexesForJob = this.#lastFinalizedIndexesForJob.get(jobId);
90
+ if (lastFinalizedIndexesForJob) {
91
+ for (const [secret, lastFinalizedIndex] of lastFinalizedIndexesForJob.entries()){
92
+ await this.#lastFinalizedIndexes.set(secret, lastFinalizedIndex);
93
+ }
94
+ }
95
+ return this.discardStaged(jobId);
96
+ }
97
+ discardStaged(jobId) {
98
+ this.#pendingIndexesForJob.delete(jobId);
99
+ this.#lastFinalizedIndexesForJob.delete(jobId);
100
+ return Promise.resolve();
101
+ }
102
+ /**
103
+ * Stores pending index ranges.
104
+ * @remarks If the same (secret, txHash) pair already exists in the db with an equal range, it's a no-op. This is
105
+ * expected to happen because whenever we start sync we start from the last finalized index and we can have pending
106
+ * ranges already stored from previous syncs. If the ranges differ, it throws an error as that indicates a bug.
107
+ * @param ranges - The tagging index ranges containing the directional app tagging secrets and the index ranges that are
108
+ * to be stored in the db.
109
+ * @param txHash - The tx in which the tagging indexes were used in private logs.
110
+ * @param jobId - job context for staged writes to this store. See `JobCoordinator` for more details.
111
+ * @throws If the highestIndex is further than window length from the highest finalized index for the same secret.
112
+ * @throws If the lowestIndex is lower than or equal to the last finalized index for the same secret.
113
+ * @throws If a different range already exists for the same (secret, txHash) pair.
114
+ */ storePendingIndexes(ranges, txHash, jobId) {
115
+ if (ranges.length === 0) {
116
+ return Promise.resolve();
117
+ }
118
+ const txHashStr = txHash.toString();
119
+ return this.#store.transactionAsync(async ()=>{
120
+ // Prefetch all data, start reads during iteration to keep IndexedDB transaction alive
121
+ const rangeReadPromises = ranges.map((range)=>({
122
+ range,
123
+ secretStr: range.extendedSecret.toString(),
124
+ pending: this.#readPendingIndexes(jobId, range.extendedSecret.toString()),
125
+ finalized: this.#readLastFinalizedIndex(jobId, range.extendedSecret.toString())
126
+ }));
127
+ // Await all reads together
128
+ const rangeData = await Promise.all(rangeReadPromises.map(async (item)=>({
129
+ ...item,
130
+ pendingData: await item.pending,
131
+ finalizedIndex: await item.finalized
132
+ })));
133
+ // Process in memory and validate
134
+ for (const { range, secretStr, pendingData, finalizedIndex } of rangeData){
135
+ // Check that the highest index is not further than window length from the highest finalized index.
136
+ if (range.highestIndex > (finalizedIndex ?? 0) + UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN) {
137
+ throw new Error(`Highest used index ${range.highestIndex} is further than window length from the highest finalized index ${finalizedIndex ?? 0}.
138
+ Tagging window length ${UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN} is configured too low. Contact the Aztec team
139
+ to increase it!`);
140
+ }
141
+ // Throw if the lowest index is lower than or equal to the last finalized index
142
+ if (finalizedIndex !== undefined && range.lowestIndex <= finalizedIndex) {
143
+ throw new Error(`Cannot store pending index range [${range.lowestIndex}, ${range.highestIndex}] for secret ${secretStr}: ` + `lowestIndex is lower than or equal to the last finalized index ${finalizedIndex}`);
144
+ }
145
+ // Check if an entry with the same txHash already exists
146
+ const existingEntry = pendingData.find((entry)=>entry.txHash === txHashStr);
147
+ if (existingEntry) {
148
+ // Assert that the ranges are equal — different ranges for the same (secret, txHash) indicates a bug
149
+ if (existingEntry.lowestIndex !== range.lowestIndex || existingEntry.highestIndex !== range.highestIndex) {
150
+ throw new Error(`Conflicting range for secret ${secretStr} and txHash ${txHashStr}: ` + `existing [${existingEntry.lowestIndex}, ${existingEntry.highestIndex}] vs ` + `new [${range.lowestIndex}, ${range.highestIndex}]`);
151
+ }
152
+ // Exact duplicate — skip
153
+ } else {
154
+ this.#writePendingIndexes(jobId, secretStr, [
155
+ ...pendingData,
156
+ {
157
+ lowestIndex: range.lowestIndex,
158
+ highestIndex: range.highestIndex,
159
+ txHash: txHashStr
160
+ }
161
+ ]);
162
+ }
163
+ }
164
+ });
165
+ }
166
+ /**
167
+ * Returns the transaction hashes of all pending transactions that contain highest indexes within a specified range
168
+ * for a given directional app tagging secret. We check based on the highest indexes only as that is the relevant
169
+ * information for the caller of this function.
170
+ * @param secret - The directional app tagging secret to query pending indexes for.
171
+ * @param startIndex - The lower bound of the index range (inclusive).
172
+ * @param endIndex - The upper bound of the index range (exclusive).
173
+ * @returns An array of unique transaction hashes for pending transactions that contain indexes in the range
174
+ * [startIndex, endIndex). Returns an empty array if no pending indexes exist in the range.
175
+ */ getTxHashesOfPendingIndexes(secret, startIndex, endIndex, jobId) {
176
+ return this.#store.transactionAsync(async ()=>{
177
+ const existing = await this.#readPendingIndexes(jobId, secret.toString());
178
+ const txHashes = existing.filter((entry)=>entry.highestIndex >= startIndex && entry.highestIndex < endIndex).map((entry)=>entry.txHash);
179
+ return Array.from(new Set(txHashes)).map(TxHash.fromString);
180
+ });
181
+ }
182
+ /**
183
+ * Returns the last (highest) finalized index for a given secret.
184
+ * @param secret - The secret to get the last finalized index for.
185
+ * @returns The last (highest) finalized index for the given secret.
186
+ */ getLastFinalizedIndex(secret, jobId) {
187
+ return this.#store.transactionAsync(()=>this.#readLastFinalizedIndex(jobId, secret.toString()));
188
+ }
189
+ /**
190
+ * Returns the last used index for a given directional app tagging secret, considering both finalized and pending
191
+ * indexes.
192
+ * @param secret - The directional app tagging secret to query the last used index for.
193
+ * @returns The last used index.
194
+ */ getLastUsedIndex(secret, jobId) {
195
+ const secretStr = secret.toString();
196
+ return this.#store.transactionAsync(async ()=>{
197
+ const pendingPromise = this.#readPendingIndexes(jobId, secretStr);
198
+ const finalizedPromise = this.#readLastFinalizedIndex(jobId, secretStr);
199
+ const [pendingEntries, lastFinalized] = await Promise.all([
200
+ pendingPromise,
201
+ finalizedPromise
202
+ ]);
203
+ if (pendingEntries.length === 0) {
204
+ return lastFinalized;
205
+ }
206
+ // As the last used index we return the highest one from the pending index ranges. Note that this value will be
207
+ // always higher than the last finalized index because we prune lower pending indexes when a tx is finalized.
208
+ return Math.max(...pendingEntries.map((entry)=>entry.highestIndex));
209
+ });
210
+ }
211
+ /**
212
+ * Drops all pending indexes corresponding to the given transaction hashes.
213
+ */ dropPendingIndexes(txHashes, jobId) {
214
+ if (txHashes.length === 0) {
215
+ return Promise.resolve();
216
+ }
217
+ const txHashStrings = new Set(txHashes.map((txHash)=>txHash.toString()));
218
+ return this.#store.transactionAsync(async ()=>{
219
+ // Prefetch all data, start reads during iteration to keep IndexedDB transaction alive
220
+ const secretReadPromises = new Map();
221
+ for await (const secret of this.#pendingIndexes.keysAsync()){
222
+ secretReadPromises.set(secret, this.#readPendingIndexes(jobId, secret));
223
+ }
224
+ // Add staged-only secrets (sync, no DB)
225
+ for (const secret of this.#getPendingIndexesForJob(jobId).keys()){
226
+ if (!secretReadPromises.has(secret)) {
227
+ secretReadPromises.set(secret, Promise.resolve(this.#getPendingIndexesForJob(jobId).get(secret) ?? []));
228
+ }
229
+ }
230
+ // Await all reads together
231
+ const secrets = [
232
+ ...secretReadPromises.keys()
233
+ ];
234
+ const pendingDataResults = await Promise.all(secretReadPromises.values());
235
+ // Process in memory
236
+ for(let i = 0; i < secrets.length; i++){
237
+ const secret = secrets[i];
238
+ const pendingData = pendingDataResults[i];
239
+ if (pendingData && pendingData.length > 0) {
240
+ const filtered = pendingData.filter((item)=>!txHashStrings.has(item.txHash));
241
+ if (filtered.length === 0) {
242
+ this.#writePendingIndexes(jobId, secret, []);
243
+ } else if (filtered.length !== pendingData.length) {
244
+ // Some items were filtered out, so update the pending data
245
+ this.#writePendingIndexes(jobId, secret, filtered);
246
+ }
247
+ // else: No items were filtered out (txHashes not found for this secret) --> no-op
248
+ }
249
+ }
250
+ });
251
+ }
252
+ /** Prefetches all pending and finalized index data for every secret (from both DB and staged writes). */ #getSecretsWithPendingData(jobId) {
253
+ return this.#store.transactionAsync(async ()=>{
254
+ // Prefetch all data, start reads during iteration to keep IndexedDB transaction alive
255
+ const secretDataPromises = new Map();
256
+ for await (const secret of this.#pendingIndexes.keysAsync()){
257
+ secretDataPromises.set(secret, {
258
+ pending: this.#readPendingIndexes(jobId, secret),
259
+ finalized: this.#readLastFinalizedIndex(jobId, secret)
260
+ });
261
+ }
262
+ // Add staged-only secrets (sync, no DB)
263
+ for (const secret of this.#getPendingIndexesForJob(jobId).keys()){
264
+ if (!secretDataPromises.has(secret)) {
265
+ secretDataPromises.set(secret, {
266
+ pending: Promise.resolve(this.#getPendingIndexesForJob(jobId).get(secret) ?? []),
267
+ finalized: Promise.resolve(this.#getLastFinalizedIndexesForJob(jobId).get(secret))
268
+ });
269
+ }
270
+ }
271
+ // Await all reads together
272
+ const secrets = [
273
+ ...secretDataPromises.keys()
274
+ ];
275
+ const dataResults = await Promise.all(secrets.map(async (secret)=>({
276
+ secret,
277
+ pendingData: await secretDataPromises.get(secret).pending,
278
+ lastFinalized: await secretDataPromises.get(secret).finalized
279
+ })));
280
+ return dataResults.filter((r)=>r.pendingData.length > 0);
281
+ });
282
+ }
283
+ /**
284
+ * Updates pending indexes corresponding to the given transaction hashes to be finalized and prunes any lower pending
285
+ * indexes.
286
+ */ async finalizePendingIndexes(txHashes, jobId) {
287
+ if (txHashes.length === 0) {
288
+ return;
289
+ }
290
+ const txHashStrings = new Set(txHashes.map((tx)=>tx.toString()));
291
+ const secretsWithData = await this.#getSecretsWithPendingData(jobId);
292
+ for (const { secret, pendingData, lastFinalized } of secretsWithData){
293
+ let currentPending = pendingData;
294
+ let currentFinalized = lastFinalized;
295
+ // Process all txHashes for this secret
296
+ for (const txHashStr of txHashStrings){
297
+ const matchingEntries = currentPending.filter((item)=>item.txHash === txHashStr);
298
+ if (matchingEntries.length === 0) {
299
+ continue;
300
+ }
301
+ if (matchingEntries.length > 1) {
302
+ // We should always just store the highest pending index for a given tx hash and secret because the lower
303
+ // values are irrelevant.
304
+ throw new Error(`Multiple pending entries found for tx hash ${txHashStr} and secret ${secret}`);
305
+ }
306
+ const newFinalized = matchingEntries[0].highestIndex;
307
+ if (newFinalized < (currentFinalized ?? 0)) {
308
+ // This should never happen because when last finalized index was finalized we should have pruned the lower
309
+ // pending indexes.
310
+ throw new Error(`New finalized index ${newFinalized} is smaller than the current last finalized index ${currentFinalized}`);
311
+ }
312
+ currentFinalized = newFinalized;
313
+ // When we add pending indexes, we ensure they are higher than the last finalized index. However, because we
314
+ // cannot control the order in which transactions are finalized, there may be pending indexes that are now
315
+ // obsolete because they are lower than the most recently finalized index. For this reason, we prune these
316
+ // outdated pending indexes.
317
+ currentPending = currentPending.filter((item)=>item.highestIndex > currentFinalized);
318
+ }
319
+ // Write final state if changed
320
+ if (currentFinalized !== lastFinalized) {
321
+ this.#writeLastFinalizedIndex(jobId, secret, currentFinalized);
322
+ }
323
+ if (currentPending !== pendingData) {
324
+ this.#writePendingIndexes(jobId, secret, currentPending);
325
+ }
326
+ }
327
+ }
328
+ /**
329
+ * Handles finalization of pending indexes for a transaction whose execution was partially reverted.
330
+ * Recomputes the siloed tags for each pending index of the given tx and checks which ones appear in the
331
+ * TxEffect's private logs (i.e., which ones made it onchain). Those that survived are finalized; those that
332
+ * didn't are dropped.
333
+ * @param txEffect - The tx effect of the partially reverted transaction.
334
+ * @param jobId - job context for staged writes to this store. See `JobCoordinator` for more details.
335
+ */ async finalizePendingIndexesOfAPartiallyRevertedTx(txEffect, jobId) {
336
+ const txHashStr = txEffect.txHash.toString();
337
+ // Build a set of all siloed tag values that made it onchain (first field of each private log).
338
+ const onChainTags = new Set(txEffect.privateLogs.map((log)=>log.fields[0].toString()));
339
+ const secretsWithData = await this.#getSecretsWithPendingData(jobId);
340
+ for (const { secret, pendingData, lastFinalized } of secretsWithData){
341
+ const matchingEntries = pendingData.filter((item)=>item.txHash === txHashStr);
342
+ if (matchingEntries.length === 0) {
343
+ continue;
344
+ }
345
+ if (matchingEntries.length > 1) {
346
+ // We should always just store the highest pending index for a given tx hash and secret because the lower
347
+ // values are irrelevant.
348
+ throw new Error(`Multiple pending entries found for tx hash ${txHashStr} and secret ${secret}`);
349
+ }
350
+ const pendingEntry = matchingEntries[0];
351
+ // Expand each matching entry's range and recompute siloed tags for each index.
352
+ const appTaggingSecret = AppTaggingSecret.fromString(secret);
353
+ let highestSurvivingIndex;
354
+ for(let index = pendingEntry.lowestIndex; index <= pendingEntry.highestIndex; index++){
355
+ const siloedTag = await SiloedTag.compute({
356
+ extendedSecret: appTaggingSecret,
357
+ index
358
+ });
359
+ if (onChainTags.has(siloedTag.value.toString())) {
360
+ highestSurvivingIndex = highestSurvivingIndex !== undefined ? Math.max(highestSurvivingIndex, index) : index;
361
+ }
362
+ }
363
+ // Remove all entries for this txHash from pending (both surviving and non-surviving).
364
+ let currentPending = pendingData.filter((item)=>item.txHash !== txHashStr);
365
+ if (highestSurvivingIndex !== undefined) {
366
+ const newFinalized = Math.max(lastFinalized ?? 0, highestSurvivingIndex);
367
+ this.#writeLastFinalizedIndex(jobId, secret, newFinalized);
368
+ // Prune pending indexes that are now <= the finalized index.
369
+ currentPending = currentPending.filter((item)=>item.highestIndex > newFinalized);
370
+ }
371
+ this.#writePendingIndexes(jobId, secret, currentPending);
372
+ }
373
+ }
374
+ }
@@ -0,0 +1,2 @@
1
+ export declare const UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN = 20;
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RhbnRzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdGFnZ2luZy9jb25zdGFudHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBU0EsZUFBTyxNQUFNLHNDQUFzQyxLQUFLLENBQUMifQ==
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/tagging/constants.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,sCAAsC,KAAK,CAAC"}
@@ -0,0 +1,10 @@
1
+ // This window has to be as large as the largest expected number of logs emitted in a tx for a given directional app
2
+ // tagging secret. If we get more tag indexes consumed than this window, an error is thrown in `PXE::proveTx` function.
3
+ // This is set to a larger value than MAX_PRIVATE_LOGS_PER_TX (currently 64) because there could be more than
4
+ // MAX_PRIVATE_LOGS_PER_TX indexes consumed in case the logs are squashed. This happens when the log contains a note
5
+ // and the note is nullified in the same tx.
6
+ //
7
+ // Having a large window significantly slowed down `e2e_l1_with_wall_time` test as there we perform sync for more than
8
+ // 1000 secrets. For this reason we set it to a relatively low value of 20. 20 should be sufficient for all the use
9
+ // cases.
10
+ export const UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN = 20;
@@ -0,0 +1,48 @@
1
+ import type { BlockNumber } from '@aztec/foundation/branded-types';
2
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
3
+ import type { BlockHash } from '@aztec/stdlib/block';
4
+ import type { AztecNode } from '@aztec/stdlib/interfaces/client';
5
+ import { type LogResult, type SiloedTag, type Tag } from '@aztec/stdlib/logs';
6
+ /** Optional block-range, effects opt-in, and pagination cap shared by both wrappers. */
7
+ export type GetAllLogsByTagsOptions = {
8
+ /** Lower block bound, inclusive. */
9
+ fromBlock?: BlockNumber;
10
+ /** Upper block bound, exclusive. */
11
+ toBlock?: BlockNumber;
12
+ /**
13
+ * When set, each log also carries `noteHashes` and all `nullifiers` of its tx. Defaults to off — sender
14
+ * sync only needs `txHash`. The recipient-sync/log-service paths flip this on to build `PendingTaggedLog`
15
+ * / `LogRetrievalResponse` from note data.
16
+ */
17
+ includeEffects?: boolean;
18
+ /**
19
+ * Maximum number of logs returned per tag per round-trip. Capped at `MAX_LOGS_PER_TAG` on the node
20
+ * (rejected if higher). Defaults to `MAX_LOGS_PER_TAG`. Mainly useful for tests that need to force
21
+ * pagination at a small page size.
22
+ */
23
+ limitPerTag?: number;
24
+ };
25
+ /**
26
+ * Fetches all private logs for the given tags, automatically paginating per-tag via `afterLog` cursors.
27
+ *
28
+ * @param aztecNode - The Aztec node to query.
29
+ * @param tags - The siloed tags to search for.
30
+ * @param anchorBlockHash - Reference block for the Aztec node query, throws if block is not found there (typically
31
+ * because of reorgs).
32
+ * @param options - Optional `fromBlock`/`toBlock` range and `includeEffects` opt-in.
33
+ * @returns An array of log arrays, one per tag, containing all logs across all pages.
34
+ */
35
+ export declare function getAllPrivateLogsByTags<Opts extends GetAllLogsByTagsOptions = GetAllLogsByTagsOptions>(aztecNode: AztecNode, tags: SiloedTag[], anchorBlockHash: BlockHash, options?: Opts): Promise<LogResult<Opts>[][]>;
36
+ /**
37
+ * Fetches all public logs for the given tags from a contract, automatically paginating per-tag via `afterLog` cursors.
38
+ *
39
+ * @param aztecNode - The Aztec node to query.
40
+ * @param contractAddress - The contract address to search logs for.
41
+ * @param tags - The tags to search for.
42
+ * @param anchorBlockHash - Reference block for the Aztec node query, throws if block is not found there (typically
43
+ * because of reorgs).
44
+ * @param options - Optional `fromBlock`/`toBlock` range and `includeEffects` opt-in.
45
+ * @returns An array of log arrays, one per tag, containing all logs across all pages.
46
+ */
47
+ export declare function getAllPublicLogsByTagsFromContract<Opts extends GetAllLogsByTagsOptions = GetAllLogsByTagsOptions>(aztecNode: AztecNode, contractAddress: AztecAddress, tags: Tag[], anchorBlockHash: BlockHash, options?: Opts): Promise<LogResult<Opts>[][]>;
48
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0X2FsbF9sb2dzX2J5X3RhZ3MuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90YWdnaW5nL2dldF9hbGxfbG9nc19ieV90YWdzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFF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;AACH,wBAAgB,kCAAkC,CAAC,IAAI,SAAS,uBAAuB,GAAG,uBAAuB,EAC/G,SAAS,EAAE,SAAS,EACpB,eAAe,EAAE,YAAY,EAC7B,IAAI,EAAE,GAAG,EAAE,EACX,eAAe,EAAE,SAAS,EAC1B,OAAO,GAAE,IAAiB,GACzB,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAc9B"}
@@ -0,0 +1,59 @@
1
+ import { MAX_RPC_LEN } from '@aztec/stdlib/interfaces/api-limit';
2
+ import { queryAllPrivateLogsByTags, queryAllPublicLogsByTags } from '@aztec/stdlib/logs';
3
+ /**
4
+ * Splits tags into chunks of MAX_RPC_LEN, paginates each chunk via the stdlib per-tag cursor helper,
5
+ * then stitches the results back into a single array preserving the original tag order.
6
+ */ async function getAllPagesInBatches(tags, fetchAllPagesForBatch) {
7
+ if (tags.length === 0) {
8
+ return [];
9
+ }
10
+ if (tags.length <= MAX_RPC_LEN) {
11
+ return fetchAllPagesForBatch(tags);
12
+ }
13
+ const batches = [];
14
+ for(let i = 0; i < tags.length; i += MAX_RPC_LEN){
15
+ batches.push(tags.slice(i, i + MAX_RPC_LEN));
16
+ }
17
+ const batchResults = await Promise.all(batches.map(fetchAllPagesForBatch));
18
+ return batchResults.flat();
19
+ }
20
+ /**
21
+ * Fetches all private logs for the given tags, automatically paginating per-tag via `afterLog` cursors.
22
+ *
23
+ * @param aztecNode - The Aztec node to query.
24
+ * @param tags - The siloed tags to search for.
25
+ * @param anchorBlockHash - Reference block for the Aztec node query, throws if block is not found there (typically
26
+ * because of reorgs).
27
+ * @param options - Optional `fromBlock`/`toBlock` range and `includeEffects` opt-in.
28
+ * @returns An array of log arrays, one per tag, containing all logs across all pages.
29
+ */ export function getAllPrivateLogsByTags(aztecNode, tags, anchorBlockHash, options = {}) {
30
+ return getAllPagesInBatches(tags, (batch)=>queryAllPrivateLogsByTags(aztecNode, {
31
+ tags: batch,
32
+ referenceBlock: anchorBlockHash,
33
+ fromBlock: options.fromBlock,
34
+ toBlock: options.toBlock,
35
+ includeEffects: options.includeEffects ?? false,
36
+ limitPerTag: options.limitPerTag
37
+ }));
38
+ }
39
+ /**
40
+ * Fetches all public logs for the given tags from a contract, automatically paginating per-tag via `afterLog` cursors.
41
+ *
42
+ * @param aztecNode - The Aztec node to query.
43
+ * @param contractAddress - The contract address to search logs for.
44
+ * @param tags - The tags to search for.
45
+ * @param anchorBlockHash - Reference block for the Aztec node query, throws if block is not found there (typically
46
+ * because of reorgs).
47
+ * @param options - Optional `fromBlock`/`toBlock` range and `includeEffects` opt-in.
48
+ * @returns An array of log arrays, one per tag, containing all logs across all pages.
49
+ */ export function getAllPublicLogsByTagsFromContract(aztecNode, contractAddress, tags, anchorBlockHash, options = {}) {
50
+ return getAllPagesInBatches(tags, (batch)=>queryAllPublicLogsByTags(aztecNode, {
51
+ contractAddress,
52
+ tags: batch,
53
+ referenceBlock: anchorBlockHash,
54
+ fromBlock: options.fromBlock,
55
+ toBlock: options.toBlock,
56
+ includeEffects: options.includeEffects ?? false,
57
+ limitPerTag: options.limitPerTag
58
+ }));
59
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * This directory contains the sender and recipient synchronization algorithms that use tagging.
3
+ *
4
+ * The objective of the sender sync algorithm is to determine which tags have already been used by a sender, thereby
5
+ * deciding which tag should be used next.
6
+ *
7
+ * The objective of the recipient sync algorithm is to fetch and sync the corresponding logs.
8
+ *
9
+ * @module tagging
10
+ */
11
+ export { syncTaggedPrivateLogs } from './recipient_sync/sync_tagged_private_logs.js';
12
+ export { syncSenderTaggingIndexes } from './sender_sync/sync_sender_tagging_indexes.js';
13
+ export { persistSenderTaggingIndexRangesForTx } from './persist_sender_tagging_index_ranges.js';
14
+ export { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from './constants.js';
15
+ export { getAllPrivateLogsByTags, getAllPublicLogsByTagsFromContract } from './get_all_logs_by_tags.js';
16
+ export { AppTaggingSecret, Tag, SiloedTag } from '@aztec/stdlib/logs';
17
+ export { type PreTag, type TaggingIndexRange } from '@aztec/stdlib/logs';
18
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90YWdnaW5nL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7Ozs7R0FTRztBQUVILE9BQU8sRUFBRSxxQkFBcUIsRUFBRSxNQUFNLDhDQUE4QyxDQUFDO0FBQ3JGLE9BQU8sRUFBRSx3QkFBd0IsRUFBRSxNQUFNLDhDQUE4QyxDQUFDO0FBQ3hGLE9BQU8sRUFBRSxvQ0FBb0MsRUFBRSxNQUFNLDBDQUEwQyxDQUFDO0FBQ2hHLE9BQU8sRUFBRSxzQ0FBc0MsRUFBRSxNQUFNLGdCQUFnQixDQUFDO0FBQ3hFLE9BQU8sRUFBRSx1QkFBdUIsRUFBRSxrQ0FBa0MsRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBR3hHLE9BQU8sRUFBRSxnQkFBZ0IsRUFBRSxHQUFHLEVBQUUsU0FBUyxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFDdEUsT0FBTyxFQUFFLEtBQUssTUFBTSxFQUFFLEtBQUssaUJBQWlCLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQyJ9
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tagging/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AACrF,OAAO,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,EAAE,oCAAoC,EAAE,MAAM,0CAA0C,CAAC;AAChG,OAAO,EAAE,sCAAsC,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,kCAAkC,EAAE,MAAM,2BAA2B,CAAC;AAGxG,OAAO,EAAE,gBAAgB,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * This directory contains the sender and recipient synchronization algorithms that use tagging.
3
+ *
4
+ * The objective of the sender sync algorithm is to determine which tags have already been used by a sender, thereby
5
+ * deciding which tag should be used next.
6
+ *
7
+ * The objective of the recipient sync algorithm is to fetch and sync the corresponding logs.
8
+ *
9
+ * @module tagging
10
+ */ export { syncTaggedPrivateLogs } from './recipient_sync/sync_tagged_private_logs.js';
11
+ export { syncSenderTaggingIndexes } from './sender_sync/sync_sender_tagging_indexes.js';
12
+ export { persistSenderTaggingIndexRangesForTx } from './persist_sender_tagging_index_ranges.js';
13
+ export { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from './constants.js';
14
+ export { getAllPrivateLogsByTags, getAllPublicLogsByTagsFromContract } from './get_all_logs_by_tags.js';
15
+ // Re-export tagging-related types from stdlib
16
+ export { AppTaggingSecret, Tag, SiloedTag } from '@aztec/stdlib/logs';