@aztec/pxe 0.0.1-commit.03f7ef2 → 0.0.1-commit.04d373f

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 (488) hide show
  1. package/dest/bin/check_oracle_version.d.ts +12 -2
  2. package/dest/bin/check_oracle_version.d.ts.map +1 -1
  3. package/dest/bin/check_oracle_version.js +32 -26
  4. package/dest/bin/index.d.ts +2 -0
  5. package/dest/bin/index.d.ts.map +1 -0
  6. package/dest/bin/index.js +1 -0
  7. package/dest/block_synchronizer/block_stream_source.d.ts +10 -0
  8. package/dest/block_synchronizer/block_stream_source.d.ts.map +1 -0
  9. package/dest/block_synchronizer/block_stream_source.js +62 -0
  10. package/dest/block_synchronizer/block_synchronizer.d.ts +22 -12
  11. package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
  12. package/dest/block_synchronizer/block_synchronizer.js +101 -35
  13. package/dest/config/index.d.ts +10 -2
  14. package/dest/config/index.d.ts.map +1 -1
  15. package/dest/config/index.js +17 -2
  16. package/dest/config/package_info.js +1 -1
  17. package/dest/contract_function_simulator/benchmarked_node.d.ts +9 -0
  18. package/dest/contract_function_simulator/benchmarked_node.d.ts.map +1 -0
  19. package/dest/contract_function_simulator/benchmarked_node.js +77 -0
  20. package/dest/contract_function_simulator/contract_function_simulator.d.ts +77 -41
  21. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  22. package/dest/contract_function_simulator/contract_function_simulator.js +251 -96
  23. package/dest/contract_function_simulator/ephemeral_array_service.d.ts +28 -0
  24. package/dest/contract_function_simulator/ephemeral_array_service.d.ts.map +1 -0
  25. package/dest/contract_function_simulator/ephemeral_array_service.js +78 -0
  26. package/dest/contract_function_simulator/execution_note_cache.d.ts +18 -9
  27. package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
  28. package/dest/contract_function_simulator/execution_note_cache.js +45 -28
  29. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +7 -11
  30. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -1
  31. package/dest/contract_function_simulator/execution_tagging_index_cache.js +19 -15
  32. package/dest/contract_function_simulator/index.d.ts +5 -2
  33. package/dest/contract_function_simulator/index.d.ts.map +1 -1
  34. package/dest/contract_function_simulator/index.js +4 -1
  35. package/dest/contract_function_simulator/noir-structs/bounded_vec.d.ts +48 -0
  36. package/dest/contract_function_simulator/noir-structs/bounded_vec.d.ts.map +1 -0
  37. package/dest/contract_function_simulator/noir-structs/bounded_vec.js +45 -0
  38. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +6 -7
  39. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
  40. package/dest/contract_function_simulator/noir-structs/event_validation_request.js +12 -10
  41. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +13 -3
  42. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts.map +1 -1
  43. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.js +35 -4
  44. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +2 -2
  45. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
  46. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +2 -4
  47. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +5 -8
  48. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
  49. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +7 -11
  50. package/dest/contract_function_simulator/noir-structs/option.d.ts +61 -0
  51. package/dest/contract_function_simulator/noir-structs/option.d.ts.map +1 -0
  52. package/dest/contract_function_simulator/noir-structs/option.js +62 -0
  53. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +4 -10
  54. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -1
  55. package/dest/contract_function_simulator/noir-structs/utility_context.js +7 -18
  56. package/dest/contract_function_simulator/oracle/interfaces.d.ts +70 -50
  57. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
  58. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +3 -1
  59. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
  60. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +7 -7
  61. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
  62. package/dest/contract_function_simulator/oracle/note_packing_utils.js +10 -10
  63. package/dest/contract_function_simulator/oracle/oracle.d.ts +74 -43
  64. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
  65. package/dest/contract_function_simulator/oracle/oracle.js +471 -264
  66. package/dest/contract_function_simulator/oracle/oracle_registry.d.ts +147 -0
  67. package/dest/contract_function_simulator/oracle/oracle_registry.d.ts.map +1 -0
  68. package/dest/contract_function_simulator/oracle/oracle_registry.js +1199 -0
  69. package/dest/contract_function_simulator/oracle/private_execution.d.ts +2 -26
  70. package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
  71. package/dest/contract_function_simulator/oracle/private_execution.js +5 -39
  72. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +74 -100
  73. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  74. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +168 -139
  75. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +169 -90
  76. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  77. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +468 -193
  78. package/dest/contract_function_simulator/pick_notes.d.ts +1 -1
  79. package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -1
  80. package/dest/contract_function_simulator/pick_notes.js +20 -3
  81. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +4 -4
  82. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -1
  83. package/dest/contract_function_simulator/proxied_contract_data_source.js +39 -68
  84. package/dest/contract_logging.d.ts +27 -0
  85. package/dest/contract_logging.d.ts.map +1 -0
  86. package/dest/contract_logging.js +38 -0
  87. package/dest/contract_sync/contract_sync_service.d.ts +42 -0
  88. package/dest/contract_sync/contract_sync_service.d.ts.map +1 -0
  89. package/dest/contract_sync/contract_sync_service.js +135 -0
  90. package/dest/contract_sync/helpers.d.ts +27 -0
  91. package/dest/contract_sync/helpers.d.ts.map +1 -0
  92. package/dest/contract_sync/helpers.js +53 -0
  93. package/dest/debug/pxe_debug_utils.d.ts +21 -12
  94. package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
  95. package/dest/debug/pxe_debug_utils.js +24 -19
  96. package/dest/entrypoints/client/bundle/index.d.ts +3 -1
  97. package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
  98. package/dest/entrypoints/client/bundle/index.js +2 -0
  99. package/dest/entrypoints/client/bundle/utils.d.ts +2 -2
  100. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  101. package/dest/entrypoints/client/bundle/utils.js +41 -10
  102. package/dest/entrypoints/client/lazy/index.d.ts +3 -1
  103. package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
  104. package/dest/entrypoints/client/lazy/index.js +2 -0
  105. package/dest/entrypoints/client/lazy/utils.d.ts +3 -3
  106. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  107. package/dest/entrypoints/client/lazy/utils.js +42 -11
  108. package/dest/entrypoints/pxe_creation_options.d.ts +13 -3
  109. package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
  110. package/dest/entrypoints/pxe_creation_options.js +3 -1
  111. package/dest/entrypoints/server/index.d.ts +6 -2
  112. package/dest/entrypoints/server/index.d.ts.map +1 -1
  113. package/dest/entrypoints/server/index.js +5 -1
  114. package/dest/entrypoints/server/utils.d.ts +4 -3
  115. package/dest/entrypoints/server/utils.d.ts.map +1 -1
  116. package/dest/entrypoints/server/utils.js +49 -18
  117. package/dest/error_enriching.d.ts +4 -4
  118. package/dest/error_enriching.d.ts.map +1 -1
  119. package/dest/error_enriching.js +6 -6
  120. package/dest/events/event_service.d.ts +19 -10
  121. package/dest/events/event_service.d.ts.map +1 -1
  122. package/dest/events/event_service.js +60 -30
  123. package/dest/events/private_event_filter_validator.d.ts +7 -6
  124. package/dest/events/private_event_filter_validator.d.ts.map +1 -1
  125. package/dest/events/private_event_filter_validator.js +20 -6
  126. package/dest/hooks/authorize_utility_call.d.ts +41 -0
  127. package/dest/hooks/authorize_utility_call.d.ts.map +1 -0
  128. package/dest/hooks/authorize_utility_call.js +4 -0
  129. package/dest/hooks/execution_hooks.d.ts +42 -0
  130. package/dest/hooks/execution_hooks.d.ts.map +1 -0
  131. package/dest/hooks/execution_hooks.js +9 -0
  132. package/dest/hooks/index.d.ts +4 -0
  133. package/dest/hooks/index.d.ts.map +1 -0
  134. package/dest/hooks/index.js +1 -0
  135. package/dest/job_coordinator/job_coordinator.d.ts +75 -0
  136. package/dest/job_coordinator/job_coordinator.d.ts.map +1 -0
  137. package/dest/job_coordinator/job_coordinator.js +94 -0
  138. package/dest/logs/log_service.d.ts +21 -35
  139. package/dest/logs/log_service.d.ts.map +1 -1
  140. package/dest/logs/log_service.js +144 -215
  141. package/dest/messages/message_context_service.d.ts +17 -0
  142. package/dest/messages/message_context_service.d.ts.map +1 -0
  143. package/dest/messages/message_context_service.js +38 -0
  144. package/dest/notes/note_service.d.ts +34 -12
  145. package/dest/notes/note_service.d.ts.map +1 -1
  146. package/dest/notes/note_service.js +102 -82
  147. package/dest/notes_filter.d.ts +24 -0
  148. package/dest/notes_filter.d.ts.map +1 -0
  149. package/dest/notes_filter.js +4 -0
  150. package/dest/oracle_version.d.ts +4 -3
  151. package/dest/oracle_version.d.ts.map +1 -1
  152. package/dest/oracle_version.js +20 -9
  153. package/dest/private_kernel/batch_planner.d.ts +47 -0
  154. package/dest/private_kernel/batch_planner.d.ts.map +1 -0
  155. package/dest/private_kernel/batch_planner.js +104 -0
  156. package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts +4 -0
  157. package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts.map +1 -0
  158. package/dest/private_kernel/hints/{compute_tx_include_by_timestamp.js → compute_tx_expiration_timestamp.js} +12 -12
  159. package/dest/private_kernel/hints/index.d.ts +3 -3
  160. package/dest/private_kernel/hints/index.d.ts.map +1 -1
  161. package/dest/private_kernel/hints/index.js +2 -2
  162. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +29 -0
  163. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -0
  164. package/dest/private_kernel/hints/{build_private_kernel_reset_private_inputs.js → private_kernel_reset_private_inputs_builder.js} +142 -75
  165. package/dest/private_kernel/hints/test_utils.d.ts +122 -0
  166. package/dest/private_kernel/hints/test_utils.d.ts.map +1 -0
  167. package/dest/private_kernel/hints/test_utils.js +202 -0
  168. package/dest/private_kernel/private_kernel_execution_prover.d.ts +7 -2
  169. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
  170. package/dest/private_kernel/private_kernel_execution_prover.js +169 -69
  171. package/dest/private_kernel/private_kernel_oracle.d.ts +29 -29
  172. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
  173. package/dest/private_kernel/private_kernel_oracle.js +96 -2
  174. package/dest/pxe.d.ts +136 -67
  175. package/dest/pxe.d.ts.map +1 -1
  176. package/dest/pxe.js +314 -231
  177. package/dest/storage/address_store/address_store.d.ts +11 -0
  178. package/dest/storage/address_store/address_store.d.ts.map +1 -0
  179. package/dest/storage/{address_data_provider/address_data_provider.js → address_store/address_store.js} +13 -12
  180. package/dest/storage/address_store/index.d.ts +2 -0
  181. package/dest/storage/address_store/index.d.ts.map +1 -0
  182. package/dest/storage/address_store/index.js +1 -0
  183. package/dest/storage/anchor_block_store/anchor_block_store.d.ts +17 -0
  184. package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -0
  185. package/dest/storage/anchor_block_store/anchor_block_store.js +26 -0
  186. package/dest/storage/anchor_block_store/index.d.ts +2 -0
  187. package/dest/storage/anchor_block_store/index.d.ts.map +1 -0
  188. package/dest/storage/anchor_block_store/index.js +1 -0
  189. package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.d.ts +42 -0
  190. package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.d.ts.map +1 -0
  191. package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.js +93 -0
  192. package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts +15 -0
  193. package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts.map +1 -0
  194. package/dest/storage/backwards_compatibility_tests/schema_tests.js +591 -0
  195. package/dest/storage/backwards_compatibility_tests/store_spy.d.ts +19 -0
  196. package/dest/storage/backwards_compatibility_tests/store_spy.d.ts.map +1 -0
  197. package/dest/storage/backwards_compatibility_tests/store_spy.js +63 -0
  198. package/dest/storage/capsule_store/capsule_service.d.ts +21 -0
  199. package/dest/storage/capsule_store/capsule_service.d.ts.map +1 -0
  200. package/dest/storage/capsule_store/capsule_service.js +50 -0
  201. package/dest/storage/capsule_store/capsule_store.d.ts +72 -0
  202. package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -0
  203. package/dest/storage/capsule_store/capsule_store.js +261 -0
  204. package/dest/storage/capsule_store/index.d.ts +3 -0
  205. package/dest/storage/capsule_store/index.d.ts.map +1 -0
  206. package/dest/storage/capsule_store/index.js +2 -0
  207. package/dest/storage/contract_store/contract_store.d.ts +93 -0
  208. package/dest/storage/contract_store/contract_store.d.ts.map +1 -0
  209. package/dest/storage/contract_store/contract_store.js +292 -0
  210. package/dest/storage/contract_store/index.d.ts +2 -0
  211. package/dest/storage/contract_store/index.d.ts.map +1 -0
  212. package/dest/storage/contract_store/index.js +1 -0
  213. package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.d.ts +1 -1
  214. package/dest/storage/contract_store/private_functions_tree.d.ts.map +1 -0
  215. package/dest/storage/index.d.ts +8 -8
  216. package/dest/storage/index.d.ts.map +1 -1
  217. package/dest/storage/index.js +7 -7
  218. package/dest/storage/metadata.d.ts +1 -1
  219. package/dest/storage/metadata.js +1 -1
  220. package/dest/storage/note_store/index.d.ts +3 -0
  221. package/dest/storage/note_store/index.d.ts.map +1 -0
  222. package/dest/storage/note_store/index.js +2 -0
  223. package/dest/storage/note_store/note_store.d.ts +83 -0
  224. package/dest/storage/note_store/note_store.d.ts.map +1 -0
  225. package/dest/storage/note_store/note_store.js +343 -0
  226. package/dest/storage/note_store/stored_note.d.ts +16 -0
  227. package/dest/storage/note_store/stored_note.d.ts.map +1 -0
  228. package/dest/storage/note_store/stored_note.js +43 -0
  229. package/dest/storage/open_pxe_stores.d.ts +33 -0
  230. package/dest/storage/open_pxe_stores.d.ts.map +1 -0
  231. package/dest/storage/open_pxe_stores.js +27 -0
  232. package/dest/storage/private_event_store/private_event_store.d.ts +91 -0
  233. package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -0
  234. package/dest/storage/private_event_store/private_event_store.js +276 -0
  235. package/dest/storage/private_event_store/stored_private_event.d.ts +23 -0
  236. package/dest/storage/private_event_store/stored_private_event.d.ts.map +1 -0
  237. package/dest/storage/private_event_store/stored_private_event.js +56 -0
  238. package/dest/storage/tagging_store/index.d.ts +4 -0
  239. package/dest/storage/tagging_store/index.d.ts.map +1 -0
  240. package/dest/storage/tagging_store/index.js +3 -0
  241. package/dest/storage/tagging_store/recipient_tagging_store.d.ts +28 -0
  242. package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -0
  243. package/dest/storage/tagging_store/recipient_tagging_store.js +111 -0
  244. package/dest/storage/tagging_store/sender_address_book_store.d.ts +14 -0
  245. package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +1 -0
  246. package/dest/storage/tagging_store/sender_address_book_store.js +36 -0
  247. package/dest/storage/tagging_store/sender_tagging_store.d.ts +78 -0
  248. package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -0
  249. package/dest/storage/tagging_store/sender_tagging_store.js +374 -0
  250. package/dest/tagging/constants.d.ts +2 -2
  251. package/dest/tagging/constants.d.ts.map +1 -1
  252. package/dest/tagging/constants.js +10 -3
  253. package/dest/tagging/get_all_logs_by_tags.d.ts +48 -0
  254. package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -0
  255. package/dest/tagging/get_all_logs_by_tags.js +59 -0
  256. package/dest/tagging/index.d.ts +18 -5
  257. package/dest/tagging/index.d.ts.map +1 -1
  258. package/dest/tagging/index.js +16 -3
  259. package/dest/tagging/persist_sender_tagging_index_ranges.d.ts +29 -0
  260. package/dest/tagging/persist_sender_tagging_index_ranges.d.ts.map +1 -0
  261. package/dest/tagging/persist_sender_tagging_index_ranges.js +42 -0
  262. package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts +56 -0
  263. package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts.map +1 -0
  264. package/dest/tagging/recipient_sync/sync_tagged_private_logs.js +163 -0
  265. package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts +3 -3
  266. package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts.map +1 -1
  267. package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +2 -2
  268. package/dest/tagging/reconcile_tagging_index_ranges.d.ts +36 -0
  269. package/dest/tagging/reconcile_tagging_index_ranges.d.ts.map +1 -0
  270. package/dest/tagging/reconcile_tagging_index_ranges.js +74 -0
  271. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +16 -0
  272. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -0
  273. package/dest/tagging/{sync → sender_sync}/sync_sender_tagging_indexes.js +35 -34
  274. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +17 -0
  275. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -0
  276. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +60 -0
  277. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +19 -0
  278. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -0
  279. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +72 -0
  280. package/package.json +31 -19
  281. package/src/bin/check_oracle_version.ts +42 -31
  282. package/src/bin/index.ts +1 -0
  283. package/src/block_synchronizer/block_stream_source.ts +81 -0
  284. package/src/block_synchronizer/block_synchronizer.ts +123 -48
  285. package/src/config/index.ts +21 -1
  286. package/src/config/package_info.ts +1 -1
  287. package/src/contract_function_simulator/benchmarked_node.ts +103 -0
  288. package/src/contract_function_simulator/contract_function_simulator.ts +431 -161
  289. package/src/contract_function_simulator/ephemeral_array_service.ts +110 -0
  290. package/src/contract_function_simulator/execution_note_cache.ts +44 -25
  291. package/src/contract_function_simulator/execution_tagging_index_cache.ts +19 -18
  292. package/src/contract_function_simulator/index.ts +4 -1
  293. package/src/contract_function_simulator/noir-structs/bounded_vec.ts +55 -0
  294. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +15 -10
  295. package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +36 -3
  296. package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +2 -5
  297. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +6 -11
  298. package/src/contract_function_simulator/noir-structs/option.ts +69 -0
  299. package/src/contract_function_simulator/noir-structs/utility_context.ts +6 -25
  300. package/src/contract_function_simulator/oracle/interfaces.ts +93 -70
  301. package/src/contract_function_simulator/oracle/note_packing_utils.ts +13 -13
  302. package/src/contract_function_simulator/oracle/oracle.ts +567 -461
  303. package/src/contract_function_simulator/oracle/oracle_registry.ts +904 -0
  304. package/src/contract_function_simulator/oracle/private_execution.ts +5 -73
  305. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +215 -239
  306. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +668 -261
  307. package/src/contract_function_simulator/pick_notes.ts +22 -3
  308. package/src/contract_function_simulator/proxied_contract_data_source.ts +47 -70
  309. package/src/contract_logging.ts +52 -0
  310. package/src/contract_sync/contract_sync_service.ts +189 -0
  311. package/src/contract_sync/helpers.ts +86 -0
  312. package/src/debug/pxe_debug_utils.ts +57 -20
  313. package/src/entrypoints/client/bundle/index.ts +2 -0
  314. package/src/entrypoints/client/bundle/utils.ts +31 -19
  315. package/src/entrypoints/client/lazy/index.ts +2 -0
  316. package/src/entrypoints/client/lazy/utils.ts +33 -21
  317. package/src/entrypoints/pxe_creation_options.ts +18 -2
  318. package/src/entrypoints/server/index.ts +5 -1
  319. package/src/entrypoints/server/utils.ts +46 -45
  320. package/src/error_enriching.ts +7 -15
  321. package/src/events/event_service.ts +83 -41
  322. package/src/events/private_event_filter_validator.ts +24 -6
  323. package/src/hooks/authorize_utility_call.ts +44 -0
  324. package/src/hooks/execution_hooks.ts +48 -0
  325. package/src/hooks/index.ts +7 -0
  326. package/src/job_coordinator/job_coordinator.ts +150 -0
  327. package/src/logs/log_service.ts +181 -313
  328. package/src/messages/message_context_service.ts +45 -0
  329. package/src/notes/note_service.ts +140 -110
  330. package/src/notes_filter.ts +24 -0
  331. package/src/oracle_version.ts +20 -9
  332. package/src/private_kernel/batch_planner.ts +169 -0
  333. package/src/private_kernel/hints/{compute_tx_include_by_timestamp.ts → compute_tx_expiration_timestamp.ts} +13 -13
  334. package/src/private_kernel/hints/index.ts +2 -2
  335. package/src/private_kernel/hints/{build_private_kernel_reset_private_inputs.ts → private_kernel_reset_private_inputs_builder.ts} +197 -139
  336. package/src/private_kernel/hints/test_utils.ts +318 -0
  337. package/src/private_kernel/private_kernel_execution_prover.ts +262 -96
  338. package/src/private_kernel/private_kernel_oracle.ts +129 -39
  339. package/src/pxe.ts +552 -310
  340. package/src/storage/{address_data_provider/address_data_provider.ts → address_store/address_store.ts} +16 -16
  341. package/src/storage/address_store/index.ts +1 -0
  342. package/src/storage/{anchor_block_data_provider/anchor_block_data_provider.ts → anchor_block_store/anchor_block_store.ts} +10 -2
  343. package/src/storage/anchor_block_store/index.ts +1 -0
  344. package/src/storage/backwards_compatibility_tests/__snapshots__/AddressStore.json +22 -0
  345. package/src/storage/backwards_compatibility_tests/__snapshots__/AnchorBlockStore.json +3 -0
  346. package/src/storage/backwards_compatibility_tests/__snapshots__/CapsuleStore.json +16 -0
  347. package/src/storage/backwards_compatibility_tests/__snapshots__/ContractStore.json +28 -0
  348. package/src/storage/backwards_compatibility_tests/__snapshots__/KeyStore.json +52 -0
  349. package/src/storage/backwards_compatibility_tests/__snapshots__/L2TipsKVStore.json +46 -0
  350. package/src/storage/backwards_compatibility_tests/__snapshots__/NoteStore.json +36 -0
  351. package/src/storage/backwards_compatibility_tests/__snapshots__/PrivateEventStore.json +44 -0
  352. package/src/storage/backwards_compatibility_tests/__snapshots__/RecipientTaggingStore.json +18 -0
  353. package/src/storage/backwards_compatibility_tests/__snapshots__/SenderAddressBookStore.json +16 -0
  354. package/src/storage/backwards_compatibility_tests/__snapshots__/SenderTaggingStore.json +22 -0
  355. package/src/storage/backwards_compatibility_tests/__snapshots__/opened_stores.json +97 -0
  356. package/src/storage/backwards_compatibility_tests/kv_store_snapshot.ts +122 -0
  357. package/src/storage/backwards_compatibility_tests/schema_tests.ts +712 -0
  358. package/src/storage/backwards_compatibility_tests/store_spy.ts +73 -0
  359. package/src/storage/capsule_store/capsule_service.ts +90 -0
  360. package/src/storage/capsule_store/capsule_store.ts +333 -0
  361. package/src/storage/capsule_store/index.ts +2 -0
  362. package/src/storage/contract_store/contract_store.ts +408 -0
  363. package/src/storage/contract_store/index.ts +1 -0
  364. package/src/storage/index.ts +7 -7
  365. package/src/storage/metadata.ts +1 -1
  366. package/src/storage/note_store/index.ts +2 -0
  367. package/src/storage/note_store/note_store.ts +415 -0
  368. package/src/storage/note_store/stored_note.ts +48 -0
  369. package/src/storage/open_pxe_stores.ts +49 -0
  370. package/src/storage/private_event_store/private_event_store.ts +388 -0
  371. package/src/storage/private_event_store/stored_private_event.ts +73 -0
  372. package/src/storage/tagging_store/index.ts +3 -0
  373. package/src/storage/tagging_store/recipient_tagging_store.ts +139 -0
  374. package/src/storage/tagging_store/sender_address_book_store.ts +48 -0
  375. package/src/storage/tagging_store/sender_tagging_store.ts +476 -0
  376. package/src/tagging/constants.ts +10 -3
  377. package/src/tagging/get_all_logs_by_tags.ts +120 -0
  378. package/src/tagging/index.ts +20 -4
  379. package/src/tagging/persist_sender_tagging_index_ranges.ts +57 -0
  380. package/src/tagging/recipient_sync/sync_tagged_private_logs.ts +240 -0
  381. package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +4 -4
  382. package/src/tagging/reconcile_tagging_index_ranges.ts +102 -0
  383. package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +134 -0
  384. package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +66 -0
  385. package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +84 -0
  386. package/dest/contract_function_simulator/proxied_node.d.ts +0 -9
  387. package/dest/contract_function_simulator/proxied_node.d.ts.map +0 -1
  388. package/dest/contract_function_simulator/proxied_node.js +0 -27
  389. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +0 -28
  390. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +0 -1
  391. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +0 -4
  392. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts.map +0 -1
  393. package/dest/private_kernel/private_kernel_oracle_impl.d.ts +0 -46
  394. package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +0 -1
  395. package/dest/private_kernel/private_kernel_oracle_impl.js +0 -86
  396. package/dest/public_storage/public_storage_service.d.ts +0 -24
  397. package/dest/public_storage/public_storage_service.d.ts.map +0 -1
  398. package/dest/public_storage/public_storage_service.js +0 -26
  399. package/dest/storage/address_data_provider/address_data_provider.d.ts +0 -11
  400. package/dest/storage/address_data_provider/address_data_provider.d.ts.map +0 -1
  401. package/dest/storage/address_data_provider/index.d.ts +0 -2
  402. package/dest/storage/address_data_provider/index.d.ts.map +0 -1
  403. package/dest/storage/address_data_provider/index.js +0 -1
  404. package/dest/storage/anchor_block_data_provider/anchor_block_data_provider.d.ts +0 -9
  405. package/dest/storage/anchor_block_data_provider/anchor_block_data_provider.d.ts.map +0 -1
  406. package/dest/storage/anchor_block_data_provider/anchor_block_data_provider.js +0 -19
  407. package/dest/storage/anchor_block_data_provider/index.d.ts +0 -2
  408. package/dest/storage/anchor_block_data_provider/index.d.ts.map +0 -1
  409. package/dest/storage/anchor_block_data_provider/index.js +0 -1
  410. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts +0 -57
  411. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +0 -1
  412. package/dest/storage/capsule_data_provider/capsule_data_provider.js +0 -146
  413. package/dest/storage/capsule_data_provider/index.d.ts +0 -2
  414. package/dest/storage/capsule_data_provider/index.d.ts.map +0 -1
  415. package/dest/storage/capsule_data_provider/index.js +0 -1
  416. package/dest/storage/contract_data_provider/contract_data_provider.d.ts +0 -66
  417. package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +0 -1
  418. package/dest/storage/contract_data_provider/contract_data_provider.js +0 -224
  419. package/dest/storage/contract_data_provider/index.d.ts +0 -2
  420. package/dest/storage/contract_data_provider/index.d.ts.map +0 -1
  421. package/dest/storage/contract_data_provider/index.js +0 -1
  422. package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +0 -1
  423. package/dest/storage/note_data_provider/index.d.ts +0 -3
  424. package/dest/storage/note_data_provider/index.d.ts.map +0 -1
  425. package/dest/storage/note_data_provider/index.js +0 -2
  426. package/dest/storage/note_data_provider/note_data_provider.d.ts +0 -84
  427. package/dest/storage/note_data_provider/note_data_provider.d.ts.map +0 -1
  428. package/dest/storage/note_data_provider/note_data_provider.js +0 -322
  429. package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +0 -51
  430. package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts.map +0 -1
  431. package/dest/storage/private_event_data_provider/private_event_data_provider.js +0 -115
  432. package/dest/storage/tagging_data_provider/index.d.ts +0 -3
  433. package/dest/storage/tagging_data_provider/index.d.ts.map +0 -1
  434. package/dest/storage/tagging_data_provider/index.js +0 -2
  435. package/dest/storage/tagging_data_provider/recipient_tagging_data_provider.d.ts +0 -31
  436. package/dest/storage/tagging_data_provider/recipient_tagging_data_provider.d.ts.map +0 -1
  437. package/dest/storage/tagging_data_provider/recipient_tagging_data_provider.js +0 -65
  438. package/dest/storage/tagging_data_provider/sender_tagging_data_provider.d.ts +0 -67
  439. package/dest/storage/tagging_data_provider/sender_tagging_data_provider.d.ts.map +0 -1
  440. package/dest/storage/tagging_data_provider/sender_tagging_data_provider.js +0 -196
  441. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +0 -14
  442. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +0 -1
  443. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +0 -99
  444. package/dest/tagging/recipient_sync/new_recipient_tagging_data_provider.d.ts +0 -21
  445. package/dest/tagging/recipient_sync/new_recipient_tagging_data_provider.d.ts.map +0 -1
  446. package/dest/tagging/recipient_sync/new_recipient_tagging_data_provider.js +0 -42
  447. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +0 -14
  448. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +0 -1
  449. package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +0 -29
  450. package/dest/tagging/sync/sync_sender_tagging_indexes.d.ts +0 -21
  451. package/dest/tagging/sync/sync_sender_tagging_indexes.d.ts.map +0 -1
  452. package/dest/tagging/sync/utils/get_status_change_of_pending.d.ts +0 -11
  453. package/dest/tagging/sync/utils/get_status_change_of_pending.d.ts.map +0 -1
  454. package/dest/tagging/sync/utils/get_status_change_of_pending.js +0 -32
  455. package/dest/tagging/sync/utils/load_and_store_new_tagging_indexes.d.ts +0 -18
  456. package/dest/tagging/sync/utils/load_and_store_new_tagging_indexes.d.ts.map +0 -1
  457. package/dest/tagging/sync/utils/load_and_store_new_tagging_indexes.js +0 -55
  458. package/dest/tagging/utils.d.ts +0 -18
  459. package/dest/tagging/utils.d.ts.map +0 -1
  460. package/dest/tagging/utils.js +0 -25
  461. package/dest/tree_membership/tree_membership_service.d.ts +0 -52
  462. package/dest/tree_membership/tree_membership_service.d.ts.map +0 -1
  463. package/dest/tree_membership/tree_membership_service.js +0 -84
  464. package/src/contract_function_simulator/proxied_node.ts +0 -33
  465. package/src/private_kernel/private_kernel_oracle_impl.ts +0 -133
  466. package/src/public_storage/public_storage_service.ts +0 -33
  467. package/src/storage/address_data_provider/index.ts +0 -1
  468. package/src/storage/anchor_block_data_provider/index.ts +0 -1
  469. package/src/storage/capsule_data_provider/capsule_data_provider.ts +0 -179
  470. package/src/storage/capsule_data_provider/index.ts +0 -1
  471. package/src/storage/contract_data_provider/contract_data_provider.ts +0 -319
  472. package/src/storage/contract_data_provider/index.ts +0 -1
  473. package/src/storage/note_data_provider/index.ts +0 -2
  474. package/src/storage/note_data_provider/note_data_provider.ts +0 -412
  475. package/src/storage/private_event_data_provider/private_event_data_provider.ts +0 -162
  476. package/src/storage/tagging_data_provider/index.ts +0 -2
  477. package/src/storage/tagging_data_provider/recipient_tagging_data_provider.ts +0 -86
  478. package/src/storage/tagging_data_provider/sender_tagging_data_provider.ts +0 -244
  479. package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +0 -129
  480. package/src/tagging/recipient_sync/new_recipient_tagging_data_provider.ts +0 -53
  481. package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +0 -43
  482. package/src/tagging/sync/sync_sender_tagging_indexes.ts +0 -112
  483. package/src/tagging/sync/utils/get_status_change_of_pending.ts +0 -44
  484. package/src/tagging/sync/utils/load_and_store_new_tagging_indexes.ts +0 -72
  485. package/src/tagging/utils.ts +0 -32
  486. package/src/tree_membership/tree_membership_service.ts +0 -112
  487. /package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.js +0 -0
  488. /package/src/storage/{contract_data_provider → contract_store}/private_functions_tree.ts +0 -0
