@aztec/pxe 5.0.0-rc.1 → 5.0.0

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 (297) hide show
  1. package/dest/block_synchronizer/block_stream_source.d.ts +5 -5
  2. package/dest/block_synchronizer/block_stream_source.d.ts.map +1 -1
  3. package/dest/block_synchronizer/block_stream_source.js +4 -29
  4. package/dest/block_synchronizer/block_synchronizer.d.ts +16 -12
  5. package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
  6. package/dest/block_synchronizer/block_synchronizer.js +49 -15
  7. package/dest/config/index.d.ts +2 -1
  8. package/dest/config/index.d.ts.map +1 -1
  9. package/dest/config/index.js +1 -0
  10. package/dest/contract/contract_class_service.d.ts +31 -0
  11. package/dest/contract/contract_class_service.d.ts.map +1 -0
  12. package/dest/contract/contract_class_service.js +68 -0
  13. package/dest/{contract_sync → contract}/contract_sync_service.d.ts +7 -6
  14. package/dest/contract/contract_sync_service.d.ts.map +1 -0
  15. package/dest/{contract_sync → contract}/contract_sync_service.js +10 -30
  16. package/dest/contract/helpers.d.ts +7 -0
  17. package/dest/contract/helpers.d.ts.map +1 -0
  18. package/dest/contract/helpers.js +20 -0
  19. package/dest/contract_function_simulator/anchored_contract_data.d.ts +36 -0
  20. package/dest/contract_function_simulator/anchored_contract_data.d.ts.map +1 -0
  21. package/dest/contract_function_simulator/anchored_contract_data.js +54 -0
  22. package/dest/contract_function_simulator/aztec_node_read_cache.d.ts +39 -0
  23. package/dest/contract_function_simulator/aztec_node_read_cache.d.ts.map +1 -0
  24. package/dest/contract_function_simulator/aztec_node_read_cache.js +60 -0
  25. package/dest/contract_function_simulator/contract_function_simulator.d.ts +19 -18
  26. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  27. package/dest/contract_function_simulator/contract_function_simulator.js +52 -31
  28. package/dest/contract_function_simulator/execution_note_cache.d.ts +3 -9
  29. package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
  30. package/dest/contract_function_simulator/execution_note_cache.js +8 -28
  31. package/dest/contract_function_simulator/index.d.ts +17 -9
  32. package/dest/contract_function_simulator/index.d.ts.map +1 -1
  33. package/dest/contract_function_simulator/index.js +4 -7
  34. package/dest/contract_function_simulator/noir-structs/bounded_vec.d.ts +8 -27
  35. package/dest/contract_function_simulator/noir-structs/bounded_vec.d.ts.map +1 -1
  36. package/dest/contract_function_simulator/noir-structs/bounded_vec.js +8 -23
  37. package/dest/contract_function_simulator/noir-structs/contract_class_log_data.d.ts +9 -0
  38. package/dest/contract_function_simulator/noir-structs/contract_class_log_data.d.ts.map +1 -0
  39. package/dest/contract_function_simulator/noir-structs/contract_class_log_data.js +1 -0
  40. package/dest/contract_function_simulator/noir-structs/embedded_curve_point.d.ts +7 -0
  41. package/dest/contract_function_simulator/noir-structs/embedded_curve_point.d.ts.map +1 -0
  42. package/dest/contract_function_simulator/noir-structs/embedded_curve_point.js +1 -0
  43. package/dest/contract_function_simulator/noir-structs/event_validation_request.js +1 -1
  44. package/dest/contract_function_simulator/noir-structs/fact.d.ts +16 -0
  45. package/dest/contract_function_simulator/noir-structs/fact.d.ts.map +1 -0
  46. package/dest/contract_function_simulator/noir-structs/fact.js +6 -0
  47. package/dest/contract_function_simulator/noir-structs/fact_collection.d.ts +27 -0
  48. package/dest/contract_function_simulator/noir-structs/fact_collection.d.ts.map +1 -0
  49. package/dest/contract_function_simulator/noir-structs/fact_collection.js +31 -0
  50. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +11 -12
  51. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts.map +1 -1
  52. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.js +6 -49
  53. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +10 -8
  54. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
  55. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +1 -60
  56. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +2 -2
  57. package/dest/contract_function_simulator/noir-structs/option.d.ts +9 -11
  58. package/dest/contract_function_simulator/noir-structs/option.d.ts.map +1 -1
  59. package/dest/contract_function_simulator/noir-structs/option.js +18 -13
  60. package/dest/contract_function_simulator/noir-structs/origin_block.d.ts +11 -0
  61. package/dest/contract_function_simulator/noir-structs/origin_block.d.ts.map +1 -0
  62. package/dest/contract_function_simulator/noir-structs/origin_block.js +5 -0
  63. package/dest/contract_function_simulator/noir-structs/pending_tagged_log.d.ts +11 -0
  64. package/dest/contract_function_simulator/noir-structs/pending_tagged_log.d.ts.map +1 -0
  65. package/dest/contract_function_simulator/noir-structs/pending_tagged_log.js +4 -0
  66. package/dest/contract_function_simulator/noir-structs/provided_secret.d.ts +6 -9
  67. package/dest/contract_function_simulator/noir-structs/provided_secret.d.ts.map +1 -1
  68. package/dest/contract_function_simulator/noir-structs/provided_secret.js +1 -14
  69. package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.d.ts +28 -0
  70. package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.d.ts.map +1 -0
  71. package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.js +50 -0
  72. package/dest/contract_function_simulator/noir-structs/resolved_tx.d.ts +21 -0
  73. package/dest/contract_function_simulator/noir-structs/resolved_tx.d.ts.map +1 -0
  74. package/dest/contract_function_simulator/noir-structs/resolved_tx.js +50 -0
  75. package/dest/contract_function_simulator/noir-structs/tx_effect_data.d.ts +14 -0
  76. package/dest/contract_function_simulator/noir-structs/tx_effect_data.d.ts.map +1 -0
  77. package/dest/contract_function_simulator/noir-structs/tx_effect_data.js +5 -0
  78. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +6 -11
  79. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -1
  80. package/dest/contract_function_simulator/noir-structs/utility_context.js +1 -20
  81. package/dest/contract_function_simulator/oracle/acir_callback.d.ts +7 -2
  82. package/dest/contract_function_simulator/oracle/acir_callback.d.ts.map +1 -1
  83. package/dest/contract_function_simulator/oracle/acir_callback.js +55 -11
  84. package/dest/contract_function_simulator/oracle/legacy_oracle_registry.d.ts +39 -0
  85. package/dest/contract_function_simulator/oracle/legacy_oracle_registry.d.ts.map +1 -0
  86. package/dest/contract_function_simulator/oracle/legacy_oracle_registry.js +107 -0
  87. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +3 -14
  88. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
  89. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.js +1 -24
  90. package/dest/contract_function_simulator/oracle/oracle_registry.d.ts +86 -8
  91. package/dest/contract_function_simulator/oracle/oracle_registry.d.ts.map +1 -1
  92. package/dest/contract_function_simulator/oracle/oracle_registry.js +168 -18
  93. package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts +123 -40
  94. package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts.map +1 -1
  95. package/dest/contract_function_simulator/oracle/oracle_type_mappings.js +947 -264
  96. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +21 -8
  97. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  98. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +126 -16
  99. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +63 -33
  100. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  101. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +175 -90
  102. package/dest/debug/pxe_debug_utils.d.ts +2 -2
  103. package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
  104. package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
  105. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  106. package/dest/entrypoints/client/bundle/utils.js +3 -2
  107. package/dest/entrypoints/client/lazy/utils.d.ts +1 -1
  108. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  109. package/dest/entrypoints/client/lazy/utils.js +3 -2
  110. package/dest/entrypoints/pxe_creation_options.d.ts +8 -2
  111. package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
  112. package/dest/entrypoints/server/index.d.ts +5 -3
  113. package/dest/entrypoints/server/index.d.ts.map +1 -1
  114. package/dest/entrypoints/server/index.js +3 -2
  115. package/dest/entrypoints/server/utils.d.ts +1 -1
  116. package/dest/entrypoints/server/utils.d.ts.map +1 -1
  117. package/dest/entrypoints/server/utils.js +3 -1
  118. package/dest/error_enriching.d.ts +5 -3
  119. package/dest/error_enriching.d.ts.map +1 -1
  120. package/dest/error_enriching.js +13 -11
  121. package/dest/hooks/execution_hooks.d.ts +27 -7
  122. package/dest/hooks/execution_hooks.d.ts.map +1 -1
  123. package/dest/hooks/execution_hooks.js +3 -3
  124. package/dest/hooks/index.d.ts +4 -3
  125. package/dest/hooks/index.d.ts.map +1 -1
  126. package/dest/hooks/index.js +1 -0
  127. package/dest/hooks/resolve_custom_request.d.ts +23 -0
  128. package/dest/hooks/resolve_custom_request.d.ts.map +1 -0
  129. package/dest/hooks/resolve_custom_request.js +3 -0
  130. package/dest/hooks/resolve_tagging_secret_strategy.d.ts +50 -0
  131. package/dest/hooks/resolve_tagging_secret_strategy.d.ts.map +1 -0
  132. package/dest/hooks/resolve_tagging_secret_strategy.js +3 -0
  133. package/dest/logs/log_service.d.ts +7 -6
  134. package/dest/logs/log_service.d.ts.map +1 -1
  135. package/dest/logs/log_service.js +79 -28
  136. package/dest/messages/tx_resolver_service.d.ts +17 -0
  137. package/dest/messages/tx_resolver_service.d.ts.map +1 -0
  138. package/dest/messages/{message_context_service.js → tx_resolver_service.js} +8 -8
  139. package/dest/oracle_version.d.ts +3 -3
  140. package/dest/oracle_version.js +3 -3
  141. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +1 -1
  142. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -1
  143. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.js +6 -2
  144. package/dest/private_kernel/hints/test_utils.js +1 -1
  145. package/dest/private_kernel/private_kernel_execution_prover.d.ts +1 -1
  146. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
  147. package/dest/private_kernel/private_kernel_execution_prover.js +17 -36
  148. package/dest/private_kernel/private_kernel_oracle.d.ts +4 -2
  149. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
  150. package/dest/private_kernel/private_kernel_oracle.js +17 -5
  151. package/dest/pxe.d.ts +109 -47
  152. package/dest/pxe.d.ts.map +1 -1
  153. package/dest/pxe.js +222 -139
  154. package/dest/storage/allowed_scopes.d.ts +6 -0
  155. package/dest/storage/allowed_scopes.d.ts.map +1 -0
  156. package/dest/storage/allowed_scopes.js +7 -0
  157. package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts +1 -1
  158. package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts.map +1 -1
  159. package/dest/storage/backwards_compatibility_tests/schema_tests.js +114 -37
  160. package/dest/storage/capsule_store/capsule_service.d.ts +1 -1
  161. package/dest/storage/capsule_store/capsule_service.d.ts.map +1 -1
  162. package/dest/storage/capsule_store/capsule_service.js +6 -9
  163. package/dest/storage/contract_store/contract_store.d.ts +27 -24
  164. package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
  165. package/dest/storage/contract_store/contract_store.js +64 -75
  166. package/dest/storage/fact_store/fact_service.d.ts +22 -0
  167. package/dest/storage/fact_store/fact_service.d.ts.map +1 -0
  168. package/dest/storage/fact_store/fact_service.js +45 -0
  169. package/dest/storage/fact_store/fact_store.d.ts +95 -0
  170. package/dest/storage/fact_store/fact_store.d.ts.map +1 -0
  171. package/dest/storage/fact_store/fact_store.js +408 -0
  172. package/dest/storage/fact_store/fact_store_keys.d.ts +34 -0
  173. package/dest/storage/fact_store/fact_store_keys.d.ts.map +1 -0
  174. package/dest/storage/fact_store/fact_store_keys.js +50 -0
  175. package/dest/storage/fact_store/index.d.ts +6 -0
  176. package/dest/storage/fact_store/index.d.ts.map +1 -0
  177. package/dest/storage/fact_store/index.js +4 -0
  178. package/dest/storage/fact_store/origin_state.d.ts +57 -0
  179. package/dest/storage/fact_store/origin_state.d.ts.map +1 -0
  180. package/dest/storage/fact_store/origin_state.js +53 -0
  181. package/dest/storage/fact_store/stored_fact.d.ts +32 -0
  182. package/dest/storage/fact_store/stored_fact.d.ts.map +1 -0
  183. package/dest/storage/fact_store/stored_fact.js +64 -0
  184. package/dest/storage/index.d.ts +2 -1
  185. package/dest/storage/index.d.ts.map +1 -1
  186. package/dest/storage/index.js +1 -0
  187. package/dest/storage/metadata.d.ts +2 -2
  188. package/dest/storage/metadata.d.ts.map +1 -1
  189. package/dest/storage/metadata.js +1 -1
  190. package/dest/storage/open_pxe_stores.d.ts +5 -3
  191. package/dest/storage/open_pxe_stores.d.ts.map +1 -1
  192. package/dest/storage/open_pxe_stores.js +5 -3
  193. package/dest/storage/tagging_store/index.d.ts +2 -2
  194. package/dest/storage/tagging_store/index.d.ts.map +1 -1
  195. package/dest/storage/tagging_store/index.js +1 -1
  196. package/dest/storage/tagging_store/tagging_secret_sources_store.d.ts +51 -0
  197. package/dest/storage/tagging_store/tagging_secret_sources_store.d.ts.map +1 -0
  198. package/dest/storage/tagging_store/tagging_secret_sources_store.js +105 -0
  199. package/dest/tagging/constants.d.ts +2 -2
  200. package/dest/tagging/constants.d.ts.map +1 -1
  201. package/dest/tagging/constants.js +18 -9
  202. package/package.json +17 -17
  203. package/src/block_synchronizer/block_stream_source.ts +6 -45
  204. package/src/block_synchronizer/block_synchronizer.ts +65 -24
  205. package/src/config/index.ts +1 -0
  206. package/src/contract/contract_class_service.ts +83 -0
  207. package/src/{contract_sync → contract}/contract_sync_service.ts +18 -37
  208. package/src/contract/helpers.ts +35 -0
  209. package/src/contract_function_simulator/anchored_contract_data.ts +74 -0
  210. package/src/contract_function_simulator/aztec_node_read_cache.ts +89 -0
  211. package/src/contract_function_simulator/contract_function_simulator.ts +86 -43
  212. package/src/contract_function_simulator/execution_note_cache.ts +7 -28
  213. package/src/contract_function_simulator/index.ts +24 -9
  214. package/src/contract_function_simulator/noir-structs/bounded_vec.ts +12 -24
  215. package/src/contract_function_simulator/noir-structs/contract_class_log_data.ts +9 -0
  216. package/src/contract_function_simulator/noir-structs/embedded_curve_point.ts +4 -0
  217. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +1 -1
  218. package/src/contract_function_simulator/noir-structs/fact.ts +13 -0
  219. package/src/contract_function_simulator/noir-structs/fact_collection.ts +64 -0
  220. package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +20 -46
  221. package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +13 -60
  222. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +2 -2
  223. package/src/contract_function_simulator/noir-structs/option.ts +17 -11
  224. package/src/contract_function_simulator/noir-structs/origin_block.ts +8 -0
  225. package/src/contract_function_simulator/noir-structs/pending_tagged_log.ts +12 -0
  226. package/src/contract_function_simulator/noir-structs/provided_secret.ts +4 -15
  227. package/src/contract_function_simulator/noir-structs/resolved_tagging_strategy.ts +66 -0
  228. package/src/contract_function_simulator/noir-structs/resolved_tx.ts +53 -0
  229. package/src/contract_function_simulator/noir-structs/tx_effect_data.ts +15 -0
  230. package/src/contract_function_simulator/noir-structs/utility_context.ts +5 -17
  231. package/src/contract_function_simulator/oracle/acir_callback.ts +58 -12
  232. package/src/contract_function_simulator/oracle/legacy_oracle_registry.ts +147 -0
  233. package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +6 -21
  234. package/src/contract_function_simulator/oracle/oracle_registry.ts +119 -86
  235. package/src/contract_function_simulator/oracle/oracle_type_mappings.ts +659 -248
  236. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +155 -24
  237. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +300 -115
  238. package/src/debug/pxe_debug_utils.ts +1 -1
  239. package/src/entrypoints/client/bundle/utils.ts +3 -2
  240. package/src/entrypoints/client/lazy/utils.ts +3 -2
  241. package/src/entrypoints/pxe_creation_options.ts +7 -1
  242. package/src/entrypoints/server/index.ts +5 -2
  243. package/src/entrypoints/server/utils.ts +3 -1
  244. package/src/error_enriching.ts +27 -11
  245. package/src/hooks/execution_hooks.ts +28 -8
  246. package/src/hooks/index.ts +8 -2
  247. package/src/hooks/resolve_custom_request.ts +24 -0
  248. package/src/hooks/resolve_tagging_secret_strategy.ts +60 -0
  249. package/src/logs/log_service.ts +91 -37
  250. package/src/messages/{message_context_service.ts → tx_resolver_service.ts} +16 -9
  251. package/src/oracle_version.ts +3 -3
  252. package/src/private_kernel/hints/private_kernel_reset_private_inputs_builder.ts +11 -1
  253. package/src/private_kernel/hints/test_utils.ts +1 -1
  254. package/src/private_kernel/private_kernel_execution_prover.ts +22 -52
  255. package/src/private_kernel/private_kernel_oracle.ts +23 -4
  256. package/src/pxe.ts +320 -158
  257. package/src/storage/allowed_scopes.ts +14 -0
  258. package/src/storage/backwards_compatibility_tests/__snapshots__/AddressStore.json +6 -6
  259. package/src/storage/backwards_compatibility_tests/__snapshots__/ContractStore.json +1 -1
  260. package/src/storage/backwards_compatibility_tests/__snapshots__/FactStore.json +40 -0
  261. package/src/storage/backwards_compatibility_tests/__snapshots__/KeyStore.json +12 -12
  262. package/src/storage/backwards_compatibility_tests/__snapshots__/L2TipsKVStore.json +1 -1
  263. package/src/storage/backwards_compatibility_tests/__snapshots__/RecipientTaggingStore.json +11 -3
  264. package/src/storage/backwards_compatibility_tests/__snapshots__/SenderTaggingStore.json +12 -4
  265. package/src/storage/backwards_compatibility_tests/__snapshots__/TaggingSecretSourcesStore.json +30 -0
  266. package/src/storage/backwards_compatibility_tests/__snapshots__/opened_stores.json +21 -5
  267. package/src/storage/backwards_compatibility_tests/schema_tests.ts +125 -36
  268. package/src/storage/capsule_store/capsule_service.ts +8 -13
  269. package/src/storage/contract_store/contract_store.ts +86 -93
  270. package/src/storage/fact_store/fact_service.ts +69 -0
  271. package/src/storage/fact_store/fact_store.ts +487 -0
  272. package/src/storage/fact_store/fact_store_keys.ts +75 -0
  273. package/src/storage/fact_store/index.ts +14 -0
  274. package/src/storage/fact_store/origin_state.ts +75 -0
  275. package/src/storage/fact_store/stored_fact.ts +80 -0
  276. package/src/storage/index.ts +1 -0
  277. package/src/storage/metadata.ts +1 -1
  278. package/src/storage/open_pxe_stores.ts +6 -3
  279. package/src/storage/tagging_store/index.ts +1 -1
  280. package/src/storage/tagging_store/tagging_secret_sources_store.ts +138 -0
  281. package/src/tagging/constants.ts +19 -9
  282. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +0 -6
  283. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +0 -1
  284. package/dest/contract_function_simulator/proxied_contract_data_source.js +0 -51
  285. package/dest/contract_sync/contract_sync_service.d.ts.map +0 -1
  286. package/dest/contract_sync/helpers.d.ts +0 -27
  287. package/dest/contract_sync/helpers.d.ts.map +0 -1
  288. package/dest/contract_sync/helpers.js +0 -53
  289. package/dest/messages/message_context_service.d.ts +0 -17
  290. package/dest/messages/message_context_service.d.ts.map +0 -1
  291. package/dest/storage/tagging_store/sender_address_book_store.d.ts +0 -14
  292. package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +0 -1
  293. package/dest/storage/tagging_store/sender_address_book_store.js +0 -36
  294. package/src/contract_function_simulator/proxied_contract_data_source.ts +0 -60
  295. package/src/contract_sync/helpers.ts +0 -86
  296. package/src/storage/backwards_compatibility_tests/__snapshots__/SenderAddressBookStore.json +0 -16
  297. package/src/storage/tagging_store/sender_address_book_store.ts +0 -48
