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

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 (328) hide show
  1. package/dest/bin/check_oracle_version.js +1 -1
  2. package/dest/block_synchronizer/block_synchronizer.d.ts +14 -10
  3. package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
  4. package/dest/block_synchronizer/block_synchronizer.js +72 -32
  5. package/dest/config/index.d.ts +3 -1
  6. package/dest/config/index.d.ts.map +1 -1
  7. package/dest/config/index.js +17 -0
  8. package/dest/config/package_info.js +1 -1
  9. package/dest/contract_function_simulator/benchmarked_node.d.ts +9 -0
  10. package/dest/contract_function_simulator/benchmarked_node.d.ts.map +1 -0
  11. package/dest/contract_function_simulator/benchmarked_node.js +77 -0
  12. package/dest/contract_function_simulator/contract_function_simulator.d.ts +28 -27
  13. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  14. package/dest/contract_function_simulator/contract_function_simulator.js +56 -40
  15. package/dest/contract_function_simulator/execution_note_cache.d.ts +18 -9
  16. package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
  17. package/dest/contract_function_simulator/execution_note_cache.js +45 -28
  18. package/dest/contract_function_simulator/index.d.ts +2 -2
  19. package/dest/contract_function_simulator/index.d.ts.map +1 -1
  20. package/dest/contract_function_simulator/index.js +1 -1
  21. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +4 -3
  22. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
  23. package/dest/contract_function_simulator/noir-structs/event_validation_request.js +6 -3
  24. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +1 -1
  25. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +1 -1
  26. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +4 -10
  27. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -1
  28. package/dest/contract_function_simulator/noir-structs/utility_context.js +7 -18
  29. package/dest/contract_function_simulator/oracle/interfaces.d.ts +15 -11
  30. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
  31. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +3 -1
  32. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
  33. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +6 -6
  34. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
  35. package/dest/contract_function_simulator/oracle/note_packing_utils.js +8 -8
  36. package/dest/contract_function_simulator/oracle/oracle.d.ts +10 -8
  37. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
  38. package/dest/contract_function_simulator/oracle/oracle.js +43 -32
  39. package/dest/contract_function_simulator/oracle/private_execution.d.ts +2 -26
  40. package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
  41. package/dest/contract_function_simulator/oracle/private_execution.js +1 -37
  42. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +26 -26
  43. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  44. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +28 -41
  45. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +44 -34
  46. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  47. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +92 -92
  48. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +4 -4
  49. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -1
  50. package/dest/contract_function_simulator/proxied_contract_data_source.js +5 -5
  51. package/dest/contract_sync/index.d.ts +23 -0
  52. package/dest/contract_sync/index.d.ts.map +1 -0
  53. package/dest/contract_sync/index.js +54 -0
  54. package/dest/debug/pxe_debug_utils.d.ts +6 -6
  55. package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
  56. package/dest/debug/pxe_debug_utils.js +8 -7
  57. package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
  58. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  59. package/dest/entrypoints/client/bundle/utils.js +10 -1
  60. package/dest/entrypoints/client/lazy/utils.d.ts +1 -1
  61. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  62. package/dest/entrypoints/client/lazy/utils.js +10 -1
  63. package/dest/entrypoints/pxe_creation_options.d.ts +3 -2
  64. package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
  65. package/dest/entrypoints/server/index.d.ts +3 -1
  66. package/dest/entrypoints/server/index.d.ts.map +1 -1
  67. package/dest/entrypoints/server/index.js +2 -0
  68. package/dest/entrypoints/server/utils.d.ts +1 -1
  69. package/dest/entrypoints/server/utils.d.ts.map +1 -1
  70. package/dest/entrypoints/server/utils.js +11 -7
  71. package/dest/error_enriching.d.ts +4 -4
  72. package/dest/error_enriching.d.ts.map +1 -1
  73. package/dest/error_enriching.js +6 -6
  74. package/dest/events/event_service.d.ts +8 -7
  75. package/dest/events/event_service.d.ts.map +1 -1
  76. package/dest/events/event_service.js +22 -24
  77. package/dest/events/private_event_filter_validator.d.ts +6 -6
  78. package/dest/events/private_event_filter_validator.d.ts.map +1 -1
  79. package/dest/events/private_event_filter_validator.js +5 -6
  80. package/dest/job_coordinator/job_coordinator.d.ts +74 -0
  81. package/dest/job_coordinator/job_coordinator.d.ts.map +1 -0
  82. package/dest/job_coordinator/job_coordinator.js +93 -0
  83. package/dest/logs/log_service.d.ts +15 -31
  84. package/dest/logs/log_service.d.ts.map +1 -1
  85. package/dest/logs/log_service.js +77 -188
  86. package/dest/notes/note_service.d.ts +10 -9
  87. package/dest/notes/note_service.d.ts.map +1 -1
  88. package/dest/notes/note_service.js +40 -44
  89. package/dest/oracle_version.d.ts +3 -3
  90. package/dest/oracle_version.d.ts.map +1 -1
  91. package/dest/oracle_version.js +4 -3
  92. package/dest/private_kernel/hints/index.d.ts +2 -2
  93. package/dest/private_kernel/hints/index.d.ts.map +1 -1
  94. package/dest/private_kernel/hints/index.js +1 -1
  95. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +28 -0
  96. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -0
  97. package/dest/private_kernel/hints/{build_private_kernel_reset_private_inputs.js → private_kernel_reset_private_inputs_builder.js} +13 -7
  98. package/dest/private_kernel/private_kernel_execution_prover.d.ts +1 -1
  99. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
  100. package/dest/private_kernel/private_kernel_execution_prover.js +4 -5
  101. package/dest/private_kernel/private_kernel_oracle.d.ts +24 -28
  102. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
  103. package/dest/private_kernel/private_kernel_oracle.js +90 -2
  104. package/dest/pxe.d.ts +17 -44
  105. package/dest/pxe.d.ts.map +1 -1
  106. package/dest/pxe.js +131 -147
  107. package/dest/storage/address_store/address_store.d.ts +11 -0
  108. package/dest/storage/address_store/address_store.d.ts.map +1 -0
  109. package/dest/storage/{address_data_provider/address_data_provider.js → address_store/address_store.js} +1 -1
  110. package/dest/storage/address_store/index.d.ts +2 -0
  111. package/dest/storage/address_store/index.d.ts.map +1 -0
  112. package/dest/storage/address_store/index.js +1 -0
  113. package/dest/storage/anchor_block_store/anchor_block_store.d.ts +9 -0
  114. package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -0
  115. package/dest/storage/{anchor_block_data_provider/anchor_block_data_provider.js → anchor_block_store/anchor_block_store.js} +1 -1
  116. package/dest/storage/anchor_block_store/index.d.ts +2 -0
  117. package/dest/storage/anchor_block_store/index.d.ts.map +1 -0
  118. package/dest/storage/anchor_block_store/index.js +1 -0
  119. package/dest/storage/capsule_store/capsule_store.d.ts +72 -0
  120. package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -0
  121. package/dest/storage/capsule_store/capsule_store.js +255 -0
  122. package/dest/storage/capsule_store/index.d.ts +2 -0
  123. package/dest/storage/capsule_store/index.d.ts.map +1 -0
  124. package/dest/storage/capsule_store/index.js +1 -0
  125. package/dest/storage/{contract_data_provider/contract_data_provider.d.ts → contract_store/contract_store.d.ts} +3 -3
  126. package/dest/storage/contract_store/contract_store.d.ts.map +1 -0
  127. package/dest/storage/{contract_data_provider/contract_data_provider.js → contract_store/contract_store.js} +2 -2
  128. package/dest/storage/contract_store/index.d.ts +2 -0
  129. package/dest/storage/contract_store/index.d.ts.map +1 -0
  130. package/dest/storage/contract_store/index.js +1 -0
  131. package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.d.ts +1 -1
  132. package/dest/storage/contract_store/private_functions_tree.d.ts.map +1 -0
  133. package/dest/storage/index.d.ts +8 -8
  134. package/dest/storage/index.d.ts.map +1 -1
  135. package/dest/storage/index.js +7 -7
  136. package/dest/storage/note_store/index.d.ts +3 -0
  137. package/dest/storage/note_store/index.d.ts.map +1 -0
  138. package/dest/storage/note_store/index.js +2 -0
  139. package/dest/storage/note_store/note_store.d.ts +73 -0
  140. package/dest/storage/note_store/note_store.d.ts.map +1 -0
  141. package/dest/storage/note_store/note_store.js +303 -0
  142. package/dest/storage/note_store/stored_note.d.ts +16 -0
  143. package/dest/storage/note_store/stored_note.d.ts.map +1 -0
  144. package/dest/storage/note_store/stored_note.js +43 -0
  145. package/dest/storage/private_event_store/private_event_store.d.ts +91 -0
  146. package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -0
  147. package/dest/storage/private_event_store/private_event_store.js +250 -0
  148. package/dest/storage/private_event_store/stored_private_event.d.ts +23 -0
  149. package/dest/storage/private_event_store/stored_private_event.d.ts.map +1 -0
  150. package/dest/storage/private_event_store/stored_private_event.js +56 -0
  151. package/dest/storage/tagging_store/index.d.ts +4 -0
  152. package/dest/storage/tagging_store/index.d.ts.map +1 -0
  153. package/dest/storage/tagging_store/index.js +3 -0
  154. package/dest/storage/tagging_store/recipient_tagging_store.d.ts +28 -0
  155. package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -0
  156. package/dest/storage/tagging_store/recipient_tagging_store.js +99 -0
  157. package/dest/storage/tagging_store/sender_address_book_store.d.ts +14 -0
  158. package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +1 -0
  159. package/dest/storage/tagging_store/sender_address_book_store.js +30 -0
  160. package/dest/storage/{tagging_data_provider/sender_tagging_data_provider.d.ts → tagging_store/sender_tagging_store.d.ts} +19 -9
  161. package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -0
  162. package/dest/storage/{tagging_data_provider/sender_tagging_data_provider.js → tagging_store/sender_tagging_store.js} +111 -29
  163. package/dest/tagging/constants.d.ts +2 -2
  164. package/dest/tagging/constants.d.ts.map +1 -1
  165. package/dest/tagging/constants.js +10 -3
  166. package/dest/tagging/get_all_logs_by_tags.d.ts +24 -0
  167. package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -0
  168. package/dest/tagging/get_all_logs_by_tags.js +46 -0
  169. package/dest/tagging/index.d.ts +15 -3
  170. package/dest/tagging/index.d.ts.map +1 -1
  171. package/dest/tagging/index.js +14 -2
  172. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +4 -3
  173. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -1
  174. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +8 -8
  175. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +3 -2
  176. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -1
  177. package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +5 -2
  178. package/dest/tagging/{sync → sender_sync}/sync_sender_tagging_indexes.d.ts +4 -4
  179. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -0
  180. package/dest/tagging/{sync → sender_sync}/sync_sender_tagging_indexes.js +8 -23
  181. package/dest/tagging/{sync → sender_sync}/utils/get_status_change_of_pending.d.ts +1 -1
  182. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -0
  183. package/dest/tagging/{sync → sender_sync}/utils/get_status_change_of_pending.js +5 -8
  184. package/dest/tagging/{sync → sender_sync}/utils/load_and_store_new_tagging_indexes.d.ts +7 -4
  185. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -0
  186. package/dest/tagging/{sync → sender_sync}/utils/load_and_store_new_tagging_indexes.js +12 -7
  187. package/package.json +18 -18
  188. package/src/bin/check_oracle_version.ts +1 -0
  189. package/src/block_synchronizer/block_synchronizer.ts +83 -34
  190. package/src/config/index.ts +14 -0
  191. package/src/config/package_info.ts +1 -1
  192. package/src/contract_function_simulator/benchmarked_node.ts +103 -0
  193. package/src/contract_function_simulator/contract_function_simulator.ts +79 -64
  194. package/src/contract_function_simulator/execution_note_cache.ts +44 -25
  195. package/src/contract_function_simulator/index.ts +1 -1
  196. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +5 -1
  197. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +1 -1
  198. package/src/contract_function_simulator/noir-structs/utility_context.ts +6 -25
  199. package/src/contract_function_simulator/oracle/interfaces.ts +20 -10
  200. package/src/contract_function_simulator/oracle/note_packing_utils.ts +10 -10
  201. package/src/contract_function_simulator/oracle/oracle.ts +56 -41
  202. package/src/contract_function_simulator/oracle/private_execution.ts +1 -69
  203. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +77 -78
  204. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +121 -105
  205. package/src/contract_function_simulator/proxied_contract_data_source.ts +7 -7
  206. package/src/contract_sync/index.ts +98 -0
  207. package/src/debug/pxe_debug_utils.ts +7 -6
  208. package/src/entrypoints/client/bundle/utils.ts +7 -1
  209. package/src/entrypoints/client/lazy/utils.ts +7 -2
  210. package/src/entrypoints/pxe_creation_options.ts +2 -1
  211. package/src/entrypoints/server/index.ts +2 -0
  212. package/src/entrypoints/server/utils.ts +11 -15
  213. package/src/error_enriching.ts +7 -15
  214. package/src/events/event_service.ts +23 -27
  215. package/src/events/private_event_filter_validator.ts +4 -6
  216. package/src/job_coordinator/job_coordinator.ts +149 -0
  217. package/src/logs/log_service.ts +116 -260
  218. package/src/notes/note_service.ts +43 -46
  219. package/src/oracle_version.ts +4 -3
  220. package/src/private_kernel/hints/index.ts +1 -1
  221. package/src/private_kernel/hints/{build_private_kernel_reset_private_inputs.ts → private_kernel_reset_private_inputs_builder.ts} +33 -22
  222. package/src/private_kernel/private_kernel_execution_prover.ts +3 -5
  223. package/src/private_kernel/private_kernel_oracle.ts +116 -36
  224. package/src/pxe.ts +189 -190
  225. package/src/storage/{address_data_provider/address_data_provider.ts → address_store/address_store.ts} +1 -1
  226. package/src/storage/address_store/index.ts +1 -0
  227. package/src/storage/{anchor_block_data_provider/anchor_block_data_provider.ts → anchor_block_store/anchor_block_store.ts} +1 -1
  228. package/src/storage/anchor_block_store/index.ts +1 -0
  229. package/src/storage/capsule_store/capsule_store.ts +315 -0
  230. package/src/storage/capsule_store/index.ts +1 -0
  231. package/src/storage/{contract_data_provider/contract_data_provider.ts → contract_store/contract_store.ts} +2 -2
  232. package/src/storage/contract_store/index.ts +1 -0
  233. package/src/storage/index.ts +7 -7
  234. package/src/storage/note_store/index.ts +2 -0
  235. package/src/storage/note_store/note_store.ts +381 -0
  236. package/src/storage/note_store/stored_note.ts +48 -0
  237. package/src/storage/private_event_store/private_event_store.ts +363 -0
  238. package/src/storage/private_event_store/stored_private_event.ts +73 -0
  239. package/src/storage/tagging_store/index.ts +3 -0
  240. package/src/storage/tagging_store/recipient_tagging_store.ts +129 -0
  241. package/src/storage/tagging_store/sender_address_book_store.ts +42 -0
  242. package/src/storage/{tagging_data_provider/sender_tagging_data_provider.ts → tagging_store/sender_tagging_store.ts} +129 -28
  243. package/src/tagging/constants.ts +10 -3
  244. package/src/tagging/get_all_logs_by_tags.ts +68 -0
  245. package/src/tagging/index.ts +17 -2
  246. package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +23 -9
  247. package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +7 -1
  248. package/src/tagging/{sync → sender_sync}/sync_sender_tagging_indexes.ts +12 -25
  249. package/src/tagging/{sync → sender_sync}/utils/get_status_change_of_pending.ts +5 -13
  250. package/src/tagging/{sync → sender_sync}/utils/load_and_store_new_tagging_indexes.ts +19 -7
  251. package/dest/contract_function_simulator/proxied_node.d.ts +0 -9
  252. package/dest/contract_function_simulator/proxied_node.d.ts.map +0 -1
  253. package/dest/contract_function_simulator/proxied_node.js +0 -27
  254. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +0 -28
  255. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +0 -1
  256. package/dest/private_kernel/private_kernel_oracle_impl.d.ts +0 -46
  257. package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +0 -1
  258. package/dest/private_kernel/private_kernel_oracle_impl.js +0 -86
  259. package/dest/public_storage/public_storage_service.d.ts +0 -24
  260. package/dest/public_storage/public_storage_service.d.ts.map +0 -1
  261. package/dest/public_storage/public_storage_service.js +0 -26
  262. package/dest/storage/address_data_provider/address_data_provider.d.ts +0 -11
  263. package/dest/storage/address_data_provider/address_data_provider.d.ts.map +0 -1
  264. package/dest/storage/address_data_provider/index.d.ts +0 -2
  265. package/dest/storage/address_data_provider/index.d.ts.map +0 -1
  266. package/dest/storage/address_data_provider/index.js +0 -1
  267. package/dest/storage/anchor_block_data_provider/anchor_block_data_provider.d.ts +0 -9
  268. package/dest/storage/anchor_block_data_provider/anchor_block_data_provider.d.ts.map +0 -1
  269. package/dest/storage/anchor_block_data_provider/index.d.ts +0 -2
  270. package/dest/storage/anchor_block_data_provider/index.d.ts.map +0 -1
  271. package/dest/storage/anchor_block_data_provider/index.js +0 -1
  272. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts +0 -57
  273. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +0 -1
  274. package/dest/storage/capsule_data_provider/capsule_data_provider.js +0 -146
  275. package/dest/storage/capsule_data_provider/index.d.ts +0 -2
  276. package/dest/storage/capsule_data_provider/index.d.ts.map +0 -1
  277. package/dest/storage/capsule_data_provider/index.js +0 -1
  278. package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +0 -1
  279. package/dest/storage/contract_data_provider/index.d.ts +0 -2
  280. package/dest/storage/contract_data_provider/index.d.ts.map +0 -1
  281. package/dest/storage/contract_data_provider/index.js +0 -1
  282. package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +0 -1
  283. package/dest/storage/note_data_provider/index.d.ts +0 -3
  284. package/dest/storage/note_data_provider/index.d.ts.map +0 -1
  285. package/dest/storage/note_data_provider/index.js +0 -2
  286. package/dest/storage/note_data_provider/note_data_provider.d.ts +0 -84
  287. package/dest/storage/note_data_provider/note_data_provider.d.ts.map +0 -1
  288. package/dest/storage/note_data_provider/note_data_provider.js +0 -322
  289. package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +0 -51
  290. package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts.map +0 -1
  291. package/dest/storage/private_event_data_provider/private_event_data_provider.js +0 -115
  292. package/dest/storage/tagging_data_provider/index.d.ts +0 -3
  293. package/dest/storage/tagging_data_provider/index.d.ts.map +0 -1
  294. package/dest/storage/tagging_data_provider/index.js +0 -2
  295. package/dest/storage/tagging_data_provider/recipient_tagging_data_provider.d.ts +0 -31
  296. package/dest/storage/tagging_data_provider/recipient_tagging_data_provider.d.ts.map +0 -1
  297. package/dest/storage/tagging_data_provider/recipient_tagging_data_provider.js +0 -65
  298. package/dest/storage/tagging_data_provider/sender_tagging_data_provider.d.ts.map +0 -1
  299. package/dest/tagging/recipient_sync/new_recipient_tagging_data_provider.d.ts +0 -21
  300. package/dest/tagging/recipient_sync/new_recipient_tagging_data_provider.d.ts.map +0 -1
  301. package/dest/tagging/recipient_sync/new_recipient_tagging_data_provider.js +0 -42
  302. package/dest/tagging/sync/sync_sender_tagging_indexes.d.ts.map +0 -1
  303. package/dest/tagging/sync/utils/get_status_change_of_pending.d.ts.map +0 -1
  304. package/dest/tagging/sync/utils/load_and_store_new_tagging_indexes.d.ts.map +0 -1
  305. package/dest/tagging/utils.d.ts +0 -18
  306. package/dest/tagging/utils.d.ts.map +0 -1
  307. package/dest/tagging/utils.js +0 -25
  308. package/dest/tree_membership/tree_membership_service.d.ts +0 -52
  309. package/dest/tree_membership/tree_membership_service.d.ts.map +0 -1
  310. package/dest/tree_membership/tree_membership_service.js +0 -84
  311. package/src/contract_function_simulator/proxied_node.ts +0 -33
  312. package/src/private_kernel/private_kernel_oracle_impl.ts +0 -133
  313. package/src/public_storage/public_storage_service.ts +0 -33
  314. package/src/storage/address_data_provider/index.ts +0 -1
  315. package/src/storage/anchor_block_data_provider/index.ts +0 -1
  316. package/src/storage/capsule_data_provider/capsule_data_provider.ts +0 -179
  317. package/src/storage/capsule_data_provider/index.ts +0 -1
  318. package/src/storage/contract_data_provider/index.ts +0 -1
  319. package/src/storage/note_data_provider/index.ts +0 -2
  320. package/src/storage/note_data_provider/note_data_provider.ts +0 -412
  321. package/src/storage/private_event_data_provider/private_event_data_provider.ts +0 -162
  322. package/src/storage/tagging_data_provider/index.ts +0 -2
  323. package/src/storage/tagging_data_provider/recipient_tagging_data_provider.ts +0 -86
  324. package/src/tagging/recipient_sync/new_recipient_tagging_data_provider.ts +0 -53
  325. package/src/tagging/utils.ts +0 -32
  326. package/src/tree_membership/tree_membership_service.ts +0 -112
  327. /package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.js +0 -0
  328. /package/src/storage/{contract_data_provider → contract_store}/private_functions_tree.ts +0 -0
