@aztec/pxe 0.0.1-commit.b9865e97 → 0.0.1-commit.be03c316

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 (397) hide show
  1. package/dest/bin/check_oracle_version.js +8 -23
  2. package/dest/bin/index.d.ts +2 -2
  3. package/dest/bin/index.d.ts.map +1 -1
  4. package/dest/bin/index.js +1 -1
  5. package/dest/bin/oracle_version_helpers.d.ts +16 -8
  6. package/dest/bin/oracle_version_helpers.d.ts.map +1 -1
  7. package/dest/bin/oracle_version_helpers.js +22 -69
  8. package/dest/block_synchronizer/block_stream_source.d.ts +5 -5
  9. package/dest/block_synchronizer/block_stream_source.d.ts.map +1 -1
  10. package/dest/block_synchronizer/block_stream_source.js +4 -29
  11. package/dest/block_synchronizer/block_synchronizer.d.ts +18 -14
  12. package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
  13. package/dest/block_synchronizer/block_synchronizer.js +54 -18
  14. package/dest/config/index.d.ts +2 -1
  15. package/dest/config/index.d.ts.map +1 -1
  16. package/dest/config/index.js +1 -0
  17. package/dest/contract/contract_class_service.d.ts +31 -0
  18. package/dest/contract/contract_class_service.d.ts.map +1 -0
  19. package/dest/contract/contract_class_service.js +68 -0
  20. package/dest/contract/contract_sync_service.d.ts +48 -0
  21. package/dest/contract/contract_sync_service.d.ts.map +1 -0
  22. package/dest/{contract_sync → contract}/contract_sync_service.js +26 -45
  23. package/dest/contract/helpers.d.ts +7 -0
  24. package/dest/contract/helpers.d.ts.map +1 -0
  25. package/dest/contract/helpers.js +20 -0
  26. package/dest/contract/skip_sync_contracts.d.ts +11 -0
  27. package/dest/contract/skip_sync_contracts.d.ts.map +1 -0
  28. package/dest/contract/skip_sync_contracts.js +18 -0
  29. package/dest/contract_function_simulator/anchored_contract_data.d.ts +36 -0
  30. package/dest/contract_function_simulator/anchored_contract_data.d.ts.map +1 -0
  31. package/dest/contract_function_simulator/anchored_contract_data.js +54 -0
  32. package/dest/contract_function_simulator/aztec_node_read_cache.d.ts +39 -0
  33. package/dest/contract_function_simulator/aztec_node_read_cache.d.ts.map +1 -0
  34. package/dest/contract_function_simulator/aztec_node_read_cache.js +60 -0
  35. package/dest/contract_function_simulator/contract_function_simulator.d.ts +19 -18
  36. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  37. package/dest/contract_function_simulator/contract_function_simulator.js +63 -32
  38. package/dest/contract_function_simulator/execution_note_cache.d.ts +3 -9
  39. package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
  40. package/dest/contract_function_simulator/execution_note_cache.js +8 -28
  41. package/dest/contract_function_simulator/index.d.ts +19 -10
  42. package/dest/contract_function_simulator/index.d.ts.map +1 -1
  43. package/dest/contract_function_simulator/index.js +6 -9
  44. package/dest/contract_function_simulator/noir-structs/bounded_vec.d.ts +8 -27
  45. package/dest/contract_function_simulator/noir-structs/bounded_vec.d.ts.map +1 -1
  46. package/dest/contract_function_simulator/noir-structs/bounded_vec.js +8 -23
  47. package/dest/contract_function_simulator/noir-structs/contract_class_log_data.d.ts +9 -0
  48. package/dest/contract_function_simulator/noir-structs/contract_class_log_data.d.ts.map +1 -0
  49. package/dest/contract_function_simulator/noir-structs/contract_class_log_data.js +1 -0
  50. package/dest/contract_function_simulator/noir-structs/embedded_curve_point.d.ts +7 -0
  51. package/dest/contract_function_simulator/noir-structs/embedded_curve_point.d.ts.map +1 -0
  52. package/dest/contract_function_simulator/noir-structs/embedded_curve_point.js +1 -0
  53. package/dest/contract_function_simulator/noir-structs/event_validation_request.js +1 -1
  54. package/dest/contract_function_simulator/noir-structs/fact.d.ts +16 -0
  55. package/dest/contract_function_simulator/noir-structs/fact.d.ts.map +1 -0
  56. package/dest/contract_function_simulator/noir-structs/fact.js +6 -0
  57. package/dest/contract_function_simulator/noir-structs/fact_collection.d.ts +27 -0
  58. package/dest/contract_function_simulator/noir-structs/fact_collection.d.ts.map +1 -0
  59. package/dest/contract_function_simulator/noir-structs/fact_collection.js +31 -0
  60. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +11 -12
  61. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts.map +1 -1
  62. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.js +6 -49
  63. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +10 -8
  64. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
  65. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +1 -60
  66. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +2 -2
  67. package/dest/contract_function_simulator/noir-structs/option.d.ts +9 -11
  68. package/dest/contract_function_simulator/noir-structs/option.d.ts.map +1 -1
  69. package/dest/contract_function_simulator/noir-structs/option.js +18 -13
  70. package/dest/contract_function_simulator/noir-structs/origin_block.d.ts +11 -0
  71. package/dest/contract_function_simulator/noir-structs/origin_block.d.ts.map +1 -0
  72. package/dest/contract_function_simulator/noir-structs/origin_block.js +5 -0
  73. package/dest/contract_function_simulator/noir-structs/pending_tagged_log.d.ts +11 -0
  74. package/dest/contract_function_simulator/noir-structs/pending_tagged_log.d.ts.map +1 -0
  75. package/dest/contract_function_simulator/noir-structs/pending_tagged_log.js +4 -0
  76. package/dest/contract_function_simulator/noir-structs/provided_secret.d.ts +6 -9
  77. package/dest/contract_function_simulator/noir-structs/provided_secret.d.ts.map +1 -1
  78. package/dest/contract_function_simulator/noir-structs/provided_secret.js +1 -24
  79. package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.d.ts +28 -0
  80. package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.d.ts.map +1 -0
  81. package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.js +50 -0
  82. package/dest/contract_function_simulator/noir-structs/resolved_tx.d.ts +19 -0
  83. package/dest/contract_function_simulator/noir-structs/resolved_tx.d.ts.map +1 -0
  84. package/dest/contract_function_simulator/noir-structs/resolved_tx.js +9 -0
  85. package/dest/contract_function_simulator/noir-structs/tx_effect_data.d.ts +15 -0
  86. package/dest/contract_function_simulator/noir-structs/tx_effect_data.d.ts.map +1 -0
  87. package/dest/contract_function_simulator/noir-structs/tx_effect_data.js +5 -0
  88. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +6 -11
  89. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -1
  90. package/dest/contract_function_simulator/noir-structs/utility_context.js +1 -20
  91. package/dest/contract_function_simulator/oracle/acir_callback.d.ts +21 -0
  92. package/dest/contract_function_simulator/oracle/acir_callback.d.ts.map +1 -0
  93. package/dest/contract_function_simulator/oracle/acir_callback.js +115 -0
  94. package/dest/contract_function_simulator/oracle/index.d.ts +2 -13
  95. package/dest/contract_function_simulator/oracle/index.d.ts.map +1 -1
  96. package/dest/contract_function_simulator/oracle/index.js +1 -1
  97. package/dest/contract_function_simulator/oracle/interfaces.d.ts +2 -3
  98. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
  99. package/dest/contract_function_simulator/oracle/legacy_oracle_registry.d.ts +39 -0
  100. package/dest/contract_function_simulator/oracle/legacy_oracle_registry.d.ts.map +1 -0
  101. package/dest/contract_function_simulator/oracle/legacy_oracle_registry.js +107 -0
  102. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +3 -14
  103. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
  104. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.js +1 -24
  105. package/dest/contract_function_simulator/oracle/oracle_registry.d.ts +43 -31
  106. package/dest/contract_function_simulator/oracle/oracle_registry.d.ts.map +1 -1
  107. package/dest/contract_function_simulator/oracle/oracle_registry.js +259 -29
  108. package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts +180 -45
  109. package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts.map +1 -1
  110. package/dest/contract_function_simulator/oracle/oracle_type_mappings.js +1024 -341
  111. package/dest/contract_function_simulator/oracle/private_execution.d.ts +1 -1
  112. package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
  113. package/dest/contract_function_simulator/oracle/private_execution.js +2 -3
  114. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +21 -8
  115. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  116. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +132 -22
  117. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +77 -34
  118. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  119. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +247 -106
  120. package/dest/contract_function_simulator/transient_array_service.d.ts +31 -0
  121. package/dest/contract_function_simulator/transient_array_service.d.ts.map +1 -0
  122. package/dest/contract_function_simulator/transient_array_service.js +62 -0
  123. package/dest/debug/pxe_debug_utils.d.ts +2 -2
  124. package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
  125. package/dest/entrypoints/client/bundle/index.d.ts +2 -1
  126. package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
  127. package/dest/entrypoints/client/bundle/index.js +1 -0
  128. package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
  129. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  130. package/dest/entrypoints/client/bundle/utils.js +17 -6
  131. package/dest/entrypoints/client/lazy/index.d.ts +2 -1
  132. package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
  133. package/dest/entrypoints/client/lazy/index.js +1 -0
  134. package/dest/entrypoints/client/lazy/utils.d.ts +1 -1
  135. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  136. package/dest/entrypoints/client/lazy/utils.js +17 -6
  137. package/dest/entrypoints/client/store.d.ts +14 -0
  138. package/dest/entrypoints/client/store.d.ts.map +1 -0
  139. package/dest/entrypoints/client/store.js +42 -0
  140. package/dest/entrypoints/pxe_creation_options.d.ts +9 -3
  141. package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
  142. package/dest/entrypoints/server/index.d.ts +6 -3
  143. package/dest/entrypoints/server/index.d.ts.map +1 -1
  144. package/dest/entrypoints/server/index.js +4 -2
  145. package/dest/entrypoints/server/store.d.ts +18 -0
  146. package/dest/entrypoints/server/store.d.ts.map +1 -0
  147. package/dest/entrypoints/server/store.js +28 -0
  148. package/dest/entrypoints/server/utils.d.ts +1 -1
  149. package/dest/entrypoints/server/utils.d.ts.map +1 -1
  150. package/dest/entrypoints/server/utils.js +16 -4
  151. package/dest/error_enriching.d.ts +5 -3
  152. package/dest/error_enriching.d.ts.map +1 -1
  153. package/dest/error_enriching.js +13 -11
  154. package/dest/hooks/execution_hooks.d.ts +31 -11
  155. package/dest/hooks/execution_hooks.d.ts.map +1 -1
  156. package/dest/hooks/execution_hooks.js +3 -3
  157. package/dest/hooks/index.d.ts +4 -3
  158. package/dest/hooks/index.d.ts.map +1 -1
  159. package/dest/hooks/index.js +1 -0
  160. package/dest/hooks/resolve_custom_request.d.ts +23 -0
  161. package/dest/hooks/resolve_custom_request.d.ts.map +1 -0
  162. package/dest/hooks/resolve_custom_request.js +3 -0
  163. package/dest/hooks/resolve_tagging_secret_strategy.d.ts +50 -0
  164. package/dest/hooks/resolve_tagging_secret_strategy.d.ts.map +1 -0
  165. package/dest/hooks/resolve_tagging_secret_strategy.js +3 -0
  166. package/dest/logs/log_service.d.ts +8 -6
  167. package/dest/logs/log_service.d.ts.map +1 -1
  168. package/dest/logs/log_service.js +88 -28
  169. package/dest/messages/tx_resolver_service.d.ts +17 -0
  170. package/dest/messages/tx_resolver_service.d.ts.map +1 -0
  171. package/dest/messages/{message_context_service.js → tx_resolver_service.js} +13 -8
  172. package/dest/notes/note_service.d.ts +1 -1
  173. package/dest/notes/note_service.js +1 -1
  174. package/dest/oracle_version.d.ts +3 -3
  175. package/dest/oracle_version.js +5 -5
  176. package/dest/private_kernel/batch_planner.d.ts +1 -1
  177. package/dest/private_kernel/batch_planner.d.ts.map +1 -1
  178. package/dest/private_kernel/batch_planner.js +1 -1
  179. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +1 -1
  180. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -1
  181. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.js +6 -2
  182. package/dest/private_kernel/hints/test_utils.js +1 -1
  183. package/dest/private_kernel/private_kernel_execution_prover.d.ts +1 -1
  184. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
  185. package/dest/private_kernel/private_kernel_execution_prover.js +61 -40
  186. package/dest/private_kernel/private_kernel_oracle.d.ts +4 -2
  187. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
  188. package/dest/private_kernel/private_kernel_oracle.js +17 -5
  189. package/dest/pxe.d.ts +114 -48
  190. package/dest/pxe.d.ts.map +1 -1
  191. package/dest/pxe.js +225 -139
  192. package/dest/storage/allowed_scopes.d.ts +6 -0
  193. package/dest/storage/allowed_scopes.d.ts.map +1 -0
  194. package/dest/storage/allowed_scopes.js +7 -0
  195. package/dest/storage/anchor_block_store/anchor_block_store.d.ts +9 -6
  196. package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -1
  197. package/dest/storage/anchor_block_store/anchor_block_store.js +8 -6
  198. package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts +1 -1
  199. package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts.map +1 -1
  200. package/dest/storage/backwards_compatibility_tests/schema_tests.js +129 -49
  201. package/dest/storage/capsule_store/capsule_service.d.ts +1 -1
  202. package/dest/storage/capsule_store/capsule_service.d.ts.map +1 -1
  203. package/dest/storage/capsule_store/capsule_service.js +6 -9
  204. package/dest/storage/contract_store/contract_store.d.ts +27 -24
  205. package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
  206. package/dest/storage/contract_store/contract_store.js +64 -75
  207. package/dest/storage/fact_store/fact_service.d.ts +22 -0
  208. package/dest/storage/fact_store/fact_service.d.ts.map +1 -0
  209. package/dest/storage/fact_store/fact_service.js +45 -0
  210. package/dest/storage/fact_store/fact_store.d.ts +95 -0
  211. package/dest/storage/fact_store/fact_store.d.ts.map +1 -0
  212. package/dest/storage/fact_store/fact_store.js +408 -0
  213. package/dest/storage/fact_store/fact_store_keys.d.ts +34 -0
  214. package/dest/storage/fact_store/fact_store_keys.d.ts.map +1 -0
  215. package/dest/storage/fact_store/fact_store_keys.js +50 -0
  216. package/dest/storage/fact_store/index.d.ts +6 -0
  217. package/dest/storage/fact_store/index.d.ts.map +1 -0
  218. package/dest/storage/fact_store/index.js +4 -0
  219. package/dest/storage/fact_store/origin_state.d.ts +59 -0
  220. package/dest/storage/fact_store/origin_state.d.ts.map +1 -0
  221. package/dest/storage/fact_store/origin_state.js +60 -0
  222. package/dest/storage/fact_store/stored_fact.d.ts +32 -0
  223. package/dest/storage/fact_store/stored_fact.d.ts.map +1 -0
  224. package/dest/storage/fact_store/stored_fact.js +64 -0
  225. package/dest/storage/index.d.ts +3 -2
  226. package/dest/storage/index.d.ts.map +1 -1
  227. package/dest/storage/index.js +2 -1
  228. package/dest/storage/metadata.d.ts +2 -2
  229. package/dest/storage/metadata.d.ts.map +1 -1
  230. package/dest/storage/metadata.js +1 -1
  231. package/dest/storage/note_store/note_store.d.ts +42 -33
  232. package/dest/storage/note_store/note_store.d.ts.map +1 -1
  233. package/dest/storage/note_store/note_store.js +197 -168
  234. package/dest/storage/note_store/stored_note.d.ts +3 -8
  235. package/dest/storage/note_store/stored_note.d.ts.map +1 -1
  236. package/dest/storage/note_store/stored_note.js +4 -20
  237. package/dest/storage/open_pxe_stores.d.ts +5 -3
  238. package/dest/storage/open_pxe_stores.d.ts.map +1 -1
  239. package/dest/storage/open_pxe_stores.js +5 -3
  240. package/dest/storage/private_event_store/private_event_store.d.ts +13 -16
  241. package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -1
  242. package/dest/storage/private_event_store/private_event_store.js +40 -43
  243. package/dest/storage/store_identity.d.ts +35 -0
  244. package/dest/storage/store_identity.d.ts.map +1 -0
  245. package/dest/storage/store_identity.js +44 -0
  246. package/dest/storage/tagging_store/index.d.ts +2 -2
  247. package/dest/storage/tagging_store/index.d.ts.map +1 -1
  248. package/dest/storage/tagging_store/index.js +1 -1
  249. package/dest/storage/tagging_store/sender_tagging_store.d.ts +19 -3
  250. package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
  251. package/dest/storage/tagging_store/sender_tagging_store.js +48 -11
  252. package/dest/storage/tagging_store/tagging_secret_sources_store.d.ts +51 -0
  253. package/dest/storage/tagging_store/tagging_secret_sources_store.d.ts.map +1 -0
  254. package/dest/storage/tagging_store/tagging_secret_sources_store.js +105 -0
  255. package/dest/tagging/constants.d.ts +3 -2
  256. package/dest/tagging/constants.d.ts.map +1 -1
  257. package/dest/tagging/constants.js +28 -10
  258. package/dest/tagging/index.d.ts +2 -2
  259. package/dest/tagging/index.d.ts.map +1 -1
  260. package/dest/tagging/index.js +1 -1
  261. package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts +26 -8
  262. package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts.map +1 -1
  263. package/dest/tagging/recipient_sync/sync_tagged_private_logs.js +95 -20
  264. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +1 -1
  265. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +1 -1
  266. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -1
  267. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +6 -2
  268. package/dest/tagging/testing/tag_query_test_utils.d.ts +6 -0
  269. package/dest/tagging/testing/tag_query_test_utils.d.ts.map +1 -0
  270. package/dest/tagging/testing/tag_query_test_utils.js +10 -0
  271. package/package.json +17 -17
  272. package/src/bin/check_oracle_version.ts +8 -24
  273. package/src/bin/index.ts +1 -1
  274. package/src/bin/oracle_version_helpers.ts +23 -90
  275. package/src/block_synchronizer/block_stream_source.ts +6 -45
  276. package/src/block_synchronizer/block_synchronizer.ts +70 -29
  277. package/src/config/index.ts +1 -0
  278. package/src/contract/contract_class_service.ts +83 -0
  279. package/src/{contract_sync → contract}/contract_sync_service.ts +37 -50
  280. package/src/contract/helpers.ts +35 -0
  281. package/src/contract/skip_sync_contracts.ts +23 -0
  282. package/src/contract_function_simulator/anchored_contract_data.ts +74 -0
  283. package/src/contract_function_simulator/aztec_node_read_cache.ts +89 -0
  284. package/src/contract_function_simulator/contract_function_simulator.ts +96 -42
  285. package/src/contract_function_simulator/execution_note_cache.ts +7 -28
  286. package/src/contract_function_simulator/index.ts +48 -13
  287. package/src/contract_function_simulator/noir-structs/bounded_vec.ts +12 -24
  288. package/src/contract_function_simulator/noir-structs/contract_class_log_data.ts +9 -0
  289. package/src/contract_function_simulator/noir-structs/embedded_curve_point.ts +4 -0
  290. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +1 -1
  291. package/src/contract_function_simulator/noir-structs/fact.ts +13 -0
  292. package/src/contract_function_simulator/noir-structs/fact_collection.ts +64 -0
  293. package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +20 -46
  294. package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +13 -60
  295. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +2 -2
  296. package/src/contract_function_simulator/noir-structs/option.ts +17 -11
  297. package/src/contract_function_simulator/noir-structs/origin_block.ts +8 -0
  298. package/src/contract_function_simulator/noir-structs/pending_tagged_log.ts +12 -0
  299. package/src/contract_function_simulator/noir-structs/provided_secret.ts +4 -26
  300. package/src/contract_function_simulator/noir-structs/resolved_tagging_strategy.ts +66 -0
  301. package/src/contract_function_simulator/noir-structs/resolved_tx.ts +19 -0
  302. package/src/contract_function_simulator/noir-structs/tx_effect_data.ts +16 -0
  303. package/src/contract_function_simulator/noir-structs/utility_context.ts +5 -17
  304. package/src/contract_function_simulator/oracle/acir_callback.ts +154 -0
  305. package/src/contract_function_simulator/oracle/index.ts +1 -15
  306. package/src/contract_function_simulator/oracle/interfaces.ts +1 -2
  307. package/src/contract_function_simulator/oracle/legacy_oracle_registry.ts +147 -0
  308. package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +6 -21
  309. package/src/contract_function_simulator/oracle/oracle_registry.ts +172 -47
  310. package/src/contract_function_simulator/oracle/oracle_type_mappings.ts +814 -315
  311. package/src/contract_function_simulator/oracle/private_execution.ts +2 -3
  312. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +167 -30
  313. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +399 -135
  314. package/src/contract_function_simulator/transient_array_service.ts +91 -0
  315. package/src/debug/pxe_debug_utils.ts +1 -1
  316. package/src/entrypoints/client/bundle/index.ts +1 -0
  317. package/src/entrypoints/client/bundle/utils.ts +24 -5
  318. package/src/entrypoints/client/lazy/index.ts +1 -0
  319. package/src/entrypoints/client/lazy/utils.ts +24 -5
  320. package/src/entrypoints/client/store.ts +54 -0
  321. package/src/entrypoints/pxe_creation_options.ts +8 -2
  322. package/src/entrypoints/server/index.ts +6 -2
  323. package/src/entrypoints/server/store.ts +47 -0
  324. package/src/entrypoints/server/utils.ts +31 -9
  325. package/src/error_enriching.ts +27 -11
  326. package/src/hooks/execution_hooks.ts +32 -12
  327. package/src/hooks/index.ts +8 -2
  328. package/src/hooks/resolve_custom_request.ts +24 -0
  329. package/src/hooks/resolve_tagging_secret_strategy.ts +60 -0
  330. package/src/logs/log_service.ts +100 -37
  331. package/src/messages/{message_context_service.ts → tx_resolver_service.ts} +16 -9
  332. package/src/notes/note_service.ts +1 -1
  333. package/src/oracle_version.ts +5 -5
  334. package/src/private_kernel/batch_planner.ts +0 -1
  335. package/src/private_kernel/hints/private_kernel_reset_private_inputs_builder.ts +11 -1
  336. package/src/private_kernel/hints/test_utils.ts +1 -1
  337. package/src/private_kernel/private_kernel_execution_prover.ts +112 -56
  338. package/src/private_kernel/private_kernel_oracle.ts +23 -4
  339. package/src/pxe.ts +328 -159
  340. package/src/storage/allowed_scopes.ts +14 -0
  341. package/src/storage/anchor_block_store/anchor_block_store.ts +8 -6
  342. package/src/storage/backwards_compatibility_tests/__snapshots__/AddressStore.json +6 -6
  343. package/src/storage/backwards_compatibility_tests/__snapshots__/ContractStore.json +1 -1
  344. package/src/storage/backwards_compatibility_tests/__snapshots__/FactStore.json +40 -0
  345. package/src/storage/backwards_compatibility_tests/__snapshots__/KeyStore.json +12 -12
  346. package/src/storage/backwards_compatibility_tests/__snapshots__/L2TipsKVStore.json +9 -15
  347. package/src/storage/backwards_compatibility_tests/__snapshots__/NoteStore.json +24 -4
  348. package/src/storage/backwards_compatibility_tests/__snapshots__/RecipientTaggingStore.json +11 -3
  349. package/src/storage/backwards_compatibility_tests/__snapshots__/SenderTaggingStore.json +12 -4
  350. package/src/storage/backwards_compatibility_tests/__snapshots__/TaggingSecretSourcesStore.json +30 -0
  351. package/src/storage/backwards_compatibility_tests/__snapshots__/opened_stores.json +29 -9
  352. package/src/storage/backwards_compatibility_tests/schema_tests.ts +141 -50
  353. package/src/storage/capsule_store/capsule_service.ts +8 -13
  354. package/src/storage/contract_store/contract_store.ts +86 -93
  355. package/src/storage/fact_store/fact_service.ts +69 -0
  356. package/src/storage/fact_store/fact_store.ts +487 -0
  357. package/src/storage/fact_store/fact_store_keys.ts +75 -0
  358. package/src/storage/fact_store/index.ts +15 -0
  359. package/src/storage/fact_store/origin_state.ts +84 -0
  360. package/src/storage/fact_store/stored_fact.ts +80 -0
  361. package/src/storage/index.ts +2 -1
  362. package/src/storage/metadata.ts +1 -1
  363. package/src/storage/note_store/note_store.ts +226 -187
  364. package/src/storage/note_store/stored_note.ts +5 -27
  365. package/src/storage/open_pxe_stores.ts +6 -3
  366. package/src/storage/private_event_store/private_event_store.ts +49 -55
  367. package/src/storage/store_identity.ts +72 -0
  368. package/src/storage/tagging_store/index.ts +1 -1
  369. package/src/storage/tagging_store/sender_tagging_store.ts +62 -15
  370. package/src/storage/tagging_store/tagging_secret_sources_store.ts +138 -0
  371. package/src/tagging/constants.ts +30 -10
  372. package/src/tagging/index.ts +1 -1
  373. package/src/tagging/recipient_sync/sync_tagged_private_logs.ts +148 -30
  374. package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +1 -1
  375. package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +6 -2
  376. package/src/tagging/testing/tag_query_test_utils.ts +11 -0
  377. package/dest/contract_function_simulator/oracle/oracle.d.ts +0 -89
  378. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +0 -1
  379. package/dest/contract_function_simulator/oracle/oracle.js +0 -552
  380. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +0 -6
  381. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +0 -1
  382. package/dest/contract_function_simulator/proxied_contract_data_source.js +0 -51
  383. package/dest/contract_sync/contract_sync_service.d.ts +0 -42
  384. package/dest/contract_sync/contract_sync_service.d.ts.map +0 -1
  385. package/dest/contract_sync/helpers.d.ts +0 -27
  386. package/dest/contract_sync/helpers.d.ts.map +0 -1
  387. package/dest/contract_sync/helpers.js +0 -53
  388. package/dest/messages/message_context_service.d.ts +0 -17
  389. package/dest/messages/message_context_service.d.ts.map +0 -1
  390. package/dest/storage/tagging_store/sender_address_book_store.d.ts +0 -14
  391. package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +0 -1
  392. package/dest/storage/tagging_store/sender_address_book_store.js +0 -36
  393. package/src/contract_function_simulator/oracle/oracle.ts +0 -711
  394. package/src/contract_function_simulator/proxied_contract_data_source.ts +0 -60
  395. package/src/contract_sync/helpers.ts +0 -86
  396. package/src/storage/backwards_compatibility_tests/__snapshots__/SenderAddressBookStore.json +0 -16
  397. package/src/storage/tagging_store/sender_address_book_store.ts +0 -48
