@aztec/pxe 5.0.0-private.20260319 → 5.0.0-rc.1

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 (365) hide show
  1. package/dest/bin/check_oracle_version.js +45 -111
  2. package/dest/bin/index.d.ts +2 -0
  3. package/dest/bin/index.d.ts.map +1 -0
  4. package/dest/bin/index.js +1 -0
  5. package/dest/bin/oracle_version_helpers.d.ts +51 -0
  6. package/dest/bin/oracle_version_helpers.d.ts.map +1 -0
  7. package/dest/bin/oracle_version_helpers.js +254 -0
  8. package/dest/block_synchronizer/block_stream_source.d.ts +10 -0
  9. package/dest/block_synchronizer/block_stream_source.d.ts.map +1 -0
  10. package/dest/block_synchronizer/block_stream_source.js +62 -0
  11. package/dest/block_synchronizer/block_synchronizer.d.ts +8 -4
  12. package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
  13. package/dest/block_synchronizer/block_synchronizer.js +35 -13
  14. package/dest/config/index.d.ts +7 -1
  15. package/dest/config/index.d.ts.map +1 -1
  16. package/dest/config/index.js +12 -14
  17. package/dest/contract_function_simulator/contract_function_simulator.d.ts +9 -4
  18. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  19. package/dest/contract_function_simulator/contract_function_simulator.js +36 -15
  20. package/dest/contract_function_simulator/ephemeral_array_service.d.ts +28 -0
  21. package/dest/contract_function_simulator/ephemeral_array_service.d.ts.map +1 -0
  22. package/dest/contract_function_simulator/ephemeral_array_service.js +78 -0
  23. package/dest/contract_function_simulator/execution_note_cache.d.ts +2 -2
  24. package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
  25. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +5 -9
  26. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -1
  27. package/dest/contract_function_simulator/execution_tagging_index_cache.js +3 -7
  28. package/dest/contract_function_simulator/index.d.ts +15 -3
  29. package/dest/contract_function_simulator/index.d.ts.map +1 -1
  30. package/dest/contract_function_simulator/index.js +12 -1
  31. package/dest/contract_function_simulator/noir-structs/bounded_vec.d.ts +48 -0
  32. package/dest/contract_function_simulator/noir-structs/bounded_vec.d.ts.map +1 -0
  33. package/dest/contract_function_simulator/noir-structs/bounded_vec.js +45 -0
  34. package/dest/contract_function_simulator/noir-structs/ephemeral_array.d.ts +37 -0
  35. package/dest/contract_function_simulator/noir-structs/ephemeral_array.d.ts.map +1 -0
  36. package/dest/contract_function_simulator/noir-structs/ephemeral_array.js +59 -0
  37. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +5 -5
  38. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
  39. package/dest/contract_function_simulator/noir-structs/event_validation_request.js +6 -8
  40. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +13 -3
  41. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts.map +1 -1
  42. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.js +35 -4
  43. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +1 -1
  44. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +1 -1
  45. package/dest/contract_function_simulator/noir-structs/note_data.d.ts +27 -0
  46. package/dest/contract_function_simulator/noir-structs/note_data.d.ts.map +1 -0
  47. package/dest/contract_function_simulator/noir-structs/note_data.js +3 -0
  48. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +5 -5
  49. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
  50. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +6 -8
  51. package/dest/contract_function_simulator/noir-structs/option.d.ts +61 -0
  52. package/dest/contract_function_simulator/noir-structs/option.d.ts.map +1 -0
  53. package/dest/contract_function_simulator/noir-structs/option.js +62 -0
  54. package/dest/contract_function_simulator/noir-structs/provided_secret.d.ts +11 -0
  55. package/dest/contract_function_simulator/noir-structs/provided_secret.d.ts.map +1 -0
  56. package/dest/contract_function_simulator/noir-structs/provided_secret.js +14 -0
  57. package/dest/contract_function_simulator/oracle/acir_callback.d.ts +16 -0
  58. package/dest/contract_function_simulator/oracle/acir_callback.d.ts.map +1 -0
  59. package/dest/contract_function_simulator/oracle/acir_callback.js +71 -0
  60. package/dest/contract_function_simulator/oracle/index.d.ts +2 -13
  61. package/dest/contract_function_simulator/oracle/index.d.ts.map +1 -1
  62. package/dest/contract_function_simulator/oracle/index.js +1 -1
  63. package/dest/contract_function_simulator/oracle/interfaces.d.ts +15 -103
  64. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
  65. package/dest/contract_function_simulator/oracle/interfaces.js +2 -2
  66. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +2 -2
  67. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
  68. package/dest/contract_function_simulator/oracle/note_packing_utils.js +2 -2
  69. package/dest/contract_function_simulator/oracle/oracle_registry.d.ts +60 -0
  70. package/dest/contract_function_simulator/oracle/oracle_registry.d.ts.map +1 -0
  71. package/dest/contract_function_simulator/oracle/oracle_registry.js +857 -0
  72. package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts +139 -0
  73. package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts.map +1 -0
  74. package/dest/contract_function_simulator/oracle/oracle_type_mappings.js +560 -0
  75. package/dest/contract_function_simulator/oracle/private_execution.d.ts +1 -1
  76. package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
  77. package/dest/contract_function_simulator/oracle/private_execution.js +3 -4
  78. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +33 -36
  79. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  80. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +71 -52
  81. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +105 -59
  82. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  83. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +396 -162
  84. package/dest/contract_function_simulator/pick_notes.d.ts +1 -1
  85. package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -1
  86. package/dest/contract_function_simulator/pick_notes.js +20 -3
  87. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +1 -1
  88. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -1
  89. package/dest/contract_function_simulator/proxied_contract_data_source.js +35 -64
  90. package/dest/contract_function_simulator/transient_array_service.d.ts +31 -0
  91. package/dest/contract_function_simulator/transient_array_service.d.ts.map +1 -0
  92. package/dest/contract_function_simulator/transient_array_service.js +62 -0
  93. package/dest/contract_logging.d.ts +9 -4
  94. package/dest/contract_logging.d.ts.map +1 -1
  95. package/dest/contract_logging.js +21 -6
  96. package/dest/contract_sync/contract_sync_service.d.ts +11 -9
  97. package/dest/contract_sync/contract_sync_service.d.ts.map +1 -1
  98. package/dest/contract_sync/contract_sync_service.js +73 -51
  99. package/dest/contract_sync/helpers.d.ts +2 -4
  100. package/dest/contract_sync/helpers.d.ts.map +1 -1
  101. package/dest/contract_sync/helpers.js +12 -14
  102. package/dest/debug/pxe_debug_utils.d.ts +3 -8
  103. package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
  104. package/dest/debug/pxe_debug_utils.js +0 -6
  105. package/dest/entrypoints/client/bundle/index.d.ts +1 -2
  106. package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
  107. package/dest/entrypoints/client/bundle/index.js +0 -1
  108. package/dest/entrypoints/client/bundle/utils.d.ts +2 -2
  109. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  110. package/dest/entrypoints/client/bundle/utils.js +17 -5
  111. package/dest/entrypoints/client/lazy/index.d.ts +1 -2
  112. package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
  113. package/dest/entrypoints/client/lazy/index.js +0 -1
  114. package/dest/entrypoints/client/lazy/utils.d.ts +2 -2
  115. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  116. package/dest/entrypoints/client/lazy/utils.js +17 -5
  117. package/dest/entrypoints/pxe_creation_options.d.ts +9 -1
  118. package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
  119. package/dest/entrypoints/pxe_creation_options.js +3 -1
  120. package/dest/entrypoints/server/index.d.ts +3 -3
  121. package/dest/entrypoints/server/index.d.ts.map +1 -1
  122. package/dest/entrypoints/server/index.js +2 -2
  123. package/dest/entrypoints/server/utils.d.ts +4 -3
  124. package/dest/entrypoints/server/utils.d.ts.map +1 -1
  125. package/dest/entrypoints/server/utils.js +17 -5
  126. package/dest/events/event_service.d.ts +15 -6
  127. package/dest/events/event_service.d.ts.map +1 -1
  128. package/dest/events/event_service.js +44 -11
  129. package/dest/events/private_event_filter_validator.d.ts +3 -2
  130. package/dest/events/private_event_filter_validator.d.ts.map +1 -1
  131. package/dest/events/private_event_filter_validator.js +15 -0
  132. package/dest/hooks/authorize_utility_call.d.ts +41 -0
  133. package/dest/hooks/authorize_utility_call.d.ts.map +1 -0
  134. package/dest/hooks/authorize_utility_call.js +4 -0
  135. package/dest/hooks/execution_hooks.d.ts +42 -0
  136. package/dest/hooks/execution_hooks.d.ts.map +1 -0
  137. package/dest/hooks/execution_hooks.js +9 -0
  138. package/dest/hooks/index.d.ts +4 -0
  139. package/dest/hooks/index.d.ts.map +1 -0
  140. package/dest/hooks/index.js +1 -0
  141. package/dest/logs/log_service.d.ts +9 -9
  142. package/dest/logs/log_service.d.ts.map +1 -1
  143. package/dest/logs/log_service.js +126 -72
  144. package/dest/messages/message_context_service.d.ts +3 -3
  145. package/dest/messages/message_context_service.d.ts.map +1 -1
  146. package/dest/messages/message_context_service.js +30 -11
  147. package/dest/notes/note_service.d.ts +27 -6
  148. package/dest/notes/note_service.d.ts.map +1 -1
  149. package/dest/notes/note_service.js +80 -56
  150. package/dest/notes_filter.d.ts +2 -3
  151. package/dest/notes_filter.d.ts.map +1 -1
  152. package/dest/oracle_version.d.ts +4 -3
  153. package/dest/oracle_version.d.ts.map +1 -1
  154. package/dest/oracle_version.js +20 -10
  155. package/dest/private_kernel/batch_planner.d.ts +47 -0
  156. package/dest/private_kernel/batch_planner.d.ts.map +1 -0
  157. package/dest/private_kernel/batch_planner.js +104 -0
  158. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.js +1 -1
  159. package/dest/private_kernel/hints/test_utils.d.ts +1 -1
  160. package/dest/private_kernel/hints/test_utils.d.ts.map +1 -1
  161. package/dest/private_kernel/hints/test_utils.js +2 -3
  162. package/dest/private_kernel/private_kernel_execution_prover.d.ts +6 -2
  163. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
  164. package/dest/private_kernel/private_kernel_execution_prover.js +152 -59
  165. package/dest/private_kernel/private_kernel_oracle.d.ts +10 -10
  166. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
  167. package/dest/private_kernel/private_kernel_oracle.js +24 -22
  168. package/dest/pxe.d.ts +60 -10
  169. package/dest/pxe.d.ts.map +1 -1
  170. package/dest/pxe.js +138 -91
  171. package/dest/storage/anchor_block_store/anchor_block_store.d.ts +9 -6
  172. package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -1
  173. package/dest/storage/anchor_block_store/anchor_block_store.js +9 -7
  174. package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.d.ts +42 -0
  175. package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.d.ts.map +1 -0
  176. package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.js +93 -0
  177. package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts +15 -0
  178. package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts.map +1 -0
  179. package/dest/storage/backwards_compatibility_tests/schema_tests.js +594 -0
  180. package/dest/storage/backwards_compatibility_tests/store_spy.d.ts +19 -0
  181. package/dest/storage/backwards_compatibility_tests/store_spy.d.ts.map +1 -0
  182. package/dest/storage/backwards_compatibility_tests/store_spy.js +63 -0
  183. package/dest/storage/capsule_store/capsule_service.d.ts +21 -0
  184. package/dest/storage/capsule_store/capsule_service.d.ts.map +1 -0
  185. package/dest/storage/capsule_store/capsule_service.js +50 -0
  186. package/dest/storage/capsule_store/capsule_store.d.ts +9 -9
  187. package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -1
  188. package/dest/storage/capsule_store/capsule_store.js +36 -28
  189. package/dest/storage/capsule_store/index.d.ts +2 -1
  190. package/dest/storage/capsule_store/index.d.ts.map +1 -1
  191. package/dest/storage/capsule_store/index.js +1 -0
  192. package/dest/storage/contract_store/contract_store.d.ts +1 -1
  193. package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
  194. package/dest/storage/contract_store/contract_store.js +9 -26
  195. package/dest/storage/index.d.ts +2 -2
  196. package/dest/storage/index.d.ts.map +1 -1
  197. package/dest/storage/index.js +1 -1
  198. package/dest/storage/metadata.d.ts +1 -1
  199. package/dest/storage/metadata.js +1 -1
  200. package/dest/storage/note_store/note_store.d.ts +42 -33
  201. package/dest/storage/note_store/note_store.d.ts.map +1 -1
  202. package/dest/storage/note_store/note_store.js +199 -170
  203. package/dest/storage/note_store/stored_note.d.ts +3 -8
  204. package/dest/storage/note_store/stored_note.d.ts.map +1 -1
  205. package/dest/storage/note_store/stored_note.js +4 -20
  206. package/dest/storage/open_pxe_stores.d.ts +33 -0
  207. package/dest/storage/open_pxe_stores.d.ts.map +1 -0
  208. package/dest/storage/open_pxe_stores.js +27 -0
  209. package/dest/storage/private_event_store/private_event_store.d.ts +13 -16
  210. package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -1
  211. package/dest/storage/private_event_store/private_event_store.js +43 -43
  212. package/dest/storage/private_event_store/stored_private_event.js +1 -1
  213. package/dest/storage/tagging_store/recipient_tagging_store.d.ts +6 -6
  214. package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -1
  215. package/dest/storage/tagging_store/sender_tagging_store.d.ts +5 -5
  216. package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
  217. package/dest/storage/tagging_store/sender_tagging_store.js +3 -3
  218. package/dest/tagging/get_all_logs_by_tags.d.ts +34 -10
  219. package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -1
  220. package/dest/tagging/get_all_logs_by_tags.js +36 -37
  221. package/dest/tagging/index.d.ts +5 -4
  222. package/dest/tagging/index.d.ts.map +1 -1
  223. package/dest/tagging/index.js +4 -3
  224. package/dest/tagging/persist_sender_tagging_index_ranges.d.ts +29 -0
  225. package/dest/tagging/persist_sender_tagging_index_ranges.d.ts.map +1 -0
  226. package/dest/tagging/persist_sender_tagging_index_ranges.js +42 -0
  227. package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts +69 -0
  228. package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts.map +1 -0
  229. package/dest/tagging/recipient_sync/sync_tagged_private_logs.js +203 -0
  230. package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts +3 -3
  231. package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts.map +1 -1
  232. package/dest/tagging/reconcile_tagging_index_ranges.d.ts +36 -0
  233. package/dest/tagging/reconcile_tagging_index_ranges.d.ts.map +1 -0
  234. package/dest/tagging/reconcile_tagging_index_ranges.js +74 -0
  235. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +4 -5
  236. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
  237. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +26 -14
  238. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +11 -6
  239. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -1
  240. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +21 -0
  241. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +4 -4
  242. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -1
  243. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +2 -2
  244. package/package.json +20 -17
  245. package/src/bin/check_oracle_version.ts +51 -133
  246. package/src/bin/index.ts +5 -0
  247. package/src/bin/oracle_version_helpers.ts +311 -0
  248. package/src/block_synchronizer/block_stream_source.ts +81 -0
  249. package/src/block_synchronizer/block_synchronizer.ts +38 -16
  250. package/src/config/index.ts +14 -8
  251. package/src/contract_function_simulator/contract_function_simulator.ts +55 -18
  252. package/src/contract_function_simulator/ephemeral_array_service.ts +110 -0
  253. package/src/contract_function_simulator/execution_note_cache.ts +1 -1
  254. package/src/contract_function_simulator/execution_tagging_index_cache.ts +5 -9
  255. package/src/contract_function_simulator/index.ts +51 -2
  256. package/src/contract_function_simulator/noir-structs/bounded_vec.ts +55 -0
  257. package/src/contract_function_simulator/noir-structs/ephemeral_array.ts +66 -0
  258. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +4 -6
  259. package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +36 -3
  260. package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +1 -1
  261. package/src/contract_function_simulator/noir-structs/note_data.ts +27 -0
  262. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +4 -6
  263. package/src/contract_function_simulator/noir-structs/option.ts +69 -0
  264. package/src/contract_function_simulator/noir-structs/provided_secret.ts +16 -0
  265. package/src/contract_function_simulator/oracle/acir_callback.ts +108 -0
  266. package/src/contract_function_simulator/oracle/index.ts +1 -15
  267. package/src/contract_function_simulator/oracle/interfaces.ts +11 -176
  268. package/src/contract_function_simulator/oracle/note_packing_utils.ts +3 -3
  269. package/src/contract_function_simulator/oracle/oracle_registry.ts +673 -0
  270. package/src/contract_function_simulator/oracle/oracle_type_mappings.ts +553 -0
  271. package/src/contract_function_simulator/oracle/private_execution.ts +3 -4
  272. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +94 -71
  273. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +577 -269
  274. package/src/contract_function_simulator/pick_notes.ts +22 -3
  275. package/src/contract_function_simulator/proxied_contract_data_source.ts +41 -64
  276. package/src/contract_function_simulator/transient_array_service.ts +91 -0
  277. package/src/contract_logging.ts +18 -5
  278. package/src/contract_sync/contract_sync_service.ts +101 -87
  279. package/src/contract_sync/helpers.ts +13 -25
  280. package/src/debug/pxe_debug_utils.ts +3 -11
  281. package/src/entrypoints/client/bundle/index.ts +0 -1
  282. package/src/entrypoints/client/bundle/utils.ts +16 -5
  283. package/src/entrypoints/client/lazy/index.ts +0 -1
  284. package/src/entrypoints/client/lazy/utils.ts +16 -5
  285. package/src/entrypoints/pxe_creation_options.ts +14 -0
  286. package/src/entrypoints/server/index.ts +2 -2
  287. package/src/entrypoints/server/utils.ts +21 -6
  288. package/src/events/event_service.ts +69 -21
  289. package/src/events/private_event_filter_validator.ts +21 -1
  290. package/src/hooks/authorize_utility_call.ts +44 -0
  291. package/src/hooks/execution_hooks.ts +48 -0
  292. package/src/hooks/index.ts +7 -0
  293. package/src/logs/log_service.ts +158 -134
  294. package/src/messages/message_context_service.ts +43 -26
  295. package/src/notes/note_service.ts +119 -85
  296. package/src/notes_filter.ts +1 -3
  297. package/src/oracle_version.ts +20 -10
  298. package/src/private_kernel/batch_planner.ts +169 -0
  299. package/src/private_kernel/hints/private_kernel_reset_private_inputs_builder.ts +1 -1
  300. package/src/private_kernel/hints/test_utils.ts +2 -9
  301. package/src/private_kernel/private_kernel_execution_prover.ts +240 -82
  302. package/src/private_kernel/private_kernel_oracle.ts +35 -25
  303. package/src/pxe.ts +230 -95
  304. package/src/storage/anchor_block_store/anchor_block_store.ts +9 -7
  305. package/src/storage/backwards_compatibility_tests/__snapshots__/AddressStore.json +22 -0
  306. package/src/storage/backwards_compatibility_tests/__snapshots__/AnchorBlockStore.json +3 -0
  307. package/src/storage/backwards_compatibility_tests/__snapshots__/CapsuleStore.json +16 -0
  308. package/src/storage/backwards_compatibility_tests/__snapshots__/ContractStore.json +28 -0
  309. package/src/storage/backwards_compatibility_tests/__snapshots__/KeyStore.json +52 -0
  310. package/src/storage/backwards_compatibility_tests/__snapshots__/L2TipsKVStore.json +40 -0
  311. package/src/storage/backwards_compatibility_tests/__snapshots__/NoteStore.json +56 -0
  312. package/src/storage/backwards_compatibility_tests/__snapshots__/PrivateEventStore.json +44 -0
  313. package/src/storage/backwards_compatibility_tests/__snapshots__/RecipientTaggingStore.json +18 -0
  314. package/src/storage/backwards_compatibility_tests/__snapshots__/SenderAddressBookStore.json +16 -0
  315. package/src/storage/backwards_compatibility_tests/__snapshots__/SenderTaggingStore.json +22 -0
  316. package/src/storage/backwards_compatibility_tests/__snapshots__/opened_stores.json +101 -0
  317. package/src/storage/backwards_compatibility_tests/kv_store_snapshot.ts +122 -0
  318. package/src/storage/backwards_compatibility_tests/schema_tests.ts +714 -0
  319. package/src/storage/backwards_compatibility_tests/store_spy.ts +73 -0
  320. package/src/storage/capsule_store/capsule_service.ts +90 -0
  321. package/src/storage/capsule_store/capsule_store.ts +44 -26
  322. package/src/storage/capsule_store/index.ts +1 -0
  323. package/src/storage/contract_store/contract_store.ts +14 -35
  324. package/src/storage/index.ts +1 -1
  325. package/src/storage/metadata.ts +1 -1
  326. package/src/storage/note_store/note_store.ts +228 -192
  327. package/src/storage/note_store/stored_note.ts +5 -27
  328. package/src/storage/open_pxe_stores.ts +49 -0
  329. package/src/storage/private_event_store/private_event_store.ts +52 -54
  330. package/src/storage/private_event_store/stored_private_event.ts +1 -1
  331. package/src/storage/tagging_store/recipient_tagging_store.ts +5 -9
  332. package/src/storage/tagging_store/sender_tagging_store.ts +6 -6
  333. package/src/tagging/get_all_logs_by_tags.ts +78 -50
  334. package/src/tagging/index.ts +4 -3
  335. package/src/tagging/persist_sender_tagging_index_ranges.ts +57 -0
  336. package/src/tagging/recipient_sync/sync_tagged_private_logs.ts +301 -0
  337. package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +2 -2
  338. package/src/tagging/reconcile_tagging_index_ranges.ts +102 -0
  339. package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +41 -19
  340. package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +23 -8
  341. package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +4 -5
  342. package/dest/access_scopes.d.ts +0 -9
  343. package/dest/access_scopes.d.ts.map +0 -1
  344. package/dest/access_scopes.js +0 -6
  345. package/dest/contract_function_simulator/noir-structs/message_tx_context.d.ts +0 -16
  346. package/dest/contract_function_simulator/noir-structs/message_tx_context.d.ts.map +0 -1
  347. package/dest/contract_function_simulator/noir-structs/message_tx_context.js +0 -57
  348. package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.d.ts +0 -9
  349. package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.d.ts.map +0 -1
  350. package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.js +0 -42
  351. package/dest/contract_function_simulator/oracle/oracle.d.ts +0 -61
  352. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +0 -1
  353. package/dest/contract_function_simulator/oracle/oracle.js +0 -437
  354. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +0 -14
  355. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +0 -1
  356. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +0 -99
  357. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +0 -14
  358. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +0 -1
  359. package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +0 -33
  360. package/src/access_scopes.ts +0 -9
  361. package/src/contract_function_simulator/noir-structs/message_tx_context.ts +0 -55
  362. package/src/contract_function_simulator/oracle/legacy_oracle_mappings.ts +0 -135
  363. package/src/contract_function_simulator/oracle/oracle.ts +0 -675
  364. package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +0 -140
  365. package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +0 -44
