@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,75 @@
1
+ import type { Fr } from '@aztec/foundation/curves/bn254';
2
+ import type { L2Tips } from '@aztec/stdlib/block';
3
+
4
+ import type { FactCollectionKey, OriginBlock } from './fact_store_keys.js';
5
+ import type { Fact } from './stored_fact.js';
6
+
7
+ /**
8
+ * Chain state of a retractable fact's origin block, mirroring the L2 chain tips.
9
+ *
10
+ * - `Pending`: above the proven tip.
11
+ * - `Proven`: proof on L1 but not yet finalized.
12
+ * - `Finalized`: L1-finalized.
13
+ *
14
+ * The numeric discriminants must stay in sync with the Noir `OriginBlockState` in
15
+ * `noir-projects/aztec-nr/aztec/src/facts/origin_state.nr`: PXE serializes this value into the `Fact` oracle response
16
+ * and Noir deserializes it via `from_u8`, which rejects any value outside this set.
17
+ */
18
+ export enum OriginBlockState {
19
+ Pending = 1,
20
+ Proven = 2,
21
+ Finalized = 3,
22
+ }
23
+
24
+ /** The two chain-tip block numbers needed to classify an origin block (`finalized <= proven` always holds). */
25
+ export type TipBlockNumbers = { provenBlockNumber: number; finalizedBlockNumber: number };
26
+
27
+ /**
28
+ * Projects the live chain tips to the block numbers used for classification, capped at the anchor block.
29
+ *
30
+ * A utility execution reads against a fixed anchor block, and every other node query in the oracle is bounded by it.
31
+ * Capping the proven/finalized tips at the anchor keeps origin-state consistent with that view and deterministic
32
+ * across runs: an origin block at or before the anchor classifies exactly as it would against the live tips, while an
33
+ * origin block above the anchor is reported `Pending` rather than trusting tips that look past the anchor.
34
+ */
35
+ export function anchoredTipBlockNumbers(tips: L2Tips, anchorBlockNumber: number): TipBlockNumbers {
36
+ return {
37
+ provenBlockNumber: Math.min(tips.proven.block.number, anchorBlockNumber),
38
+ finalizedBlockNumber: Math.min(tips.finalized.block.number, anchorBlockNumber),
39
+ };
40
+ }
41
+
42
+ /** A retractable fact's origin block annotated with that block's current chain state. */
43
+ export type RetractableFactOrigin = OriginBlock & { blockState: OriginBlockState };
44
+
45
+ /** A fact enriched with origin-block state. `originBlock` is undefined for a non-retractable fact. */
46
+ export type FactWithOriginState = { factTypeId: Fr; payload: Fr[]; originBlock: RetractableFactOrigin | undefined };
47
+
48
+ /** A fact collection whose facts carry origin-block state. */
49
+ export type FactCollectionWithOriginState = { key: FactCollectionKey; facts: FactWithOriginState[] };
50
+
51
+ /**
52
+ * Classifies an origin block by number against the chain tips. A surviving retractable fact's origin block is
53
+ * guaranteed canonical (a reorg would have pruned the fact), so a number comparison is sufficient.
54
+ */
55
+ export function classifyOriginBlockState(blockNumber: number, tips: TipBlockNumbers): OriginBlockState {
56
+ if (blockNumber <= tips.finalizedBlockNumber) {
57
+ return OriginBlockState.Finalized;
58
+ }
59
+ if (blockNumber <= tips.provenBlockNumber) {
60
+ return OriginBlockState.Proven;
61
+ }
62
+ return OriginBlockState.Pending;
63
+ }
64
+
65
+ /** Enriches a stored fact with the chain state of its origin block (when retractable). */
66
+ export function toFactWithOriginState(fact: Fact, tips: TipBlockNumbers): FactWithOriginState {
67
+ const originBlock: RetractableFactOrigin | undefined = fact.originBlock
68
+ ? {
69
+ blockNumber: fact.originBlock.blockNumber,
70
+ blockHash: fact.originBlock.blockHash,
71
+ blockState: classifyOriginBlockState(fact.originBlock.blockNumber, tips),
72
+ }
73
+ : undefined;
74
+ return { factTypeId: fact.factTypeId, payload: fact.payload, originBlock };
75
+ }
@@ -0,0 +1,80 @@
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
+
6
+ import { FactCollectionKey, type OriginBlock } from './fact_store_keys.js';
7
+
8
+ /** A fact as returned by the fact store. */
9
+ export type Fact = { factTypeId: Fr; payload: Fr[]; originBlock: OriginBlock | undefined };
10
+
11
+ /**
12
+ * A single immutable fact belonging to a fact collection.
13
+ */
14
+ export class StoredFact {
15
+ constructor(
16
+ public readonly factCollectionKey: FactCollectionKey,
17
+ public readonly factTypeId: Fr,
18
+ public readonly payload: Fr[],
19
+ public readonly originBlock: OriginBlock | undefined,
20
+ ) {}
21
+
22
+ /** Whether this fact is deleted on block pruning (true) or survives reorgs (false). */
23
+ get isRetractable(): boolean {
24
+ return this.originBlock !== undefined;
25
+ }
26
+
27
+ /** Stable digest of the payload, used for fact idempotency. */
28
+ payloadHash(): Fr {
29
+ return sha256ToField([this.payload.length, ...this.payload]);
30
+ }
31
+
32
+ /** Returns the externally facing view of this fact. */
33
+ toFact(): Fact {
34
+ return { factTypeId: this.factTypeId, payload: this.payload, originBlock: this.originBlock };
35
+ }
36
+
37
+ toBuffer(): Buffer {
38
+ return serializeToBuffer(
39
+ this.factCollectionKey.contractAddress,
40
+ this.factCollectionKey.scope,
41
+ this.factCollectionKey.factCollectionTypeId,
42
+ this.factCollectionKey.factCollectionId,
43
+ this.factTypeId,
44
+ this.payload.length,
45
+ ...this.payload,
46
+ this.originBlock !== undefined,
47
+ this.originBlock ? this.originBlock.blockNumber : 0,
48
+ this.originBlock ? this.originBlock.blockHash : Fr.ZERO,
49
+ );
50
+ }
51
+
52
+ static fromBuffer(buffer: Buffer | BufferReader): StoredFact {
53
+ const reader = BufferReader.asReader(buffer);
54
+ const contractAddress = reader.readObject(AztecAddress);
55
+ const scope = reader.readObject(AztecAddress);
56
+ const factCollectionTypeId = reader.readObject(Fr);
57
+ const factCollectionId = reader.readObject(Fr);
58
+ const factTypeId = reader.readObject(Fr);
59
+ const payloadLen = reader.readNumber();
60
+ const payload = reader.readArray(payloadLen, Fr);
61
+ const hasOriginBlock = reader.readBoolean();
62
+ const blockNumber = reader.readNumber();
63
+ const blockHash = reader.readObject(Fr);
64
+ const originBlock = hasOriginBlock ? { blockNumber, blockHash } : undefined;
65
+ return new StoredFact(
66
+ new FactCollectionKey(contractAddress, scope, factCollectionTypeId, factCollectionId),
67
+ factTypeId,
68
+ [...payload],
69
+ originBlock,
70
+ );
71
+ }
72
+ }
73
+
74
+ /**
75
+ * Builds the serialized key that identifies a fact in the store.
76
+ */
77
+ export function factKeyStrOf(fact: StoredFact): string {
78
+ const origin = fact.originBlock ? `${fact.originBlock.blockNumber}:${fact.originBlock.blockHash}` : 'none';
79
+ return `${fact.factCollectionKey}:${fact.factTypeId}:${fact.payloadHash()}:${origin}`;
80
+ }
@@ -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 +1 @@
1
- export const PXE_DATA_SCHEMA_VERSION = 8;
1
+ export const PXE_DATA_SCHEMA_VERSION = 13;
@@ -7,9 +7,10 @@ import { AddressStore } from './address_store/address_store.js';
7
7
  import { AnchorBlockStore } from './anchor_block_store/anchor_block_store.js';
