@aztec/pxe 0.0.1-commit.2448fdb → 0.0.1-commit.2606882

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 (279) hide show
  1. package/dest/bin/check_oracle_version.js +40 -96
  2. package/dest/bin/index.d.ts +2 -0
  3. package/dest/bin/index.d.ts.map +1 -0
  4. package/dest/bin/index.js +1 -0
  5. package/dest/bin/oracle_version_helpers.d.ts +26 -0
  6. package/dest/bin/oracle_version_helpers.d.ts.map +1 -0
  7. package/dest/bin/oracle_version_helpers.js +93 -0
  8. package/dest/block_synchronizer/block_stream_source.d.ts +10 -0
  9. package/dest/block_synchronizer/block_stream_source.d.ts.map +1 -0
  10. package/dest/block_synchronizer/block_stream_source.js +62 -0
  11. package/dest/block_synchronizer/block_synchronizer.d.ts +5 -3
  12. package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
  13. package/dest/block_synchronizer/block_synchronizer.js +21 -11
  14. package/dest/config/index.d.ts +8 -2
  15. package/dest/config/index.d.ts.map +1 -1
  16. package/dest/config/index.js +13 -15
  17. package/dest/config/package_info.js +1 -1
  18. package/dest/contract_function_simulator/contract_function_simulator.d.ts +4 -1
  19. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  20. package/dest/contract_function_simulator/contract_function_simulator.js +20 -12
  21. package/dest/contract_function_simulator/execution_note_cache.d.ts +2 -2
  22. package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
  23. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +5 -9
  24. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -1
  25. package/dest/contract_function_simulator/execution_tagging_index_cache.js +3 -7
  26. package/dest/contract_function_simulator/index.d.ts +13 -2
  27. package/dest/contract_function_simulator/index.d.ts.map +1 -1
  28. package/dest/contract_function_simulator/index.js +10 -0
  29. package/dest/contract_function_simulator/noir-structs/bounded_vec.d.ts +48 -0
  30. package/dest/contract_function_simulator/noir-structs/bounded_vec.d.ts.map +1 -0
  31. package/dest/contract_function_simulator/noir-structs/bounded_vec.js +45 -0
  32. package/dest/contract_function_simulator/noir-structs/ephemeral_array.d.ts +37 -0
  33. package/dest/contract_function_simulator/noir-structs/ephemeral_array.d.ts.map +1 -0
  34. package/dest/contract_function_simulator/noir-structs/ephemeral_array.js +59 -0
  35. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +3 -2
  36. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
  37. package/dest/contract_function_simulator/noir-structs/event_validation_request.js +3 -2
  38. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +12 -2
  39. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts.map +1 -1
  40. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.js +34 -3
  41. package/dest/contract_function_simulator/noir-structs/note_data.d.ts +27 -0
  42. package/dest/contract_function_simulator/noir-structs/note_data.d.ts.map +1 -0
  43. package/dest/contract_function_simulator/noir-structs/note_data.js +3 -0
  44. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +3 -2
  45. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
  46. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +3 -2
  47. package/dest/contract_function_simulator/noir-structs/option.d.ts +61 -0
  48. package/dest/contract_function_simulator/noir-structs/option.d.ts.map +1 -0
  49. package/dest/contract_function_simulator/noir-structs/option.js +62 -0
  50. package/dest/contract_function_simulator/noir-structs/provided_secret.d.ts +11 -0
  51. package/dest/contract_function_simulator/noir-structs/provided_secret.d.ts.map +1 -0
  52. package/dest/contract_function_simulator/noir-structs/provided_secret.js +24 -0
  53. package/dest/contract_function_simulator/oracle/interfaces.d.ts +16 -114
  54. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
  55. package/dest/contract_function_simulator/oracle/interfaces.js +2 -2
  56. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +2 -2
  57. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
  58. package/dest/contract_function_simulator/oracle/note_packing_utils.js +2 -2
  59. package/dest/contract_function_simulator/oracle/oracle.d.ts +55 -57
  60. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
  61. package/dest/contract_function_simulator/oracle/oracle.js +343 -344
  62. package/dest/contract_function_simulator/oracle/oracle_registry.d.ts +127 -0
  63. package/dest/contract_function_simulator/oracle/oracle_registry.d.ts.map +1 -0
  64. package/dest/contract_function_simulator/oracle/oracle_registry.js +786 -0
  65. package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts +139 -0
  66. package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts.map +1 -0
  67. package/dest/contract_function_simulator/oracle/oracle_type_mappings.js +560 -0
  68. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +27 -29
  69. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  70. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +55 -47
  71. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +59 -39
  72. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  73. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +244 -149
  74. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +1 -1
  75. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -1
  76. package/dest/contract_function_simulator/proxied_contract_data_source.js +35 -67
  77. package/dest/contract_sync/contract_sync_service.d.ts +4 -6
  78. package/dest/contract_sync/contract_sync_service.d.ts.map +1 -1
  79. package/dest/contract_sync/contract_sync_service.js +43 -24
  80. package/dest/contract_sync/helpers.d.ts +2 -3
  81. package/dest/contract_sync/helpers.d.ts.map +1 -1
  82. package/dest/contract_sync/helpers.js +12 -19
  83. package/dest/debug/pxe_debug_utils.d.ts +1 -6
  84. package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
  85. package/dest/debug/pxe_debug_utils.js +0 -6
  86. package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
  87. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  88. package/dest/entrypoints/client/bundle/utils.js +11 -3
  89. package/dest/entrypoints/client/lazy/utils.d.ts +1 -1
  90. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  91. package/dest/entrypoints/client/lazy/utils.js +11 -3
  92. package/dest/entrypoints/pxe_creation_options.d.ts +7 -1
  93. package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
  94. package/dest/entrypoints/server/index.d.ts +2 -1
  95. package/dest/entrypoints/server/index.d.ts.map +1 -1
  96. package/dest/entrypoints/server/index.js +1 -0
  97. package/dest/entrypoints/server/utils.d.ts +3 -2
  98. package/dest/entrypoints/server/utils.d.ts.map +1 -1
  99. package/dest/entrypoints/server/utils.js +11 -3
  100. package/dest/events/event_service.d.ts +13 -5
  101. package/dest/events/event_service.d.ts.map +1 -1
  102. package/dest/events/event_service.js +30 -9
  103. package/dest/hooks/authorize_utility_call.d.ts +41 -0
  104. package/dest/hooks/authorize_utility_call.d.ts.map +1 -0
  105. package/dest/hooks/authorize_utility_call.js +4 -0
  106. package/dest/hooks/execution_hooks.d.ts +42 -0
  107. package/dest/hooks/execution_hooks.d.ts.map +1 -0
  108. package/dest/hooks/execution_hooks.js +9 -0
  109. package/dest/hooks/index.d.ts +4 -0
  110. package/dest/hooks/index.d.ts.map +1 -0
  111. package/dest/hooks/index.js +1 -0
  112. package/dest/logs/log_service.d.ts +6 -5
  113. package/dest/logs/log_service.d.ts.map +1 -1
  114. package/dest/logs/log_service.js +112 -48
  115. package/dest/messages/message_context_service.d.ts +1 -1
  116. package/dest/messages/message_context_service.d.ts.map +1 -1
  117. package/dest/messages/message_context_service.js +28 -9
  118. package/dest/notes/note_service.d.ts +25 -3
  119. package/dest/notes/note_service.d.ts.map +1 -1
  120. package/dest/notes/note_service.js +80 -65
  121. package/dest/oracle_version.d.ts +3 -3
  122. package/dest/oracle_version.js +4 -4
  123. package/dest/private_kernel/batch_planner.d.ts +47 -0
  124. package/dest/private_kernel/batch_planner.d.ts.map +1 -0
  125. package/dest/private_kernel/batch_planner.js +104 -0
  126. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.js +1 -1
  127. package/dest/private_kernel/hints/test_utils.d.ts +1 -1
  128. package/dest/private_kernel/hints/test_utils.d.ts.map +1 -1
  129. package/dest/private_kernel/hints/test_utils.js +2 -3
  130. package/dest/private_kernel/private_kernel_execution_prover.d.ts +6 -2
  131. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
  132. package/dest/private_kernel/private_kernel_execution_prover.js +148 -52
  133. package/dest/private_kernel/private_kernel_oracle.d.ts +6 -6
  134. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
  135. package/dest/private_kernel/private_kernel_oracle.js +12 -7
  136. package/dest/pxe.d.ts +54 -7
  137. package/dest/pxe.d.ts.map +1 -1
  138. package/dest/pxe.js +126 -84
  139. package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.d.ts +42 -0
  140. package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.d.ts.map +1 -0
  141. package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.js +93 -0
  142. package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts +15 -0
  143. package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts.map +1 -0
  144. package/dest/storage/backwards_compatibility_tests/schema_tests.js +591 -0
  145. package/dest/storage/backwards_compatibility_tests/store_spy.d.ts +19 -0
  146. package/dest/storage/backwards_compatibility_tests/store_spy.d.ts.map +1 -0
  147. package/dest/storage/backwards_compatibility_tests/store_spy.js +63 -0
  148. package/dest/storage/contract_store/contract_store.d.ts +1 -1
  149. package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
  150. package/dest/storage/contract_store/contract_store.js +5 -24
  151. package/dest/storage/metadata.d.ts +1 -1
  152. package/dest/storage/metadata.js +1 -1
  153. package/dest/storage/open_pxe_stores.d.ts +33 -0
  154. package/dest/storage/open_pxe_stores.d.ts.map +1 -0
  155. package/dest/storage/open_pxe_stores.js +27 -0
  156. package/dest/storage/private_event_store/stored_private_event.js +1 -1
  157. package/dest/storage/tagging_store/recipient_tagging_store.d.ts +6 -6
  158. package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -1
  159. package/dest/storage/tagging_store/sender_tagging_store.d.ts +5 -5
  160. package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
  161. package/dest/storage/tagging_store/sender_tagging_store.js +3 -3
  162. package/dest/tagging/get_all_logs_by_tags.d.ts +34 -10
  163. package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -1
  164. package/dest/tagging/get_all_logs_by_tags.js +36 -37
  165. package/dest/tagging/index.d.ts +5 -4
  166. package/dest/tagging/index.d.ts.map +1 -1
  167. package/dest/tagging/index.js +4 -3
  168. package/dest/tagging/persist_sender_tagging_index_ranges.d.ts +29 -0
  169. package/dest/tagging/persist_sender_tagging_index_ranges.d.ts.map +1 -0
  170. package/dest/tagging/persist_sender_tagging_index_ranges.js +42 -0
  171. package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts +56 -0
  172. package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts.map +1 -0
  173. package/dest/tagging/recipient_sync/sync_tagged_private_logs.js +163 -0
  174. package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts +3 -3
  175. package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts.map +1 -1
  176. package/dest/tagging/reconcile_tagging_index_ranges.d.ts +36 -0
  177. package/dest/tagging/reconcile_tagging_index_ranges.d.ts.map +1 -0
  178. package/dest/tagging/reconcile_tagging_index_ranges.js +74 -0
  179. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +4 -5
  180. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
  181. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +26 -14
  182. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +11 -6
  183. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -1
  184. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +21 -0
  185. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +4 -4
  186. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -1
  187. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +2 -2
  188. package/package.json +20 -17
  189. package/src/bin/check_oracle_version.ts +46 -119
  190. package/src/bin/index.ts +1 -0
  191. package/src/bin/oracle_version_helpers.ts +121 -0
  192. package/src/block_synchronizer/block_stream_source.ts +81 -0
  193. package/src/block_synchronizer/block_synchronizer.ts +22 -12
  194. package/src/config/index.ts +15 -9
  195. package/src/config/package_info.ts +1 -1
  196. package/src/contract_function_simulator/contract_function_simulator.ts +34 -11
  197. package/src/contract_function_simulator/execution_note_cache.ts +1 -1
  198. package/src/contract_function_simulator/execution_tagging_index_cache.ts +5 -9
  199. package/src/contract_function_simulator/index.ts +50 -1
  200. package/src/contract_function_simulator/noir-structs/bounded_vec.ts +55 -0
  201. package/src/contract_function_simulator/noir-structs/ephemeral_array.ts +66 -0
  202. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +3 -2
  203. package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +35 -2
  204. package/src/contract_function_simulator/noir-structs/note_data.ts +27 -0
  205. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +3 -2
  206. package/src/contract_function_simulator/noir-structs/option.ts +69 -0
  207. package/src/contract_function_simulator/noir-structs/provided_secret.ts +27 -0
  208. package/src/contract_function_simulator/oracle/interfaces.ts +12 -204
  209. package/src/contract_function_simulator/oracle/note_packing_utils.ts +3 -3
  210. package/src/contract_function_simulator/oracle/oracle.ts +406 -556
  211. package/src/contract_function_simulator/oracle/oracle_registry.ts +585 -0
  212. package/src/contract_function_simulator/oracle/oracle_type_mappings.ts +553 -0
  213. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +74 -67
  214. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +350 -304
  215. package/src/contract_function_simulator/proxied_contract_data_source.ts +40 -70
  216. package/src/contract_sync/contract_sync_service.ts +56 -43
  217. package/src/contract_sync/helpers.ts +11 -23
  218. package/src/debug/pxe_debug_utils.ts +0 -8
  219. package/src/entrypoints/client/bundle/utils.ts +8 -2
  220. package/src/entrypoints/client/lazy/utils.ts +8 -2
  221. package/src/entrypoints/pxe_creation_options.ts +7 -0
  222. package/src/entrypoints/server/index.ts +1 -0
  223. package/src/entrypoints/server/utils.ts +13 -3
  224. package/src/events/event_service.ts +54 -19
  225. package/src/hooks/authorize_utility_call.ts +44 -0
  226. package/src/hooks/execution_hooks.ts +48 -0
  227. package/src/hooks/index.ts +7 -0
  228. package/src/logs/log_service.ts +137 -92
  229. package/src/messages/message_context_service.ts +42 -24
  230. package/src/notes/note_service.ts +115 -91
  231. package/src/oracle_version.ts +4 -4
  232. package/src/private_kernel/batch_planner.ts +169 -0
  233. package/src/private_kernel/hints/private_kernel_reset_private_inputs_builder.ts +1 -1
  234. package/src/private_kernel/hints/test_utils.ts +2 -9
  235. package/src/private_kernel/private_kernel_execution_prover.ts +236 -73
  236. package/src/private_kernel/private_kernel_oracle.ts +21 -11
  237. package/src/pxe.ts +208 -85
  238. package/src/storage/backwards_compatibility_tests/__snapshots__/AddressStore.json +22 -0
  239. package/src/storage/backwards_compatibility_tests/__snapshots__/AnchorBlockStore.json +3 -0
  240. package/src/storage/backwards_compatibility_tests/__snapshots__/CapsuleStore.json +16 -0
  241. package/src/storage/backwards_compatibility_tests/__snapshots__/ContractStore.json +28 -0
  242. package/src/storage/backwards_compatibility_tests/__snapshots__/KeyStore.json +52 -0
  243. package/src/storage/backwards_compatibility_tests/__snapshots__/L2TipsKVStore.json +46 -0
  244. package/src/storage/backwards_compatibility_tests/__snapshots__/NoteStore.json +36 -0
  245. package/src/storage/backwards_compatibility_tests/__snapshots__/PrivateEventStore.json +44 -0
  246. package/src/storage/backwards_compatibility_tests/__snapshots__/RecipientTaggingStore.json +18 -0
  247. package/src/storage/backwards_compatibility_tests/__snapshots__/SenderAddressBookStore.json +16 -0
  248. package/src/storage/backwards_compatibility_tests/__snapshots__/SenderTaggingStore.json +22 -0
  249. package/src/storage/backwards_compatibility_tests/__snapshots__/opened_stores.json +97 -0
  250. package/src/storage/backwards_compatibility_tests/kv_store_snapshot.ts +122 -0
  251. package/src/storage/backwards_compatibility_tests/schema_tests.ts +712 -0
  252. package/src/storage/backwards_compatibility_tests/store_spy.ts +73 -0
  253. package/src/storage/contract_store/contract_store.ts +6 -29
  254. package/src/storage/metadata.ts +1 -1
  255. package/src/storage/open_pxe_stores.ts +49 -0
  256. package/src/storage/private_event_store/stored_private_event.ts +1 -1
  257. package/src/storage/tagging_store/recipient_tagging_store.ts +5 -9
  258. package/src/storage/tagging_store/sender_tagging_store.ts +6 -6
  259. package/src/tagging/get_all_logs_by_tags.ts +78 -50
  260. package/src/tagging/index.ts +4 -3
  261. package/src/tagging/persist_sender_tagging_index_ranges.ts +57 -0
  262. package/src/tagging/recipient_sync/sync_tagged_private_logs.ts +240 -0
  263. package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +2 -2
  264. package/src/tagging/reconcile_tagging_index_ranges.ts +102 -0
  265. package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +41 -19
  266. package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +23 -8
  267. package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +4 -5
  268. package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.d.ts +0 -9
  269. package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.d.ts.map +0 -1
  270. package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.js +0 -47
  271. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +0 -14
  272. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +0 -1
  273. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +0 -85
  274. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +0 -14
  275. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +0 -1
  276. package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +0 -33
  277. package/src/contract_function_simulator/oracle/legacy_oracle_mappings.ts +0 -104
  278. package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +0 -130
  279. package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +0 -44