@@ -1,10 +1,28 @@
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;
1
+ import { MAX_PRIVATE_LOGS_PER_TX } from '@aztec/constants';
2
+ // This window bounds how far a sender's next tag index for a directional app tagging secret can run ahead of that
3
+ // secret's highest finalized index before `PXE::proveTx` throws.
4
+ //
5
+ // MAX_PRIVATE_LOGS_PER_TX is a floor for ordinary transaction patterns: the private kernel accumulates every
6
+ // surviving private log into a single tx-wide array of exactly this size, so a fresh secret's very first
7
+ // ordinary tx can consume that many indexes before anything is finalized.
8
+ //
9
+ // The +20 on top is headroom for multiple pending ordinary txs to the same counterparty stacking up
10
+ // before the first one is observed as mined. Only a run of near-MAX_PRIVATE_LOGS_PER_TX txs back-to-back would
11
+ // exhaust this; ordinary transfers use far fewer logs per tx, so the same margin covers many more of those. Keep the
12
+ // margin additive rather than another multiple of the floor. A larger window also makes recipient-side sync more
13
+ // expensive, since discovery has to probe ahead of the last finalized index for every active secret.
14
+ //
15
+ // TODO(F-783): MAX_PRIVATE_LOGS_PER_TX is not a hard ceiling in general — a tx that creates and nullifies (squashes)
16
+ // many notes/logs to the same secret can drive that secret's raw tag index arbitrarily higher, since indexes are
17
+ // reserved at log emission time, before squashing is decided, and the kernel's reset/squash loop is not bounded by
18
+ // MAX_PRIVATE_LOGS_PER_TX. No fixed window value closes that gap.
19
+ export const UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN = MAX_PRIVATE_LOGS_PER_TX + 20;
20
+ // The number of tags probed per constrained secret in the first round.
21
+ //
22
+ // The probe doubles each round (2, 4, 8, ..., capped at UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN) while every probed
23
+ // index is a hit, stopping at the first missing tag. Constrained delivery is gapless, so a single missing tag proves
24
+ // the stream has ended: at steady state this turns a full WINDOW_LEN probe into two tags. A secret K logs behind
25
+ // catches up in ~log2(K) round-trips while the probe is still doubling (2, 4, 8, 16, 32), but once it saturates the cap
26
+ // and advances WINDOW_LEN tags per round, deeper catch-up is linear at ~K/WINDOW_LEN rounds. Either way it beats both
27
+ // the full window every round and one round per log.
28
+ export const INITIAL_CONSTRAINED_PROBE_LEN = 2;
@@ -11,8 +11,8 @@
11
11
  export { syncTaggedPrivateLogs } from './recipient_sync/sync_tagged_private_logs.js';