@@ -0,0 +1,32 @@
1
+ import { Fr } from '@aztec/foundation/curves/bn254';
2
+ import { BufferReader } from '@aztec/foundation/serialize';
3
+ import { FactCollectionKey, type OriginBlock } from './fact_store_keys.js';
4
+ /** A fact as returned by the fact store. */
5
+ export type Fact = {
6
+ factTypeId: Fr;
7
+ payload: Fr[];
8
+ originBlock: OriginBlock | undefined;
9
+ };
10
+ /**
11
+ * A single immutable fact belonging to a fact collection.
12
+ */
13
+ export declare class StoredFact {
14
+ readonly factCollectionKey: FactCollectionKey;
15
+ readonly factTypeId: Fr;
16
+ readonly payload: Fr[];
17
+ readonly originBlock: OriginBlock | undefined;
18
+ constructor(factCollectionKey: FactCollectionKey, factTypeId: Fr, payload: Fr[], originBlock: OriginBlock | undefined);
19
+ /** Whether this fact is deleted on block pruning (true) or survives reorgs (false). */
20
+ get isRetractable(): boolean;
21
+ /** Stable digest of the payload, used for fact idempotency. */
22
+ payloadHash(): Fr;
23
+ /** Returns the externally facing view of this fact. */
24
+ toFact(): Fact;
25
+ toBuffer(): Buffer;
26
+ static fromBuffer(buffer: Buffer | BufferReader): StoredFact;
27
+ }
28
+ /**
29
+ * Builds the serialized key that identifies a fact in the store.
30
+ */
31
+ export declare function factKeyStrOf(fact: StoredFact): string;
32
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RvcmVkX2ZhY3QuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zdG9yYWdlL2ZhY3Rfc3RvcmUvc3RvcmVkX2ZhY3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQ3BELE9BQU8sRUFBRSxZQUFZLEVBQXFCLE1BQU0sNkJBQTZCLENBQUM7QUFHOUUsT0FBTyxFQUFFLGlCQUFpQixFQUFFLEtBQUssV0FBVyxFQUFFLE1BQU0sc0JBQXNCLENBQUM7QUFFM0UsNENBQTRDO0FBQzVDLE1BQU0sTUFBTSxJQUFJLEdBQUc7SUFBRSxVQUFVLEVBQUUsRUFBRSxDQUFDO0lBQUMsT0FBTyxFQUFFLEVBQUUsRUFBRSxDQUFDO0lBQUMsV0FBVyxFQUFFLFdBQVcsR0FBRyxTQUFTLENBQUE7Q0FBRSxDQUFDO0FBRTNGOztHQUVHO0FB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AAS,CAAA;CAAE,CAAC;AAE3F;;GAEG;AACH,qBAAa,UAAU;aAEH,iBAAiB,EAAE,iBAAiB;aACpC,UAAU,EAAE,EAAE;aACd,OAAO,EAAE,EAAE,EAAE;aACb,WAAW,EAAE,WAAW,GAAG,SAAS;IAJtD,YACkB,iBAAiB,EAAE,iBAAiB,EACpC,UAAU,EAAE,EAAE,EACd,OAAO,EAAE,EAAE,EAAE,EACb,WAAW,EAAE,WAAW,GAAG,SAAS,EAClD;IAEJ,uFAAuF;IACvF,IAAI,aAAa,IAAI,OAAO,CAE3B;IAED,+DAA+D;IAC/D,WAAW,IAAI,EAAE,CAEhB;IAED,uDAAuD;IACvD,MAAM,IAAI,IAAI,CAEb;IAED,QAAQ,IAAI,MAAM,CAajB;IAED,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,GAAG,UAAU,CAmB3D;CACF;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAGrD"}
@@ -0,0 +1,64 @@
1
+ import { sha256ToField } from '@aztec/foundation/crypto/sha256';
2
+ import { Fr } from '@aztec/foundation/curves/bn254';
3
+ import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
4
+ import { AztecAddress } from '@aztec/stdlib/aztec-address';
5
+ import { FactCollectionKey } from './fact_store_keys.js';
6
+ /**
7
+ * A single immutable fact belonging to a fact collection.
8
+ */ export class StoredFact {
9
+ factCollectionKey;
10
+ factTypeId;
11
+ payload;
12
+ originBlock;
13
+ constructor(factCollectionKey, factTypeId, payload, originBlock){
14
+ this.factCollectionKey = factCollectionKey;
15
+ this.factTypeId = factTypeId;
16
+ this.payload = payload;
17
+ this.originBlock = originBlock;
18
+ }
19
+ /** Whether this fact is deleted on block pruning (true) or survives reorgs (false). */ get isRetractable() {
20
+ return this.originBlock !== undefined;
21
+ }
22
+ /** Stable digest of the payload, used for fact idempotency. */ payloadHash() {
23
+ return sha256ToField([
24
+ this.payload.length,
25
+ ...this.payload
26
+ ]);
27
+ }
28
+ /** Returns the externally facing view of this fact. */ toFact() {
29
+ return {
30
+ factTypeId: this.factTypeId,
31
+ payload: this.payload,
32
+ originBlock: this.originBlock
33
+ };
34
+ }
35
+ toBuffer() {
36
+ return serializeToBuffer(this.factCollectionKey.contractAddress, this.factCollectionKey.scope, this.factCollectionKey.factCollectionTypeId, this.factCollectionKey.factCollectionId, this.factTypeId, this.payload.length, ...this.payload, this.originBlock !== undefined, this.originBlock ? this.originBlock.blockNumber : 0, this.originBlock ? this.originBlock.blockHash : Fr.ZERO);
37
+ }
38
+ static fromBuffer(buffer) {
39
+ const reader = BufferReader.asReader(buffer);
40
+ const contractAddress = reader.readObject(AztecAddress);
41
+ const scope = reader.readObject(AztecAddress);
42
+ const factCollectionTypeId = reader.readObject(Fr);
43
+ const factCollectionId = reader.readObject(Fr);
44
+ const factTypeId = reader.readObject(Fr);
45
+ const payloadLen = reader.readNumber();
46
+ const payload = reader.readArray(payloadLen, Fr);
47
+ const hasOriginBlock = reader.readBoolean();
48
+ const blockNumber = reader.readNumber();
49
+ const blockHash = reader.readObject(Fr);
50
+ const originBlock = hasOriginBlock ? {
51
+ blockNumber,
52
+ blockHash
53
+ } : undefined;
54
+ return new StoredFact(new FactCollectionKey(contractAddress, scope, factCollectionTypeId, factCollectionId), factTypeId, [
55
+ ...payload
56
+ ], originBlock);
57
+ }
58
+ }
59
+ /**
60
+ * Builds the serialized key that identifies a fact in the store.
61
+ */ export function factKeyStrOf(fact) {
62
+ const origin = fact.originBlock ? `${fact.originBlock.blockNumber}:${fact.originBlock.blockHash}` : 'none';
63
+ return `${fact.factCollectionKey}:${fact.factTypeId}:${fact.payloadHash()}:${origin}`;
64
+ }
@@ -2,8 +2,9 @@ export * from './address_store/index.js';
2
2
  export * from './anchor_block_store/index.js';