@@ -0,0 +1,240 @@
1
+ import { BlockNumber } from '@aztec/foundation/branded-types';
2
+ import { isDefined } from '@aztec/foundation/types';
3
+ import type { BlockHash } from '@aztec/stdlib/block';
4
+ import type { AztecNode } from '@aztec/stdlib/interfaces/client';
5
+ import type { AppTaggingSecret, LogResult } from '@aztec/stdlib/logs';
6
+ import { SiloedTag } from '@aztec/stdlib/logs';
7
+ import type { BlockHeader } from '@aztec/stdlib/tx';
8
+
9
+ import type { RecipientTaggingStore } from '../../storage/tagging_store/recipient_tagging_store.js';
10
+ import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../constants.js';
11
+ import { getAllPrivateLogsByTags } from '../get_all_logs_by_tags.js';
12
+ import { findHighestIndexes } from './utils/find_highest_indexes.js';
13
+
14
+ /**
15
+ * Fetches and syncs tagged private logs for multiple sender-recipient pairs, batching tag queries across all secrets
16
+ * into shared RPC calls.
17
+ *
18
+ * # Explanation of how the algorithm works
19
+ *
20
+ * For each secret we sync logs that correspond to the tagging index range
21
+ * (highestAgedIndex, highestFinalizedIndex + WINDOW_LEN]
22
+ *
23
+ * highestAgedIndex is the highest index that was used in a tx that is included in a block at least
24
+ * `MAX_TX_LIFETIME` seconds ago.
25
+ * highestFinalizedIndex is the highest index that was used in a tx that is included in a finalized block.
26
+ *
27
+ * "(" denotes an open end of the range - the index is not included in the range.
28
+ * "]" denotes a closed end of the range - the index is included in the range.
29
+ *
30
+ * ## Explanation of highestAgedIndex
31
+ *
32
+ * highestAgedIndex is chosen such that for all tagging indexes `i <= highestAgedIndex` we know that no new logs can
33
+ * ever appear.
34
+ *
35
+ * This relies on the "maximum inclusion timestamp" rule enforced by the kernel and rollup circuits:
36
+ * - a transaction's maximum inclusion timestamp is at most `MAX_TX_LIFETIME` seconds after
37
+ * the timestamp of its anchor block; and
38
+ * - a rollup only includes transactions whose inclusion timestamp is >= the L2 block's timestamp.
39
+ *
40
+ * Suppose some device used index `I` in a transaction anchored to block `B_N` at time `N`, and that block is now at
41
+ * least `MAX_TX_LIFETIME` seconds in the past. Then there is no possibility of any *other* device
42
+ * trying to use an index <= `I` while anchoring to a *newer* block than `B_N` because if we were anchoring to
43
+ * a newer block than `B_N` then we would already have seen the log with index `I` and hence the device would have
44
+ * chosen a larger index.
45
+ * If that *other* device would anchor to a block older than `B_N` then that tx could never be included in a block
46
+ * because it would already have been expired.
47
+ *
48
+ * Therefore, once we see that index `I` has been used in a block that is at least `MAX_TX_LIFETIME`
49
+ * seconds old, we can safely stop syncing logs for all indexes <= `I` and set highestAgedIndex = `I`.
50
+ *
51
+ * ## Explanation of the upper bound `highestFinalizedIndex + WINDOW_LEN`
52
+ *
53
+ * When a sender chooses a tagging index, they will select an index that is at most `WINDOW_LEN` greater than
54
+ * the highest finalized index. If that index was already used, they will throw an error. For this reason we
55
+ * don't have to look further than `highestFinalizedIndex + WINDOW_LEN`.
56
+ *
57
+ * ## Batching across secrets
58
+ *
59
+ * Instead of running one RPC call per secret, we merge tags from all pending secrets into a single flat array,
60
+ * make one batched `getAllPrivateLogsByTags` call (which internally chunks at MAX_RPC_LEN), then split results
61
+ * back per secret using tracked offsets. Only secrets whose window advanced are kept for the next iteration.
62
+ */
63
+ export async function syncTaggedPrivateLogs(
64
+ secrets: AppTaggingSecret[],
65
+ aztecNode: AztecNode,
66
+ taggingStore: RecipientTaggingStore,
67
+ anchorBlockHeader: BlockHeader,
68
+ finalizedBlockNumber: BlockNumber,
69
+ jobId: string,
70
+ ): Promise<LogResult[]> {
71
+ if (secrets.length === 0) {
72
+ return [];
73
+ }
74
+
75
+ const anchorBlockNumber = anchorBlockHeader.getBlockNumber();
76
+ const anchorBlockHash = await anchorBlockHeader.hash();
77
+ const currentTimestamp = anchorBlockHeader.globalVariables.timestamp;
78
+
79
+ // Read stored indexes from the db and compute the initial [start, end) range for each secret
80
+ let pending = await getIndexRangesForSecrets(secrets, taggingStore, jobId);
81
+ const allLogs: LogResult[] = [];
82
+
83
+ while (pending.length > 0) {
84
+ // Compute tags for all pending secrets and fetch logs in batched RPC calls
85
+ const logsPerSecret = await fetchLogsForSecrets(pending, aztecNode, anchorBlockNumber, anchorBlockHash);
86
+
87
+ const nextRound = await Promise.all(
88
+ pending.map(async (pendingSecret, i) => {
89
+ const logsFoundWithSecret = logsPerSecret[i];
90
+ if (logsFoundWithSecret.length === 0) {
91
+ // No logs found, no need to update indexes or advance window.
92
+ return undefined;
93
+ }
94
+
95
+ allLogs.push(...logsFoundWithSecret.map(({ log }) => log));
96
+
97
+ // Persist new indexes. If the finalized index moved forward, the window advances
98
+ // and we need another round for this secret.
99
+ return await updateIndexesAndAdvanceWindow(
100
+ pendingSecret,
101
+ logsFoundWithSecret,
102
+ taggingStore,
103
+ currentTimestamp,
104
+ finalizedBlockNumber,
105
+ jobId,
106
+ );
107
+ }),
108
+ );
109
+
110
+ pending = nextRound.filter(isDefined);
111
+ }
112
+
113
+ return allLogs;
114
+ }
115
+
116
+ /** Reads stored indexes for each secret and computes the initial index range to query. */
117
+ function getIndexRangesForSecrets(
118
+ secrets: AppTaggingSecret[],
119
+ taggingStore: RecipientTaggingStore,
120
+ jobId: string,
121
+ ): Promise<PendingSecret[]> {
122
+ return Promise.all(
123
+ secrets.map(async secret => {
124
+ const [currentHighestAgedIndex, currentHighestFinalizedIndex] = await Promise.all([
125
+ taggingStore.getHighestAgedIndex(secret, jobId),
126
+ taggingStore.getHighestFinalizedIndex(secret, jobId),
127
+ ]);
128
+
129
+ const start = currentHighestAgedIndex === undefined ? 0 : currentHighestAgedIndex + 1;
130
+ const end = (currentHighestFinalizedIndex ?? 0) + UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN + 1;
131
+
132
+ return { secret, start, end };
133
+ }),
134
+ );
135
+ }
136
+
137
+ /**
138
+ * Computes siloed tags for all pending secrets' index ranges, fetches logs in one batched RPC call,
139
+ * and returns the results grouped back per secret.
140
+ */
141
+ async function fetchLogsForSecrets(
142
+ pending: PendingSecret[],
143
+ aztecNode: AztecNode,
144
+ anchorBlockNumber: BlockNumber,
145
+ anchorBlockHash: BlockHash,
146
+ ): Promise<LogWithIndex[][]> {
147
+ // Determine the index range for each secret
148
+ const indexesPerSecret = pending.map(({ start, end }) => Array.from({ length: end - start }, (_, i) => start + i));
149
+
150
+ // Compute siloed tags for all indexes
151
+ const tagsPerSecret = await Promise.all(
152
+ pending.map(({ secret }, i) =>
153
+ Promise.all(indexesPerSecret[i].map(index => SiloedTag.compute({ extendedSecret: secret, index }))),
154
+ ),
155
+ );
156
+
157
+ const allTags = tagsPerSecret.flat();
158
+
159
+ // getAllPrivateLogsByTags handles MAX_RPC_LEN chunking internally. Recipient sync builds `PendingTaggedLog` from
160
+ // each log's note hashes and first nullifier, so we opt into effects. The `toBlock` cap (anchor block + 1,
161
+ // exclusive) tells the node to skip any logs in blocks past the anchor — the same guard previously enforced
162
+ // by an in-memory filter on the response.
163
+ const allResults = await getAllPrivateLogsByTags(aztecNode, allTags, anchorBlockHash, {
164
+ includeEffects: true,
165
+ toBlock: BlockNumber(anchorBlockNumber + 1),
166
+ });
167
+
168
+ // Split flat results back per secret using the known lengths
169
+ const logsPerSecret: LogWithIndex[][] = [];
170
+ let offset = 0;
171
+ for (const indexes of indexesPerSecret) {
172
+ const logsForSecret: LogWithIndex[] = [];
173
+ for (let i = 0; i < indexes.length; i++) {
174
+ for (const log of allResults[offset + i]) {
175
+ logsForSecret.push({ log, taggingIndex: indexes[i] });
176
+ }
177
+ }
178
+ logsPerSecret.push(logsForSecret);
179
+ offset += indexes.length;
180
+ }
181
+
182
+ return logsPerSecret;
183
+ }
184
+
185
+ /**
186
+ * Processes a single secret's fetched logs: updates stored indexes and returns a new PendingSecret
187
+ * if the window needs to advance, or undefined if this secret is done.
188
+ */
189
+ async function updateIndexesAndAdvanceWindow(
190
+ pending: PendingSecret,
191
+ logsWithIndexes: LogWithIndex[],
192
+ taggingStore: RecipientTaggingStore,
193
+ currentTimestamp: bigint,
194
+ finalizedBlockNumber: BlockNumber,
195
+ jobId: string,
196
+ ): Promise<PendingSecret | undefined> {
197
+ const { highestAgedIndex, highestFinalizedIndex } = findHighestIndexes(
198
+ logsWithIndexes,
199
+ currentTimestamp,
200
+ finalizedBlockNumber,
201
+ );
202
+
203
+ // Store updates in data provider and update local variables
204
+ if (highestAgedIndex !== undefined) {
205
+ await taggingStore.updateHighestAgedIndex(pending.secret, highestAgedIndex, jobId);
206
+ }
207
+
208
+ if (highestFinalizedIndex === undefined) {
209
+ // We have not found a new highest finalized index, so there is no need to move the window forward.
210
+ return undefined;
211
+ }
212
+
213
+ if (highestAgedIndex !== undefined && highestAgedIndex > highestFinalizedIndex) {
214
+ // This is just a sanity check as this should never happen.
215
+ throw new Error(
216
+ `Highest aged index (${highestAgedIndex}) must not exceed highest finalized index (${highestFinalizedIndex})`,
217
+ );
218
+ }
219
+
220
+ await taggingStore.updateHighestFinalizedIndex(pending.secret, highestFinalizedIndex, jobId);
221
+
222
+ // For the next iteration we want to look only at indexes for which we have not yet fetched logs while
223
+ // ensuring that we do not look further than WINDOW_LEN ahead of the highest finalized index.
224
+ return {
225
+ secret: pending.secret,
226
+ start: pending.end,
227
+ end: highestFinalizedIndex + UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN + 1,
228
+ };
229
+ }
230
+
231
+ type PendingSecret = {
232
+ secret: AppTaggingSecret;
233
+ start: number;
234
+ end: number;
235
+ };
236
+
237
+ type LogWithIndex = {
238
+ log: LogResult;
239
+ taggingIndex: number;
240
+ };
@@ -1,11 +1,11 @@
1
1
  import { MAX_TX_LIFETIME } from '@aztec/constants';