12
12
  export { syncSenderTaggingIndexes } from './sender_sync/sync_sender_tagging_indexes.js';
13
13
  export { persistSenderTaggingIndexRangesForTx } from './persist_sender_tagging_index_ranges.js';
14
- export { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from './constants.js';
14
+ export { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN, INITIAL_CONSTRAINED_PROBE_LEN } from './constants.js';
15
15
  export { getAllPrivateLogsByTags, getAllPublicLogsByTagsFromContract } from './get_all_logs_by_tags.js';
16
16
  export { AppTaggingSecret, Tag, SiloedTag } from '@aztec/stdlib/logs';
17
17
  export { type PreTag, type TaggingIndexRange } from '@aztec/stdlib/logs';
18
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90YWdnaW5nL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7Ozs7R0FTRztBQUVILE9BQU8sRUFBRSxxQkFBcUIsRUFBRSxNQUFNLDhDQUE4QyxDQUFDO0FBQ3JGLE9BQU8sRUFBRSx3QkFBd0IsRUFBRSxNQUFNLDhDQUE4QyxDQUFDO0FBQ3hGLE9BQU8sRUFBRSxvQ0FBb0MsRUFBRSxNQUFNLDBDQUEwQyxDQUFDO0FBQ2hHLE9BQU8sRUFBRSxzQ0FBc0MsRUFBRSxNQUFNLGdCQUFnQixDQUFDO0FBQ3hFLE9BQU8sRUFBRSx1QkFBdUIsRUFBRSxrQ0FBa0MsRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBR3hHLE9BQU8sRUFBRSxnQkFBZ0IsRUFBRSxHQUFHLEVBQUUsU0FBUyxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFDdEUsT0FBTyxFQUFFLEtBQUssTUFBTSxFQUFFLEtBQUssaUJBQWlCLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQyJ9
18
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90YWdnaW5nL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7Ozs7R0FTRztBQUVILE9BQU8sRUFBRSxxQkFBcUIsRUFBRSxNQUFNLDhDQUE4QyxDQUFDO0FBQ3JGLE9BQU8sRUFBRSx3QkFBd0IsRUFBRSxNQUFNLDhDQUE4QyxDQUFDO0FBQ3hGLE9BQU8sRUFBRSxvQ0FBb0MsRUFBRSxNQUFNLDBDQUEwQyxDQUFDO0FBQ2hHLE9BQU8sRUFBRSxzQ0FBc0MsRUFBRSw2QkFBNkIsRUFBRSxNQUFNLGdCQUFnQixDQUFDO0FBQ3ZHLE9BQU8sRUFBRSx1QkFBdUIsRUFBRSxrQ0FBa0MsRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBR3hHLE9BQU8sRUFBRSxnQkFBZ0IsRUFBRSxHQUFHLEVBQUUsU0FBUyxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFDdEUsT0FBTyxFQUFFLEtBQUssTUFBTSxFQUFFLEtBQUssaUJBQWlCLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQyJ9
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tagging/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AACrF,OAAO,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,EAAE,oCAAoC,EAAE,MAAM,0CAA0C,CAAC;AAChG,OAAO,EAAE,sCAAsC,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,kCAAkC,EAAE,MAAM,2BAA2B,CAAC;AAGxG,OAAO,EAAE,gBAAgB,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tagging/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AACrF,OAAO,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,EAAE,oCAAoC,EAAE,MAAM,0CAA0C,CAAC;AAChG,OAAO,EAAE,sCAAsC,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAC;AACvG,OAAO,EAAE,uBAAuB,EAAE,kCAAkC,EAAE,MAAM,2BAA2B,CAAC;AAGxG,OAAO,EAAE,gBAAgB,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAC"}
@@ -10,7 +10,7 @@
10
10
  */ export { syncTaggedPrivateLogs } from './recipient_sync/sync_tagged_private_logs.js';
11
11
  export { syncSenderTaggingIndexes } from './sender_sync/sync_sender_tagging_indexes.js';
12
12
  export { persistSenderTaggingIndexRangesForTx } from './persist_sender_tagging_index_ranges.js';
13
- export { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from './constants.js';
13
+ export { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN, INITIAL_CONSTRAINED_PROBE_LEN } from './constants.js';
14
14
  export { getAllPrivateLogsByTags, getAllPublicLogsByTagsFromContract } from './get_all_logs_by_tags.js';
15
15
  // Re-export tagging-related types from stdlib
16
16
  export { AppTaggingSecret, Tag, SiloedTag } from '@aztec/stdlib/logs';
@@ -5,11 +5,12 @@ import type { BlockHeader } from '@aztec/stdlib/tx';
5
5
  import type { RecipientTaggingStore } from '../../storage/tagging_store/recipient_tagging_store.js';
6
6
  /**
7
7
  * Fetches and syncs tagged private logs for multiple sender-recipient pairs, batching tag queries across all secrets
8
- * into shared RPC calls.
8
+ * into shared RPC calls. Handles both constrained and unconstrained secrets, which differ in their scan strategy
9
+ * but share the same batching infrastructure.
9
10
  *
10
- * # Explanation of how the algorithm works
11
+ * # Unconstrained secrets
11
12
  *
12
- * For each secret we sync logs that correspond to the tagging index range
13
+ * For each unconstrained secret we sync logs that correspond to the tagging index range
13
14
  * (highestAgedIndex, highestFinalizedIndex + WINDOW_LEN]
14
15
  *
15
16
  * highestAgedIndex is the highest index that was used in a tx that is included in a block at least
@@ -46,11 +47,28 @@ import type { RecipientTaggingStore } from '../../storage/tagging_store/recipien
46
47
  * the highest finalized index. If that index was already used, they will throw an error. For this reason we
47
48
  * don't have to look further than `highestFinalizedIndex + WINDOW_LEN`.
48
49
  *
49
- * ## Batching across secrets
50
+ * # Constrained secrets
50
51
  *
51
- * Instead of running one RPC call per secret, we merge tags from all pending secrets into a single flat array,
52
- * make one batched `getAllPrivateLogsByTags` call (which internally chunks at MAX_RPC_LEN), then split results
53
- * back per secret using tracked offsets. Only secrets whose window advanced are kept for the next iteration.
52
+ * Constrained delivery enforces a contiguous index sequence (each send proves the predecessor's nullifier,
53
+ * chaining back to the handshake), so there is only one sender and indexes are sequential. This means:
54
+ * - The lower bound is `highestFinalizedIndex + 1`. The `highestAgedIndex` mechanism is unnecessary because
55
+ * the nullifier chain prevents out-of-order index usage: no device can fill in a lower index after a higher
56
+ * one is already on-chain.
57
+ * - Because the sequence is gapless, the scan stops at the first missing index: that gap proves the sequence has
58
+ * ended and no further logs exist. We exploit this with a doubling first-miss probe (see
59
+ * `INITIAL_CONSTRAINED_PROBE_LEN` in ../constants.ts), so a
60
+ * steady-state sync with no new logs costs two tags instead of the whole window. The probe length is in-memory
61
+ * state scoped to one sync call, so every sync restarts at the initial probe.
62
+ * - The upper bound is the same as unconstrained: `highestFinalizedIndex + WINDOW_LEN`. Advancing the probe is
63
+ * decoupled from persisting the finalized index, so unfinalized logs at the top of the run are still fetched
64
+ * while only the finalized prefix is persisted.
65
+ *
66
+ * # Batching across secrets
67
+ *
68
+ * Instead of running one RPC call per secret, we merge tags from all pending secrets (both constrained and
69
+ * unconstrained) into a single flat array, make one batched `getAllPrivateLogsByTags` call (which internally
70
+ * chunks at MAX_RPC_LEN), then split results back per secret using tracked offsets. Only secrets whose window
71
+ * advanced are kept for the next iteration.
54
72
  */
55
73
  export declare function syncTaggedPrivateLogs(secrets: AppTaggingSecret[], aztecNode: AztecNode, taggingStore: RecipientTaggingStore, anchorBlockHeader: BlockHeader, finalizedBlockNumber: BlockNumber, jobId: string): Promise<LogResult[]>;
56
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3luY190YWdnZWRfcHJpdmF0ZV9sb2dzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvdGFnZ2luZy9yZWNpcGllbnRfc3luYy9zeW5jX3RhZ2dlZF9wcml2YXRlX2xvZ3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFdBQVcsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBRzlELE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQ2pFLE9BQU8sS0FBSyxFQUFFLGdCQUFnQixFQUFFLFNBQVMsRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBRXRFLE9BQU8sS0FBSyxFQUFFLFdBQVcsRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBRXBELE9BQU8sS0FBSyxFQUFFLHFCQUFxQixFQUFFLE1BQU0sd0RBQXdELENBQUM7QUFLcEc7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztHQWdERztBQUNILHdCQUFzQixxQkFBcUIsQ0FDekMsT0FBTyxFQUFFLGdCQUFnQixFQUFFLEVBQzNCLFNBQVMsRUFBRSxTQUFTLEVBQ3BCLFlBQVksRUFBRSxxQkFBcUIsRUFDbkMsaUJBQWlCLEVBQUUsV0FBVyxFQUM5QixvQkFBb0IsRUFBRSxXQUFXLEVBQ2pDLEtBQUssRUFBRSxNQUFNLEdBQ1osT0FBTyxDQUFDLFNBQVMsRUFBRSxDQUFDLENBNEN0QiJ9
74
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3luY190YWdnZWRfcHJpdmF0ZV9sb2dzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvdGFnZ2luZy9yZWNpcGllbnRfc3luYy9zeW5jX3RhZ2dlZF9wcml2YXRlX2xvZ3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFdBQVcsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBRzlELE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQ2pFLE9BQU8sS0FBSyxFQUFFLGdCQUFnQixFQUFFLFNBQVMsRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBRXRFLE9BQU8sS0FBSyxFQUFFLFdBQVcsRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBRXBELE9BQU8sS0FBSyxFQUFFLHFCQUFxQixFQUFFLE1BQU0sd0RBQXdELENBQUM7QUFLcEc7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztHQWtFRztBQUNILHdCQUFzQixxQkFBcUIsQ0FDekMsT0FBTyxFQUFFLGdCQUFnQixFQUFFLEVBQzNCLFNBQVMsRUFBRSxTQUFTLEVBQ3BCLFlBQVksRUFBRSxxQkFBcUIsRUFDbkMsaUJBQWlCLEVBQUUsV0FBVyxFQUM5QixvQkFBb0IsRUFBRSxXQUFXLEVBQ2pDLEtBQUssRUFBRSxNQUFNLEdBQ1osT0FBTyxDQUFDLFNBQVMsRUFBRSxDQUFDLENBcUR0QiJ9
@@ -1 +1 @@
1
- {"version":3,"file":"sync_tagged_private_logs.d.ts","sourceRoot":"","sources":["../../../src/tagging/recipient_sync/sync_tagged_private_logs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAG9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wDAAwD,CAAC;AAKpG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,gBAAgB,EAAE,EAC3B,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,qBAAqB,EACnC,iBAAiB,EAAE,WAAW,EAC9B,oBAAoB,EAAE,WAAW,EACjC,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,SAAS,EAAE,CAAC,CA4CtB"}
1
+ {"version":3,"file":"sync_tagged_private_logs.d.ts","sourceRoot":"","sources":["../../../src/tagging/recipient_sync/sync_tagged_private_logs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAG9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wDAAwD,CAAC;AAKpG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,gBAAgB,EAAE,EAC3B,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,qBAAqB,EACnC,iBAAiB,EAAE,WAAW,EAC9B,oBAAoB,EAAE,WAAW,EACjC,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,SAAS,EAAE,CAAC,CAqDtB"}
@@ -1,16 +1,17 @@
1
1
  import { BlockNumber } from '@aztec/foundation/branded-types';
2
2
  import { isDefined } from '@aztec/foundation/types';
3
- import { SiloedTag } from '@aztec/stdlib/logs';
4
- import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../constants.js';
3
+ import { AppTaggingSecretKind, SiloedTag } from '@aztec/stdlib/logs';
4
+ import { INITIAL_CONSTRAINED_PROBE_LEN, UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../constants.js';
5
5
  import { getAllPrivateLogsByTags } from '../get_all_logs_by_tags.js';
6
6
  import { findHighestIndexes } from './utils/find_highest_indexes.js';
7
7
  /**
8
8
  * Fetches and syncs tagged private logs for multiple sender-recipient pairs, batching tag queries across all secrets
9
- * into shared RPC calls.
9
+ * into shared RPC calls. Handles both constrained and unconstrained secrets, which differ in their scan strategy
10
+ * but share the same batching infrastructure.
10
11
  *
11
- * # Explanation of how the algorithm works
12
+ * # Unconstrained secrets
12
13
  *
13
- * For each secret we sync logs that correspond to the tagging index range
14
+ * For each unconstrained secret we sync logs that correspond to the tagging index range
14
15
  * (highestAgedIndex, highestFinalizedIndex + WINDOW_LEN]
15
16
  *
16
17
  * highestAgedIndex is the highest index that was used in a tx that is included in a block at least
@@ -47,11 +48,28 @@ import { findHighestIndexes } from './utils/find_highest_indexes.js';
47
48
  * the highest finalized index. If that index was already used, they will throw an error. For this reason we
48
49
  * don't have to look further than `highestFinalizedIndex + WINDOW_LEN`.
49
50
  *
50
- * ## Batching across secrets
51
+ * # Constrained secrets
51
52
  *
52
- * Instead of running one RPC call per secret, we merge tags from all pending secrets into a single flat array,
53
- * make one batched `getAllPrivateLogsByTags` call (which internally chunks at MAX_RPC_LEN), then split results
54
- * back per secret using tracked offsets. Only secrets whose window advanced are kept for the next iteration.
53
+ * Constrained delivery enforces a contiguous index sequence (each send proves the predecessor's nullifier,
54
+ * chaining back to the handshake), so there is only one sender and indexes are sequential. This means:
55
+ * - The lower bound is `highestFinalizedIndex + 1`. The `highestAgedIndex` mechanism is unnecessary because
56
+ * the nullifier chain prevents out-of-order index usage: no device can fill in a lower index after a higher
57
+ * one is already on-chain.
58
+ * - Because the sequence is gapless, the scan stops at the first missing index: that gap proves the sequence has
59
+ * ended and no further logs exist. We exploit this with a doubling first-miss probe (see
60
+ * `INITIAL_CONSTRAINED_PROBE_LEN` in ../constants.ts), so a
61
+ * steady-state sync with no new logs costs two tags instead of the whole window. The probe length is in-memory
62
+ * state scoped to one sync call, so every sync restarts at the initial probe.
63
+ * - The upper bound is the same as unconstrained: `highestFinalizedIndex + WINDOW_LEN`. Advancing the probe is
64
+ * decoupled from persisting the finalized index, so unfinalized logs at the top of the run are still fetched
65
+ * while only the finalized prefix is persisted.
66
+ *
67
+ * # Batching across secrets
68
+ *
69
+ * Instead of running one RPC call per secret, we merge tags from all pending secrets (both constrained and
70
+ * unconstrained) into a single flat array, make one batched `getAllPrivateLogsByTags` call (which internally
71
+ * chunks at MAX_RPC_LEN), then split results back per secret using tracked offsets. Only secrets whose window
72
+ * advanced are kept for the next iteration.
55
73
  */ export async function syncTaggedPrivateLogs(secrets, aztecNode, taggingStore, anchorBlockHeader, finalizedBlockNumber, jobId) {
56
74
  if (secrets.length === 0) {
57
75
  return [];
@@ -74,7 +92,7 @@ import { findHighestIndexes } from './utils/find_highest_indexes.js';
74
92
  allLogs.push(...logsFoundWithSecret.map(({ log })=>log));
75
93
  // Persist new indexes. If the finalized index moved forward, the window advances
76
94
  // and we need another round for this secret.
77
- return await updateIndexesAndAdvanceWindow(pendingSecret, logsFoundWithSecret, taggingStore, currentTimestamp, finalizedBlockNumber, jobId);
95
+ return pendingSecret.kind === AppTaggingSecretKind.CONSTRAINED ? await processConstrainedResults(pendingSecret, logsFoundWithSecret, taggingStore, currentTimestamp, finalizedBlockNumber, jobId) : await processUnconstrainedResults(pendingSecret, logsFoundWithSecret, taggingStore, currentTimestamp, finalizedBlockNumber, jobId);
78
96
  }));
79
97
  pending = nextRound.filter(isDefined);
80
98
  }
@@ -82,16 +100,30 @@ import { findHighestIndexes } from './utils/find_highest_indexes.js';
82
100
  }
83
101
  /** Reads stored indexes for each secret and computes the initial index range to query. */ function getIndexRangesForSecrets(secrets, taggingStore, jobId) {
84
102
  return Promise.all(secrets.map(async (secret)=>{
85
- const [currentHighestAgedIndex, currentHighestFinalizedIndex] = await Promise.all([
86
- taggingStore.getHighestAgedIndex(secret, jobId),
87
- taggingStore.getHighestFinalizedIndex(secret, jobId)
88
- ]);
89
- const start = currentHighestAgedIndex === undefined ? 0 : currentHighestAgedIndex + 1;
90
- const end = (currentHighestFinalizedIndex ?? 0) + UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN + 1;
103
+ const currentHighestFinalizedIndex = await taggingStore.getHighestFinalizedIndex(secret, jobId);
104
+ const boundEnd = (currentHighestFinalizedIndex ?? 0) + UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN + 1;
105
+ if (secret.kind === AppTaggingSecretKind.CONSTRAINED) {
106
+ // Constrained streams are gapless and resume at the finalized index, so probe a small initial window and stop
107
+ // at the first missing tag instead of always fetching the full window. The probe grows each round up to the
108
+ // window cap.
109
+ const start = currentHighestFinalizedIndex === undefined ? 0 : currentHighestFinalizedIndex + 1;
110
+ return {
111
+ kind: AppTaggingSecretKind.CONSTRAINED,
112
+ secret,
113
+ start,
114
+ end: Math.min(boundEnd, start + INITIAL_CONSTRAINED_PROBE_LEN),
115
+ boundEnd,
116
+ probeLen: INITIAL_CONSTRAINED_PROBE_LEN
117
+ };
118
+ }
119
+ // Unconstrained secrets can have gaps, so they scan the whole window starting past the highest aged index.
120
+ const highestAgedIndex = await taggingStore.getHighestAgedIndex(secret, jobId);
121
+ const start = highestAgedIndex === undefined ? 0 : highestAgedIndex + 1;
91
122
  return {
123
+ kind: AppTaggingSecretKind.UNCONSTRAINED,
92
124
  secret,
93
125
  start,
94
- end
126
+ end: boundEnd
95
127
  };
96
128
  }));
97
129
  }
@@ -136,9 +168,50 @@ import { findHighestIndexes } from './utils/find_highest_indexes.js';
136
168
  return logsPerSecret;
137
169
  }
138
170
  /**
139
- * Processes a single secret's fetched logs: updates stored indexes and returns a new PendingSecret
171
+ * Processes fetched logs for a constrained secret: persists the finalized index and advances the probe. See the
172
+ * "# Constrained secrets" section above for why the scan stops at the first missing index. Only `highestFinalizedIndex`
173
+ * is tracked (no aged index).
174
+ */ async function processConstrainedResults(pending, logsWithIndexes, taggingStore, currentTimestamp, finalizedBlockNumber, jobId) {
175
+ // Find where the contiguous run of indexes ends; all logs in the batch fall within this prefix.
176
+ const indexesWithLogs = new Set(logsWithIndexes.map((l)=>l.taggingIndex));
177
+ let firstMissingIndex = pending.start;
178
+ while(firstMissingIndex < pending.end && indexesWithLogs.has(firstMissingIndex)){
179
+ firstMissingIndex++;
180
+ }
181
+ // Persist the highest finalized index found. The nullifier for a constrained-delivery log is emitted in the same
182
+ // transaction, guaranteeing the log cannot disappear once included, so we persist even when a gap stops the scan.
183
+ // This lets the next sync round skip already-finalized indexes.
184
+ const { highestFinalizedIndex } = findHighestIndexes(logsWithIndexes, currentTimestamp, finalizedBlockNumber);
185
+ if (highestFinalizedIndex !== undefined) {
186
+ await taggingStore.updateHighestFinalizedIndex(pending.secret, highestFinalizedIndex, jobId);
187
+ }
188
+ // Advancing the probe is decoupled from persisting the finalized index: keep scanning as long as the probe was
189
+ // entirely hits (no gap) and there is room before the protocol bound, even if none of those hits is finalized yet.
190
+ // Gating this on finalization would drop logs in unfinalized blocks, which sit at the top of the contiguous run.
191
+ // The bound re-anchors to any finalized index found this round.
192
+ const probeFullyConsumed = firstMissingIndex >= pending.end;
193
+ const boundEnd = highestFinalizedIndex !== undefined ? Math.max(pending.boundEnd, highestFinalizedIndex + UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN + 1) : pending.boundEnd;
194
+ // Double the probe each round, capped at the window (see INITIAL_CONSTRAINED_PROBE_LEN in ../constants.ts).
195
+ // The queried range is already bounded by boundEnd (a probe can never reach
196
+ // more than WINDOW_LEN past the finalized frontier); this cap just keeps the stored length from growing unbounded
197
+ // once the probe saturates the window.
198
+ const nextProbeLen = Math.min(pending.probeLen * 2, UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN);
199
+ if (probeFullyConsumed && pending.end < boundEnd) {
200
+ return {
201
+ kind: AppTaggingSecretKind.CONSTRAINED,
202
+ secret: pending.secret,
203
+ start: pending.end,
204
+ end: Math.min(boundEnd, pending.end + nextProbeLen),
205
+ boundEnd,
206
+ probeLen: nextProbeLen
207
+ };
208
+ }
209
+ return undefined;
210
+ }
211
+ /**
212
+ * Processes a single unconstrained secret's fetched logs: updates stored indexes and returns a new PendingSecret
140
213
  * if the window needs to advance, or undefined if this secret is done.
141
- */ async function updateIndexesAndAdvanceWindow(pending, logsWithIndexes, taggingStore, currentTimestamp, finalizedBlockNumber, jobId) {
214
+ */ async function processUnconstrainedResults(pending, logsWithIndexes, taggingStore, currentTimestamp, finalizedBlockNumber, jobId) {
142
215
  const { highestAgedIndex, highestFinalizedIndex } = findHighestIndexes(logsWithIndexes, currentTimestamp, finalizedBlockNumber);
143
216
  // Store updates in data provider and update local variables
144
217
  if (highestAgedIndex !== undefined) {
@@ -155,9 +228,11 @@ import { findHighestIndexes } from './utils/find_highest_indexes.js';
155
228
  await taggingStore.updateHighestFinalizedIndex(pending.secret, highestFinalizedIndex, jobId);
156
229
  // For the next iteration we want to look only at indexes for which we have not yet fetched logs while
157
230
  // ensuring that we do not look further than WINDOW_LEN ahead of the highest finalized index.
231
+ const end = highestFinalizedIndex + UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN + 1;
158
232
  return {
233
+ kind: AppTaggingSecretKind.UNCONSTRAINED,
159
234
  secret: pending.secret,
160
235
  start: pending.end,
161
- end: highestFinalizedIndex + UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN + 1
236
+ end
162
237
  };
163
238
  }
@@ -48,7 +48,7 @@ import { loadAndStoreNewTaggingIndexes } from './utils/load_and_store_new_taggin
48
48
  break;
49
49
  }
50
50
  // Receipts for pending tx hashes that the logs query just surfaced still need a sequential follow-up call.
51
- // `storePendingIndexes` is idempotent on (secret, txHash), so a re-discovered hash stays classified as known
51
+ // `mergePendingIndexes` is idempotent on (secret, txHash), so a re-discovered hash stays classified as known
52
52
  // and is not re-fetched here.
53
53
  const knownSet = new Set(knownPendingTxHashes.map((h)=>h.toString()));
54
54
  const newPendingTxHashes = allPendingTxHashes.filter((h)=>!knownSet.has(h.toString()));
@@ -16,4 +16,4 @@ import type { SenderTaggingStore } from '../../../storage/tagging_store/sender_t
16
16
  * preserving way.
17
17
  */
18
18
  export declare function loadAndStoreNewTaggingIndexes(extendedSecret: AppTaggingSecret, start: number, end: number, aztecNode: AztecNode, taggingStore: SenderTaggingStore, anchorBlockHash: BlockHash, jobId: string): Promise<void>;
19
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9hZF9hbmRfc3RvcmVfbmV3X3RhZ2dpbmdfaW5kZXhlcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL3RhZ2dpbmcvc2VuZGVyX3N5bmMvdXRpbHMvbG9hZF9hbmRfc3RvcmVfbmV3X3RhZ2dpbmdfaW5kZXhlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUNyRCxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNqRSxPQUFPLEVBQUUsS0FBSyxnQkFBZ0IsRUFBYSxNQUFNLG9CQUFvQixDQUFDO0FBR3RFLE9BQU8sS0FBSyxFQUFFLGtCQUFrQixFQUFFLE1BQU0sd0RBQXdELENBQUM7QUFHakc7Ozs7Ozs7Ozs7OztHQVlHO0FBQ0gsd0JBQXNCLDZCQUE2QixDQUNqRCxjQUFjLEVBQUUsZ0JBQWdCLEVBQ2hDLEtBQUssRUFBRSxNQUFNLEVBQ2IsR0FBRyxFQUFFLE1BQU0sRUFDWCxTQUFTLEVBQUUsU0FBUyxFQUNwQixZQUFZLEVBQUUsa0JBQWtCLEVBQ2hDLGVBQWUsRUFBRSxTQUFTLEVBQzFCLEtBQUssRUFBRSxNQUFNLGlCQWdCZCJ9
19
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9hZF9hbmRfc3RvcmVfbmV3X3RhZ2dpbmdfaW5kZXhlcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL3RhZ2dpbmcvc2VuZGVyX3N5bmMvdXRpbHMvbG9hZF9hbmRfc3RvcmVfbmV3X3RhZ2dpbmdfaW5kZXhlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUNyRCxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNqRSxPQUFPLEVBQUUsS0FBSyxnQkFBZ0IsRUFBYSxNQUFNLG9CQUFvQixDQUFDO0FBR3RFLE9BQU8sS0FBSyxFQUFFLGtCQUFrQixFQUFFLE1BQU0sd0RBQXdELENBQUM7QUFHakc7Ozs7Ozs7Ozs7OztHQVlHO0FBQ0gsd0JBQXNCLDZCQUE2QixDQUNqRCxjQUFjLEVBQUUsZ0JBQWdCLEVBQ2hDLEtBQUssRUFBRSxNQUFNLEVBQ2IsR0FBRyxFQUFFLE1BQU0sRUFDWCxTQUFTLEVBQUUsU0FBUyxFQUNwQixZQUFZLEVBQUUsa0JBQWtCLEVBQ2hDLGVBQWUsRUFBRSxTQUFTLEVBQzFCLEtBQUssRUFBRSxNQUFNLGlCQW9CZCJ9
@@ -1 +1 @@
1
- {"version":3,"file":"load_and_store_new_tagging_indexes.d.ts","sourceRoot":"","sources":["../../../../src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,KAAK,gBAAgB,EAAa,MAAM,oBAAoB,CAAC;AAGtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wDAAwD,CAAC;AAGjG;;;;;;;;;;;;GAYG;AACH,wBAAsB,6BAA6B,CACjD,cAAc,EAAE,gBAAgB,EAChC,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,kBAAkB,EAChC,eAAe,EAAE,SAAS,EAC1B,KAAK,EAAE,MAAM,iBAgBd"}
1
+ {"version":3,"file":"load_and_store_new_tagging_indexes.d.ts","sourceRoot":"","sources":["../../../../src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,KAAK,gBAAgB,EAAa,MAAM,oBAAoB,CAAC;AAGtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wDAAwD,CAAC;AAGjG;;;;;;;;;;;;GAYG;AACH,wBAAsB,6BAA6B,CACjD,cAAc,EAAE,gBAAgB,EAChC,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,kBAAkB,EAChC,eAAe,EAAE,SAAS,EAC1B,KAAK,EAAE,MAAM,iBAoBd"}
@@ -23,7 +23,11 @@ import { getAllPrivateLogsByTags } from '../../get_all_logs_by_tags.js';
23
23
  })));