@@ -1,6 +1,10 @@
1
1
  import type { AztecAsyncKVStore, AztecAsyncSingleton } from '@aztec/kv-store';
2
2
  import { BlockHeader } from '@aztec/stdlib/tx';
3
3
 
4
+ /**
5
+ * Holds the block header that PXE's private execution is anchored to. Updated by the BlockSynchronizer as the chain
6
+ * advances or reorgs.
7
+ */
4
8
  export class AnchorBlockStore {
5
9
  #store: AztecAsyncKVStore;
6
10
  #synchronizedHeader: AztecAsyncSingleton<Buffer>;
@@ -11,23 +15,21 @@ export class AnchorBlockStore {
11
15
  }
12
16
 
13
17
  /**
14
- * Sets the currently synchronized block
15
- *
16
- * Important: this method is only called from BlockSynchronizer, and since we need it to run atomically with other
17
- * stores in the case of a reorg, it MUST NOT be wrapped in a `transactionAsync` call. Doing so would result in a
18
- * deadlock when the backend is IndexedDB, because `transactionAsync` is not designed to support reentrancy.
18
+ * Sets the currently synchronized block header.
19
19
  *
20
+ * Important: only called from BlockSynchronizer, and since it must run atomically with other stores in a reorg, it
21
+ * MUST NOT be wrapped in `transactionAsync`: doing so deadlocks when the kv-store backend is IndexedDB (no
22
+ * support for reentrancy).
20
23
  */
21
24
  async setHeader(header: BlockHeader): Promise<void> {
22
25
  await this.#synchronizedHeader.set(header.toBuffer());
23
26
  }
24
27
 
25
28
  async getBlockHeader(): Promise<BlockHeader> {
26
- const headerBuffer = await this.#synchronizedHeader.getAsync();
29
+ const headerBuffer = await this.#store.transactionAsync(() => this.#synchronizedHeader.getAsync());
27
30
  if (!headerBuffer) {
28
31
  throw new Error(`Trying to get block header with a not-yet-synchronized PXE - this should never happen`);
29
32
  }
30
-
31
33
  return BlockHeader.fromBuffer(headerBuffer);
32
34
  }
33
35
  }