3
3
  export * from './capsule_store/index.js';
4
4
  export * from './contract_store/index.js';
5
+ export * from './fact_store/index.js';
5
6
  export * from './note_store/index.js';
6
7
  export * from './tagging_store/index.js';
7
8
  export * from './metadata.js';
8
9
  export * from './private_event_store/private_event_store.js';
9
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zdG9yYWdlL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsMEJBQTBCLENBQUM7QUFDekMsY0FBYywrQkFBK0IsQ0FBQztBQUM5QyxjQUFjLDBCQUEwQixDQUFDO0FBQ3pDLGNBQWMsMkJBQTJCLENBQUM7QUFDMUMsY0FBYyx1QkFBdUIsQ0FBQztBQUN0QyxjQUFjLDBCQUEwQixDQUFDO0FBQ3pDLGNBQWMsZUFBZSxDQUFDO0FBQzlCLGNBQWMsOENBQThDLENBQUMifQ==
10
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zdG9yYWdlL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsMEJBQTBCLENBQUM7QUFDekMsY0FBYywrQkFBK0IsQ0FBQztBQUM5QyxjQUFjLDBCQUEwQixDQUFDO0FBQ3pDLGNBQWMsMkJBQTJCLENBQUM7QUFDMUMsY0FBYyx1QkFBdUIsQ0FBQztBQUN0QyxjQUFjLHVCQUF1QixDQUFDO0FBQ3RDLGNBQWMsMEJBQTBCLENBQUM7QUFDekMsY0FBYyxlQUFlLENBQUM7QUFDOUIsY0FBYyw4Q0FBOEMsQ0FBQyJ9
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,8CAA8C,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,8CAA8C,CAAC"}
@@ -2,6 +2,7 @@ export * from './address_store/index.js';
2
2
  export * from './anchor_block_store/index.js';