@@ -1,67 +0,0 @@
1
- import type { AztecAsyncKVStore } from '@aztec/kv-store';
2
- import type { DirectionalAppTaggingSecret, PreTag } from '@aztec/stdlib/logs';
3
- import { TxHash } from '@aztec/stdlib/tx';
4
- /**
5
- * Data provider of tagging data used when syncing the sender tagging indexes. The recipient counterpart of this class
6
- * is called RecipientTaggingDataProvider. We have the providers separate for the sender and recipient because
7
- * the algorithms are completely disjoint and there is not data reuse between the two.
8
- */
9
- export declare class SenderTaggingDataProvider {
10
- #private;
11
- constructor(store: AztecAsyncKVStore);
12
- /**
13
- * Stores pending indexes.
14
- * @remarks Ignores the index if the same preTag + txHash combination already exists in the db with the same index.
15
- * This is expected to happen because whenever we start sync we start from the last finalized index and we can have
16
- * pending indexes already stored from previous syncs.
17
- * @param preTags - The pre-tags containing the directional app tagging secrets and the indexes that are to be
18
- * stored in the db.
19
- * @param txHash - The tx in which the pretags were used in private logs.
20
- * @throws If any two pre-tags contain the same directional app tagging secret. This is enforced because we care
21
- * only about the highest index for a given secret that was used in the tx. Hence this check is a good way to catch
22
- * bugs.
23
- * @throws If the newly stored pending index is further than window length from the highest finalized index for the
24
- * same secret. This is enforced in order to give a guarantee to a recipient that he doesn't need to look further than
25
- * window length ahead of the highest finalized index.
26
- * @throws If a secret + txHash pair already exists in the db with a different index value. It should never happen
27
- * that we would attempt to store a different index for a given secret-txHash pair because we always store just the
28
- * highest index for a given secret-txHash pair. Hence this is a good way to catch bugs.
29
- * @throws If the newly stored pending index is lower than or equal to the last finalized index for the same secret.
30
- * This is enforced because this should never happen if the syncing is done correctly as we look for logs from higher
31
- * indexes than finalized ones.
32
- */
33
- storePendingIndexes(preTags: PreTag[], txHash: TxHash): Promise<void>;
34
- /**
35
- * Returns the transaction hashes of all pending transactions that contain indexes within a specified range
36
- * for a given directional app tagging secret.
37
- * @param secret - The directional app tagging secret to query pending indexes for.
38
- * @param startIndex - The lower bound of the index range (inclusive).
39
- * @param endIndex - The upper bound of the index range (exclusive).
40
- * @returns An array of unique transaction hashes for pending transactions that contain indexes in the range
41
- * [startIndex, endIndex). Returns an empty array if no pending indexes exist in the range.
42
- */
43
- getTxHashesOfPendingIndexes(secret: DirectionalAppTaggingSecret, startIndex: number, endIndex: number): Promise<TxHash[]>;
44
- /**
45
- * Returns the last (highest) finalized index for a given secret.
46
- * @param secret - The secret to get the last finalized index for.
47
- * @returns The last (highest) finalized index for the given secret.
48
- */
49
- getLastFinalizedIndex(secret: DirectionalAppTaggingSecret): Promise<number | undefined>;
50
- /**
51
- * Returns the last used index for a given directional app tagging secret, considering both finalized and pending
52
- * indexes.
53
- * @param secret - The directional app tagging secret to query the last used index for.
54
- * @returns The last used index.
55
- */
56
- getLastUsedIndex(secret: DirectionalAppTaggingSecret): Promise<number | undefined>;
57
- /**
58
- * Drops all pending indexes corresponding to the given transaction hashes.
59
- */
60
- dropPendingIndexes(txHashes: TxHash[]): Promise<void>;
61
- /**
62
- * Updates pending indexes corresponding to the given transaction hashes to be finalized and prunes any lower pending
63
- * indexes.
64
- */
65
- finalizePendingIndexes(txHashes: TxHash[]): Promise<void>;
66
- }
67
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VuZGVyX3RhZ2dpbmdfZGF0YV9wcm92aWRlci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3N0b3JhZ2UvdGFnZ2luZ19kYXRhX3Byb3ZpZGVyL3NlbmRlcl90YWdnaW5nX2RhdGFfcHJvdmlkZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxLQUFLLEVBQUUsaUJBQWlCLEVBQWlCLE1BQU0saUJBQWlCLENBQUM7QUFDeEUsT0FBTyxLQUFLLEVBQUUsMkJBQTJCLEVBQUUsTUFBTSxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFDOUUsT0FBTyxFQUFFLE1BQU0sRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBSTFDOzs7O0dBSUc7QUFDSCxxQkFBYSx5QkFBeUI7O0lBa0JwQyxZQUFZLEtBQUssRUFBRSxpQkFBaUIsRUFLbkM7SUFFRDs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7T0FvQkc7SUFDRyxtQkFBbUIsQ0FBQyxPQUFPLEVBQUUsTUFBTSxFQUFFLEVBQUUsTUFBTSxFQUFFLE1BQU0saUJBaUQxRDtJQUVEOzs7Ozs7OztPQVFHO0lBQ0csMkJBQTJCLENBQy9CLE1BQU0sRUFBRSwyQkFBMkIsRUFDbkMsVUFBVSxFQUFFLE1BQU0sRUFDbEIsUUFBUSxFQUFFLE1BQU0sR0FDZixPQUFPLENBQUMsTUFBTSxFQUFFLENBQUMsQ0FNbkI7SUFFRDs7OztPQUlHO0lBQ0gscUJBQXFCLENBQUMsTUFBTSxFQUFFLDJCQUEyQixHQUFHLE9BQU8sQ0FBQyxNQUFNLEdBQUcsU0FBUyxDQUFDLENBRXRGO0lBRUQ7Ozs7O09BS0c7SUFDRyxnQkFBZ0IsQ0FBQyxNQUFNLEVBQUUsMkJBQTJCLEdBQUcsT0FBTyxDQUFDLE1BQU0sR0FBRyxTQUFTLENBQUMsQ0FZdkY7SUFFRDs7T0FFRztJQUNHLGtCQUFrQixDQUFDLFFBQVEsRUFBRSxNQUFNLEVBQUUsaUJBcUIxQztJQUVEOzs7T0FHRztJQUNHLHNCQUFzQixDQUFDLFFBQVEsRUFBRSxNQUFNLEVBQUUsaUJBcUQ5QztDQUNGIn0=
@@ -1 +0,0 @@
1
- {"version":3,"file":"sender_tagging_data_provider.d.ts","sourceRoot":"","sources":["../../../src/storage/tagging_data_provider/sender_tagging_data_provider.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAI1C;;;;GAIG;AACH,qBAAa,yBAAyB;;IAkBpC,YAAY,KAAK,EAAE,iBAAiB,EAKnC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,iBAiD1D;IAED;;;;;;;;OAQG;IACG,2BAA2B,CAC/B,MAAM,EAAE,2BAA2B,EACnC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,EAAE,CAAC,CAMnB;IAED;;;;OAIG;IACH,qBAAqB,CAAC,MAAM,EAAE,2BAA2B,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAEtF;IAED;;;;;OAKG;IACG,gBAAgB,CAAC,MAAM,EAAE,2BAA2B,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAYvF;IAED;;OAEG;IACG,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,iBAqB1C;IAED;;;OAGG;IACG,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,iBAqD9C;CACF"}
@@ -1,196 +0,0 @@
1
- import { toArray } from '@aztec/foundation/iterable';
2
- import { TxHash } from '@aztec/stdlib/tx';
3
- import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../../tagging/sync/sync_sender_tagging_indexes.js';
4
- /**
5
- * Data provider of tagging data used when syncing the sender tagging indexes. The recipient counterpart of this class
6
- * is called RecipientTaggingDataProvider. We have the providers separate for the sender and recipient because
7
- * the algorithms are completely disjoint and there is not data reuse between the two.
8
- */ export class SenderTaggingDataProvider {
9
- #store;
10
- // Stores the pending indexes for each directional app tagging secret. Pending here means that the tx that contained
11
- // the private logs with tags corresponding to these indexes has not been finalized yet.
12
- //
13
- // We don't store just the highest index because if their transaction is dropped we'd then need the information about
14
- // the lower pending indexes. For each secret-tx pair however we only store the largest index used in that tx, since
15
- // the smaller ones are irrelevant due to tx atomicity.
16
- //
17
- // TODO(#17615): This assumes no logs are used in the non-revertible phase.
18
- #pendingIndexes;
19
- // Stores the last (highest) finalized index for each directional app tagging secret. We care only about the last
20
- // index because unlike the pending indexes, it will never happen that a finalized index would be removed and hence
21
- // we don't need to store the history.
22
- #lastFinalizedIndexes;
23
- constructor(store){
24
- this.#store = store;
25
- this.#pendingIndexes = this.#store.openMap('pending_indexes');
26
- this.#lastFinalizedIndexes = this.#store.openMap('last_finalized_indexes');
27
- }
28
- /**
29
- * Stores pending indexes.
30
- * @remarks Ignores the index if the same preTag + txHash combination already exists in the db with the same index.
31
- * This is expected to happen because whenever we start sync we start from the last finalized index and we can have
32
- * pending indexes already stored from previous syncs.
33
- * @param preTags - The pre-tags containing the directional app tagging secrets and the indexes that are to be
34
- * stored in the db.
35
- * @param txHash - The tx in which the pretags were used in private logs.
36
- * @throws If any two pre-tags contain the same directional app tagging secret. This is enforced because we care
37
- * only about the highest index for a given secret that was used in the tx. Hence this check is a good way to catch
38
- * bugs.
39
- * @throws If the newly stored pending index is further than window length from the highest finalized index for the
40
- * same secret. This is enforced in order to give a guarantee to a recipient that he doesn't need to look further than
41
- * window length ahead of the highest finalized index.
42
- * @throws If a secret + txHash pair already exists in the db with a different index value. It should never happen
43
- * that we would attempt to store a different index for a given secret-txHash pair because we always store just the
44
- * highest index for a given secret-txHash pair. Hence this is a good way to catch bugs.
45
- * @throws If the newly stored pending index is lower than or equal to the last finalized index for the same secret.
46
- * This is enforced because this should never happen if the syncing is done correctly as we look for logs from higher
47
- * indexes than finalized ones.
48
- */ async storePendingIndexes(preTags, txHash) {
49
- // The secrets in pre-tags should be unique because we always store just the highest index per given secret-txHash
50
- // pair. Below we check that this is the case.
51
- const secretsSet = new Set(preTags.map((preTag)=>preTag.secret.toString()));
52
- if (secretsSet.size !== preTags.length) {
53
- throw new Error(`Duplicate secrets found when storing pending indexes`);
54
- }
55
- for (const { secret, index } of preTags){
56
- // First we check that for any secret the highest used index in tx is not further than window length from
57
- // the highest finalized index.
58
- const finalizedIndex = await this.getLastFinalizedIndex(secret) ?? 0;
59
- if (index > finalizedIndex + UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN) {
60
- throw new Error(`Highest used index ${index} is further than window length from the highest finalized index ${finalizedIndex}.
61
- Tagging window length ${UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN} is configured too low. Contact the Aztec team
62
- to increase it!`);
63
- }
64
- // Throw if the new pending index is lower than or equal to the last finalized index
65
- const secretStr = secret.toString();
66
- const lastFinalizedIndex = await this.#lastFinalizedIndexes.getAsync(secretStr);
67
- if (lastFinalizedIndex !== undefined && index <= lastFinalizedIndex) {
68
- throw new Error(`Cannot store pending index ${index} for secret ${secretStr}: ` + `it is lower than or equal to the last finalized index ${lastFinalizedIndex}`);
69
- }
70
- // Check if this secret + txHash combination already exists
71
- const txHashStr = txHash.toString();
72
- const existingForSecret = await this.#pendingIndexes.getAsync(secretStr) ?? [];
73
- const existingForSecretAndTx = existingForSecret.find((entry)=>entry.txHash === txHashStr);
74
- if (existingForSecretAndTx) {
75
- // If it exists with a different index, throw an error
76
- if (existingForSecretAndTx.index !== index) {
77
- throw new Error(`Cannot store index ${index} for secret ${secretStr} and txHash ${txHashStr}: ` + `a different index ${existingForSecretAndTx.index} already exists for this secret-txHash pair`);
78
- }
79
- // If it exists with the same index, ignore the update (no-op)
80
- } else {
81
- // If it doesn't exist, add it
82
- await this.#pendingIndexes.set(secretStr, [
83
- ...existingForSecret,
84
- {
85
- index,
86
- txHash: txHashStr
87
- }
88
- ]);
89
- }
90
- }
91
- }
92
- /**
93
- * Returns the transaction hashes of all pending transactions that contain indexes within a specified range
94
- * for a given directional app tagging secret.
95
- * @param secret - The directional app tagging secret to query pending indexes for.
96
- * @param startIndex - The lower bound of the index range (inclusive).
97
- * @param endIndex - The upper bound of the index range (exclusive).
98
- * @returns An array of unique transaction hashes for pending transactions that contain indexes in the range
99
- * [startIndex, endIndex). Returns an empty array if no pending indexes exist in the range.
100
- */ async getTxHashesOfPendingIndexes(secret, startIndex, endIndex) {
101
- const existing = await this.#pendingIndexes.getAsync(secret.toString()) ?? [];
102
- const txHashes = existing.filter((entry)=>entry.index >= startIndex && entry.index < endIndex).map((entry)=>entry.txHash);
103
- return Array.from(new Set(txHashes)).map(TxHash.fromString);
104
- }
105
- /**
106
- * Returns the last (highest) finalized index for a given secret.
107
- * @param secret - The secret to get the last finalized index for.
108
- * @returns The last (highest) finalized index for the given secret.
109
- */ getLastFinalizedIndex(secret) {
110
- return this.#lastFinalizedIndexes.getAsync(secret.toString());
111
- }
112
- /**
113
- * Returns the last used index for a given directional app tagging secret, considering both finalized and pending
114
- * indexes.
115
- * @param secret - The directional app tagging secret to query the last used index for.
116
- * @returns The last used index.
117
- */ async getLastUsedIndex(secret) {
118
- const secretStr = secret.toString();
119
- const pendingTxScopedIndexes = await this.#pendingIndexes.getAsync(secretStr) ?? [];
120
- const pendingIndexes = pendingTxScopedIndexes.map((entry)=>entry.index);
121
- if (pendingTxScopedIndexes.length === 0) {
122
- return this.#lastFinalizedIndexes.getAsync(secretStr);
123
- }
124
- // As the last used index we return the highest one from the pending indexes. Note that this value will be always
125
- // higher than the last finalized index because we prune lower pending indexes when a tx is finalized.
126
- return Math.max(...pendingIndexes);
127
- }
128
- /**
129
- * Drops all pending indexes corresponding to the given transaction hashes.
130
- */ async dropPendingIndexes(txHashes) {
131
- if (txHashes.length === 0) {
132
- return;
133
- }
134
- const txHashStrs = new Set(txHashes.map((txHash)=>txHash.toString()));
135
- const allSecrets = await toArray(this.#pendingIndexes.keysAsync());
136
- for (const secret of allSecrets){
137
- const pendingData = await this.#pendingIndexes.getAsync(secret);
138
- if (pendingData) {
139
- const filtered = pendingData.filter((item)=>!txHashStrs.has(item.txHash));
140
- if (filtered.length === 0) {
141
- await this.#pendingIndexes.delete(secret);
142
- } else if (filtered.length !== pendingData.length) {
143
- // Some items were filtered out, so update the pending data
144
- await this.#pendingIndexes.set(secret, filtered);
145
- }
146
- // else: No items were filtered out (txHashes not found for this secret) --> no-op
147
- }
148
- }
149
- }
150
- /**
151
- * Updates pending indexes corresponding to the given transaction hashes to be finalized and prunes any lower pending
152
- * indexes.
153
- */ async finalizePendingIndexes(txHashes) {
154
- if (txHashes.length === 0) {
155
- return;
156
- }
157
- for (const txHash of txHashes){
158
- const txHashStr = txHash.toString();
159
- const allSecrets = await toArray(this.#pendingIndexes.keysAsync());
160
- for (const secret of allSecrets){
161
- const pendingData = await this.#pendingIndexes.getAsync(secret);
162
- if (!pendingData) {
163
- continue;
164
- }
165
- const matchingIndexes = pendingData.filter((item)=>item.txHash === txHashStr).map((item)=>item.index);
166
- if (matchingIndexes.length === 0) {
167
- continue;
168
- }
169
- if (matchingIndexes.length > 1) {
170
- // We should always just store the highest pending index for a given tx hash and secret because the lower
171
- // values are irrelevant.
172
- throw new Error(`Multiple pending indexes found for tx hash ${txHashStr} and secret ${secret}`);
173
- }
174
- let lastFinalized = await this.#lastFinalizedIndexes.getAsync(secret);
175
- const newFinalized = matchingIndexes[0];
176
- if (newFinalized < (lastFinalized ?? 0)) {
177
- // This should never happen because when last finalized index was finalized we should have pruned the lower
178
- // pending indexes.
179
- throw new Error(`New finalized index ${newFinalized} is smaller than the current last finalized index ${lastFinalized}`);
180
- }
181
- await this.#lastFinalizedIndexes.set(secret, newFinalized);
182
- lastFinalized = newFinalized;
183
- // When we add pending indexes, we ensure they are higher than the last finalized index. However, because we
184
- // cannot control the order in which transactions are finalized, there may be pending indexes that are now
185
- // obsolete because they are lower than the most recently finalized index. For this reason, we prune these
186
- // outdated pending indexes.
187
- const remainingItemsOfHigherIndex = pendingData.filter((item)=>item.index > (lastFinalized ?? 0));
188
- if (remainingItemsOfHigherIndex.length === 0) {
189
- await this.#pendingIndexes.delete(secret);
190
- } else {
191
- await this.#pendingIndexes.set(secret, remainingItemsOfHigherIndex);
192
- }
193
- }
194
- }
195
- }
196
- }
@@ -1,14 +0,0 @@
1
- import type { BlockNumber } from '@aztec/foundation/branded-types';
2
- import type { AztecAddress } from '@aztec/stdlib/aztec-address';
3
- import type { AztecNode } from '@aztec/stdlib/interfaces/client';
4
- import type { DirectionalAppTaggingSecret, TxScopedL2Log } from '@aztec/stdlib/logs';
5
- import type { NewRecipientTaggingDataProvider } from './new_recipient_tagging_data_provider.js';
6
- /**
7
- * Loads private logs for `app` and sender-recipient pair defined by `secret` and updates the highest aged and
8
- * finalized indexes in the db. At most load logs from blocks up to and including `anchorBlockNumber`.
9
- *
10
- * @dev This function can be safely executed "in parallel" for other sender-recipient pairs because the data in
11
- * in the tagging data provider is indexed by the secret and hence completely disjoint.
12
- */
13
- export declare function loadPrivateLogsForSenderRecipientPair(secret: DirectionalAppTaggingSecret, app: AztecAddress, aztecNode: AztecNode, taggingDataProvider: NewRecipientTaggingDataProvider, anchorBlockNumber: BlockNumber): Promise<TxScopedL2Log[]>;
14
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9hZF9wcml2YXRlX2xvZ3NfZm9yX3NlbmRlcl9yZWNpcGllbnRfcGFpci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3RhZ2dpbmcvcmVjaXBpZW50X3N5bmMvbG9hZF9wcml2YXRlX2xvZ3NfZm9yX3NlbmRlcl9yZWNpcGllbnRfcGFpci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNuRSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUNoRSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNqRSxPQUFPLEtBQUssRUFBRSwyQkFBMkIsRUFBRSxhQUFhLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUdyRixPQUFPLEtBQUssRUFBRSwrQkFBK0IsRUFBRSxNQUFNLDBDQUEwQyxDQUFDO0FBSWhHOzs7Ozs7R0FNRztBQUNILHdCQUFzQixxQ0FBcUMsQ0FDekQsTUFBTSxFQUFFLDJCQUEyQixFQUNuQyxHQUFHLEVBQUUsWUFBWSxFQUNqQixTQUFTLEVBQUUsU0FBUyxFQUNwQixtQkFBbUIsRUFBRSwrQkFBK0IsRUFDcEQsaUJBQWlCLEVBQUUsV0FBVyxHQUM3QixPQUFPLENBQUMsYUFBYSxFQUFFLENBQUMsQ0F5RzFCIn0=
@@ -1 +0,0 @@
1
- {"version":3,"file":"load_private_logs_for_sender_recipient_pair.d.ts","sourceRoot":"","sources":["../../../src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,2BAA2B,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGrF,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,0CAA0C,CAAC;AAIhG;;;;;;GAMG;AACH,wBAAsB,qCAAqC,CACzD,MAAM,EAAE,2BAA2B,EACnC,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE,SAAS,EACpB,mBAAmB,EAAE,+BAA+B,EACpD,iBAAiB,EAAE,WAAW,GAC7B,OAAO,CAAC,aAAa,EAAE,CAAC,CAyG1B"}
@@ -1,99 +0,0 @@
1
- import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../sync/sync_sender_tagging_indexes.js';
2
- import { findHighestIndexes } from './utils/find_highest_indexes.js';
3
- import { loadLogsForRange } from './utils/load_logs_for_range.js';
4
- /**
5
- * Loads private logs for `app` and sender-recipient pair defined by `secret` and updates the highest aged and
6
- * finalized indexes in the db. At most load logs from blocks up to and including `anchorBlockNumber`.
7
- *
8
- * @dev This function can be safely executed "in parallel" for other sender-recipient pairs because the data in
9
- * in the tagging data provider is indexed by the secret and hence completely disjoint.
10
- */ export async function loadPrivateLogsForSenderRecipientPair(secret, app, aztecNode, taggingDataProvider, anchorBlockNumber) {
11
- // # Explanation of how the algorithm works
12
- // When we perform the sync we will look at logs that correspond to the tagging index range
13
- // (highestAgedIndex, highestFinalizedIndex + WINDOW_LEN]
14
- //
15
- // highestAgedIndex is the highest index that was used in a tx that is included in a block at least
16
- // `MAX_INCLUDE_BY_TIMESTAMP_DURATION` seconds ago.
17
- // highestFinalizedIndex is the highest index that was used in a tx that is included in a finalized block.
18
- //
19
- // "(" denotes an open end of the range - the index is not included in the range.
20
- // "]" denotes a closed end of the range - the index is included in the range.
21
- //
22
- // ## Explanation of highestAgedIndex
23
- //
24
- // highestAgedIndex is chosen such that for all tagging indexes `i <= highestAgedIndex` we know that no new logs can
25
- // ever appear.
26
- //
27
- // This relies on the "maximum inclusion timestamp" rule enforced by the kernel and rollup circuits:
28
- // - a transaction's maximum inclusion timestamp is at most `MAX_INCLUDE_BY_TIMESTAMP_DURATION` seconds after
29
- // the timestamp of its anchor block; and
30
- // - a rollup only includes transactions whose inclusion timestamp is >= the L2 block's timestamp.
31
- //
32
- // Suppose some device used index `I` in a transaction anchored to block `B_N` at time `N`, and that block is now at
33
- // least `MAX_INCLUDE_BY_TIMESTAMP_DURATION` seconds in the past. Then there is no possibility of any *other* device
34
- // trying to use an index <= `I` while anchoring to a *newer* block than `B_N` because if we were anchoring to
35
- // a newer block than `B_N` then we would already have seen the log with index `I` and hence the device would have
36
- // chosen a larger index.
37
- // If that *other* device would anchor to a block older than `B_N` then that tx could never be included in a block
38
- // because it would already have been expired.
39
- //
40
- // Therefore, once we see that index `I` has been used in a block that is at least `MAX_INCLUDE_BY_TIMESTAMP_DURATION`
41
- // seconds old, we can safely stop syncing logs for all indexes <= `I` and set highestAgedIndex = `I`.
42
- //
43
- // ## Explanation of the upper bound `highestFinalizedIndex + WINDOW_LEN`
44
- //
45
- // When a sender chooses a tagging index, they will select an index that is at most `WINDOW_LEN` greater than
46
- // the highest finalized index. If that index was already used, they will throw an error. For this reason we
47
- // don't have to look further than `highestFinalizedIndex + WINDOW_LEN`.
48
- let finalizedBlockNumber, currentTimestamp;
49
- {
50
- const [l2Tips, latestBlockHeader] = await Promise.all([
51
- aztecNode.getL2Tips(),
52
- aztecNode.getBlockHeader('latest')
53
- ]);
54
- if (!latestBlockHeader) {
55
- throw new Error('Node failed to return latest block header when syncing logs');
56
- }
57
- [finalizedBlockNumber, currentTimestamp] = [
58
- l2Tips.finalized.number,
59
- latestBlockHeader.globalVariables.timestamp
60
- ];
61
- }
62
- let start, end;
63
- {
64
- const currentHighestAgedIndex = await taggingDataProvider.getHighestAgedIndex(secret);
65
- const currentHighestFinalizedIndex = await taggingDataProvider.getHighestFinalizedIndex(secret);
66
- // We don't want to include the highest aged index so we start from `currentHighestAgedIndex + 1` (or 0 if not set)
67
- start = currentHighestAgedIndex === undefined ? 0 : currentHighestAgedIndex + 1;
68
- // The highest index a sender can choose is "highest finalized index + window length" but given that
69
- // `loadLogsForRange` expects an exclusive `end` we add 1.
70
- end = (currentHighestFinalizedIndex ?? 0) + UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN + 1;
71
- }
72
- const logs = [];
73
- while(true){
74
- // Get private logs with their block timestamps and corresponding tagging indexes
75
- const privateLogsWithIndexes = await loadLogsForRange(secret, app, aztecNode, start, end, anchorBlockNumber);
76
- if (privateLogsWithIndexes.length === 0) {
77
- break;
78
- }
79
- logs.push(...privateLogsWithIndexes.map(({ log })=>log));
80
- const { highestAgedIndex, highestFinalizedIndex } = findHighestIndexes(privateLogsWithIndexes, currentTimestamp, finalizedBlockNumber);
81
- // Store updates in data provider and update local variables
82
- if (highestAgedIndex !== undefined) {
83
- await taggingDataProvider.updateHighestAgedIndex(secret, highestAgedIndex);
84
- }
85
- if (highestFinalizedIndex === undefined) {
86
- break;
87
- }
88
- if (highestAgedIndex !== undefined && highestAgedIndex > highestFinalizedIndex) {
89
- // This is just a sanity check as this should never happen.
90
- throw new Error('Highest aged index lower than highest finalized index invariant violated');
91
- }
92
- await taggingDataProvider.updateHighestFinalizedIndex(secret, highestFinalizedIndex);
93
- // For the next iteration we want to look only at indexes for which we have not attempted to load logs yet while
94
- // ensuring that we do not look further than WINDOW_LEN ahead of the highest finalized index.
95
- start = end;
96
- end = highestFinalizedIndex + UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN + 1; // `end` is exclusive so we add 1.
97
- }
98
- return logs;
99
- }
@@ -1,21 +0,0 @@
1
- import type { AztecAsyncKVStore } from '@aztec/kv-store';
2
- import type { DirectionalAppTaggingSecret } from '@aztec/stdlib/logs';
3
- /**
4
- * Data provider of tagging data used when syncing the logs as a recipient. The sender counterpart of this class
5
- * is called SenderTaggingDataProvider. We have the providers separate for the sender and recipient because
6
- * the algorithms are completely disjoint and there is not data reuse between the two.
7
- *
8
- * @dev Chain reorgs do not need to be handled here because both the finalized and aged indexes refer to finalized
9
- * blocks, which by definition cannot be affected by reorgs.
10
- *
11
- * TODO(benesjan): Rename as to RecipientTaggingDataProvider and relocate once the old tagging sync is purged.
12
- */
13
- export declare class NewRecipientTaggingDataProvider {
14
- #private;
15
- constructor(store: AztecAsyncKVStore);
16
- getHighestAgedIndex(secret: DirectionalAppTaggingSecret): Promise<number | undefined>;
17
- updateHighestAgedIndex(secret: DirectionalAppTaggingSecret, index: number): Promise<void>;
18
- getHighestFinalizedIndex(secret: DirectionalAppTaggingSecret): Promise<number | undefined>;
19
- updateHighestFinalizedIndex(secret: DirectionalAppTaggingSecret, index: number): Promise<void>;
20
- }
21
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmV3X3JlY2lwaWVudF90YWdnaW5nX2RhdGFfcHJvdmlkZXIuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy90YWdnaW5nL3JlY2lwaWVudF9zeW5jL25ld19yZWNpcGllbnRfdGFnZ2luZ19kYXRhX3Byb3ZpZGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLGlCQUFpQixFQUFpQixNQUFNLGlCQUFpQixDQUFDO0FBQ3hFLE9BQU8sS0FBSyxFQUFFLDJCQUEyQixFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFFdEU7Ozs7Ozs7OztHQVNHO0FBQ0gscUJBQWEsK0JBQStCOztJQU0xQyxZQUFZLEtBQUssRUFBRSxpQkFBaUIsRUFLbkM7SUFFRCxtQkFBbUIsQ0FBQyxNQUFNLEVBQUUsMkJBQTJCLEdBQUcsT0FBTyxDQUFDLE1BQU0sR0FBRyxTQUFTLENBQUMsQ0FFcEY7SUFFSyxzQkFBc0IsQ0FBQyxNQUFNLEVBQUUsMkJBQTJCLEVBQUUsS0FBSyxFQUFFLE1BQU0sR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLENBTzlGO0lBRUQsd0JBQXdCLENBQUMsTUFBTSxFQUFFLDJCQUEyQixHQUFHLE9BQU8sQ0FBQyxNQUFNLEdBQUcsU0FBUyxDQUFDLENBRXpGO0lBRUssMkJBQTJCLENBQUMsTUFBTSxFQUFFLDJCQUEyQixFQUFFLEtBQUssRUFBRSxNQUFNLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxDQVFuRztDQUNGIn0=
@@ -1 +0,0 @@
1
- {"version":3,"file":"new_recipient_tagging_data_provider.d.ts","sourceRoot":"","sources":["../../../src/tagging/recipient_sync/new_recipient_tagging_data_provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAEtE;;;;;;;;;GASG;AACH,qBAAa,+BAA+B;;IAM1C,YAAY,KAAK,EAAE,iBAAiB,EAKnC;IAED,mBAAmB,CAAC,MAAM,EAAE,2BAA2B,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAEpF;IAEK,sBAAsB,CAAC,MAAM,EAAE,2BAA2B,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAO9F;IAED,wBAAwB,CAAC,MAAM,EAAE,2BAA2B,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAEzF;IAEK,2BAA2B,CAAC,MAAM,EAAE,2BAA2B,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAQnG;CACF"}
@@ -1,42 +0,0 @@
1
- /**
2
- * Data provider of tagging data used when syncing the logs as a recipient. The sender counterpart of this class
3
- * is called SenderTaggingDataProvider. We have the providers separate for the sender and recipient because
4
- * the algorithms are completely disjoint and there is not data reuse between the two.
5
- *
6
- * @dev Chain reorgs do not need to be handled here because both the finalized and aged indexes refer to finalized
7
- * blocks, which by definition cannot be affected by reorgs.
8
- *
9
- * TODO(benesjan): Rename as to RecipientTaggingDataProvider and relocate once the old tagging sync is purged.
10
- */ export class NewRecipientTaggingDataProvider {
11
- #store;
12
- #highestAgedIndex;
13
- #highestFinalizedIndex;
14
- constructor(store){
15
- this.#store = store;
16
- this.#highestAgedIndex = this.#store.openMap('highest_aged_index');
17
- this.#highestFinalizedIndex = this.#store.openMap('highest_finalized_index');
18
- }
19
- getHighestAgedIndex(secret) {
20
- return this.#highestAgedIndex.getAsync(secret.toString());
21
- }
22
- async updateHighestAgedIndex(secret, index) {
23
- const currentIndex = await this.#highestAgedIndex.getAsync(secret.toString());
24
- if (currentIndex !== undefined && index <= currentIndex) {
25
- // Log sync should never set a lower highest aged index.
26
- throw new Error(`New highest aged index (${index}) must be higher than the current one (${currentIndex})`);
27
- }
28
- await this.#highestAgedIndex.set(secret.toString(), index);
29
- }
30
- getHighestFinalizedIndex(secret) {
31
- return this.#highestFinalizedIndex.getAsync(secret.toString());
32
- }
33
- async updateHighestFinalizedIndex(secret, index) {
34
- const currentIndex = await this.#highestFinalizedIndex.getAsync(secret.toString());
35
- if (currentIndex !== undefined && index < currentIndex) {
36
- // Log sync should never set a lower highest finalized index but it can happen that it would try to set the same
37
- // one because we are loading logs from highest aged index + 1 and not from the highest finalized index.
38
- throw new Error(`New highest finalized index (${index}) must be higher than the current one (${currentIndex})`);
39
- }
40
- await this.#highestFinalizedIndex.set(secret.toString(), index);
41
- }
42
- }
@@ -1,14 +0,0 @@
1
- import type { BlockNumber } from '@aztec/foundation/branded-types';
2
- import type { AztecAddress } from '@aztec/stdlib/aztec-address';
3
- import type { AztecNode } from '@aztec/stdlib/interfaces/client';
4
- import type { DirectionalAppTaggingSecret, TxScopedL2Log } from '@aztec/stdlib/logs';
5
- /**
6
- * Gets private logs with their corresponding block timestamps and tagging indexes for the given index range, `app` and
7
- * `secret`. At most load logs from blocks up to and including `anchorBlockNumber`. `start` is inclusive and `end` is
8
- * exclusive.
9
- */
10
- export declare function loadLogsForRange(secret: DirectionalAppTaggingSecret, app: AztecAddress, aztecNode: AztecNode, start: number, end: number, anchorBlockNumber: BlockNumber): Promise<Array<{
11
- log: TxScopedL2Log;
12
- taggingIndex: number;
13
- }>>;
14
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9hZF9sb2dzX2Zvcl9yYW5nZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL3RhZ2dpbmcvcmVjaXBpZW50X3N5bmMvdXRpbHMvbG9hZF9sb2dzX2Zvcl9yYW5nZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNuRSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUNoRSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNqRSxPQUFPLEtBQUssRUFBRSwyQkFBMkIsRUFBVSxhQUFhLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUc3Rjs7OztHQUlHO0FBQ0gsd0JBQXNCLGdCQUFnQixDQUNwQyxNQUFNLEVBQUUsMkJBQTJCLEVBQ25DLEdBQUcsRUFBRSxZQUFZLEVBQ2pCLFNBQVMsRUFBRSxTQUFTLEVBQ3BCLEtBQUssRUFBRSxNQUFNLEVBQ2IsR0FBRyxFQUFFLE1BQU0sRUFDWCxpQkFBaUIsRUFBRSxXQUFXLEdBQzdCLE9BQU8sQ0FBQyxLQUFLLENBQUM7SUFBRSxHQUFHLEVBQUUsYUFBYSxDQUFDO0lBQUMsWUFBWSxFQUFFLE1BQU0sQ0FBQTtDQUFFLENBQUMsQ0FBQyxDQXdCOUQifQ==
@@ -1 +0,0 @@
1
- {"version":3,"file":"load_logs_for_range.d.ts","sourceRoot":"","sources":["../../../../src/tagging/recipient_sync/utils/load_logs_for_range.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,2BAA2B,EAAU,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAG7F;;;;GAIG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,2BAA2B,EACnC,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,iBAAiB,EAAE,WAAW,GAC7B,OAAO,CAAC,KAAK,CAAC;IAAE,GAAG,EAAE,aAAa,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAwB9D"}
@@ -1,29 +0,0 @@
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
- }
@@ -1,21 +0,0 @@
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==
@@ -1 +0,0 @@
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"}
@@ -1,11 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,32 +0,0 @@
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
- }
@@ -1,18 +0,0 @@
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==
@@ -1 +0,0 @@
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"}