@@ -0,0 +1,22 @@
1
+ {
2
+ "complete_addresses": [
3
+ {
4
+ "index": 0,
5
+ "value": "0b3683ee9df3ed6ed7027145bd6093f783b0bb4d8354501d906db7bb8cb58ea313ad6965d11a533a663d07507319f74ac3305325f6f72423c0b24aa1193268bb19e95c05f09cb86d1a6257572f9082ca15d4a02373c4d8c9cee23dc61a4c2a882f9017d51bca6616102d8a1d4dba89e4ce12881a2414576f01d2fec9492814a22a1b054e998835d166711839b515d434b1fbc207ad4fdb5b2b43d6ac6b400871019f5bb255e87523d43da83ebc9fa95169b653d4abef902e011e9eac620fc45b14a5d4bde495b8c3a9ba4aed0d4870526e46fdff22d341a2f689ac5a50d103560f124f07811eebfaaa6d31316a2cc5bf255fa118f720e8ff1f2fc0d4aa46d4960000000000000000000000000000000000000000000000000000000000000003"
6
+ },
7
+ {
8
+ "index": 1,
9
+ "value": "2cf4c6a79bcb041923c0cf1cfbb6c7407e082824e29588dbcf9cc6c1d6e8b01f17c2df1b7355bb4c4494aa4ec85d15ff8881cea1b34691f0cc558e8aef3f3f4c267e526a2e6e9adf6a026989be005bd50d1aea76d20816b9843bc95557696f9f16c3eb259ba3e3eb27b7fe3abc36e87923990bf5c265cb0d57790eda2a4432f105a5449624125d37f10cd4c68ffd57b0dc0cdaa916cb37840be1db9bf88e3c5f0e81754454e3b12035b13448a9fe3b980bf31a9808cb93e146628fb06fa1b46f14a5d4bde495b8c3a9ba4aed0d4870526e46fdff22d341a2f689ac5a50d103560f124f07811eebfaaa6d31316a2cc5bf255fa118f720e8ff1f2fc0d4aa46d4960000000000000000000000000000000000000000000000000000000000000007"
10
+ }
11
+ ],
12
+ "complete_address_index": [
13
+ {
14
+ "key": "utf8:0x0b3683ee9df3ed6ed7027145bd6093f783b0bb4d8354501d906db7bb8cb58ea3",
15
+ "value": "num:0"
16
+ },
17
+ {
18
+ "key": "utf8:0x2cf4c6a79bcb041923c0cf1cfbb6c7407e082824e29588dbcf9cc6c1d6e8b01f",
19
+ "value": "num:1"
20
+ }
21
+ ]
22
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "header": "000000000000000000000000000000000000000000000000000000000000000200000003000000000000000000000000000000000000000000000000000000000000000500000007000000000000000000000000000000000000000000000000000000000000000b0000000d00000000000000000000000000000000000000000000000000000000000000110000001300000000000000000000000000000000000000000000000000000000000000170000001d000000000000000000000000000000000000000000000000000000000000001f000000000000000000000000000000000000000000000000000000000000002500000000000000000000000000000000000000000000000000000000000000290000002b0000002f0000000000000035000000000000000000000000000000000000003b000000000000000000000000000000000000000000000000000000000000003d00000000000000000000000000000043000000000000000000000000000000470000000000000000000000000000000000000000000000000000000000000049000000000000000000000000000000000000000000000000000000000000004f"
3
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "capsules": [
3
+ {
4
+ "key": "utf8:0x0000000000000000000000000000000000000000000000000000000000000002:0x0000000000000000000000000000000000000000000000000000000000000003:0x0000000000000000000000000000000000000000000000000000000000000005",
5
+ "value": "0000000000000000000000000000000000000000000000000000000000000007000000000000000000000000000000000000000000000000000000000000000b"
6
+ },
7
+ {
8
+ "key": "utf8:0x0000000000000000000000000000000000000000000000000000000000000002:0x0000000000000000000000000000000000000000000000000000000000000003:0x000000000000000000000000000000000000000000000000000000000000000d",
9
+ "value": "0000000000000000000000000000000000000000000000000000000000000011"
10
+ },
11
+ {
12
+ "key": "utf8:0x0000000000000000000000000000000000000000000000000000000000000002:0x0000000000000000000000000000000000000000000000000000000000000003:0x0000000000000000000000000000000000000000000000000000000000000013",
13
+ "value": ""
14
+ }
15
+ ]
16
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "contract_artifacts": [
3
+ {
4
+ "key": "utf8:0x0000000000000000000000000000000000000000000000000000000000000002",
5
+ "value": "7b226e616d65223a22536368656d6146697874757265436f6e7472616374222c22617a74656356657273696f6e223a22736368656d612d666978747572652d76657273696f6e222c2266756e6374696f6e73223a5b7b226e616d65223a22707269766174655f666e222c2266756e6374696f6e54797065223a2270726976617465222c2269734f6e6c7953656c66223a66616c73652c226973537461746963223a66616c73652c226973496e697469616c697a6572223a747275652c22706172616d6574657273223a5b7b226e616d65223a226669727374222c2274797065223a7b226b696e64223a226669656c64227d2c227669736962696c697479223a2270726976617465227d2c7b226e616d65223a227365636f6e64222c2274797065223a7b226b696e64223a22696e7465676572222c227369676e223a22756e7369676e6564222c227769647468223a33327d2c227669736962696c697479223a227075626c6963227d5d2c2272657475726e5479706573223a5b7b226b696e64223a22626f6f6c65616e227d5d2c226572726f725479706573223a7b22736368656d615f746573745f6572726f72223a7b226572726f725f6b696e64223a22737472696e67222c22737472696e67223a22666978656420736368656d612d74657374206572726f72227d7d2c2262797465636f6465223a2241674d4642773d3d222c22646562756753796d626f6c73223a22736368656d612d666978747572652d6465627567227d5d2c226e6f6e44697370617463685075626c696346756e6374696f6e73223a5b7b226e616d65223a227075626c69635f666e222c2266756e6374696f6e54797065223a227075626c6963222c2269734f6e6c7953656c66223a747275652c226973537461746963223a747275652c226973496e697469616c697a6572223a66616c73652c22706172616d6574657273223a5b5d2c2272657475726e5479706573223a5b5d2c226572726f725479706573223a7b7d7d5d2c226f757470757473223a7b2273747275637473223a7b226d795f737472756374223a5b7b226b696e64223a226669656c64227d2c7b226b696e64223a22626f6f6c65616e227d5d7d2c22676c6f62616c73223a7b7d7d2c2273746f726167654c61796f7574223a7b226d795f6669656c64223a7b22736c6f74223a22307830303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303062227d7d2c2266696c654d6170223a7b2231223a7b22736f75726365223a22736368656d61206669787475726520736f75726365222c2270617468223a227372632f736368656d615f666978747572652e6e72222c2266756e6374696f6e5f6c6f636174696f6e73223a5b5d7d7d7d"
6
+ },
7
+ {
8
+ "key": "utf8:0x0000000000000000000000000000000000000000000000000000000000000017",
9
+ "value": "7b226e616d65223a22536368656d6146697874757265436f6e7472616374222c22617a74656356657273696f6e223a22736368656d612d666978747572652d76657273696f6e222c2266756e6374696f6e73223a5b7b226e616d65223a22707269766174655f666e222c2266756e6374696f6e54797065223a2270726976617465222c2269734f6e6c7953656c66223a66616c73652c226973537461746963223a66616c73652c226973496e697469616c697a6572223a747275652c22706172616d6574657273223a5b7b226e616d65223a226669727374222c2274797065223a7b226b696e64223a226669656c64227d2c227669736962696c697479223a2270726976617465227d2c7b226e616d65223a227365636f6e64222c2274797065223a7b226b696e64223a22696e7465676572222c227369676e223a22756e7369676e6564222c227769647468223a33327d2c227669736962696c697479223a227075626c6963227d5d2c2272657475726e5479706573223a5b7b226b696e64223a22626f6f6c65616e227d5d2c226572726f725479706573223a7b22736368656d615f746573745f6572726f72223a7b226572726f725f6b696e64223a22737472696e67222c22737472696e67223a22666978656420736368656d612d74657374206572726f72227d7d2c2262797465636f6465223a2241674d4642773d3d222c22646562756753796d626f6c73223a22736368656d612d666978747572652d6465627567227d5d2c226e6f6e44697370617463685075626c696346756e6374696f6e73223a5b7b226e616d65223a227075626c69635f666e222c2266756e6374696f6e54797065223a227075626c6963222c2269734f6e6c7953656c66223a747275652c226973537461746963223a747275652c226973496e697469616c697a6572223a66616c73652c22706172616d6574657273223a5b5d2c2272657475726e5479706573223a5b5d2c226572726f725479706573223a7b7d7d5d2c226f757470757473223a7b2273747275637473223a7b226d795f737472756374223a5b7b226b696e64223a226669656c64227d2c7b226b696e64223a22626f6f6c65616e227d5d7d2c22676c6f62616c73223a7b7d7d2c2273746f726167654c61796f7574223a7b226d795f6669656c64223a7b22736c6f74223a22307830303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303062227d7d2c2266696c654d6170223a7b2231223a7b22736f75726365223a22736368656d61206669787475726520736f75726365222c2270617468223a227372632f736368656d615f666978747572652e6e72222c2266756e6374696f6e5f6c6f636174696f6e73223a5b5d7d7d7d"
10
+ }
11
+ ],
12
+ "contract_classes": [
13
+ {
14
+ "key": "utf8:0x0000000000000000000000000000000000000000000000000000000000000002",
15
+ "value": "010000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000007000000020000000b000000000000000000000000000000000000000000000000000000000000000d000000110000000000000000000000000000000000000000000000000000000000000013"
16
+ },
17
+ {
18
+ "key": "utf8:0x0000000000000000000000000000000000000000000000000000000000000017",
19
+ "value": "010000000000000000000000000000000000000000000000000000000000000017000000000000000000000000000000000000000000000000000000000000001d000000000000000000000000000000000000000000000000000000000000001f000000000000000000000000000000000000000000000000000000000000002500000000"
20
+ }
21
+ ],
22
+ "contracts_instances": [
23
+ {
24
+ "key": "utf8:0x0000000000000000000000000000000000000000000000000000000000000065",
25
+ "value": "020000000000000000000000000000000000000000000000000000000000000049000000000000000000000000000000000000000000000000000000000000004f00000000000000000000000000000000000000000000000000000000000000530000000000000000000000000000000000000000000000000000000000000059000000000000000000000000000000000000000000000000000000000000006100000000000000000000000000000000000000000000000000000000000000670000000000000000000000000000000000000000000000000000000000000029000000000000000000000000000000000000000000000000000000000000002f0000000000000000000000000000000000000000000000000000000000000035000000000000000000000000000000000000000000000000000000000000003b000000000000000000000000000000000000000000000000000000000000004300000000000000000000000000000000000000000000000000000000000000470000000000000000000000000000000000000000000000000000000000000049"
26
+ }
27
+ ]
28
+ }
@@ -0,0 +1,52 @@
1
+ {
2
+ "key_store": [
3
+ {
4
+ "key": "utf8:0x0b3683ee9df3ed6ed7027145bd6093f783b0bb4d8354501d906db7bb8cb58ea3-ivpk_m",
5
+ "value": "19e95c05f09cb86d1a6257572f9082ca15d4a02373c4d8c9cee23dc61a4c2a882f9017d51bca6616102d8a1d4dba89e4ce12881a2414576f01d2fec9492814a2"
6
+ },
7
+ {
8
+ "key": "utf8:0x0b3683ee9df3ed6ed7027145bd6093f783b0bb4d8354501d906db7bb8cb58ea3-ivpk_m_hash",
9
+ "value": "1fd17152d394f6a43b527c531590888d610d1bcb9aa71a02498ce820bbf4dc62"
10
+ },
11
+ {
12
+ "key": "utf8:0x0b3683ee9df3ed6ed7027145bd6093f783b0bb4d8354501d906db7bb8cb58ea3-ivsk_m",
13
+ "value": "1fb01c42d1aaa2662041b899c77cb19e08192193acc5a94405f1b43c974eba7a"
14
+ },
15
+ {
16
+ "key": "utf8:0x0b3683ee9df3ed6ed7027145bd6093f783b0bb4d8354501d906db7bb8cb58ea3-nhk_m",
17
+ "value": "2dd30220767969b10044b1322585bb4c4df4e0c5d9b4d7b3045a879a8e3e91d2"
18
+ },
19
+ {
20
+ "key": "utf8:0x0b3683ee9df3ed6ed7027145bd6093f783b0bb4d8354501d906db7bb8cb58ea3-npk_m",
21
+ "value": "214c7a24ddf501afc8734c7379ee502296289eb24cd8cd03cd435e128c06be0000987721e0963b4a5bd81ee862e2740d8849fd90537569064d3d3a4640e858d2"
22
+ },
23
+ {
24
+ "key": "utf8:0x0b3683ee9df3ed6ed7027145bd6093f783b0bb4d8354501d906db7bb8cb58ea3-npk_m_hash",
25
+ "value": "13ad6965d11a533a663d07507319f74ac3305325f6f72423c0b24aa1193268bb"
26
+ },
27
+ {
28
+ "key": "utf8:0x0b3683ee9df3ed6ed7027145bd6093f783b0bb4d8354501d906db7bb8cb58ea3-ovpk_m",
29
+ "value": "2c19ff0b089b07da436e6f7be6b26cdc17b9cee504a528c071ef6a416299683d0b369479d6e50504702d0b56bb56e4e8e0e77171429896651d0c11621e82ebc3"
30
+ },
31
+ {
32
+ "key": "utf8:0x0b3683ee9df3ed6ed7027145bd6093f783b0bb4d8354501d906db7bb8cb58ea3-ovpk_m_hash",
33
+ "value": "2a1b054e998835d166711839b515d434b1fbc207ad4fdb5b2b43d6ac6b400871"
34
+ },
35
+ {
36
+ "key": "utf8:0x0b3683ee9df3ed6ed7027145bd6093f783b0bb4d8354501d906db7bb8cb58ea3-ovsk_m",
37
+ "value": "279fe6ef7dd2477b919327b1ebab7497c41b9a7ccfa9d5d52e32698e3b85293b"
38
+ },
39
+ {
40
+ "key": "utf8:0x0b3683ee9df3ed6ed7027145bd6093f783b0bb4d8354501d906db7bb8cb58ea3-tpk_m",
41
+ "value": "2fcdd0d194adafd753dc0ed279f5cfb54ddcce1dd581d4631cf343ba9ee6c1ab2858abca6c00da3def156b1f12a6464384e326d5fa724c2fc2ff2b7f3fc8ad5f"
42
+ },
43
+ {
44
+ "key": "utf8:0x0b3683ee9df3ed6ed7027145bd6093f783b0bb4d8354501d906db7bb8cb58ea3-tpk_m_hash",
45
+ "value": "019f5bb255e87523d43da83ebc9fa95169b653d4abef902e011e9eac620fc45b"
46
+ },
47
+ {
48
+ "key": "utf8:0x0b3683ee9df3ed6ed7027145bd6093f783b0bb4d8354501d906db7bb8cb58ea3-tsk_m",
49
+ "value": "183cb61099458d1564aa57c90c7091ac623a14092ab314150c9cfbb416810320"
50
+ }
51
+ ]
52
+ }
@@ -0,0 +1,40 @@
1
+ {
2
+ "pxe_l2_tips": [
3
+ {
4
+ "key": "utf8:checkpointed",
5
+ "value": "num:71"
6
+ },
7
+ {
8
+ "key": "utf8:proposed",
9
+ "value": "num:179"
10
+ },
11
+ {
12
+ "key": "utf8:proven",
13
+ "value": "num:79"
14
+ }
15
+ ],
16
+ "pxe_l2_tip_checkpoints": [
17
+ {
18
+ "key": "utf8:checkpointed",
19
+ "value": "{\"number\":47,\"hash\":\"0x00a21eaf943186f15f609a8a76fb0bee7ce3e78c86ef95f5466614e59546eb19\"}"
20
+ },
21
+ {
22
+ "key": "utf8:proven",
23
+ "value": "{\"number\":47,\"hash\":\"0x0000000000000000000000000000000000000000000000000000000000000059\"}"
24
+ }
25
+ ],
26
+ "pxe_l2_block_hashes": [
27
+ {
28
+ "key": "num:179",
29
+ "value": "utf8:0x10547c3c23be9d4208cc6d60355ca61c35bd612ace129984ed97a6cc4ec007f8"
30
+ },
31
+ {
32
+ "key": "num:71",
33
+ "value": "utf8:0x0000000000000000000000000000000000000000000000000000000000000049"
34
+ },
35
+ {
36
+ "key": "num:79",
37
+ "value": "utf8:0x0000000000000000000000000000000000000000000000000000000000000053"
38
+ }
39
+ ]
40
+ }
@@ -0,0 +1,56 @@
1
+ {
2
+ "notes": [
3
+ {
4
+ "key": "utf8:0x000000000000000000000000000000000000000000000000000000000000002b",
5
+ "value": "00000003000000000000000000000000000000000000000000000000000000000000000d0000000000000000000000000000000000000000000000000000000000000011000000000000000000000000000000000000000000000000000000000000001300000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000017000000000000000000000000000000000000000000000000000000000000001d000000000000000000000000000000000000000000000000000000000000001f00000000000000000000000000000000000000000000000000000000000000250000000000000000000000000000000000000000000000000000000000000029000000000000000000000000000000000000000000000000000000000000002b000000000000000000000000000000000000000000000000000000000000002f00000035000000000000000000000000000000000000000000000000000000000000003b0000003d00000043000000020000004230783030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303500000042307830303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303037"
6
+ },
7
+ {
8
+ "key": "utf8:0x000000000000000000000000000000000000000000000000000000000000006b",
9
+ "value": "0000000300000000000000000000000000000000000000000000000000000000000000470000000000000000000000000000000000000000000000000000000000000049000000000000000000000000000000000000000000000000000000000000004f000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000530000000000000000000000000000000000000000000000000000000000000059000000000000000000000000000000000000000000000000000000000000006100000000000000000000000000000000000000000000000000000000000000650000000000000000000000000000000000000000000000000000000000000067000000000000000000000000000000000000000000000000000000000000006b000000000000000000000000000000000000000000000000000000000000006d00000071000000000000000000000000000000000000000000000000000000000000007f00000083000000890000000100000042307830303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303035"
10
+ },
11
+ {
12
+ "key": "utf8:0x00000000000000000000000000000000000000000000000000000000000000b5",
13
+ "value": "00000003000000000000000000000000000000000000000000000000000000000000008b000000000000000000000000000000000000000000000000000000000000009500000000000000000000000000000000000000000000000000000000000000970000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000009d00000000000000000000000000000000000000000000000000000000000000a300000000000000000000000000000000000000000000000000000000000000a700000000000000000000000000000000000000000000000000000000000000ad00000000000000000000000000000000000000000000000000000000000000b300000000000000000000000000000000000000000000000000000000000000b500000000000000000000000000000000000000000000000000000000000000bf000000c100000000000000000000000000000000000000000000000000000000000000c5000000c7000000d30000000100000042307830303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303035"
14
+ }
15
+ ],
16
+ "note_nullifiers_by_contract": [
17
+ {
18
+ "key": "utf8:0x0000000000000000000000000000000000000000000000000000000000000002",
19
+ "value": "utf8:0x000000000000000000000000000000000000000000000000000000000000002b"
20
+ },
21
+ {
22
+ "key": "utf8:0x0000000000000000000000000000000000000000000000000000000000000002",
23
+ "value": "utf8:0x000000000000000000000000000000000000000000000000000000000000006b"
24
+ },
25
+ {
26
+ "key": "utf8:0x0000000000000000000000000000000000000000000000000000000000000003",
27
+ "value": "utf8:0x00000000000000000000000000000000000000000000000000000000000000b5"
28
+ }
29
+ ],
30
+ "note_nullifications_by_nullifier": [
31
+ {
32
+ "key": "utf8:0x00000000000000000000000000000000000000000000000000000000000000b5",
33
+ "value": "num:223"
34
+ }
35
+ ],
36
+ "note_nullifiers_by_block": [
37
+ {
38
+ "key": "num:113",
39
+ "value": "utf8:0x000000000000000000000000000000000000000000000000000000000000006b"
40
+ },
41
+ {
42
+ "key": "num:193",
43
+ "value": "utf8:0x00000000000000000000000000000000000000000000000000000000000000b5"
44
+ },
45
+ {
46
+ "key": "num:53",
47
+ "value": "utf8:0x000000000000000000000000000000000000000000000000000000000000002b"
48
+ }
49
+ ],
50
+ "note_nullifications_by_block": [
51
+ {
52
+ "key": "num:223",
53
+ "value": "utf8:0x00000000000000000000000000000000000000000000000000000000000000b5"
54
+ }
55
+ ]
56
+ }
@@ -0,0 +1,44 @@
1
+ {
2
+ "private_event_logs": [
3
+ {
4
+ "key": "utf8:0x0000000000000000000000000000000000000000000000000000000000000017",
5
+ "value": "000000000000000000000000000000000000000000000000000000000000001d00000003000000000000000000000000000000000000000000000000000000000000001f0000000000000000000000000000000000000000000000000000000000000025000000000000000000000000000000000000000000000000000000000000002900000011000000000000000000000000000000000000000000000000000000000000002f000000000000000000000000000000000000000000000000000000000000002b000000350000003b000000000000000000000000000000000000000000000000000000000000000200000005000000020000004230783030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030306200000042307830303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303064"
6
+ },
7
+ {
8
+ "key": "utf8:0x000000000000000000000000000000000000000000000000000000000000004f",
9
+ "value": "000000000000000000000000000000000000000000000000000000000000003d00000003000000000000000000000000000000000000000000000000000000000000004300000000000000000000000000000000000000000000000000000000000000470000000000000000000000000000000000000000000000000000000000000049000000110000000000000000000000000000000000000000000000000000000000000059000000000000000000000000000000000000000000000000000000000000005300000061000000650000000000000000000000000000000000000000000000000000000000000002000000050000000100000042307830303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303062"
10
+ },
11
+ {
12
+ "key": "utf8:0x000000000000000000000000000000000000000000000000000000000000007f",
13
+ "value": "000000000000000000000000000000000000000000000000000000000000006700000003000000000000000000000000000000000000000000000000000000000000006b000000000000000000000000000000000000000000000000000000000000006d000000000000000000000000000000000000000000000000000000000000007100000013000000000000000000000000000000000000000000000000000000000000008900000000000000000000000000000000000000000000000000000000000000830000008b000000950000000000000000000000000000000000000000000000000000000000000003000000070000000100000042307830303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303062"
14
+ }
15
+ ],
16
+ "events_by_contract_selector": [
17
+ {
18
+ "key": "utf8:0x0000000000000000000000000000000000000000000000000000000000000002_0x00000005",
19
+ "value": "utf8:0x0000000000000000000000000000000000000000000000000000000000000017"
20
+ },
21
+ {
22
+ "key": "utf8:0x0000000000000000000000000000000000000000000000000000000000000002_0x00000005",
23
+ "value": "utf8:0x000000000000000000000000000000000000000000000000000000000000004f"
24
+ },
25
+ {
26
+ "key": "utf8:0x0000000000000000000000000000000000000000000000000000000000000003_0x00000007",
27
+ "value": "utf8:0x000000000000000000000000000000000000000000000000000000000000007f"
28
+ }
29
+ ],
30
+ "events_by_block_number": [
31
+ {
32
+ "key": "num:17",
33
+ "value": "utf8:0x0000000000000000000000000000000000000000000000000000000000000017"
34
+ },
35
+ {
36
+ "key": "num:17",
37
+ "value": "utf8:0x000000000000000000000000000000000000000000000000000000000000004f"
38
+ },
39
+ {
40
+ "key": "num:19",
41
+ "value": "utf8:0x000000000000000000000000000000000000000000000000000000000000007f"
42
+ }
43
+ ]
44
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "highest_aged_index": [
3
+ {
4
+ "key": "utf8:0x0000000000000000000000000000000000000000000000000000000000000002:0x0000000000000000000000000000000000000000000000000000000000000003",
5
+ "value": "num:13"
6
+ }
7
+ ],
8
+ "highest_finalized_index": [
9
+ {
10
+ "key": "utf8:0x0000000000000000000000000000000000000000000000000000000000000002:0x0000000000000000000000000000000000000000000000000000000000000003",
11
+ "value": "num:11"
12
+ },
13
+ {
14
+ "key": "utf8:0x0000000000000000000000000000000000000000000000000000000000000005:0x0000000000000000000000000000000000000000000000000000000000000007",
15
+ "value": "num:17"
16
+ }
17
+ ]
18
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "address_book": [
3
+ {
4
+ "key": "utf8:0x0000000000000000000000000000000000000000000000000000000000000002",
5
+ "value": "true"
6
+ },
7
+ {
8
+ "key": "utf8:0x0000000000000000000000000000000000000000000000000000000000000003",
9
+ "value": "true"
10
+ },
11
+ {
12
+ "key": "utf8:0x0000000000000000000000000000000000000000000000000000000000000005",
13
+ "value": "true"
14
+ }
15
+ ]
16
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "pending_indexes": [
3
+ {
4
+ "key": "utf8:0x0000000000000000000000000000000000000000000000000000000000000002:0x0000000000000000000000000000000000000000000000000000000000000003",
5
+ "value": "[{\"lowestIndex\":4,\"highestIndex\":7,\"txHash\":\"0x0000000000000000000000000000000000000000000000000000000000000013\"},{\"lowestIndex\":8,\"highestIndex\":11,\"txHash\":\"0x0000000000000000000000000000000000000000000000000000000000000017\"}]"
6
+ },
7
+ {
8
+ "key": "utf8:0x000000000000000000000000000000000000000000000000000000000000000b:0x000000000000000000000000000000000000000000000000000000000000000d",
9
+ "value": "[{\"lowestIndex\":1,\"highestIndex\":9,\"txHash\":\"0x000000000000000000000000000000000000000000000000000000000000001d\"}]"
10
+ }
11
+ ],
12
+ "last_finalized_indexes": [
13
+ {
14
+ "key": "utf8:0x0000000000000000000000000000000000000000000000000000000000000002:0x0000000000000000000000000000000000000000000000000000000000000003",
15
+ "value": "num:3"
16
+ },
17
+ {
18
+ "key": "utf8:0x0000000000000000000000000000000000000000000000000000000000000005:0x0000000000000000000000000000000000000000000000000000000000000007",
19
+ "value": "num:5"
20
+ }
21
+ ]
22
+ }
@@ -0,0 +1,101 @@
1
+ {
2
+ "schemaVersion": 8,
3
+ "stores": [
4
+ {
5
+ "name": "address_book",
6
+ "kind": "map"
7
+ },
8
+ {
9
+ "name": "capsules",
10
+ "kind": "map"
11
+ },
12
+ {
13
+ "name": "complete_address_index",
14
+ "kind": "map"
15
+ },
16
+ {
17
+ "name": "complete_addresses",
18
+ "kind": "array"
19
+ },
20
+ {
21
+ "name": "contract_artifacts",
22
+ "kind": "map"
23
+ },
24
+ {
25
+ "name": "contract_classes",
26
+ "kind": "map"
27
+ },
28
+ {
29
+ "name": "contracts_instances",
30
+ "kind": "map"
31
+ },
32
+ {
33
+ "name": "events_by_block_number",
34
+ "kind": "multimap"
35
+ },
36
+ {
37
+ "name": "events_by_contract_selector",
38
+ "kind": "multimap"
39
+ },
40
+ {
41
+ "name": "header",
42
+ "kind": "singleton"
43
+ },
44
+ {
45
+ "name": "highest_aged_index",
46
+ "kind": "map"
47
+ },
48
+ {
49
+ "name": "highest_finalized_index",
50
+ "kind": "map"
51
+ },
52
+ {
53
+ "name": "key_store",
54
+ "kind": "map"
55
+ },
56
+ {
57
+ "name": "last_finalized_indexes",
58
+ "kind": "map"
59
+ },
60
+ {
61
+ "name": "note_nullifications_by_block",
62
+ "kind": "multimap"
63
+ },
64
+ {
65
+ "name": "note_nullifications_by_nullifier",
66
+ "kind": "map"
67
+ },
68
+ {
69
+ "name": "note_nullifiers_by_block",
70
+ "kind": "multimap"
71
+ },
72
+ {
73
+ "name": "note_nullifiers_by_contract",
74
+ "kind": "multimap"
75
+ },
76
+ {
77
+ "name": "notes",
78
+ "kind": "map"
79
+ },
80
+ {
81
+ "name": "pending_indexes",
82
+ "kind": "map"
83
+ },
84
+ {
85
+ "name": "private_event_logs",
86
+ "kind": "map"
87
+ },
88
+ {
89
+ "name": "pxe_l2_block_hashes",
90
+ "kind": "map"
91
+ },
92
+ {
93
+ "name": "pxe_l2_tip_checkpoints",
94
+ "kind": "map"
95
+ },
96
+ {
97
+ "name": "pxe_l2_tips",
98
+ "kind": "map"
99
+ }
100
+ ]
101
+ }
@@ -0,0 +1,122 @@
1
+ import type { AztecAsyncArray, AztecAsyncMap, AztecAsyncSingleton, Key } from '@aztec/kv-store';
2
+
3
+ /**
4
+ * This file contains helpers that produce stable, snapshot-friendly text representations of our kv-stores'
5
+ * contents (map / multimap / array / singleton). Used by the backwards compatibility tests in this directory to
6
+ * fingerprint the bytes PXE persists.
7
+ *
8
+ * Each backwards compatibility schema scenario test follows the same shape:
9
+ *
10
+ * 1. drive the production write path through the store class's public API.
11
+ * 2. re-open the underlying kv-store by name, bypassing the store abstraction layer (eg:
12
+ * `kvStore.openMap<K, Buffer>('foo')`) and snapshot it via the helpers below.
13
+ * 3. compare fresh snapshots with committed ones.
14
+ *
15
+ * Why text rather than buffers: Jest snapshots are stored as JS literals; `Buffer` instances render as the verbose
16
+ * `Buffer <01 02 03>` form, which clutters `.snap` files and resists clean diffs. Each collection's contents are
17
+ * normalized into strings before being fed to `toMatchSnapshot()`.
18
+ */
19
+
20
+ /** A single map/multimap entry, rendered as strings for stable snapshotting. */
21
+ export type MapEntry = { key: string; value: string };
22
+
23
+ /** A single array entry, rendered as a string for stable snapshotting. */
24
+ export type ArrayEntry = { index: number; value: string };
25
+
26
+ /**
27
+ * Returns every entry of the given map (or multimap), with both keys and values rendered as strings, sorted by key
28
+ * with value as a tiebreaker.
29
+ */
30
+ export async function snapshotMap<K extends Key, V>(map: AztecAsyncMap<K, V>): Promise<MapEntry[]> {
31
+ const entries: MapEntry[] = [];
32
+ for await (const [k, v] of map.entriesAsync()) {
33
+ entries.push({ key: keyToString(k), value: valueToString(v) });
34
+ }
35
+ return entries.sort(compareMapEntries);
36
+ }
37
+
38
+ /**
39
+ * Returns the contents of `array` paired with their numeric indices, in insertion order.
40
+ *
41
+ * Unlike {@link snapshotMap}, no sort: arrays are inherently ordered by index and that order *is* part of the schema.
42
+ * The `index` field is preserved on each entry so any unintended reorder shows up in the diff.
43
+ */
44
+ export async function snapshotArray<V>(array: AztecAsyncArray<V>): Promise<ArrayEntry[]> {
45
+ const entries: ArrayEntry[] = [];
46
+ let index = 0;
47
+ for await (const v of array.valuesAsync()) {
48
+ entries.push({ index: index++, value: valueToString(v) });
49
+ }
50
+ return entries;
51
+ }
52
+
53
+ /** Returns the singleton's value rendered as a string, or `null` if unset. */
54
+ export async function snapshotSingleton<V>(singleton: AztecAsyncSingleton<V>): Promise<string | null> {
55
+ const value = await singleton.getAsync();
56
+ return value === undefined ? null : valueToString(value);
57
+ }
58
+
59
+ function compareMapEntries(a: MapEntry, b: MapEntry): number {
60
+ return a.key === b.key ? a.value.localeCompare(b.value) : a.key.localeCompare(b.key);
61
+ }
62
+
63
+ /**
64
+ * Renders a key as a stable string. Buffers and `Uint8Array`s become `0x`-prefixed hex (matching the canonical byte
65
+ * form used by `Fr.toString()`, `AztecAddress.toString()`, etc. elsewhere in the codebase); primitives carry a type
66
+ * prefix (`utf8:`, `num:`) so that different runtime types can't alias to the same string in a snapshot. Without the
67
+ * prefix, a future change that swapped a `number` key for a `string` of the same digits would be invisible in the
68
+ * diff.
69
+ */
70
+ function keyToString(k: unknown): string {
71
+ if (typeof k === 'string') {
72
+ return `utf8:${k}`;
73
+ }
74
+ if (typeof k === 'number') {
75
+ return `num:${k}`;
76
+ }
77
+ if (Buffer.isBuffer(k)) {
78
+ return `0x${k.toString('hex')}`;
79
+ }
80
+ if (k instanceof Uint8Array) {
81
+ return `0x${Buffer.from(k).toString('hex')}`;
82
+ }
83
+ if (Array.isArray(k)) {
84
+ return `[${k.map(keyToString).join(',')}]`;
85
+ }
86
+ return JSON.stringify(k);
87
+ }
88
+
89
+ /**
90
+ * Renders a value for snapshotting. Same type-prefix discipline as {@link keyToString} so primitives can't
91
+ * accidentally render identically to buffers carrying the same bytes.
92
+ *
93
+ * Resolution order:
94
+ * 1. `Buffer` / `Uint8Array` -> hex. This is the on-disk byte view; the kv-store layer treats these as opaque, so
95
+ * what we see here is exactly what's persisted.
96
+ * 2. Tagged primitives (`num:`, `big:`, `utf8:`).
97
+ * 3. `Bufferable` fallback: any object with a `.toBuffer()` method renders as `value.toBuffer().toString('hex')`.
98
+ * Covers stdlib domain types stored without pre-serialization. The canonical byte form is what we want to
99
+ * fingerprint.
100
+ * 4. `JSON.stringify` for plain objects, matching how the kv-store layer encodes arbitrary structures on disk.
101
+ */
102
+ function valueToString(v: unknown): string {
103
+ if (Buffer.isBuffer(v)) {
104
+ return v.toString('hex');
105
+ }
106
+ if (v instanceof Uint8Array) {
107
+ return Buffer.from(v).toString('hex');
108
+ }
109
+ if (typeof v === 'number') {
110
+ return `num:${v}`;
111
+ }
112
+ if (typeof v === 'bigint') {
113
+ return `big:${v.toString()}`;
114
+ }
115
+ if (typeof v === 'string') {
116
+ return `utf8:${v}`;
117
+ }
118
+ if (v && typeof (v as { toBuffer?: unknown }).toBuffer === 'function') {
119
+ return (v as { toBuffer: () => Buffer }).toBuffer().toString('hex');
120
+ }
121
+ return JSON.stringify(v);
122
+ }