3
3
  export * from './capsule_store/index.js';
4
4
  export * from './contract_store/index.js';
5
+ export * from './fact_store/index.js';
5
6
  export * from './note_store/index.js';
6
7
  export * from './tagging_store/index.js';
7
8
  export * from './metadata.js';
@@ -1,2 +1,2 @@
1
- export declare const PXE_DATA_SCHEMA_VERSION = 8;
2
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWV0YWRhdGEuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zdG9yYWdlL21ldGFkYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGVBQU8sTUFBTSx1QkFBdUIsSUFBSSxDQUFDIn0=
1
+ export declare const PXE_DATA_SCHEMA_VERSION = 13;
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWV0YWRhdGEuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zdG9yYWdlL21ldGFkYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGVBQU8sTUFBTSx1QkFBdUIsS0FBSyxDQUFDIn0=
@@ -1 +1 @@
1
- {"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../src/storage/metadata.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,IAAI,CAAC"}
1
+ {"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../src/storage/metadata.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,KAAK,CAAC"}
@@ -1 +1 @@
1
- export const PXE_DATA_SCHEMA_VERSION = 8;
1
+ export const PXE_DATA_SCHEMA_VERSION = 13;
@@ -6,9 +6,10 @@ import { AddressStore } from './address_store/address_store.js';
6
6
  import { AnchorBlockStore } from './anchor_block_store/anchor_block_store.js';