@@ -3,14 +3,17 @@ import type { AztecAsyncKVStore, AztecAsyncMap } from '@aztec/kv-store';
3
3
  import type { DirectionalAppTaggingSecret, PreTag } from '@aztec/stdlib/logs';
4
4
  import { TxHash } from '@aztec/stdlib/tx';
5
5
 
6
- import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../../tagging/sync/sync_sender_tagging_indexes.js';
6
+ import type { StagedStore } from '../../job_coordinator/job_coordinator.js';
7
+ import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../../tagging/constants.js';
7
8
 
8
9
  /**
9
10
  * Data provider of tagging data used when syncing the sender tagging indexes. The recipient counterpart of this class
10
- * is called RecipientTaggingDataProvider. We have the providers separate for the sender and recipient because
11
+ * is called RecipientTaggingStore. We have the data stores separate for sender and recipient because
11
12
  * the algorithms are completely disjoint and there is not data reuse between the two.
12
13
  */
13
- export class SenderTaggingDataProvider {
14
+ export class SenderTaggingStore implements StagedStore {
15
+ readonly storeName = 'sender_tagging';
16
+
14
17
  #store: AztecAsyncKVStore;
15
18
 
16
19
  // Stores the pending indexes for each directional app tagging secret. Pending here means that the tx that contained
@@ -21,18 +24,114 @@ export class SenderTaggingDataProvider {
21
24
  // the smaller ones are irrelevant due to tx atomicity.
22
25
  //
23
26
  // TODO(#17615): This assumes no logs are used in the non-revertible phase.
27
+ //
28
+ // directional app tagging secret => { pending index, txHash }[]
24
29
  #pendingIndexes: AztecAsyncMap<string, { index: number; txHash: string }[]>;
25
30
 
31
+ // jobId => directional app tagging secret => { pending index, txHash }[]
32
+ #pendingIndexesForJob: Map<string, Map<string, { index: number; txHash: string }[]>>;
33
+
26
34
  // Stores the last (highest) finalized index for each directional app tagging secret. We care only about the last
27
35
  // index because unlike the pending indexes, it will never happen that a finalized index would be removed and hence
28
36
  // we don't need to store the history.
37
+ //
38
+ // directional app tagging secret => highest finalized index
29
39
  #lastFinalizedIndexes: AztecAsyncMap<string, number>;
30
40
 
41
+ // jobId => directional app tagging secret => highest finalized index
42
+ #lastFinalizedIndexesForJob: Map<string, Map<string, number>>;
43
+
31
44
  constructor(store: AztecAsyncKVStore) {
32
45
  this.#store = store;
33
46
 
34
47
  this.#pendingIndexes = this.#store.openMap('pending_indexes');
35
48
  this.#lastFinalizedIndexes = this.#store.openMap('last_finalized_indexes');
49
+
50
+ this.#pendingIndexesForJob = new Map();
51
+ this.#lastFinalizedIndexesForJob = new Map();
52
+ }
53
+
54
+ #getPendingIndexesForJob(jobId: string): Map<string, { index: number; txHash: string }[]> {
55
+ let pendingIndexesForJob = this.#pendingIndexesForJob.get(jobId);
56
+ if (!pendingIndexesForJob) {
57
+ pendingIndexesForJob = new Map();
58
+ this.#pendingIndexesForJob.set(jobId, pendingIndexesForJob);
59
+ }
60
+ return pendingIndexesForJob;
61
+ }
62
+
63
+ #getLastFinalizedIndexesForJob(jobId: string): Map<string, number> {
64
+ let jobStagedLastFinalizedIndexes = this.#lastFinalizedIndexesForJob.get(jobId);
65
+ if (!jobStagedLastFinalizedIndexes) {
66
+ jobStagedLastFinalizedIndexes = new Map();
67
+ this.#lastFinalizedIndexesForJob.set(jobId, jobStagedLastFinalizedIndexes);
68
+ }
69
+ return jobStagedLastFinalizedIndexes;
70
+ }
71
+
72
+ async #readPendingIndexes(jobId: string, secret: string): Promise<{ index: number; txHash: string }[]> {
73
+ const jobStagedPendingIndexes = this.#getPendingIndexesForJob(jobId);
74
+ const pendingIndexes = jobStagedPendingIndexes.get(secret);
75
+ // We return the staged version of this if it exists, if not, we read from the DB.
76
+ // If the DB also has nothing, we return an empty array [].
77
+ return pendingIndexes !== undefined ? pendingIndexes : ((await this.#pendingIndexes.getAsync(secret)) ?? []);
78
+ }
79
+
80
+ #writePendingIndexes(jobId: string, secret: string, pendingIndexes: { index: number; txHash: string }[]) {
81
+ this.#getPendingIndexesForJob(jobId).set(secret, pendingIndexes);
82
+ }
83
+
84
+ /**
85
+ * Returns a job view of all the secrets that have a corresponding list of pending indexes either in persistent
86
+ * storage or the current job.
87
+ */
88
+ async #readSecretsWithPendingIndexes(jobId: string): Promise<string[]> {
89
+ const storedSecrets = new Set(await toArray(this.#pendingIndexes.keysAsync()));
90
+ const stagedSecrets = this.#getPendingIndexesForJob(jobId).keys();
91
+ return [...storedSecrets.union(new Set(stagedSecrets))];
92
+ }
93
+
94
+ async #readLastFinalizedIndex(jobId: string, secret: string): Promise<number | undefined> {
95
+ return (
96
+ this.#getLastFinalizedIndexesForJob(jobId).get(secret) ?? (await this.#lastFinalizedIndexes.getAsync(secret))
97
+ );
98
+ }
99
+
100
+ #writeLastFinalizedIndex(jobId: string, secret: string, lastFinalizedIndex: number) {
101
+ this.#getLastFinalizedIndexesForJob(jobId).set(secret, lastFinalizedIndex);
102
+ }
103
+
104
+ /**
105
+ * Writes all job-specific in-memory data to persistent storage.
106
+ *
107
+ * @remark This method must run in a DB transaction context. It's designed to be called from JobCoordinator#commitJob.
108
+ */
109
+ async commit(jobId: string): Promise<void> {
110
+ const pendingIndexesForJob = this.#pendingIndexesForJob.get(jobId);
111
+ if (pendingIndexesForJob) {
112
+ for (const [secret, pendingIndexes] of pendingIndexesForJob.entries()) {
113
+ if (pendingIndexes.length === 0) {
114
+ await this.#pendingIndexes.delete(secret);
115
+ } else {
116
+ await this.#pendingIndexes.set(secret, pendingIndexes);
117
+ }
118
+ }
119
+ }
120
+
121
+ const lastFinalizedIndexesForJob = this.#lastFinalizedIndexesForJob.get(jobId);
122
+ if (lastFinalizedIndexesForJob) {
123
+ for (const [secret, lastFinalizedIndex] of lastFinalizedIndexesForJob.entries()) {
124
+ await this.#lastFinalizedIndexes.set(secret, lastFinalizedIndex);
125
+ }
126
+ }
127
+
128
+ return this.discardStaged(jobId);
129
+ }
130
+
131
+ discardStaged(jobId: string): Promise<void> {
132
+ this.#pendingIndexesForJob.delete(jobId);
133
+ this.#lastFinalizedIndexesForJob.delete(jobId);
134
+ return Promise.resolve();
36
135
  }