24
24
  const txsForTags = await getTxsContainingTags(siloedTagsForWindow, aztecNode, anchorBlockHash);
25
25
  const txIndexesMap = getTxIndexesMap(txsForTags, start, siloedTagsForWindow.length);
26
- // Now we iterate over the map, construct the tagging index ranges and store them in the db.
26
+ // Now we iterate over the map, construct the tagging index ranges and store them in the db. A tx already tracked
27
+ // in the store is merged rather than range-checked: if this PXE sent the tx and it partially reverted, the chain
28
+ // only shows the surviving sub-range of the prove-time entry (the finalized receipt step of the sync owns
29
+ // resolving that difference), and a tx from another PXE may straddle a sync window boundary, in which case the
30
+ // entry is widened so the next index choice covers the full onchain range.
27
31
  for (const [txHashStr, indexes] of txIndexesMap.entries()){
28
32
  const txHash = TxHash.fromString(txHashStr);
29
33
  const ranges = [
@@ -33,7 +37,7 @@ import { getAllPrivateLogsByTags } from '../../get_all_logs_by_tags.js';
33
37
  highestIndex: Math.max(...indexes)
34
38
  }
35
39
  ];
36
- await taggingStore.storePendingIndexes(ranges, txHash, jobId);
40
+ await taggingStore.mergePendingIndexes(ranges, txHash, jobId);
37
41
  }