7
7
  import { CapsuleStore } from './capsule_store/capsule_store.js';
8
8
  import { ContractStore } from './contract_store/contract_store.js';
9
+ import { FactStore } from './fact_store/fact_store.js';
9
10
  import { NoteStore } from './note_store/note_store.js';
10
11
  import { PrivateEventStore } from './private_event_store/private_event_store.js';
11
- import { RecipientTaggingStore, SenderAddressBookStore, SenderTaggingStore } from './tagging_store/index.js';
12
+ import { RecipientTaggingStore, SenderTaggingStore, TaggingSecretSourcesStore } from './tagging_store/index.js';
12
13
  /**
13
14
  * The set of sub-stores opened against a single `AztecAsyncKVStore` to back PXE state.
14
15
  */
@@ -19,15 +20,16 @@ export type PxeStores = {
19
20
  noteStore: NoteStore;
20
21
  anchorBlockStore: AnchorBlockStore;
21
22
  senderTaggingStore: SenderTaggingStore;
22
- senderAddressBookStore: SenderAddressBookStore;
23
+ taggingSecretSourcesStore: TaggingSecretSourcesStore;
23
24
  recipientTaggingStore: RecipientTaggingStore;
24
25
  capsuleStore: CapsuleStore;
25
26
  keyStore: KeyStore;
26
27
  l2TipsStore: L2TipsKVStore;
28
+ factStore: FactStore;
27
29
  };
28
30
  /**
29
31
  * Opens every PXE sub-store against the given backing store. The `initialBlockHash` seeds the
30
32
  * `L2TipsKVStore` so it agrees with the node's archiver on the dynamic genesis header hash.
31
33
  */
32
34
  export declare function openPxeStores(store: AztecAsyncKVStore, initialBlockHash: BlockHash): PxeStores;