2
- import type { TxScopedL2Log } from '@aztec/stdlib/logs';
2
+ import type { LogResult } from '@aztec/stdlib/logs';
3
3
 
4
4
  /**
5
5
  * Finds the highest aged and the highest finalized tagging indexes.
6
6
  */
7
7
  export function findHighestIndexes(
8
- privateLogsWithIndexes: Array<{ log: TxScopedL2Log; taggingIndex: number }>,
8
+ privateLogsWithIndexes: Array<{ log: LogResult; taggingIndex: number }>,
9
9
  currentTimestamp: bigint,
10
10
  finalizedBlockNumber: number,
11
11
  ): { highestAgedIndex: number | undefined; highestFinalizedIndex: number | undefined } {
@@ -0,0 +1,102 @@
1
+ import { type AppTaggingSecret, SiloedTag, type TaggingIndexRange } from '@aztec/stdlib/logs';
2
+
3
+ /**
4
+ * Reconciles tagging index ranges recorded by the PXE during private execution against the set of siloed tags whose
5
+ * private logs survived to the final kernel output.
6
+ *
7
+ * Each input range is the contiguous `[lowestIndex, highestIndex]` set of indexes that the tagging index cache
8
+ * reserved for a given tagging secret while a tx was being executed. The kernel may then squash some of those logs
9
+ * (e.g. when a note is created and nullified within the same tx, taking its log with it), so the actual on-chain
10
+ * footprint can be a strict subset of what was reserved.
11
+ *
12
+ * For each input range, this function shrinks `[lowestIndex, highestIndex]` so that both bounds correspond to indexes
13
+ * that actually survived, trimming any dropped indices at the front or the back. It is possible that some interior
14
+ * indexes were also dropped, leaving gaps between the lowest and highest indices, but we ignore those and accept the
15
+ * resulting inefficiency rather than complicate the tagging model with one in which transactions may use interleaved
16
+ * indices.
17
+ *
18
+ * Trimming tailing indices (e.g. `highestIndex`) is highly useful as it lets us reuse those indices in future
19
+ * transactions. Trimming indices at the front (e.g. `lowestIndex`) is not as impactful since we will not ever use a
20
+ * tagging index if a larger one exists (same as with gaps), but it does help in both making the consistency check
21
+ * between database and transaction effects cheaper (as there's fewer logs to test) and making the database more
22
+ * accurately reflect reality.
23
+ *
24
+ * Ranges with no surviving indexes are dropped from the output entirely.
25
+ *
26
+ * Example scenario:
27
+ * - used indexes 3 to 7, kerel squashed indexes 3, 5, and 7:
28
+ * - range: [3, 7]
29
+ * - survived: set(3, 5, 7)
30
+ * - output: [4, 6] (trimmed from both ends, gap at 5 is tolerated)
31
+ *
32
+ * @param ranges - The tagging index ranges as recorded during private execution (pre-squash).
33
+ * @param survivingTags - The set of siloed tag values (as strings) of private logs that survived kernel squashing.
34
+ * @returns The reconciled ranges, with bounds tightened to surviving indexes and fully-squashed ranges removed.
35
+ */
36
+ export async function reconcileTaggingIndexRangesAgainstSurvivingTags(
37
+ ranges: TaggingIndexRange[],
38
+ survivingTags: Set<string>,
39
+ ): Promise<TaggingIndexRange[]> {
40
+ const reconciled: TaggingIndexRange[] = [];
41
+
42
+ for (const range of ranges) {
43
+ const newLowestIndex = await findFirstSurvivingIndex(
44
+ range.extendedSecret,
45
+ range.lowestIndex,
46
+ range.highestIndex,
47
+ survivingTags,
48
+ );
49
+ if (newLowestIndex === undefined) {
50
+ // No index in this range corresponds to a surviving log: the entire range was squashed.
51
+ continue;
52
+ }
53
+
54
+ // newLowestIndex is itself a survivor, so the backward scan is guaranteed to find at least that index.
55
+ const newHighestIndex = await findLastSurvivingIndex(
56
+ range.extendedSecret,
57
+ newLowestIndex,
58
+ range.highestIndex,
59
+ survivingTags,
60
+ );
61
+
62
+ reconciled.push({
63
+ extendedSecret: range.extendedSecret,
64
+ lowestIndex: newLowestIndex,
65
+ highestIndex: newHighestIndex!,
66
+ });
67
+ }
68
+
69
+ return reconciled;
70
+ }
71
+
72
+ /** Scans `[start, end]` ascending and returns the first index whose siloed tag is in `survivingTags`. */
73
+ async function findFirstSurvivingIndex(
74
+ secret: AppTaggingSecret,
75
+ start: number,
76
+ end: number,
77
+ survivingTags: Set<string>,
78
+ ): Promise<number | undefined> {
79
+ for (let index = start; index <= end; index++) {
80
+ const tag = await SiloedTag.compute({ extendedSecret: secret, index });
81
+ if (survivingTags.has(tag.value.toString())) {
82
+ return index;
83
+ }
84
+ }
85
+ return undefined;
86
+ }
87
+
88
+ /** Scans `[start, end]` descending and returns the first index whose siloed tag is in `survivingTags`. */
89
+ async function findLastSurvivingIndex(
90
+ secret: AppTaggingSecret,
91
+ start: number,
92
+ end: number,
93
+ survivingTags: Set<string>,
94
+ ): Promise<number | undefined> {
95
+ for (let index = end; index >= start; index--) {
96
+ const tag = await SiloedTag.compute({ extendedSecret: secret, index });
97
+ if (survivingTags.has(tag.value.toString())) {
98
+ return index;
99
+ }
100
+ }
101
+ return undefined;
102
+ }
@@ -1,17 +1,20 @@
1
1
  import type { BlockHash } from '@aztec/stdlib/block';
2
2
  import type { AztecNode } from '@aztec/stdlib/interfaces/server';
3
- import type { ExtendedDirectionalAppTaggingSecret } from '@aztec/stdlib/logs';
3
+ import type { AppTaggingSecret } from '@aztec/stdlib/logs';
4
4
 
5
5
  import type { SenderTaggingStore } from '../../storage/tagging_store/sender_tagging_store.js';
6
6
  import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../constants.js';
7
- import { getStatusChangeOfPending } from './utils/get_status_change_of_pending.js';
7
+ import {
8
+ EMPTY_STATUS_CHANGE,
9
+ getStatusChangeOfPending,
10
+ mergeStatusChanges,
11
+ } from './utils/get_status_change_of_pending.js';
8
12
  import { loadAndStoreNewTaggingIndexes } from './utils/load_and_store_new_tagging_indexes.js';
9
13
 
10
14
  /**
11
15
  * Syncs tagging indexes. This function needs to be called whenever a private log is being sent.
12
16
  *
13
- * @param secret - The secret that's unique for (sender, recipient, app) tuple while the direction of
14
- * sender -> recipient matters.
17
+ * @param secret - The sender-side tagging `AppTaggingSecret`.
15
18
  * @remarks When syncing the indexes as sender we don't care about the log contents - we only care about the highest
16
19
  * pending and highest finalized indexes as that guides the next index choice when sending a log. The next index choice
17
20
  * is simply the highest pending index plus one (or finalized if pending is undefined).
@@ -19,7 +22,7 @@ import { loadAndStoreNewTaggingIndexes } from './utils/load_and_store_new_taggin
19
22
  * updates its status accordingly.
20
23
  */
21
24
  export async function syncSenderTaggingIndexes(
22
- secret: ExtendedDirectionalAppTaggingSecret,
25
+ secret: AppTaggingSecret,
23
26
  aztecNode: AztecNode,
24
27
  taggingStore: SenderTaggingStore,
25
28
  anchorBlockHash: BlockHash,
@@ -52,36 +55,55 @@ export async function syncSenderTaggingIndexes(
52
55
  let newFinalizedIndex = undefined;
53
56
 
54
57
  while (true) {
55
- // Load and store indexes for the current window. These indexes may already exist in the database if txs using
56
- // them were previously sent from this PXE. Any duplicates are handled by the tagging data provider.
57
- await loadAndStoreNewTaggingIndexes(secret, start, end, aztecNode, taggingStore, anchorBlockHash, jobId);
58
+ // Pending tx hashes already in the store for this window (from prior syncs or txs this PXE itself sent).
59
+ // Reading these before issuing any RPC lets us fetch their receipts in parallel with the logs query below.
60
+ const knownPendingTxHashes = await taggingStore.getTxHashesOfPendingIndexes(secret, start, end, jobId);
58
61
 
59
- // Retrieve all indexes within the current window from storage and update their status accordingly.
60
- const pendingTxHashes = await taggingStore.getTxHashesOfPendingIndexes(secret, start, end, jobId);
61
- if (pendingTxHashes.length === 0) {
62
+ // Fire the logs query and the known-pending receipts query in parallel
63
+ const [, statusOfKnown] = await Promise.all([
64
+ loadAndStoreNewTaggingIndexes(secret, start, end, aztecNode, taggingStore, anchorBlockHash, jobId),
65
+ knownPendingTxHashes.length > 0
66
+ ? getStatusChangeOfPending(knownPendingTxHashes, aztecNode)
67
+ : Promise.resolve(EMPTY_STATUS_CHANGE),
68
+ ]);
69
+
70
+ // Re-read pending tx hashes after the logs query writes any newly-discovered ones to the store.
71
+ const allPendingTxHashes = await taggingStore.getTxHashesOfPendingIndexes(secret, start, end, jobId);
72
+ if (allPendingTxHashes.length === 0) {
62
73
  break;
63
74
  }
64
75
 
65
- const { txHashesToFinalize, txHashesToDrop, txHashesWithExecutionReverted } = await getStatusChangeOfPending(
66
- pendingTxHashes,
67
- aztecNode,
76
+ // Receipts for pending tx hashes that the logs query just surfaced still need a sequential follow-up call.
77
+ // `storePendingIndexes` is idempotent on (secret, txHash), so a re-discovered hash stays classified as known
78
+ // and is not re-fetched here.
79
+ const knownSet = new Set(knownPendingTxHashes.map(h => h.toString()));
80
+ const newPendingTxHashes = allPendingTxHashes.filter(h => !knownSet.has(h.toString()));
81
+
82
+ const statusOfNew =
83
+ newPendingTxHashes.length > 0
84
+ ? await getStatusChangeOfPending(newPendingTxHashes, aztecNode)
85
+ : EMPTY_STATUS_CHANGE;
86
+
87
+ const { txHashesToFinalize, txHashesToDrop, txHashesWithExecutionReverted } = mergeStatusChanges(
88
+ statusOfKnown,
89
+ statusOfNew,
68
90
  );
69
91
 
70
92
  await taggingStore.dropPendingIndexes(txHashesToDrop, jobId);
71
93
  await taggingStore.finalizePendingIndexes(txHashesToFinalize, jobId);
72
94
 
73
95
  if (txHashesWithExecutionReverted.length > 0) {
74
- const indexedTxEffects = await Promise.all(
75
- txHashesWithExecutionReverted.map(txHash => aztecNode.getTxEffect(txHash)),
96
+ const receipts = await Promise.all(
97
+ txHashesWithExecutionReverted.map(txHash => aztecNode.getTxReceipt(txHash, { includeTxEffect: true })),
76
98
  );
77
- for (const indexedTxEffect of indexedTxEffects) {
78
- if (indexedTxEffect === undefined) {
99
+ for (const receipt of receipts) {
100
+ if (!receipt.isMined() || !receipt.txEffect) {
79
101
  throw new Error(
80
102
  'TxEffect not found for execution-reverted tx. This is either a bug or a reorg has occurred.',
81
103
  );
82
104
  }
83
105
 
84
- await taggingStore.finalizePendingIndexesOfAPartiallyRevertedTx(indexedTxEffect.data, jobId);
106
+ await taggingStore.finalizePendingIndexesOfAPartiallyRevertedTx(receipt.txEffect, jobId);
85
107
  }
86
108
  }
87
109
 
@@ -1,18 +1,33 @@
1
1
  import type { AztecNode } from '@aztec/stdlib/interfaces/server';
2
2
  import { TxHash, TxStatus } from '@aztec/stdlib/tx';
3
3
 
4
+ /** Classification of a batch of pending tx hashes by the status change implied by their receipts. */
5
+ export type StatusChange = {
6
+ txHashesToFinalize: TxHash[];
7
+ txHashesToDrop: TxHash[];
8
+ txHashesWithExecutionReverted: TxHash[];
9
+ };
10
+
11
+ export const EMPTY_STATUS_CHANGE: StatusChange = {
12
+ txHashesToFinalize: [],
13
+ txHashesToDrop: [],
14
+ txHashesWithExecutionReverted: [],
15
+ };
16
+
17
+ /** Concatenates two status changes field-by-field. */
18
+ export function mergeStatusChanges(a: StatusChange, b: StatusChange): StatusChange {
19
+ return {
20
+ txHashesToFinalize: [...a.txHashesToFinalize, ...b.txHashesToFinalize],
21
+ txHashesToDrop: [...a.txHashesToDrop, ...b.txHashesToDrop],
22
+ txHashesWithExecutionReverted: [...a.txHashesWithExecutionReverted, ...b.txHashesWithExecutionReverted],
23
+ };
24
+ }
25
+
4
26
  /**
5
27
  * Based on receipts obtained from `aztecNode` returns which pending transactions changed their status to finalized,
6
28
  * dropped, or execution-reverted (but mined).
7
29
  */
8
- export async function getStatusChangeOfPending(
9
- pending: TxHash[],
10
- aztecNode: AztecNode,
11
- ): Promise<{
12
- txHashesToFinalize: TxHash[];
13
- txHashesToDrop: TxHash[];
14
- txHashesWithExecutionReverted: TxHash[];
15
- }> {
30
+ export async function getStatusChangeOfPending(pending: TxHash[], aztecNode: AztecNode): Promise<StatusChange> {
16
31
  // Get receipts for all pending tx hashes.
17
32
  const receipts = await Promise.all(pending.map(pendingTxHash => aztecNode.getTxReceipt(pendingTxHash)));
18
33
 
@@ -1,7 +1,6 @@
1
1
  import type { BlockHash } from '@aztec/stdlib/block';
2
2
  import type { AztecNode } from '@aztec/stdlib/interfaces/server';
3
- import type { ExtendedDirectionalAppTaggingSecret } from '@aztec/stdlib/logs';
4
- import { SiloedTag } from '@aztec/stdlib/logs';
3
+ import { type AppTaggingSecret, SiloedTag } from '@aztec/stdlib/logs';
5
4
  import { TxHash } from '@aztec/stdlib/tx';
6
5
 
7
6
  import type { SenderTaggingStore } from '../../../storage/tagging_store/sender_tagging_store.js';
@@ -11,7 +10,7 @@ import { getAllPrivateLogsByTags } from '../../get_all_logs_by_tags.js';
11
10
  * Loads tagging indexes from the Aztec node and stores them in the tagging data provider.
12
11
  * @remarks This function is one of two places by which a pending index can get to the tagging data provider. The other
13
12
  * place is when a tx is being sent from this PXE.
14
- * @param extendedSecret - The extended directional app tagging secret that's unique for (sender, recipient, app) tuple.
13
+ * @param extendedSecret - The app tagging secret whose indexes are being synced.
15
14
  * @param start - The starting index (inclusive) of the window to process.
16
15
  * @param end - The ending index (exclusive) of the window to process.
17
16
  * @param aztecNode - The Aztec node instance to query for logs.
@@ -21,7 +20,7 @@ import { getAllPrivateLogsByTags } from '../../get_all_logs_by_tags.js';
21
20
  * preserving way.
22
21
  */
23
22
  export async function loadAndStoreNewTaggingIndexes(
24
- extendedSecret: ExtendedDirectionalAppTaggingSecret,
23
+ extendedSecret: AppTaggingSecret,
25
24
  start: number,
26
25
  end: number,
27
26
  aztecNode: AztecNode,
@@ -53,7 +52,7 @@ async function getTxsContainingTags(
53
52
  anchorBlockHash: BlockHash,
54
53
  ): Promise<TxHash[][]> {
55
54
  // We use the utility function below to retrieve all logs for the tags across all pages, so we don't need to handle
56
- // pagination here.
55
+ // pagination here. Sender sync only needs `txHash` from each log, so we leave `includeEffects` off.
57
56
  const allLogs = await getAllPrivateLogsByTags(aztecNode, tags, anchorBlockHash);
58
57
  return allLogs.map(logs => logs.map(log => log.txHash));
59
58
  }
@@ -1,9 +0,0 @@
1
- import type { ACIRCallback } from '@aztec/simulator/client';
2
- import type { Oracle } from './oracle.js';
3
- /**
4
- * Builds legacy oracle name callbacks for pinned protocol contracts whose artifacts are committed and cannot be
5
- * changed.
6
- * TODO(F-416): Remove these aliases on v5 when protocol contracts are redeployed.
7
- */
8
- export declare function buildLegacyOracleCallbacks(oracle: Oracle): ACIRCallback;
9
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGVnYWN5X29yYWNsZV9tYXBwaW5ncy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NvbnRyYWN0X2Z1bmN0aW9uX3NpbXVsYXRvci9vcmFjbGUvbGVnYWN5X29yYWNsZV9tYXBwaW5ncy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQWEsTUFBTSx5QkFBeUIsQ0FBQztBQUd2RSxPQUFPLEtBQUssRUFBRSxNQUFNLEVBQUUsTUFBTSxhQUFhLENBQUM7QUFFMUM7Ozs7R0FJRztBQUNILHdCQUFnQiwwQkFBMEIsQ0FBQyxNQUFNLEVBQUUsTUFBTSxHQUFHLFlBQVksQ0E0RnZFIn0=
@@ -1 +0,0 @@
1
- {"version":3,"file":"legacy_oracle_mappings.d.ts","sourceRoot":"","sources":["../../../src/contract_function_simulator/oracle/legacy_oracle_mappings.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAa,MAAM,yBAAyB,CAAC;AAGvE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CA4FvE"}
@@ -1,47 +0,0 @@
1
- import { toACVMField } from '@aztec/simulator/client';
2
- import { AztecAddress } from '@aztec/stdlib/aztec-address';
3
- /**
4
- * Builds legacy oracle name callbacks for pinned protocol contracts whose artifacts are committed and cannot be
5
- * changed.
6
- * TODO(F-416): Remove these aliases on v5 when protocol contracts are redeployed.
7
- */ export function buildLegacyOracleCallbacks(oracle) {
8
- // If you are about to add a new mapping ensure that the old oracle name is different from the new one - this can
9
- // commonly occur when only the args are getting modified.
10
- return {
11
- // Simple prefix renames (privateXxx/utilityXxx → aztec_prv_/aztec_utl_)
12
- utilityLog: (level, message, _ignoredFieldsSize, fields)=>oracle.aztec_utl_log(level, message, _ignoredFieldsSize, fields),
13
- utilityAssertCompatibleOracleVersion: (version)=>oracle.aztec_utl_assertCompatibleOracleVersionV2(version, [
14
- toACVMField(0)
15
- ]),
16
- // Old 1-arg oracle before minor/major split. Maps to V2 with minor=0.
17
- // eslint-disable-next-line camelcase
18
- aztec_utl_assertCompatibleOracleVersion: (version)=>oracle.aztec_utl_assertCompatibleOracleVersionV2(version, [
19
- toACVMField(0)
20
- ]),
21
- utilityLoadCapsule: (contractAddress, slot, tSize)=>oracle.aztec_utl_getCapsule(contractAddress, slot, tSize, [
22
- toACVMField(AztecAddress.ZERO)
23
- ]),
24
- privateStoreInExecutionCache: (values, hash)=>oracle.aztec_prv_setHashPreimage(values, hash),
25
- privateLoadFromExecutionCache: (returnsHash)=>oracle.aztec_prv_getHashPreimage(returnsHash),
26
- privateCallPrivateFunction: (contractAddress, functionSelector, argsHash, sideEffectCounter, isStaticCall)=>oracle.aztec_prv_callPrivateFunction(contractAddress, functionSelector, argsHash, sideEffectCounter, isStaticCall),
27
- privateIsNullifierPending: (innerNullifier, contractAddress)=>oracle.aztec_prv_isNullifierPending(innerNullifier, contractAddress),
28
- privateNotifyCreatedNullifier: (innerNullifier)=>oracle.aztec_prv_notifyCreatedNullifier(innerNullifier),
29
- privateNotifyCreatedContractClassLog: (contractAddress, message, length, counter)=>oracle.aztec_prv_notifyCreatedContractClassLog(contractAddress, message, length, counter),
30
- utilityGetUtilityContext: ()=>oracle.aztec_utl_getUtilityContext(),
31
- utilityStorageRead: (blockHash, contractAddress, startStorageSlot, numberOfElements)=>oracle.aztec_utl_getFromPublicStorage(blockHash, contractAddress, startStorageSlot, numberOfElements),
32
- utilityStoreCapsule: (contractAddress, slot, capsule)=>oracle.aztec_utl_setCapsule(contractAddress, slot, capsule, [
33
- toACVMField(AztecAddress.ZERO)
34
- ]),
35
- utilityCopyCapsule: (contractAddress, srcSlot, dstSlot, numEntries)=>oracle.aztec_utl_copyCapsule(contractAddress, srcSlot, dstSlot, numEntries, [
36
- toACVMField(AztecAddress.ZERO)
37
- ]),
38
- utilityDeleteCapsule: (contractAddress, slot)=>oracle.aztec_utl_deleteCapsule(contractAddress, slot, [
39
- toACVMField(AztecAddress.ZERO)
40
- ]),
41
- utilityGetL1ToL2MembershipWitness: (contractAddress, messageHash, secret)=>oracle.aztec_utl_getL1ToL2MembershipWitness(contractAddress, messageHash, secret),
42
- // Renames (same signature, different oracle name)
43
- privateNotifySetMinRevertibleSideEffectCounter: (counter)=>oracle.aztec_prv_notifyRevertiblePhaseStart(counter),
44
- // Signature changes: old 4-param oracles → new 1-param validatePublicCalldata
45
- privateNotifyEnqueuedPublicFunctionCall: (_contractAddress, calldataHash, _sideEffectCounter, _isStaticCall)=>oracle.aztec_prv_assertValidPublicCalldata(calldataHash)
46
- };
47
- }
@@ -1,14 +0,0 @@
1
- import type { BlockNumber } from '@aztec/foundation/branded-types';
2
- import type { BlockHash } from '@aztec/stdlib/block';
3
- import type { AztecNode } from '@aztec/stdlib/interfaces/client';
4
- import type { ExtendedDirectionalAppTaggingSecret, TxScopedL2Log } from '@aztec/stdlib/logs';
5
- import type { RecipientTaggingStore } from '../../storage/tagging_store/recipient_tagging_store.js';
6
- /**
7
- * Loads private logs for the app-sender-recipient triplet 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: ExtendedDirectionalAppTaggingSecret, aztecNode: AztecNode, taggingStore: RecipientTaggingStore, anchorBlockNumber: BlockNumber, anchorBlockHash: BlockHash, currentTimestamp: bigint, finalizedBlockNumber: BlockNumber, jobId: string): Promise<TxScopedL2Log[]>;
14
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9hZF9wcml2YXRlX2xvZ3NfZm9yX3NlbmRlcl9yZWNpcGllbnRfcGFpci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3RhZ2dpbmcvcmVjaXBpZW50X3N5bmMvbG9hZF9wcml2YXRlX2xvZ3NfZm9yX3NlbmRlcl9yZWNpcGllbnRfcGFpci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNuRSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUNyRCxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNqRSxPQUFPLEtBQUssRUFBRSxtQ0FBbUMsRUFBRSxhQUFhLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUU3RixPQUFPLEtBQUssRUFBRSxxQkFBcUIsRUFBRSxNQUFNLHdEQUF3RCxDQUFDO0FBS3BHOzs7Ozs7R0FNRztBQUNILHdCQUFzQixxQ0FBcUMsQ0FDekQsTUFBTSxFQUFFLG1DQUFtQyxFQUMzQyxTQUFTLEVBQUUsU0FBUyxFQUNwQixZQUFZLEVBQUUscUJBQXFCLEVBQ25DLGlCQUFpQixFQUFFLFdBQVcsRUFDOUIsZUFBZSxFQUFFLFNBQVMsRUFDMUIsZ0JBQWdCLEVBQUUsTUFBTSxFQUN4QixvQkFBb0IsRUFBRSxXQUFXLEVBQ2pDLEtBQUssRUFBRSxNQUFNLEdBQ1osT0FBTyxDQUFDLGFBQWEsRUFBRSxDQUFDLENBdUcxQiJ9
@@ -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,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,mCAAmC,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAE7F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wDAAwD,CAAC;AAKpG;;;;;;GAMG;AACH,wBAAsB,qCAAqC,CACzD,MAAM,EAAE,mCAAmC,EAC3C,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,qBAAqB,EACnC,iBAAiB,EAAE,WAAW,EAC9B,eAAe,EAAE,SAAS,EAC1B,gBAAgB,EAAE,MAAM,EACxB,oBAAoB,EAAE,WAAW,EACjC,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,aAAa,EAAE,CAAC,CAuG1B"}