38
42
  }
39
43
  // Returns txs that used the given tags. A tag might have been used in multiple txs and for this reason we return
@@ -0,0 +1,6 @@
1
+ import { type AppTaggingSecret, type PrivateLogsQuery, SiloedTag } from '@aztec/stdlib/logs';
2
+ /** Computes the siloed tag */
3
+ export declare function computeSiloedTagForIndex(secret: AppTaggingSecret, index: number): Promise<SiloedTag>;
4
+ /** Extracts the bare-tag set from a query */
5
+ export declare function extractTags(query: PrivateLogsQuery): SiloedTag[];
6
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFnX3F1ZXJ5X3Rlc3RfdXRpbHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy90YWdnaW5nL3Rlc3RpbmcvdGFnX3F1ZXJ5X3Rlc3RfdXRpbHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLEtBQUssZ0JBQWdCLEVBQUUsS0FBSyxnQkFBZ0IsRUFBRSxTQUFTLEVBQWlCLE1BQU0sb0JBQW9CLENBQUM7QUFFNUcsOEJBQThCO0FBQzlCLHdCQUFnQix3QkFBd0IsQ0FBQyxNQUFNLEVBQUUsZ0JBQWdCLEVBQUUsS0FBSyxFQUFFLE1BQU0sR0FBRyxPQUFPLENBQUMsU0FBUyxDQUFDLENBRXBHO0FBRUQsNkNBQTZDO0FBQzdDLHdCQUFnQixXQUFXLENBQUMsS0FBSyxFQUFFLGdCQUFnQixHQUFHLFNBQVMsRUFBRSxDQUVoRSJ9
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tag_query_test_utils.d.ts","sourceRoot":"","sources":["../../../src/tagging/testing/tag_query_test_utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,SAAS,EAAiB,MAAM,oBAAoB,CAAC;AAE5G,8BAA8B;AAC9B,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAEpG;AAED,6CAA6C;AAC7C,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,SAAS,EAAE,CAEhE"}
@@ -0,0 +1,10 @@
1
+ import { SiloedTag } from '@aztec/stdlib/logs';
2
+ /** Computes the siloed tag */ export function computeSiloedTagForIndex(secret, index) {
3
+ return SiloedTag.compute({
4
+ extendedSecret: secret,
5
+ index
6
+ });
7
+ }
8
+ /** Extracts the bare-tag set from a query */ export function extractTags(query) {
9
+ return query.tags.map((entry)=>entry instanceof SiloedTag ? entry : entry.tag);
10
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/pxe",
3
- "version": "0.0.1-commit.b9865e97",
3
+ "version": "0.0.1-commit.be03c316",
4
4
  "type": "module",
5
5
  "typedocOptions": {
6
6
  "entryPoints": [
@@ -71,20 +71,20 @@
71
71
  ]
72
72
  },
73
73
  "dependencies": {
74
- "@aztec/bb-prover": "0.0.1-commit.b9865e97",
75
- "@aztec/bb.js": "0.0.1-commit.b9865e97",
76
- "@aztec/builder": "0.0.1-commit.b9865e97",
77
- "@aztec/constants": "0.0.1-commit.b9865e97",
78
- "@aztec/ethereum": "0.0.1-commit.b9865e97",
79
- "@aztec/foundation": "0.0.1-commit.b9865e97",
80
- "@aztec/key-store": "0.0.1-commit.b9865e97",
81
- "@aztec/kv-store": "0.0.1-commit.b9865e97",
82
- "@aztec/noir-protocol-circuits-types": "0.0.1-commit.b9865e97",
83
- "@aztec/noir-types": "0.0.1-commit.b9865e97",
84
- "@aztec/protocol-contracts": "0.0.1-commit.b9865e97",
85
- "@aztec/simulator": "0.0.1-commit.b9865e97",
86
- "@aztec/standard-contracts": "0.0.1-commit.b9865e97",
87
- "@aztec/stdlib": "0.0.1-commit.b9865e97",
74
+ "@aztec/bb-prover": "0.0.1-commit.be03c316",
75
+ "@aztec/bb.js": "0.0.1-commit.be03c316",
76
+ "@aztec/builder": "0.0.1-commit.be03c316",
77
+ "@aztec/constants": "0.0.1-commit.be03c316",
78
+ "@aztec/ethereum": "0.0.1-commit.be03c316",
79
+ "@aztec/foundation": "0.0.1-commit.be03c316",
80
+ "@aztec/key-store": "0.0.1-commit.be03c316",
81
+ "@aztec/kv-store": "0.0.1-commit.be03c316",
82
+ "@aztec/noir-protocol-circuits-types": "0.0.1-commit.be03c316",
83
+ "@aztec/noir-types": "0.0.1-commit.be03c316",
84
+ "@aztec/protocol-contracts": "0.0.1-commit.be03c316",
85
+ "@aztec/simulator": "0.0.1-commit.be03c316",
86
+ "@aztec/standard-contracts": "0.0.1-commit.be03c316",
87
+ "@aztec/stdlib": "0.0.1-commit.be03c316",
88
88
  "koa": "^2.16.1",
89
89
  "koa-router": "^13.1.1",
90
90
  "lodash.omit": "^4.5.0",
@@ -93,8 +93,8 @@
93
93
  "viem": "npm:@aztec/viem@2.38.2"
94
94
  },
95
95
  "devDependencies": {
96
- "@aztec/noir-test-contracts.js": "0.0.1-commit.b9865e97",
97
- "@aztec/world-state": "0.0.1-commit.b9865e97",
96
+ "@aztec/noir-test-contracts.js": "0.0.1-commit.be03c316",
97
+ "@aztec/world-state": "0.0.1-commit.be03c316",
98
98
  "@jest/globals": "^30.0.0",
99
99
  "@types/jest": "^30.0.0",
100
100
  "@types/lodash.omit": "^4.5.7",
@@ -3,40 +3,24 @@ import { keccak256String } from '@aztec/foundation/crypto/keccak';
3
3
  import { dirname, join } from 'path';
4
4
  import { fileURLToPath } from 'url';
5
5
 
6
+ import { ORACLE_REGISTRY } from '../contract_function_simulator/index.js';
6
7
  import { ORACLE_INTERFACE_HASH, ORACLE_VERSION_MAJOR } from '../oracle_version.js';
7
- import { getOracleInterfaceSignature, readNumericGlobal } from './oracle_version_helpers.js';
8
+ import { getOracleRegistrySignature, readNumericGlobal } from './oracle_version_helpers.js';
8
9
 
9
10
  /**
10
11
  * Verifies that the Oracle interface matches the expected interface hash.
11
12
  *
12
13
  * The Oracle interface needs to be versioned to ensure compatibility between Aztec.nr and PXE. This function computes
13
- * a hash of the Oracle interface and compares it against a known hash. If they don't match, it means the interface has
14
- * changed and the oracle version needs to be bumped:
15
- * - If the change is backward-breaking (e.g. removing/renaming an oracle), bump ORACLE_VERSION_MAJOR.
14
+ * a hash of `ORACLE_REGISTRY` (where each oracle's parameter names, parameter types, and return type
15
+ * live) and compares it against a known hash. If they don't match, it means the interface has changed and the oracle
16
+ * version needs to be bumped:
17
+ * - If the change is backward-breaking (e.g. removing/renaming an oracle, or changing its params/return), bump
18
+ * ORACLE_VERSION_MAJOR.
16
19
  * - If the change is an oracle addition (non-breaking), bump ORACLE_VERSION_MINOR.
17
20
  */
18
21
  function assertOracleInterfaceMatches(): void {
19
- const excludedProps = [
20
- 'handler',
21
- 'constructor',
22
- 'toACIRCallback',
23
- 'handlerAsMisc',
24
- 'handlerAsUtility',
25
- 'handlerAsPrivate',
26
- ];
27
-
28
- // Get the path to Oracle.ts source file
29
- // The script runs from dest/bin/ after compilation, so we need to go up to the package root
30
- // then into src/ to find the source file
31
- const currentDir = dirname(fileURLToPath(import.meta.url));
32
- // Go up from dest/bin/ or src/bin/ to the package root (pxe/), then into src/
33
- const packageRoot = dirname(dirname(currentDir)); // Go up from bin/ to pxe/
34
- const oracleSourcePath = join(packageRoot, 'src/contract_function_simulator/oracle/oracle.ts');
35
-
36
- const oracleInterfaceSignature = getOracleInterfaceSignature(oracleSourcePath, ['Oracle'], excludedProps);
37
-
38
22
  // We use keccak256 here just because we already have it in the dependencies.
39
- const oracleInterfaceHash = keccak256String(oracleInterfaceSignature);
23
+ const oracleInterfaceHash = keccak256String(getOracleRegistrySignature(ORACLE_REGISTRY));
40
24
  if (oracleInterfaceHash !== ORACLE_INTERFACE_HASH) {
41
25
  throw new Error(
42
26
  `The Oracle interface has changed. Update ORACLE_INTERFACE_HASH to ${oracleInterfaceHash} in pxe/src/oracle_version.ts and bump the oracle version (ORACLE_VERSION_MAJOR for breaking changes, ORACLE_VERSION_MINOR for oracle additions).`,
package/src/bin/index.ts CHANGED
@@ -1 +1 @@
1
- export { getOracleInterfaceSignature, readNumericGlobal } from './oracle_version_helpers.js';
1
+ export { getOracleRegistrySignature, readNumericGlobal } from './oracle_version_helpers.js';
@@ -1,63 +1,34 @@
1
- /* eslint-disable import-x/no-named-as-default-member */
2
1
  import { readFileSync } from 'fs';
3
- import ts from 'typescript';
2
+
3
+ import type { OracleRegistryEntry } from '../contract_function_simulator/index.js';
4
4
 
5
5
  /**
6
- * Extracts method signatures from TypeScript classes or interfaces and returns a deterministic string representation.
6
+ * Extracts a deterministic signature string from an oracle registry (e.g. PXE's `ORACLE_REGISTRY`).
7
7
  *
8
- * This is used to detect when an oracle interface changes so that the oracle version can be bumped. It works with both
9
- * class declarations (e.g. PXE's `Oracle` class) and interface declarations (e.g. TXE's `IAvmExecutionOracle`).
8
+ * Reads the registry where each oracle's wire ABI lives: the ordered parameter names with their `TypeMapping` labels
9
+ * and the return type. The resulting hash is sensitive to parameter, type, and return changes, not just oracle
10
+ * additions and removals.
10
11
  *
11
- * @param sourcePath - Absolute path to the TypeScript source file to parse.
12
- * @param targets - Names of classes or interfaces to extract methods from.
13
- * @param excludedMembers - Method names to skip (e.g. non-oracle helpers like `constructor`).
12
+ * @example
13
+ * // Given a registry like:
14
+ * // export const ORACLE_REGISTRY = {
15
+ * // aztec_utl_foo: makeEntry({ params: [{ name: 'a', type: U32 }], returnType: BOOL }),
16
+ * // aztec_prv_bar: makeEntry(),
17
+ * // } satisfies Record<string, OracleRegistryEntry>;
18
+ * //
19
+ * // Returns (sorted, newline-joined):
20
+ * // "aztec_prv_bar(): void\naztec_utl_foo(a: u32): bool"
14
21
  */
15
- export function getOracleInterfaceSignature(sourcePath: string, targets: string[], excludedMembers: string[]): string {
16
- const sourceCode = readFileSync(sourcePath, 'utf-8');
17
- const sourceFile = ts.createSourceFile(sourcePath, sourceCode, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
18
-
19
- const methodSignatures: string[] = [];
20
-
21
- function visit(node: ts.Node) {
22
- const isTarget =
23
- (ts.isClassDeclaration(node) || ts.isInterfaceDeclaration(node)) && targets.includes(node.name?.text ?? '');
24
-
25
- if (isTarget) {
26
- node.members.forEach(member => {
27
- if (
28
- (ts.isMethodDeclaration(member) || ts.isMethodSignature(member)) &&
29
- member.name &&
30
- ts.isIdentifier(member.name)
31
- ) {
32
- const methodName = member.name.text;
33
-
34
- if (excludedMembers.includes(methodName)) {
35
- return;
36
- }
37
-
38
- const paramSignatures: string[] = [];
39
- member.parameters.forEach(param => {
40
- const paramName = extractParameterName(param, sourceFile);
41
- const paramType = extractTypeString(param.type, sourceFile);
42
- paramSignatures.push(`${paramName}: ${paramType}`);
43
- });
22
+ export function getOracleRegistrySignature(registry: Record<string, OracleRegistryEntry>): string {
23
+ const oracleSignatures = Object.entries(registry).map(([name, entry]) => {
24
+ const paramSignatures = entry.params.map(p => `${p.name}: ${p.type.label}`);
25
+ const returnType = entry.returnType === undefined ? 'void' : entry.returnType.label;
26
+ return `${name}(${paramSignatures.join(', ')}): ${returnType}`;
27
+ });
44
28
 
45
- const returnType = extractTypeString(member.type, sourceFile);
29
+ oracleSignatures.sort();
46
30
 
47
- const signature = `${methodName}(${paramSignatures.join(', ')}): ${returnType}`;
48
- methodSignatures.push(signature);
49
- }
50
- });
51
- }
52
-
53
- ts.forEachChild(node, visit);
54
- }
55
-
56
- visit(sourceFile);
57
-
58
- methodSignatures.sort();
59
-
60
- return methodSignatures.join('');
31
+ return oracleSignatures.join('\n');
61
32
  }
62
33
 
63
34
  /**
@@ -81,41 +52,3 @@ export function readNumericGlobal(sourcePath: string, name: string): number {
81
52
  }
82
53
  return Number(match[1]);
83
54
  }
84
-
85
- function extractParameterName(param: ts.ParameterDeclaration, sourceFile: ts.SourceFile): string {
86
- const name = param.name;
87
-
88
- if (ts.isIdentifier(name)) {
89
- return name.text;
90
- }
91
-
92
- if (ts.isArrayBindingPattern(name)) {
93
- if (name.elements.length > 0) {
94
- const element = name.elements[0];
95
- if (ts.isBindingElement(element)) {
96
- const elementName = element.name;
97
- if (ts.isIdentifier(elementName)) {
98
- return elementName.text;
99
- }
100
- if (ts.isArrayBindingPattern(elementName) || ts.isObjectBindingPattern(elementName)) {
101
- return elementName.getText(sourceFile);
102
- }
103
- }
104
- }
105
- return name.getText(sourceFile);
106
- }
107
-
108
- if (ts.isObjectBindingPattern(name)) {
109
- return name.getText(sourceFile);
110
- }
111
-
112
- return (name as ts.Node).getText(sourceFile);
113
- }
114
-
115
- function extractTypeString(typeNode: ts.TypeNode | undefined, sourceFile: ts.SourceFile): string {
116
- if (!typeNode) {
117
- return 'void';
118
- }
119
-
120
- return typeNode.getText(sourceFile).replace(/\s+/g, ' ').trim();
121
- }