33
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3Blbl9weGVfc3RvcmVzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvc3RvcmFnZS9vcGVuX3B4ZV9zdG9yZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFFBQVEsRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBQzVDLE9BQU8sS0FBSyxFQUFFLGlCQUFpQixFQUFFLE1BQU0saUJBQWlCLENBQUM7QUFDekQsT0FBTyxFQUFFLGFBQWEsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBQ3ZELE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBRXJELE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSxrQ0FBa0MsQ0FBQztBQUNoRSxPQUFPLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSw0Q0FBNEMsQ0FBQztBQUM5RSxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sa0NBQWtDLENBQUM7QUFDaEUsT0FBTyxFQUFFLGFBQWEsRUFBRSxNQUFNLG9DQUFvQyxDQUFDO0FBQ25FLE9BQU8sRUFBRSxTQUFTLEVBQUUsTUFBTSw0QkFBNEIsQ0FBQztBQUN2RCxPQUFPLEVBQUUsaUJBQWlCLEVBQUUsTUFBTSw4Q0FBOEMsQ0FBQztBQUNqRixPQUFPLEVBQUUscUJBQXFCLEVBQUUsc0JBQXNCLEVBQUUsa0JBQWtCLEVBQUUsTUFBTSwwQkFBMEIsQ0FBQztBQUU3Rzs7R0FFRztBQUNILE1BQU0sTUFBTSxTQUFTLEdBQUc7SUFDdEIsWUFBWSxF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C,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,SAAS,GAAG,SAAS,CAe9F"}
@@ -4,9 +4,10 @@ import { AddressStore } from './address_store/address_store.js';
4
4
  import { AnchorBlockStore } from './anchor_block_store/anchor_block_store.js';
5
5
  import { CapsuleStore } from './capsule_store/capsule_store.js';
6
6
  import { ContractStore } from './contract_store/contract_store.js';
7
+ import { FactStore } from './fact_store/fact_store.js';
7
8
  import { NoteStore } from './note_store/note_store.js';
8
9
  import { PrivateEventStore } from './private_event_store/private_event_store.js';