8
8
  import { CapsuleStore } from './capsule_store/capsule_store.js';
9
9
  import { ContractStore } from './contract_store/contract_store.js';
10
+ import { FactStore } from './fact_store/fact_store.js';
10
11
  import { NoteStore } from './note_store/note_store.js';
11
12
  import { PrivateEventStore } from './private_event_store/private_event_store.js';
12
- import { RecipientTaggingStore, SenderAddressBookStore, SenderTaggingStore } from './tagging_store/index.js';
13
+ import { RecipientTaggingStore, SenderTaggingStore, TaggingSecretSourcesStore } from './tagging_store/index.js';
13
14
 
14
15
  /**
15
16
  * The set of sub-stores opened against a single `AztecAsyncKVStore` to back PXE state.
@@ -21,11 +22,12 @@ export type PxeStores = {
21
22
  noteStore: NoteStore;
22
23
  anchorBlockStore: AnchorBlockStore;
23
24
  senderTaggingStore: SenderTaggingStore;
24
- senderAddressBookStore: SenderAddressBookStore;
25
+ taggingSecretSourcesStore: TaggingSecretSourcesStore;
25
26
  recipientTaggingStore: RecipientTaggingStore;
26
27
  capsuleStore: CapsuleStore;
27
28
  keyStore: KeyStore;
28
29
  l2TipsStore: L2TipsKVStore;
30
+ factStore: FactStore;
29
31
  };
30
32
 
31
33
  /**
@@ -40,10 +42,11 @@ export function openPxeStores(store: AztecAsyncKVStore, initialBlockHash: BlockH
40
42
  noteStore: new NoteStore(store),
41
43
  anchorBlockStore: new AnchorBlockStore(store),
42
44
  senderTaggingStore: new SenderTaggingStore(store),
43
- senderAddressBookStore: new SenderAddressBookStore(store),
45
+ taggingSecretSourcesStore: new TaggingSecretSourcesStore(store),
44
46
  recipientTaggingStore: new RecipientTaggingStore(store),
45
47
  capsuleStore: new CapsuleStore(store),
46
48
  keyStore: new KeyStore(store),
47
49
  l2TipsStore: new L2TipsKVStore(store, 'pxe', initialBlockHash),
50
+ factStore: new FactStore(store),
48
51
  };
49
52
  }
@@ -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,138 @@
1
+ import { Point } from '@aztec/foundation/curves/grumpkin';
2
+ import { toArray } from '@aztec/foundation/iterable';
3
+ import type { AztecAsyncKVStore, AztecAsyncMap, AztecAsyncMultiMap } from '@aztec/kv-store';
4
+ import { AztecAddress } from '@aztec/stdlib/aztec-address';
5
+
6
+ /**
7
+ * The kinds of shared secret an entry can hold.
8
+ */
9
+ export type SharedSecretKind = 'arbitrary-secret' | 'handshake';
10
+
11
+ /** A shared secret registered for a recipient, with the kind that determines which tag streams it backs. */
12
+ export type SharedSecret = { kind: SharedSecretKind; secret: Point };
13
+
14
+ /**
15
+ * Stores the sources from which directional app tagging secrets are derived during recipient log synchronization.
16
+ *
17
+ * Two kinds of source are held:
18
+ * - Sender addresses: combined with a recipient to derive a shared tagging secret via ECDH. These are global (not
19
+ * scoped to a recipient) because the per-recipient binding comes from re-mixing the recipient's keys during
20
+ * derivation, so each account only ever derives secrets meant for it.
21
+ * - Pre-shared tagging secrets: shared secret points registered directly, bypassing ECDH. These are scoped to a
22
+ * specific recipient, since the derivation of the directional app tagging secret does not require any secret
23
+ * recipient data: given the original secret anyone can derive a recipient's app-siloed directional tagging secret,
24
+ * and so these must not be reused across recipients to preserve privacy. Each carries the {@link SharedSecretKind}
25
+ * it was registered through, which determines the tag streams it is scanned under.
26
+ */
27
+ export class TaggingSecretSourcesStore {
28
+ #store: AztecAsyncKVStore;
29
+ #senders: AztecAsyncMap<string, true>;
30
+ #sharedSecretsByRecipient: AztecAsyncMultiMap<string, StoredSharedSecret>;
31
+
32
+ constructor(store: AztecAsyncKVStore) {
33
+ this.#store = store;
34
+
35
+ this.#senders = this.#store.openMap('senders');
36
+ this.#sharedSecretsByRecipient = this.#store.openMultiMap('recipient_shared_secrets');
37
+ }
38
+
39
+ addSender(address: AztecAddress): Promise<boolean> {
40
+ return this.#store.transactionAsync(async () => {
41
+ if (await this.#senders.hasAsync(address.toString())) {
42
+ return false;
43
+ }
44
+
45
+ await this.#senders.set(address.toString(), true);
46
+
47
+ return true;
48
+ });
49
+ }
50
+
51
+ getSenders(): Promise<AztecAddress[]> {
52
+ return this.#store.transactionAsync(async () => {
53
+ return (await toArray(this.#senders.keysAsync())).map(AztecAddress.fromStringUnsafe);
54
+ });
55
+ }
56
+
57
+ removeSender(address: AztecAddress): Promise<boolean> {
58
+ return this.#store.transactionAsync(async () => {
59
+ if (!(await this.#senders.hasAsync(address.toString()))) {
60
+ return false;
61
+ }
62
+
63
+ await this.#senders.delete(address.toString());
64
+
65
+ return true;
66
+ });
67
+ }
68
+
69
+ /**
70
+ * Registers a pre-shared tagging secret scoped to a recipient.
71
+ * @returns true if the secret was newly added, false if it was already registered for that recipient.
72
+ */
73
+ addSharedSecret(recipient: AztecAddress, kind: SharedSecretKind, secret: Point): Promise<boolean> {
74
+ return this.#store.transactionAsync(async () => {
75
+ const secretStr = secret.toString();
76
+ // MultiMap.set silently ignores an identical (key, value), so we scan to report whether this is a new secret.
77
+ for await (const existing of this.#sharedSecretsByRecipient.getValuesAsync(recipient.toString())) {
78
+ if (existing.secret === secretStr) {
79
+ if (existing.kind !== kind) {
80
+ throw new Error(
81
+ `Secret already registered for recipient with kind '${existing.kind}', cannot re-register it as '${kind}'.`,
82
+ );
83
+ }
84
+ return false;
85
+ }
86
+ }
87
+
88
+ await this.#sharedSecretsByRecipient.set(recipient.toString(), { kind, secret: secretStr });
89
+
90
+ return true;
91
+ });
92
+ }
93
+
94
+ /** Returns the pre-shared tagging secrets registered for a given recipient. */
95
+ getSharedSecretsForRecipient(recipient: AztecAddress): Promise<SharedSecret[]> {
96
+ return this.#store.transactionAsync(async () => {
97
+ return (await toArray(this.#sharedSecretsByRecipient.getValuesAsync(recipient.toString()))).map(
98
+ deserializeSharedSecret,
99
+ );
100
+ });
101
+ }
102
+
103
+ /** Returns every registered pre-shared tagging secret, each paired with the recipient it is scoped to. */
104
+ getAllSharedSecrets(): Promise<{ recipient: AztecAddress; kind: SharedSecretKind; secret: Point }[]> {
105
+ return this.#store.transactionAsync(async () => {
106
+ const entries = await toArray(this.#sharedSecretsByRecipient.entriesAsync());
107
+ return entries.map(([recipient, entry]) => ({
108
+ recipient: AztecAddress.fromStringUnsafe(recipient),
109
+ ...deserializeSharedSecret(entry),
110
+ }));
111
+ });
112
+ }
113
+
114
+ /**
115
+ * Removes a pre-shared tagging secret scoped to a recipient. Both the secret and its kind must match.
116
+ * @returns true if the secret was registered and removed, false if it was not registered for that recipient.
117
+ */
118
+ removeSharedSecret(recipient: AztecAddress, kind: SharedSecretKind, secret: Point): Promise<boolean> {
119
+ return this.#store.transactionAsync(async () => {
120
+ const secretStr = secret.toString();
121
+ for await (const existing of this.#sharedSecretsByRecipient.getValuesAsync(recipient.toString())) {
122
+ if (existing.kind === kind && existing.secret === secretStr) {
123
+ await this.#sharedSecretsByRecipient.deleteValue(recipient.toString(), existing);
124
+ return true;
125
+ }
126
+ }
127
+
128
+ return false;
129
+ });
130
+ }
131
+ }
132
+
133
+ /** The wire form a shared secret entry is persisted as. */
134
+ type StoredSharedSecret = { kind: SharedSecretKind; secret: string };
135
+
136
+ function deserializeSharedSecret(entry: StoredSharedSecret): SharedSecret {
137
+ return { kind: entry.kind, secret: Point.fromString(entry.secret) };
138
+ }
@@ -1,10 +1,20 @@
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
+
3
+ // This window bounds how far a sender's next tag index for a directional app tagging secret can run ahead of that
4
+ // secret's highest finalized index before `PXE::proveTx` throws.
6
5
  //
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;
6
+ // MAX_PRIVATE_LOGS_PER_TX is a floor for ordinary transaction patterns: the private kernel accumulates every
7
+ // surviving private log into a single tx-wide array of exactly this size, so a fresh secret's very first
8
+ // ordinary tx can consume that many indexes before anything is finalized.
9
+ //
10
+ // The +20 on top is headroom for multiple pending ordinary txs to the same counterparty stacking up
11
+ // before the first one is observed as mined. Only a run of near-MAX_PRIVATE_LOGS_PER_TX txs back-to-back would
12
+ // exhaust this; ordinary transfers use far fewer logs per tx, so the same margin covers many more of those. Keep the
13
+ // margin additive rather than another multiple of the floor. A larger window also makes recipient-side sync more
14
+ // expensive, since discovery has to probe ahead of the last finalized index for every active secret.
15
+ //
16
+ // TODO(F-783): MAX_PRIVATE_LOGS_PER_TX is not a hard ceiling in general — a tx that creates and nullifies (squashes)
17
+ // many notes/logs to the same secret can drive that secret's raw tag index arbitrarily higher, since indexes are
18
+ // reserved at log emission time, before squashing is decided, and the kernel's reset/squash loop is not bounded by
19
+ // MAX_PRIVATE_LOGS_PER_TX. No fixed window value closes that gap.
20
+ export const UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN = MAX_PRIVATE_LOGS_PER_TX + 20;
@@ -1,6 +0,0 @@
1
- import type { ContractOverrides } from '@aztec/stdlib/tx';
2
- import type { ContractStore } from '../storage/contract_store/contract_store.js';
3
- export declare class ProxiedContractStoreFactory {
4
- static create(contractStore: ContractStore, overrides?: ContractOverrides): ContractStore;
5
- }
6
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJveGllZF9jb250cmFjdF9kYXRhX3NvdXJjZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbnRyYWN0X2Z1bmN0aW9uX3NpbXVsYXRvci9wcm94aWVkX2NvbnRyYWN0X2RhdGFfc291cmNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUVBLE9BQU8sS0FBSyxFQUFFLGlCQUFpQixFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFFMUQsT0FBTyxLQUFLLEVBQUUsYUFBYSxFQUFFLE1BQU0sNkNBQTZDLENBQUM7QUFjakYscUJBQWEsMkJBQTJCO0lBQ3RDLE1BQU0sQ0FBQyxNQUFNLENBQUMsYUFBYSxFQUFFLGFBQWEsRUFBRSxTQUFTLENBQUMsRUFBRSxpQkFBaUIsaUJBdUN4RTtDQUNGIn0=
@@ -1 +0,0 @@
1
- {"version":3,"file":"proxied_contract_data_source.d.ts","sourceRoot":"","sources":["../../src/contract_function_simulator/proxied_contract_data_source.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAcjF,qBAAa,2BAA2B;IACtC,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,aAAa,EAAE,SAAS,CAAC,EAAE,iBAAiB,iBAuCxE;CACF"}
@@ -1,51 +0,0 @@
1
- import { findFunctionArtifactBySelector } from '@aztec/stdlib/abi';
2
- /*
3
- * Proxy generator for a ContractStore that allows overriding contract instances at given addresses,
4
- * so the contract function simulator can execute different bytecode on certain addresses. An example
5
- * use case would be overriding your own account contract so that valid signatures don't have to be
6
- * provided while simulating.
7
- *
8
- * Function artifact lookups for an overridden address are routed via the override-instance's
9
- * `currentContractClassId` rather than the underlying ContractStore's address→class mapping —
10
- * `ContractStore.getFunctionArtifact` calls `this.getContractInstance` internally, which the proxy
11
- * cannot intercept (the binding sees the raw target, not the proxy). The target class must be
12
- * registered ahead of time via `pxe.registerContractClass(...)`.
13
- */ export class ProxiedContractStoreFactory {
14
- static create(contractStore, overrides) {
15
- if (!overrides) {
16
- return contractStore;
17
- }
18
- return new Proxy(contractStore, {
19
- get (target, prop) {
20
- if (prop === 'getContractInstance') {
21
- return (address)=>{
22
- const override = overrides[address.toString()];
23
- return override ? Promise.resolve(override.instance) : target.getContractInstance(address);
24
- };
25
- }
26
- if (prop === 'getFunctionArtifact' || prop === 'getFunctionArtifactWithDebugMetadata') {
27
- return async (contractAddress, selector)=>{
28
- const override = overrides[contractAddress.toString()];
29
- if (!override) {
30
- return target[prop].call(target, contractAddress, selector);
31
- }
32
- const artifact = await target.getContractArtifact(override.instance.currentContractClassId);
33
- if (!artifact) {
34
- throw new Error(`No artifact registered for override class ${override.instance.currentContractClassId} ` + `at ${contractAddress}. Register it via pxe.registerContractClass(...) before simulating.`);
35
- }
36
- const fn = await findFunctionArtifactBySelector(artifact, selector);
37
- if (!fn) {
38
- throw new Error(`Function with selector ${selector} not found in stub artifact for overridden contract at ${contractAddress}.`);
39
- }
40
- return {
41
- ...fn,
42
- contractName: artifact.name
43
- };
44
- };
45
- }
46
- const value = Reflect.get(target, prop);
47
- return typeof value === 'function' ? value.bind(target) : value;
48
- }
49
- });
50
- }
51
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"contract_sync_service.d.ts","sourceRoot":"","sources":["../../src/contract_sync/contract_sync_service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAGpD,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAEzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AACjF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAGrE;;;GAGG;AACH,eAAO,MAAM,0BAA0B,IAAI,CAAC;AAE5C;;;;;GAKG;AACH,qBAAa,mBAAoB,YAAW,WAAW;;IAanD,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,GAAG;IAfb,QAAQ,CAAC,SAAS,mBAAmB;IAKrC,OAAO,CAAC,eAAe,CAAyC;IAIhE,OAAO,CAAC,wBAAwB,CAAyC;IAEzE,YACU,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,aAAa,EAC5B,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,MAAM,EACjB;IAEJ;;;;;;;;OAQG;IACG,oBAAoB,CACxB,eAAe,EAAE,YAAY,EAC7B,yBAAyB,EAAE,gBAAgB,GAAG,IAAI,EAClD,eAAe,EAAE,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,EAC7E,iBAAiB,EAAE,WAAW,EAC9B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,YAAY,EAAE,GACrB,OAAO,CAAC,IAAI,CAAC,CAMf;IAED,oEAAoE;IACpE,2BAA2B,CAAC,eAAe,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,IAAI,CAKvF;IAED,gFAAgF;IAChF,IAAI,IAAI,IAAI,CAIX;IAED,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEpC;IAED,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAM3C;CAsFF"}
@@ -1,27 +0,0 @@
1
- import type { FunctionCall, FunctionSelector } from '@aztec/stdlib/abi';
2
- import type { AztecAddress } from '@aztec/stdlib/aztec-address';
3
- import type { ContractInstance } from '@aztec/stdlib/contract';
4
- import type { AztecNode } from '@aztec/stdlib/interfaces/client';
5
- import type { BlockHeader } from '@aztec/stdlib/tx';
6
- import type { ContractStore } from '../storage/contract_store/contract_store.js';
7
- /**
8
- * Read the current class id of a contract from the execution data provider or AztecNode. If not found, class id
9
- * from the instance is used.
10
- * @param contractAddress - The address of the contract to read the class id for.
11
- * @param instance - The instance of the contract.
12
- * @param aztecNode - The Aztec node to query for storage.
13
- * @param header - The header of the block at which to load the DelayedPublicMutable storing the class id.
14
- * @returns The current class id.
15
- */
16
- export declare function readCurrentClassId(contractAddress: AztecAddress, instance: ContractInstance, aztecNode: AztecNode, header: BlockHeader): Promise<import("@aztec/foundation/schemas").Fr>;
17
- export declare function syncScope(contractAddress: AztecAddress, contractStore: ContractStore, functionToInvokeAfterSync: FunctionSelector | null, utilityExecutor: (privateSyncCall: FunctionCall, scopes: AztecAddress[]) => Promise<any>, scope: AztecAddress): Promise<void>;
18
- /**
19
- * Verify that the current class id of a contract obtained from AztecNode is the same as the one in contract data
20
- * provider (i.e. PXE's own storage).
21
- * @param contractAddress - The address of the contract to verify.
22
- * @param aztecNode - The Aztec node to query for storage.
23
- * @param contractStore - The contract store to fetch the local instance from.
24
- * @param header - The header of the block at which to verify the current class id.
25
- */
26
- export declare function verifyCurrentClassId(contractAddress: AztecAddress, aztecNode: AztecNode, contractStore: ContractStore, header: BlockHeader): Promise<void>;
27
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaGVscGVycy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbnRyYWN0X3N5bmMvaGVscGVycy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxtQkFBbUIsQ0FBQztBQUN4RSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUNoRSxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBRS9ELE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQ2pFLE9BQU8sS0FBSyxFQUFFLFdBQVcsRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBRXBELE9BQU8sS0FBSyxFQUFFLGFBQWEsRUFBRSxNQUFNLDZDQUE2QyxDQUFDO0FBRWpGOzs7Ozs7OztHQVFHO0FBQ0gsd0JBQXNCLGtCQUFrQixDQUN0QyxlQUFlLEVBQUUsWUFBWSxFQUM3QixRQUFRLEVBQUUsZ0JBQWdCLEVBQzFCLFNBQVMsRUFBRSxTQUFTLEVBQ3BCLE1BQU0sRUFBRSxXQUFXLG1EQWFwQjtBQUVELHdCQUFzQixTQUFTLENBQzdCLGVBQWUsRUFBRSxZQUFZLEVBQzdCLGFBQWEsRUFBRSxhQUFhLEVBQzVCLHlCQUF5QixFQUFFLGdCQUFnQixHQUFHLElBQUksRUFDbEQsZUFBZSxFQUFFLENBQUMsZUFBZSxFQUFFLFlBQVksRUFBRSxNQUFNLEVBQUUsWUFBWSxFQUFFLEtBQUssT0FBTyxDQUFDLEdBQUcsQ0FBQyxFQUN4RixLQUFLLEVBQUUsWUFBWSxpQkFlcEI7QUFFRDs7Ozs7OztHQU9HO0FBQ0gsd0JBQXNCLG9CQUFvQixDQUN4QyxlQUFlLEVBQUUsWUFBWSxFQUM3QixTQUFTLEVBQUUsU0FBUyxFQUNwQixhQUFhLEVBQUUsYUFBYSxFQUM1QixNQUFNLEVBQUUsV0FBVyxpQkFhcEIifQ==
@@ -1 +0,0 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/contract_sync/helpers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAEjF;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CACtC,eAAe,EAAE,YAAY,EAC7B,QAAQ,EAAE,gBAAgB,EAC1B,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,WAAW,mDAapB;AAED,wBAAsB,SAAS,CAC7B,eAAe,EAAE,YAAY,EAC7B,aAAa,EAAE,aAAa,EAC5B,yBAAyB,EAAE,gBAAgB,GAAG,IAAI,EAClD,eAAe,EAAE,CAAC,eAAe,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,EACxF,KAAK,EAAE,YAAY,iBAepB;AAED;;;;;;;GAOG;AACH,wBAAsB,oBAAoB,CACxC,eAAe,EAAE,YAAY,EAC7B,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,WAAW,iBAapB"}
@@ -1,53 +0,0 @@
1
- import { ProtocolContractAddress, isProtocolContract } from '@aztec/protocol-contracts';
2
- import { DelayedPublicMutableValues, DelayedPublicMutableValuesWithHash } from '@aztec/stdlib/delayed-public-mutable';
3
- /**
4
- * Read the current class id of a contract from the execution data provider or AztecNode. If not found, class id
5
- * from the instance is used.
6
- * @param contractAddress - The address of the contract to read the class id for.
7
- * @param instance - The instance of the contract.
8
- * @param aztecNode - The Aztec node to query for storage.
9
- * @param header - The header of the block at which to load the DelayedPublicMutable storing the class id.
10
- * @returns The current class id.
11
- */ export async function readCurrentClassId(contractAddress, instance, aztecNode, header) {
12
- const blockHash = await header.hash();
13
- const timestamp = header.globalVariables.timestamp;
14
- const { delayedPublicMutableSlot } = await DelayedPublicMutableValuesWithHash.getContractUpdateSlots(contractAddress);
15
- const delayedPublicMutableValues = await DelayedPublicMutableValues.readFromTree(delayedPublicMutableSlot, (slot)=>aztecNode.getPublicStorageAt(blockHash, ProtocolContractAddress.ContractInstanceRegistry, slot));
16
- let currentClassId = delayedPublicMutableValues.svc.getCurrentAt(timestamp)[0];
17
- if (currentClassId.isZero()) {
18
- currentClassId = instance.originalContractClassId;
19
- }
20
- return currentClassId;
21
- }
22
- export async function syncScope(contractAddress, contractStore, functionToInvokeAfterSync, utilityExecutor, scope) {
23
- // Protocol contracts don't have private state to sync
24
- if (isProtocolContract(contractAddress)) {
25
- return;
26
- }
27
- const syncStateFunctionCall = await contractStore.getFunctionCall('sync_state', [
28
- scope
29
- ], contractAddress);
30
- if (functionToInvokeAfterSync && functionToInvokeAfterSync.equals(syncStateFunctionCall.selector)) {
31
- throw new Error('Forbidden `sync_state` invocation. `sync_state` can only be invoked by PXE, manual execution can lead to inconsistencies.');
32
- }
33
- await utilityExecutor(syncStateFunctionCall, [
34
- scope
35
- ]);
36
- }
37
- /**
38
- * Verify that the current class id of a contract obtained from AztecNode is the same as the one in contract data
39
- * provider (i.e. PXE's own storage).
40
- * @param contractAddress - The address of the contract to verify.
41
- * @param aztecNode - The Aztec node to query for storage.
42
- * @param contractStore - The contract store to fetch the local instance from.
43
- * @param header - The header of the block at which to verify the current class id.
44
- */ export async function verifyCurrentClassId(contractAddress, aztecNode, contractStore, header) {
45
- const instance = await contractStore.getContractInstance(contractAddress);
46
- if (!instance) {
47
- throw new Error(`No contract instance found for address ${contractAddress.toString()}`);
48
- }
49
- const currentClassId = await readCurrentClassId(contractAddress, instance, aztecNode, header);
50
- if (!instance.currentContractClassId.equals(currentClassId)) {
51
- throw new Error(`Contract ${contractAddress} is outdated, current class id is ${currentClassId}, local class id is ${instance.currentContractClassId}`);
52
- }
53
- }
@@ -1,17 +0,0 @@
1
- import { Fr } from '@aztec/foundation/curves/bn254';
2
- import type { AztecNode } from '@aztec/stdlib/interfaces/server';
3
- import { MessageContext } from '@aztec/stdlib/logs';
4
- /** Resolves transaction hashes into the context needed to process messages. */
5
- export declare class MessageContextService {
6
- private readonly aztecNode;
7
- constructor(aztecNode: AztecNode);
8
- /**
9
- * Resolves a list of tx hashes into their message contexts.
10
- *
11
- * For each tx hash, looks up the corresponding tx effect and extracts the note hashes and first nullifier needed to
12
- * process messages that originated from that transaction. Returns `null` for tx hashes that are zero, not yet
13
- * available, or in blocks beyond the anchor block.
14
- */
15
- getMessageContextsByTxHash(txHashes: Fr[], anchorBlockNumber: number): Promise<(MessageContext | null)[]>;
16
- }
17
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWVzc2FnZV9jb250ZXh0X3NlcnZpY2UuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9tZXNzYWdlcy9tZXNzYWdlX2NvbnRleHRfc2VydmljZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDcEQsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFDakUsT0FBTyxFQUFFLGNBQWMsRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBR3BELCtFQUErRTtBQUMvRSxxQkFBYSxxQkFBcUI7SUFDcEIsT0FBTyxDQUFDLFFBQVEsQ0FBQyxTQUFTO0lBQXRDLFlBQTZCLFNBQVMsRUFBRSxTQUFTLEVBQUk7SUFFckQ7Ozs7OztPQU1HO0lBQ0csMEJBQTBCLENBQUMsUUFBUSxFQUFFLEVBQUUsRUFBRSxFQUFFLGlCQUFpQixFQUFFLE1BQU0sR0FBRyxPQUFPLENBQUMsQ0FBQyxjQUFjLEdBQUcsSUFBSSxDQUFDLEVBQUUsQ0FBQyxDQTJDOUc7Q0FDRiJ9
@@ -1 +0,0 @@
1
- {"version":3,"file":"message_context_service.d.ts","sourceRoot":"","sources":["../../src/messages/message_context_service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,+EAA+E;AAC/E,qBAAa,qBAAqB;IACpB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAAtC,YAA6B,SAAS,EAAE,SAAS,EAAI;IAErD;;;;;;OAMG;IACG,0BAA0B,CAAC,QAAQ,EAAE,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,cAAc,GAAG,IAAI,CAAC,EAAE,CAAC,CA2C9G;CACF"}
@@ -1,14 +0,0 @@
1
- import type { AztecAsyncKVStore } from '@aztec/kv-store';
2
- import { AztecAddress } from '@aztec/stdlib/aztec-address';
3
- /**
4
- * Stores sender addresses. During recipient log synchronization, these senders are used, along with a given recipient,
5
- * to derive directional app tagging secrets that are then used to sync the logs.
6
- */
7
- export declare class SenderAddressBookStore {
8
- #private;
9
- constructor(store: AztecAsyncKVStore);
10
- addSender(address: AztecAddress): Promise<boolean>;
11
- getSenders(): Promise<AztecAddress[]>;
12
- removeSender(address: AztecAddress): Promise<boolean>;
13
- }
14
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VuZGVyX2FkZHJlc3NfYm9va19zdG9yZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3N0b3JhZ2UvdGFnZ2luZ19zdG9yZS9zZW5kZXJfYWRkcmVzc19ib29rX3N0b3JlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sS0FBSyxFQUFFLGlCQUFpQixFQUFpQixNQUFNLGlCQUFpQixDQUFDO0FBQ3hFLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUUzRDs7O0dBR0c7QUFDSCxxQkFBYSxzQkFBc0I7O0lBSWpDLFlBQVksS0FBSyxFQUFFLGlCQUFpQixFQUluQztJQUVELFNBQVMsQ0FBQyxPQUFPLEVBQUUsWUFBWSxHQUFHLE9BQU8sQ0FBQyxPQUFPLENBQUMsQ0FVakQ7SUFFRCxVQUFVLElBQUksT0FBTyxDQUFDLFlBQVksRUFBRSxDQUFDLENBSXBDO0lBRUQsWUFBWSxDQUFDLE9BQU8sRUFBRSxZQUFZLEdBQUcsT0FBTyxDQUFDLE9BQU8sQ0FBQyxDQVVwRDtDQUNGIn0=
@@ -1 +0,0 @@
1
- {"version":3,"file":"sender_address_book_store.d.ts","sourceRoot":"","sources":["../../../src/storage/tagging_store/sender_address_book_store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D;;;GAGG;AACH,qBAAa,sBAAsB;;IAIjC,YAAY,KAAK,EAAE,iBAAiB,EAInC;IAED,SAAS,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CAUjD;IAED,UAAU,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC,CAIpC;IAED,YAAY,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CAUpD;CACF"}
@@ -1,36 +0,0 @@
1
- import { toArray } from '@aztec/foundation/iterable';
2
- import { AztecAddress } from '@aztec/stdlib/aztec-address';
3
- /**
4
- * Stores sender addresses. During recipient log synchronization, these senders are used, along with a given recipient,
5
- * to derive directional app tagging secrets that are then used to sync the logs.
6
- */ export class SenderAddressBookStore {
7
- #store;
8
- #addressBook;
9
- constructor(store){
10
- this.#store = store;
11
- this.#addressBook = this.#store.openMap('address_book');
12
- }
13
- addSender(address) {
14
- return this.#store.transactionAsync(async ()=>{
15
- if (await this.#addressBook.hasAsync(address.toString())) {
16
- return false;
17
- }
18
- await this.#addressBook.set(address.toString(), true);
19
- return true;
20
- });
21
- }
22
- getSenders() {
23
- return this.#store.transactionAsync(async ()=>{
24
- return (await toArray(this.#addressBook.keysAsync())).map(AztecAddress.fromString);
25
- });
26
- }
27
- removeSender(address) {
28
- return this.#store.transactionAsync(async ()=>{
29
- if (!await this.#addressBook.hasAsync(address.toString())) {
30
- return false;
31
- }
32
- await this.#addressBook.delete(address.toString());
33
- return true;
34
- });
35
- }
36
- }