37
136
 
38
137
  /**
@@ -43,6 +142,7 @@ export class SenderTaggingDataProvider {
43
142
  * @param preTags - The pre-tags containing the directional app tagging secrets and the indexes that are to be
44
143
  * stored in the db.
45
144
  * @param txHash - The tx in which the pretags were used in private logs.
145
+ * @param jobId - job context for staged writes to this store. See `JobCoordinator` for more details.
46
146
  * @throws If any two pre-tags contain the same directional app tagging secret. This is enforced because we care
47
147
  * only about the highest index for a given secret that was used in the tx. Hence this check is a good way to catch
48
148
  * bugs.
@@ -56,7 +156,7 @@ export class SenderTaggingDataProvider {
56
156
  * This is enforced because this should never happen if the syncing is done correctly as we look for logs from higher
57
157
  * indexes than finalized ones.
58
158
  */
59
- async storePendingIndexes(preTags: PreTag[], txHash: TxHash) {
159
+ async storePendingIndexes(preTags: PreTag[], txHash: TxHash, jobId: string) {
60
160
  // The secrets in pre-tags should be unique because we always store just the highest index per given secret-txHash
61
161
  // pair. Below we check that this is the case.
62
162
  const secretsSet = new Set(preTags.map(preTag => preTag.secret.toString()));
@@ -67,7 +167,7 @@ export class SenderTaggingDataProvider {
67
167
  for (const { secret, index } of preTags) {
68
168
  // First we check that for any secret the highest used index in tx is not further than window length from
69
169
  // the highest finalized index.
70
- const finalizedIndex = (await this.getLastFinalizedIndex(secret)) ?? 0;
170
+ const finalizedIndex = (await this.getLastFinalizedIndex(secret, jobId)) ?? 0;
71
171
  if (index > finalizedIndex + UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN) {
72
172
  throw new Error(
73
173
  `Highest used index ${index} is further than window length from the highest finalized index ${finalizedIndex}.
@@ -78,7 +178,7 @@ export class SenderTaggingDataProvider {
78
178
 
79
179
  // Throw if the new pending index is lower than or equal to the last finalized index
80
180
  const secretStr = secret.toString();
81
- const lastFinalizedIndex = await this.#lastFinalizedIndexes.getAsync(secretStr);
181
+ const lastFinalizedIndex = await this.#readLastFinalizedIndex(jobId, secretStr);
82
182
  if (lastFinalizedIndex !== undefined && index <= lastFinalizedIndex) {
83
183
  throw new Error(
84
184
  `Cannot store pending index ${index} for secret ${secretStr}: ` +
@@ -88,7 +188,7 @@ export class SenderTaggingDataProvider {
88
188
 
89
189
  // Check if this secret + txHash combination already exists
90
190
  const txHashStr = txHash.toString();
91
- const existingForSecret = (await this.#pendingIndexes.getAsync(secretStr)) ?? [];
191
+ const existingForSecret = await this.#readPendingIndexes(jobId, secretStr);
92
192
  const existingForSecretAndTx = existingForSecret.find(entry => entry.txHash === txHashStr);
93
193
 
94
194
  if (existingForSecretAndTx) {
@@ -102,7 +202,7 @@ export class SenderTaggingDataProvider {
102
202
  // If it exists with the same index, ignore the update (no-op)
103
203
  } else {
104
204
  // If it doesn't exist, add it
105
- await this.#pendingIndexes.set(secretStr, [...existingForSecret, { index, txHash: txHashStr }]);
205
+ this.#writePendingIndexes(jobId, secretStr, [...existingForSecret, { index, txHash: txHashStr }]);
106
206
  }
107
207
  }
108
208
  }
@@ -120,8 +220,9 @@ export class SenderTaggingDataProvider {
120
220
  secret: DirectionalAppTaggingSecret,
121
221
  startIndex: number,
122
222
  endIndex: number,
223
+ jobId: string,
123
224
  ): Promise<TxHash[]> {
124
- const existing = (await this.#pendingIndexes.getAsync(secret.toString())) ?? [];
225
+ const existing = await this.#readPendingIndexes(jobId, secret.toString());
125
226
  const txHashes = existing
126
227
  .filter(entry => entry.index >= startIndex && entry.index < endIndex)
127
228
  .map(entry => entry.txHash);
@@ -133,8 +234,8 @@ export class SenderTaggingDataProvider {
133
234
  * @param secret - The secret to get the last finalized index for.
134
235
  * @returns The last (highest) finalized index for the given secret.
135
236
  */
136
- getLastFinalizedIndex(secret: DirectionalAppTaggingSecret): Promise<number | undefined> {
137
- return this.#lastFinalizedIndexes.getAsync(secret.toString());
237
+ getLastFinalizedIndex(secret: DirectionalAppTaggingSecret, jobId: string): Promise<number | undefined> {
238
+ return this.#readLastFinalizedIndex(jobId, secret.toString());
138
239
  }
139
240
 
140
241
  /**
@@ -143,13 +244,13 @@ export class SenderTaggingDataProvider {
143
244
  * @param secret - The directional app tagging secret to query the last used index for.
144
245
  * @returns The last used index.
145
246
  */
146
- async getLastUsedIndex(secret: DirectionalAppTaggingSecret): Promise<number | undefined> {
247
+ async getLastUsedIndex(secret: DirectionalAppTaggingSecret, jobId: string): Promise<number | undefined> {
147
248
  const secretStr = secret.toString();
148
- const pendingTxScopedIndexes = (await this.#pendingIndexes.getAsync(secretStr)) ?? [];
249
+ const pendingTxScopedIndexes = await this.#readPendingIndexes(jobId, secretStr);
149
250
  const pendingIndexes = pendingTxScopedIndexes.map(entry => entry.index);
150
251
 
151
252
  if (pendingTxScopedIndexes.length === 0) {
152
- return this.#lastFinalizedIndexes.getAsync(secretStr);
253
+ return this.#readLastFinalizedIndex(jobId, secretStr);
153
254
  }
154
255
 
155
256
  // As the last used index we return the highest one from the pending indexes. Note that this value will be always
@@ -160,23 +261,23 @@ export class SenderTaggingDataProvider {
160
261
  /**
161
262
  * Drops all pending indexes corresponding to the given transaction hashes.
162
263
  */
163
- async dropPendingIndexes(txHashes: TxHash[]) {
264
+ async dropPendingIndexes(txHashes: TxHash[], jobId: string) {
164
265
  if (txHashes.length === 0) {
165
266
  return;
166
267
  }
167
268
 
168
- const txHashStrs = new Set<string>(txHashes.map(txHash => txHash.toString()));
169
- const allSecrets = await toArray(this.#pendingIndexes.keysAsync());
269
+ const txHashStrings = new Set<string>(txHashes.map(txHash => txHash.toString()));
270
+ const allSecrets = await this.#readSecretsWithPendingIndexes(jobId);
170
271
 
171
272
  for (const secret of allSecrets) {
172
- const pendingData = await this.#pendingIndexes.getAsync(secret);
273
+ const pendingData = await this.#readPendingIndexes(jobId, secret);
173
274
  if (pendingData) {
174
- const filtered = pendingData.filter(item => !txHashStrs.has(item.txHash));
275
+ const filtered = pendingData.filter(item => !txHashStrings.has(item.txHash));
175
276
  if (filtered.length === 0) {
176
- await this.#pendingIndexes.delete(secret);
277
+ this.#writePendingIndexes(jobId, secret, []);
177
278
  } else if (filtered.length !== pendingData.length) {
178
279
  // Some items were filtered out, so update the pending data
179
- await this.#pendingIndexes.set(secret, filtered);
280
+ this.#writePendingIndexes(jobId, secret, filtered);
180
281
  }
181
282
  // else: No items were filtered out (txHashes not found for this secret) --> no-op
182
283
  }
@@ -187,7 +288,7 @@ export class SenderTaggingDataProvider {
187
288
  * Updates pending indexes corresponding to the given transaction hashes to be finalized and prunes any lower pending
188
289
  * indexes.
189
290
  */
190
- async finalizePendingIndexes(txHashes: TxHash[]) {
291
+ async finalizePendingIndexes(txHashes: TxHash[], jobId: string) {
191
292
  if (txHashes.length === 0) {
192
293
  return;
193
294
  }
@@ -195,10 +296,10 @@ export class SenderTaggingDataProvider {
195
296
  for (const txHash of txHashes) {
196
297
  const txHashStr = txHash.toString();
197
298
 
198
- const allSecrets = await toArray(this.#pendingIndexes.keysAsync());
299
+ const allSecrets = await this.#readSecretsWithPendingIndexes(jobId);
199
300
 
200
301
  for (const secret of allSecrets) {
201
- const pendingData = await this.#pendingIndexes.getAsync(secret);
302
+ const pendingData = await this.#readPendingIndexes(jobId, secret);
202
303
  if (!pendingData) {
203
304
  continue;
204
305
  }
@@ -214,7 +315,7 @@ export class SenderTaggingDataProvider {
214
315
  throw new Error(`Multiple pending indexes found for tx hash ${txHashStr} and secret ${secret}`);
215
316
  }
216
317
 
217
- let lastFinalized = await this.#lastFinalizedIndexes.getAsync(secret);
318
+ let lastFinalized = await this.#readLastFinalizedIndex(jobId, secret);
218
319
  const newFinalized = matchingIndexes[0];
219
320
 
220
321
  if (newFinalized < (lastFinalized ?? 0)) {
@@ -225,7 +326,7 @@ export class SenderTaggingDataProvider {
225
326
  );
226
327
  }
227
328
 
228
- await this.#lastFinalizedIndexes.set(secret, newFinalized);
329
+ this.#writeLastFinalizedIndex(jobId, secret, newFinalized);
229
330
  lastFinalized = newFinalized;
230
331
 
231
332
  // When we add pending indexes, we ensure they are higher than the last finalized index. However, because we
@@ -234,9 +335,9 @@ export class SenderTaggingDataProvider {
234
335
  // outdated pending indexes.
235
336
  const remainingItemsOfHigherIndex = pendingData.filter(item => item.index > (lastFinalized ?? 0));
236
337
  if (remainingItemsOfHigherIndex.length === 0) {
237
- await this.#pendingIndexes.delete(secret);
338
+ this.#writePendingIndexes(jobId, secret, []);
238
339
  } else {
239
- await this.#pendingIndexes.set(secret, remainingItemsOfHigherIndex);
340
+ this.#writePendingIndexes(jobId, secret, remainingItemsOfHigherIndex);
240
341
  }
241
342
  }
242
343
  }
@@ -1,3 +1,10 @@
1
- // Half the size of the window we slide over the tagging indexes.
2
- // TODO(#17775): Move this to the recipient log sync function once it's implemented in this directory.
3
- export const WINDOW_HALF_SIZE = 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,68 @@
1
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
2
+ import type { L2BlockHash } from '@aztec/stdlib/block';
3
+ import { MAX_LOGS_PER_TAG } from '@aztec/stdlib/interfaces/api-limit';
4
+ import type { AztecNode } from '@aztec/stdlib/interfaces/client';
5
+ import type { SiloedTag, Tag, TxScopedL2Log } from '@aztec/stdlib/logs';
6
+
7
+ /**
8
+ * Generic pagination helper that fetches all pages of results.
9
+ * @param numTags - The number of tags being queried (determines result array size).
10
+ * @param fetchPage - Function that fetches a single page of results given a page number.
11
+ * @returns An array of arrays, one per tag, containing all results across all pages.
12
+ */
13
+ async function getAllPages<T>(numTags: number, fetchPage: (page: number) => Promise<T[][]>): Promise<T[][]> {
14
+ const allResultsPerTag: T[][] = Array.from({ length: numTags }, () => []);
15
+ let page = 0;
16
+ let hasMore = true;
17
+
18
+ while (hasMore) {
19
+ const resultsPage = await fetchPage(page);
20
+ hasMore = false;
21
+
22
+ for (let i = 0; i < resultsPage.length; i++) {
23
+ allResultsPerTag[i].push(...resultsPage[i]);
24
+ if (resultsPage[i].length === MAX_LOGS_PER_TAG) {
25
+ hasMore = true;
26
+ }
27
+ }
28
+ page++;
29
+ }
30
+
31
+ return allResultsPerTag;
32
+ }
33
+
34
+ /**
35
+ * Fetches all private logs for the given tags, automatically paginating through all pages.
36
+ * @param aztecNode - The Aztec node to query.
37
+ * @param tags - The siloed tags to search for.
38
+ * @param anchorBlockHash - reference block for the Aztec node query, throws if block is not found there (typically
39
+ * because of reorgs).
40
+ * @returns An array of log arrays, one per tag, containing all logs across all pages.
41
+ */
42
+ export function getAllPrivateLogsByTags(
43
+ aztecNode: AztecNode,
44
+ tags: SiloedTag[],
45
+ anchorBlockHash: L2BlockHash,
46
+ ): Promise<TxScopedL2Log[][]> {
47
+ return getAllPages(tags.length, page => aztecNode.getPrivateLogsByTags(tags, page, anchorBlockHash));
48
+ }
49
+
50
+ /**
51
+ * Fetches all public logs for the given tags from a contract, automatically paginating through all pages.
52
+ * @param aztecNode - The Aztec node to query.
53
+ * @param contractAddress - The contract address to search logs for.
54
+ * @param tags - The tags to search for.
55
+ * @param anchorBlockHash - reference block for the Aztec node query, throws if block is not found there (typically
56
+ * because of reorgs).
57
+ * @returns An array of log arrays, one per tag, containing all logs across all pages.
58
+ */
59
+ export function getAllPublicLogsByTagsFromContract(
60
+ aztecNode: AztecNode,
61
+ contractAddress: AztecAddress,
62
+ tags: Tag[],
63
+ anchorBlockHash: L2BlockHash,
64
+ ): Promise<TxScopedL2Log[][]> {
65
+ return getAllPages(tags.length, page =>
66
+ aztecNode.getPublicLogsByTagsFromContract(contractAddress, tags, page, anchorBlockHash),
67
+ );
68
+ }
@@ -1,4 +1,19 @@
1
- export * from './constants.js';
2
- export * from './utils.js';
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 load and process the corresponding logs.
8
+ *
9
+ * @module tagging
10
+ */
11
+
12
+ export { loadPrivateLogsForSenderRecipientPair } from './recipient_sync/load_private_logs_for_sender_recipient_pair.js';
13
+ export { syncSenderTaggingIndexes } from './sender_sync/sync_sender_tagging_indexes.js';
14
+ export { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from './constants.js';
15
+ export { getAllPrivateLogsByTags, getAllPublicLogsByTagsFromContract } from './get_all_logs_by_tags.js';
16
+
17
+ // Re-export tagging-related types from stdlib
3
18
  export { DirectionalAppTaggingSecret, Tag, SiloedTag } from '@aztec/stdlib/logs';
4
19
  export { type PreTag } from '@aztec/stdlib/logs';
@@ -1,10 +1,11 @@
1
1
  import type { BlockNumber } from '@aztec/foundation/branded-types';
2
2
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
3
+ import type { L2BlockHash } from '@aztec/stdlib/block';
3
4
  import type { AztecNode } from '@aztec/stdlib/interfaces/client';
4
5
  import type { DirectionalAppTaggingSecret, TxScopedL2Log } from '@aztec/stdlib/logs';
5
6
 
6
- import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../sync/sync_sender_tagging_indexes.js';
7
- import type { NewRecipientTaggingDataProvider } from './new_recipient_tagging_data_provider.js';
7
+ import type { RecipientTaggingStore } from '../../storage/tagging_store/recipient_tagging_store.js';
8
+ import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../constants.js';
8
9
  import { findHighestIndexes } from './utils/find_highest_indexes.js';
9
10
  import { loadLogsForRange } from './utils/load_logs_for_range.js';
10
11
 
@@ -19,8 +20,10 @@ export async function loadPrivateLogsForSenderRecipientPair(
19
20
  secret: DirectionalAppTaggingSecret,
20
21
  app: AztecAddress,
21
22
  aztecNode: AztecNode,
22
- taggingDataProvider: NewRecipientTaggingDataProvider,
23
+ taggingStore: RecipientTaggingStore,
23
24
  anchorBlockNumber: BlockNumber,
25
+ anchorBlockHash: L2BlockHash,
26
+ jobId: string,
24
27
  ): Promise<TxScopedL2Log[]> {
25
28
  // # Explanation of how the algorithm works
26
29
  // When we perform the sync we will look at logs that correspond to the tagging index range
@@ -68,13 +71,16 @@ export async function loadPrivateLogsForSenderRecipientPair(
68
71
  throw new Error('Node failed to return latest block header when syncing logs');
69
72
  }
70
73
 
71
- [finalizedBlockNumber, currentTimestamp] = [l2Tips.finalized.number, latestBlockHeader.globalVariables.timestamp];
74
+ [finalizedBlockNumber, currentTimestamp] = [
75
+ l2Tips.finalized.block.number,
76
+ latestBlockHeader.globalVariables.timestamp,
77
+ ];
72
78
  }
73
79
 
74
80
  let start: number, end: number;
75
81
  {
76
- const currentHighestAgedIndex = await taggingDataProvider.getHighestAgedIndex(secret);
77
- const currentHighestFinalizedIndex = await taggingDataProvider.getHighestFinalizedIndex(secret);
82
+ const currentHighestAgedIndex = await taggingStore.getHighestAgedIndex(secret, jobId);
83
+ const currentHighestFinalizedIndex = await taggingStore.getHighestFinalizedIndex(secret, jobId);
78
84
 
79
85
  // We don't want to include the highest aged index so we start from `currentHighestAgedIndex + 1` (or 0 if not set)
80
86
  start = currentHighestAgedIndex === undefined ? 0 : currentHighestAgedIndex + 1;
@@ -88,7 +94,15 @@ export async function loadPrivateLogsForSenderRecipientPair(
88
94
 
89
95
  while (true) {
90
96
  // Get private logs with their block timestamps and corresponding tagging indexes
91
- const privateLogsWithIndexes = await loadLogsForRange(secret, app, aztecNode, start, end, anchorBlockNumber);
97
+ const privateLogsWithIndexes = await loadLogsForRange(
98
+ secret,
99
+ app,
100
+ aztecNode,
101
+ start,
102
+ end,
103
+ anchorBlockNumber,
104
+ anchorBlockHash,
105
+ );
92
106
 
93
107
  if (privateLogsWithIndexes.length === 0) {
94
108
  break;
@@ -104,7 +118,7 @@ export async function loadPrivateLogsForSenderRecipientPair(
104
118
 
105
119
  // Store updates in data provider and update local variables
106
120
  if (highestAgedIndex !== undefined) {
107
- await taggingDataProvider.updateHighestAgedIndex(secret, highestAgedIndex);
121
+ await taggingStore.updateHighestAgedIndex(secret, highestAgedIndex, jobId);
108
122
  }
109
123
 
110
124
  if (highestFinalizedIndex === undefined) {
@@ -117,7 +131,7 @@ export async function loadPrivateLogsForSenderRecipientPair(
117
131
  throw new Error('Highest aged index lower than highest finalized index invariant violated');
118
132
  }
119
133
 
120
- await taggingDataProvider.updateHighestFinalizedIndex(secret, highestFinalizedIndex);
134
+ await taggingStore.updateHighestFinalizedIndex(secret, highestFinalizedIndex, jobId);
121
135
 
122
136
  // For the next iteration we want to look only at indexes for which we have not attempted to load logs yet while
123
137
  // ensuring that we do not look further than WINDOW_LEN ahead of the highest finalized index.
@@ -1,9 +1,12 @@
1
1
  import type { BlockNumber } from '@aztec/foundation/branded-types';
2
2
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
3
+ import type { L2BlockHash } from '@aztec/stdlib/block';
3
4
  import type { AztecNode } from '@aztec/stdlib/interfaces/client';
4
5
  import type { DirectionalAppTaggingSecret, PreTag, TxScopedL2Log } from '@aztec/stdlib/logs';
5
6
  import { SiloedTag, Tag } from '@aztec/stdlib/logs';
6
7
 
8
+ import { getAllPrivateLogsByTags } from '../../get_all_logs_by_tags.js';
9
+
7
10
  /**
8
11
  * Gets private logs with their corresponding block timestamps and tagging indexes for the given index range, `app` and
9
12
  * `secret`. At most load logs from blocks up to and including `anchorBlockNumber`. `start` is inclusive and `end` is
@@ -16,6 +19,7 @@ export async function loadLogsForRange(
16
19
  start: number,
17
20
  end: number,
18
21
  anchorBlockNumber: BlockNumber,
22
+ anchorBlockHash: L2BlockHash,
19
23
  ): Promise<Array<{ log: TxScopedL2Log; taggingIndex: number }>> {
20
24
  // Derive tags for the window
21
25
  const preTags: PreTag[] = Array(end - start)
@@ -25,7 +29,9 @@ export async function loadLogsForRange(
25
29
  Promise.all(tags.map(tag => SiloedTag.compute(tag, app))),
26
30
  );
27
31
 
28
- const logs = await aztecNode.getPrivateLogsByTags(siloedTags);
32
+ // We use the utility function below to retrieve all logs for the tags across all pages, so we don't need to handle
33
+ // pagination here.
34
+ const logs = await getAllPrivateLogsByTags(aztecNode, siloedTags, anchorBlockHash);
29
35
 
30
36
  // Pair logs with their corresponding tagging indexes
31
37
  const logsWithIndexes: Array<{ log: TxScopedL2Log; taggingIndex: number }> = [];
@@ -1,28 +1,13 @@
1
1
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
2
+ import type { L2BlockHash } from '@aztec/stdlib/block';
2
3
  import type { AztecNode } from '@aztec/stdlib/interfaces/server';
3
4
  import type { DirectionalAppTaggingSecret } from '@aztec/stdlib/logs';
4
5
 
5
- import type { SenderTaggingDataProvider } from '../../storage/tagging_data_provider/sender_tagging_data_provider.js';
6
+ import type { SenderTaggingStore } from '../../storage/tagging_store/sender_tagging_store.js';
7
+ import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../constants.js';
6
8
  import { getStatusChangeOfPending } from './utils/get_status_change_of_pending.js';
7
9
  import { loadAndStoreNewTaggingIndexes } from './utils/load_and_store_new_tagging_indexes.js';
8
10
 
9
- // This window has to be as large as the largest expected number of logs emitted in a tx for a given directional app
10
- // tagging secret. If we get more tag indexes consumed than this window, an error is thrown in `PXE::proveTx` function.
11
- // This is set to a larger value than MAX_PRIVATE_LOGS_PER_TX (currently 64) because there could be more than
12
- // MAX_PRIVATE_LOGS_PER_TX indexes consumed in case the logs are squashed. This happens when the log contains a note
13
- // and the note is nullified in the same tx.
14
- //
15
- // Rationale for value 95:
16
- // - The `e2e_pending_note_hashes_contract` test's "Should handle overflowing the kernel data structures in nested
17
- // calls" test case hits 95 tagging indexes emitted in a single transaction. This test creates and nullifies many
18
- // notes recursively to test kernel reset circuit behavior, which causes logs to be squashed but still consume
19
- // tagging indexes during the sync process. Since this is testing MAX_PRIVATE_LOGS_PER_TX overflow we can be
20
- // reasonably certain that this value is large enough for standard use cases.
21
- // - This value is below MAX_RPC_LEN (100) which is the limit for array parameters in the JSON RPC schema for
22
- // `getLogsByTags`. Any test that would perform sync over JSON RPC (not by having access to the Aztec node instance
23
- // directly) would error out if that maximum was hit (docs_examples.test.ts is an example of this).
24
- export const UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN = 95;
25
-
26
11
  /**
27
12
  * Syncs tagging indexes. This function needs to be called whenever a private log is being sent.
28
13
  *
@@ -41,7 +26,9 @@ export async function syncSenderTaggingIndexes(
41
26
  secret: DirectionalAppTaggingSecret,
42
27
  app: AztecAddress,
43
28
  aztecNode: AztecNode,
44
- taggingDataProvider: SenderTaggingDataProvider,
29
+ taggingStore: SenderTaggingStore,
30
+ anchorBlockHash: L2BlockHash,
31
+ jobId: string,
45
32
  ): Promise<void> {
46
33
  // # Explanation of how syncing works
47
34
  //
@@ -61,7 +48,7 @@ export async function syncSenderTaggingIndexes(
61
48
  // Each window advance requires two queries (logs + tx status). For example, syncing indexes 0–500 with a window of
62
49
  // 100 takes at least 10 round trips (5 windows × 2 queries).
63
50
 
64
- const finalizedIndex = await taggingDataProvider.getLastFinalizedIndex(secret);
51
+ const finalizedIndex = await taggingStore.getLastFinalizedIndex(secret, jobId);
65
52
 
66
53
  let start = finalizedIndex === undefined ? 0 : finalizedIndex + 1;
67
54
  let end = start + UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN;
@@ -72,21 +59,21 @@ export async function syncSenderTaggingIndexes(
72
59
  while (true) {
73
60
  // Load and store indexes for the current window. These indexes may already exist in the database if txs using
74
61
  // them were previously sent from this PXE. Any duplicates are handled by the tagging data provider.
75
- await loadAndStoreNewTaggingIndexes(secret, app, start, end, aztecNode, taggingDataProvider);
62
+ await loadAndStoreNewTaggingIndexes(secret, app, start, end, aztecNode, taggingStore, anchorBlockHash, jobId);
76
63
 
77
64
  // Retrieve all indexes within the current window from storage and update their status accordingly.
78
- const pendingTxHashes = await taggingDataProvider.getTxHashesOfPendingIndexes(secret, start, end);
65
+ const pendingTxHashes = await taggingStore.getTxHashesOfPendingIndexes(secret, start, end, jobId);
79
66
  if (pendingTxHashes.length === 0) {
80
67
  break;
81
68
  }
82
69
 
83
70
  const { txHashesToFinalize, txHashesToDrop } = await getStatusChangeOfPending(pendingTxHashes, aztecNode);
84
71
 
85
- await taggingDataProvider.dropPendingIndexes(txHashesToDrop);
86
- await taggingDataProvider.finalizePendingIndexes(txHashesToFinalize);
72
+ await taggingStore.dropPendingIndexes(txHashesToDrop, jobId);
73
+ await taggingStore.finalizePendingIndexes(txHashesToFinalize, jobId);
87
74
 
88
75
  // We check if the finalized index has been updated.
89
- newFinalizedIndex = await taggingDataProvider.getLastFinalizedIndex(secret);
76
+ newFinalizedIndex = await taggingStore.getLastFinalizedIndex(secret, jobId);
90
77
  if (previousFinalizedIndex !== newFinalizedIndex) {
91
78
  // A new finalized index was found, so we'll run the loop again. For example:
92
79
  // - Previous finalized index: 10
@@ -9,11 +9,8 @@ export async function getStatusChangeOfPending(
9
9
  pending: TxHash[],
10
10
  aztecNode: AztecNode,
11
11
  ): Promise<{ txHashesToFinalize: TxHash[]; txHashesToDrop: TxHash[] }> {
12
- // Get receipts for all pending tx hashes and the finalized block number.
13
- const [receipts, { finalized }] = await Promise.all([
14
- Promise.all(pending.map(pendingTxHash => aztecNode.getTxReceipt(pendingTxHash))),
15
- aztecNode.getL2Tips(),
16
- ]);
12
+ // Get receipts for all pending tx hashes.
13
+ const receipts = await Promise.all(pending.map(pendingTxHash => aztecNode.getTxReceipt(pendingTxHash)));
17
14
 
18
15
  const txHashesToFinalize: TxHash[] = [];
19
16
  const txHashesToDrop: TxHash[] = [];
@@ -22,21 +19,16 @@ export async function getStatusChangeOfPending(
22
19
  const receipt = receipts[i];
23
20
  const txHash = pending[i];
24
21
 
25
- if (receipt.status === TxStatus.SUCCESS && receipt.blockNumber && receipt.blockNumber <= finalized.number) {
22
+ if (receipt.status === TxStatus.FINALIZED && receipt.hasExecutionSucceeded()) {
26
23
  // Tx has been included in a block and the corresponding block is finalized --> we mark the indexes as
27
24
  // finalized.
28
25
  txHashesToFinalize.push(txHash);
29
- } else if (
30
- receipt.status === TxStatus.DROPPED ||
31
- receipt.status === TxStatus.APP_LOGIC_REVERTED ||
32
- receipt.status === TxStatus.TEARDOWN_REVERTED ||
33
- receipt.status === TxStatus.BOTH_REVERTED
34
- ) {
26
+ } else if (receipt.isDropped() || receipt.hasExecutionReverted()) {
35
27
  // Tx was dropped or reverted --> we drop the corresponding pending indexes.
36
28
  // TODO(#17615): Don't drop pending indexes corresponding to non-revertible phases.
37
29
  txHashesToDrop.push(txHash);
38
30
  } else {
39
- // Tx is still pending or the corresponding block is not yet finalized --> we don't do anything.
31
+ // Tx is still pending, not yet finalized, or was mined successfully but not yet finalized --> we don't do anything.
40
32
  }
41
33
  }
42
34