9
- import { RecipientTaggingStore, SenderAddressBookStore, SenderTaggingStore } from './tagging_store/index.js';
10
+ import { RecipientTaggingStore, SenderTaggingStore, TaggingSecretSourcesStore } from './tagging_store/index.js';
10
11
  /**
11
12
  * Opens every PXE sub-store against the given backing store. The `initialBlockHash` seeds the
12
13
  * `L2TipsKVStore` so it agrees with the node's archiver on the dynamic genesis header hash.
@@ -18,10 +19,11 @@ import { RecipientTaggingStore, SenderAddressBookStore, SenderTaggingStore } fro
18
19
  noteStore: new NoteStore(store),
19
20
  anchorBlockStore: new AnchorBlockStore(store),
20
21
  senderTaggingStore: new SenderTaggingStore(store),
21
- senderAddressBookStore: new SenderAddressBookStore(store),
22
+ taggingSecretSourcesStore: new TaggingSecretSourcesStore(store),
22
23
  recipientTaggingStore: new RecipientTaggingStore(store),
23
24
  capsuleStore: new CapsuleStore(store),
24
25
  keyStore: new KeyStore(store),
25
- l2TipsStore: new L2TipsKVStore(store, 'pxe', initialBlockHash)
26
+ l2TipsStore: new L2TipsKVStore(store, 'pxe', initialBlockHash),
27
+ factStore: new FactStore(store)
26
28
  };
27
29
  }
@@ -1,4 +1,4 @@
1
1
  export { SenderTaggingStore } from './sender_tagging_store.js';
2
- export { SenderAddressBookStore } from './sender_address_book_store.js';
2
+ export { TaggingSecretSourcesStore } from './tagging_secret_sources_store.js';
3
3
  export { RecipientTaggingStore } from './recipient_tagging_store.js';
4
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zdG9yYWdlL3RhZ2dpbmdfc3RvcmUvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLGtCQUFrQixFQUFFLE1BQU0sMkJBQTJCLENBQUM7QUFDL0QsT0FBTyxFQUFFLHNCQUFzQixFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDeEUsT0FBTyxFQUFFLHFCQUFxQixFQUFFLE1BQU0sOEJBQThCLENBQUMifQ==
4
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zdG9yYWdlL3RhZ2dpbmdfc3RvcmUvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLGtCQUFrQixFQUFFLE1BQU0sMkJBQTJCLENBQUM7QUFDL0QsT0FBTyxFQUFFLHlCQUF5QixFQUFFLE1BQU0sbUNBQW1DLENBQUM7QUFDOUUsT0FBTyxFQUFFLHFCQUFxQixFQUFFLE1BQU0sOEJBQThCLENBQUMifQ==
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/tagging_store/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/tagging_store/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC"}
@@ -1,3 +1,3 @@
1
1
  export { SenderTaggingStore } from './sender_tagging_store.js';
2
- export { SenderAddressBookStore } from './sender_address_book_store.js';
2
+ export { TaggingSecretSourcesStore } from './tagging_secret_sources_store.js';
3
3
  export { RecipientTaggingStore } from './recipient_tagging_store.js';
@@ -0,0 +1,51 @@
1
+ import { Point } from '@aztec/foundation/curves/grumpkin';
2
+ import type { AztecAsyncKVStore } from '@aztec/kv-store';
3
+ import { AztecAddress } from '@aztec/stdlib/aztec-address';
4
+ /**
5
+ * The kinds of shared secret an entry can hold.
6
+ */
7
+ export type SharedSecretKind = 'arbitrary-secret' | 'handshake';
8
+ /** A shared secret registered for a recipient, with the kind that determines which tag streams it backs. */
9
+ export type SharedSecret = {
10
+ kind: SharedSecretKind;
11
+ secret: Point;
12
+ };
13
+ /**
14
+ * Stores the sources from which directional app tagging secrets are derived during recipient log synchronization.
15
+ *
16
+ * Two kinds of source are held:
17
+ * - Sender addresses: combined with a recipient to derive a shared tagging secret via ECDH. These are global (not
18
+ * scoped to a recipient) because the per-recipient binding comes from re-mixing the recipient's keys during
19
+ * derivation, so each account only ever derives secrets meant for it.
20
+ * - Pre-shared tagging secrets: shared secret points registered directly, bypassing ECDH. These are scoped to a
21
+ * specific recipient, since the derivation of the directional app tagging secret does not require any secret
22
+ * recipient data: given the original secret anyone can derive a recipient's app-siloed directional tagging secret,
23
+ * and so these must not be reused across recipients to preserve privacy. Each carries the {@link SharedSecretKind}
24
+ * it was registered through, which determines the tag streams it is scanned under.
25
+ */
26
+ export declare class TaggingSecretSourcesStore {
27
+ #private;
28
+ constructor(store: AztecAsyncKVStore);
29
+ addSender(address: AztecAddress): Promise<boolean>;
30
+ getSenders(): Promise<AztecAddress[]>;
31
+ removeSender(address: AztecAddress): Promise<boolean>;
32
+ /**
33
+ * Registers a pre-shared tagging secret scoped to a recipient.
34
+ * @returns true if the secret was newly added, false if it was already registered for that recipient.
35
+ */
36
+ addSharedSecret(recipient: AztecAddress, kind: SharedSecretKind, secret: Point): Promise<boolean>;
37
+ /** Returns the pre-shared tagging secrets registered for a given recipient. */
38
+ getSharedSecretsForRecipient(recipient: AztecAddress): Promise<SharedSecret[]>;
39
+ /** Returns every registered pre-shared tagging secret, each paired with the recipient it is scoped to. */
40
+ getAllSharedSecrets(): Promise<{
41
+ recipient: AztecAddress;
42
+ kind: SharedSecretKind;
43
+ secret: Point;
44
+ }[]>;
45
+ /**
46
+ * Removes a pre-shared tagging secret scoped to a recipient. Both the secret and its kind must match.
47
+ * @returns true if the secret was registered and removed, false if it was not registered for that recipient.
48
+ */
49
+ removeSharedSecret(recipient: AztecAddress, kind: SharedSecretKind, secret: Point): Promise<boolean>;
50
+ }
51
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFnZ2luZ19zZWNyZXRfc291cmNlc19zdG9yZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3N0b3JhZ2UvdGFnZ2luZ19zdG9yZS90YWdnaW5nX3NlY3JldF9zb3VyY2VzX3N0b3JlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxLQUFLLEVBQUUsTUFBTSxtQ0FBbUMsQ0FBQztBQUUxRCxPQUFPLEtBQUssRUFBRSxpQkFBaUIsRUFBcUMsTUFBTSxpQkFBaUIsQ0FBQztBQUM1RixPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFFM0Q7O0dBRUc7QUFDSCxNQUFNLE1BQU0sZ0JBQWdCLEdBQUcsa0JBQWtCLEdBQUcsV0FBVyxDQUFDO0FBRWhFLDRHQUE0RztBQUM1RyxNQUFNLE1BQU0sWUFBWSxHQUFHO0lBQUUsSU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,CAAC,OAAO,CAAC,CAYnG;CACF"}
@@ -0,0 +1,105 @@
1
+ import { Point } from '@aztec/foundation/curves/grumpkin';
2
+ import { toArray } from '@aztec/foundation/iterable';
3
+ import { AztecAddress } from '@aztec/stdlib/aztec-address';
4
+ /**
5
+ * Stores the sources from which directional app tagging secrets are derived during recipient log synchronization.
6
+ *
7
+ * Two kinds of source are held:
8
+ * - Sender addresses: combined with a recipient to derive a shared tagging secret via ECDH. These are global (not
9
+ * scoped to a recipient) because the per-recipient binding comes from re-mixing the recipient's keys during
10
+ * derivation, so each account only ever derives secrets meant for it.
11
+ * - Pre-shared tagging secrets: shared secret points registered directly, bypassing ECDH. These are scoped to a
12
+ * specific recipient, since the derivation of the directional app tagging secret does not require any secret
13
+ * recipient data: given the original secret anyone can derive a recipient's app-siloed directional tagging secret,
14
+ * and so these must not be reused across recipients to preserve privacy. Each carries the {@link SharedSecretKind}
15
+ * it was registered through, which determines the tag streams it is scanned under.
16
+ */ export class TaggingSecretSourcesStore {
17
+ #store;
18
+ #senders;
19
+ #sharedSecretsByRecipient;
20
+ constructor(store){
21
+ this.#store = store;
22
+ this.#senders = this.#store.openMap('senders');
23
+ this.#sharedSecretsByRecipient = this.#store.openMultiMap('recipient_shared_secrets');
24
+ }
25
+ addSender(address) {
26
+ return this.#store.transactionAsync(async ()=>{
27
+ if (await this.#senders.hasAsync(address.toString())) {
28
+ return false;
29
+ }
30
+ await this.#senders.set(address.toString(), true);
31
+ return true;
32
+ });
33
+ }
34
+ getSenders() {
35
+ return this.#store.transactionAsync(async ()=>{
36
+ return (await toArray(this.#senders.keysAsync())).map(AztecAddress.fromStringUnsafe);
37
+ });
38
+ }
39
+ removeSender(address) {
40
+ return this.#store.transactionAsync(async ()=>{
41
+ if (!await this.#senders.hasAsync(address.toString())) {
42
+ return false;
43
+ }
44
+ await this.#senders.delete(address.toString());
45
+ return true;
46
+ });
47
+ }
48
+ /**
49
+ * Registers a pre-shared tagging secret scoped to a recipient.
50
+ * @returns true if the secret was newly added, false if it was already registered for that recipient.
51
+ */ addSharedSecret(recipient, kind, secret) {
52
+ return this.#store.transactionAsync(async ()=>{
53
+ const secretStr = secret.toString();
54
+ // MultiMap.set silently ignores an identical (key, value), so we scan to report whether this is a new secret.
55
+ for await (const existing of this.#sharedSecretsByRecipient.getValuesAsync(recipient.toString())){
56
+ if (existing.secret === secretStr) {
57
+ if (existing.kind !== kind) {
58
+ throw new Error(`Secret already registered for recipient with kind '${existing.kind}', cannot re-register it as '${kind}'.`);
59
+ }
60
+ return false;
61
+ }
62
+ }
63
+ await this.#sharedSecretsByRecipient.set(recipient.toString(), {
64
+ kind,
65
+ secret: secretStr
66
+ });
67
+ return true;
68
+ });
69
+ }
70
+ /** Returns the pre-shared tagging secrets registered for a given recipient. */ getSharedSecretsForRecipient(recipient) {
71
+ return this.#store.transactionAsync(async ()=>{
72
+ return (await toArray(this.#sharedSecretsByRecipient.getValuesAsync(recipient.toString()))).map(deserializeSharedSecret);
73
+ });
74
+ }
75
+ /** Returns every registered pre-shared tagging secret, each paired with the recipient it is scoped to. */ getAllSharedSecrets() {
76
+ return this.#store.transactionAsync(async ()=>{
77
+ const entries = await toArray(this.#sharedSecretsByRecipient.entriesAsync());
78
+ return entries.map(([recipient, entry])=>({
79
+ recipient: AztecAddress.fromStringUnsafe(recipient),
80
+ ...deserializeSharedSecret(entry)
81
+ }));
82
+ });
83
+ }
84
+ /**
85
+ * Removes a pre-shared tagging secret scoped to a recipient. Both the secret and its kind must match.
86
+ * @returns true if the secret was registered and removed, false if it was not registered for that recipient.
87
+ */ removeSharedSecret(recipient, kind, secret) {
88
+ return this.#store.transactionAsync(async ()=>{
89
+ const secretStr = secret.toString();
90
+ for await (const existing of this.#sharedSecretsByRecipient.getValuesAsync(recipient.toString())){
91
+ if (existing.kind === kind && existing.secret === secretStr) {
92
+ await this.#sharedSecretsByRecipient.deleteValue(recipient.toString(), existing);
93
+ return true;
94
+ }
95
+ }
96
+ return false;
97
+ });
98
+ }
99
+ }
100
+ function deserializeSharedSecret(entry) {
101
+ return {
102
+ kind: entry.kind,
103
+ secret: Point.fromString(entry.secret)
104
+ };
105
+ }
@@ -1,2 +1,2 @@
1
- export declare const UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN = 20;
2
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RhbnRzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdGFnZ2luZy9jb25zdGFudHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBU0EsZUFBTyxNQUFNLHNDQUFzQyxLQUFLLENBQUMifQ==
1
+ export declare const UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN: number;
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RhbnRzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdGFnZ2luZy9jb25zdGFudHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBbUJBLGVBQU8sTUFBTSxzQ0FBc0MsUUFBK0IsQ0FBQyJ9
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/tagging/constants.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,sCAAsC,KAAK,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/tagging/constants.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,sCAAsC,QAA+B,CAAC"}
@@ -1,10 +1,19 @@
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.
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.
6
4
  //
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;
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/pxe",
3
- "version": "5.0.0-rc.1",
3
+ "version": "5.0.0",
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": "5.0.0-rc.1",
75
- "@aztec/bb.js": "5.0.0-rc.1",
76
- "@aztec/builder": "5.0.0-rc.1",
77
- "@aztec/constants": "5.0.0-rc.1",
78
- "@aztec/ethereum": "5.0.0-rc.1",
79
- "@aztec/foundation": "5.0.0-rc.1",
80
- "@aztec/key-store": "5.0.0-rc.1",
81
- "@aztec/kv-store": "5.0.0-rc.1",
82
- "@aztec/noir-protocol-circuits-types": "5.0.0-rc.1",
83
- "@aztec/noir-types": "5.0.0-rc.1",
84
- "@aztec/protocol-contracts": "5.0.0-rc.1",
85
- "@aztec/simulator": "5.0.0-rc.1",
86
- "@aztec/standard-contracts": "5.0.0-rc.1",
87
- "@aztec/stdlib": "5.0.0-rc.1",
74
+ "@aztec/bb-prover": "5.0.0",
75
+ "@aztec/bb.js": "5.0.0",
76
+ "@aztec/builder": "5.0.0",
77
+ "@aztec/constants": "5.0.0",
78
+ "@aztec/ethereum": "5.0.0",
79
+ "@aztec/foundation": "5.0.0",
80
+ "@aztec/key-store": "5.0.0",
81
+ "@aztec/kv-store": "5.0.0",
82
+ "@aztec/noir-protocol-circuits-types": "5.0.0",
83
+ "@aztec/noir-types": "5.0.0",
84
+ "@aztec/protocol-contracts": "5.0.0",
85
+ "@aztec/simulator": "5.0.0",
86
+ "@aztec/standard-contracts": "5.0.0",
87
+ "@aztec/stdlib": "5.0.0",
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": "5.0.0-rc.1",
97
- "@aztec/world-state": "5.0.0-rc.1",
96
+ "@aztec/noir-test-contracts.js": "5.0.0",
97
+ "@aztec/world-state": "5.0.0",
98
98
  "@jest/globals": "^30.0.0",
99
99
  "@types/jest": "^30.0.0",
100
100
  "@types/lodash.omit": "^4.5.7",
@@ -1,29 +1,17 @@
1
- import { Fr } from '@aztec/foundation/curves/bn254';
2
- import {
3
- type BlockData,
4
- type BlockQuery,
5
- type BlocksQuery,
6
- type CheckpointsQuery,
7
- L2Block,
8
- type L2BlockSource,
9
- } from '@aztec/stdlib/block';
10
- import { Checkpoint, L1PublishedData, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
1
+ import { type BlockData, type BlockQuery, type BlocksQuery, L2Block, type L2BlockSource } from '@aztec/stdlib/block';
11
2
  import type { AztecNode } from '@aztec/stdlib/interfaces/client';
12
3
 
13
4
  /**
14
5
  * Lifts an {@link AztecNode} RPC client into the shape {@link L2BlockStream} expects.
15
- * `getBlocks` requests transaction bodies so that real `L2Block` instances can be constructed;
16
- * `getCheckpoints` requests blocks + L1 info + attestations so that `PublishedCheckpoint`
17
- * instances are fully populated.
6
+ * `getBlocks` requests transaction bodies so that real `L2Block` instances can be constructed. The stream no
7
+ * longer fetches checkpoint payloads (the `chain-checkpointed` event is a thin tip event), so `getCheckpoints`
8
+ * is not part of the lifted shape.
18
9
  */
19
10
  export function blockStreamSourceFromAztecNode(
20
11
  node: AztecNode,
21
- ): Pick<L2BlockSource, 'getBlocks' | 'getBlockData' | 'getL2Tips' | 'getCheckpoints'> {
12
+ ): Pick<L2BlockSource, 'getBlocks' | 'getBlockData' | 'getL2Tips'> {
22
13
  return {
23
- getL2Tips: async () => {
24
- const tips = await node.getChainTips();
25
- return { ...tips, proposedCheckpoint: tips.checkpointed };
26
- },
14
+ getL2Tips: () => node.getChainTips(),
27
15
 
28
16
  async getBlockData(query: BlockQuery): Promise<BlockData | undefined> {
29
17
  const response = await node.getBlock(query);
@@ -50,32 +38,5 @@ export function blockStreamSourceFromAztecNode(
50
38
  const responses = await node.getBlocks(query.from, query.limit, { includeTransactions: true });
51
39
  return responses.map(r => new L2Block(r.archive, r.header, r.body!, r.checkpointNumber, r.indexWithinCheckpoint));
52
40
  },
53
-
54
- async getCheckpoints(query: CheckpointsQuery): Promise<PublishedCheckpoint[]> {
55
- if (!('from' in query)) {
56
- throw new Error('getCheckpoints with epoch query not supported via AztecNode RPC');
57
- }
58
- const { from, limit } = query;
59
- const responses = await node.getCheckpoints(from, limit, {
60
- includeBlocks: true,
61
- includeTransactions: true,
62
- includeL1PublishInfo: true,
63
- includeAttestations: true,
64
- });
65
- return responses.map(r => {
66
- const checkpoint = new Checkpoint(
67
- r.archive,
68
- r.header,
69
- r.blocks!.map(b => new L2Block(b.archive, b.header, b.body!, b.checkpointNumber, b.indexWithinCheckpoint)),
70
- r.number,
71
- r.feeAssetPriceModifier,
72
- );
73
- const l1 =
74
- r.l1?.published === true
75
- ? new L1PublishedData(r.l1.blockNumber, r.l1.timestamp, r.l1.blockHash)
76
- : new L1PublishedData(0n, 0n, Fr.ZERO.toString());
77
- return new PublishedCheckpoint(checkpoint, l1, r.attestations ?? []);
78
- });
79
- },
80
41
  };
81
42
  }