@aztec/pxe 0.0.1-commit.96bb3f7 → 0.0.1-commit.993d240

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 (379) hide show
  1. package/dest/bin/check_oracle_version.d.ts +12 -2
  2. package/dest/bin/check_oracle_version.d.ts.map +1 -1
  3. package/dest/bin/check_oracle_version.js +32 -26
  4. package/dest/bin/index.d.ts +2 -0
  5. package/dest/bin/index.d.ts.map +1 -0
  6. package/dest/bin/index.js +1 -0
  7. package/dest/block_synchronizer/block_stream_source.d.ts +10 -0
  8. package/dest/block_synchronizer/block_stream_source.d.ts.map +1 -0
  9. package/dest/block_synchronizer/block_stream_source.js +62 -0
  10. package/dest/block_synchronizer/block_synchronizer.d.ts +16 -6
  11. package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
  12. package/dest/block_synchronizer/block_synchronizer.js +94 -23
  13. package/dest/config/index.d.ts +10 -2
  14. package/dest/config/index.d.ts.map +1 -1
  15. package/dest/config/index.js +17 -2
  16. package/dest/config/package_info.js +1 -1
  17. package/dest/contract_function_simulator/benchmarked_node.d.ts +9 -0
  18. package/dest/contract_function_simulator/benchmarked_node.d.ts.map +1 -0
  19. package/dest/contract_function_simulator/benchmarked_node.js +77 -0
  20. package/dest/contract_function_simulator/contract_function_simulator.d.ts +69 -36
  21. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  22. package/dest/contract_function_simulator/contract_function_simulator.js +240 -91
  23. package/dest/contract_function_simulator/ephemeral_array_service.d.ts +28 -0
  24. package/dest/contract_function_simulator/ephemeral_array_service.d.ts.map +1 -0
  25. package/dest/contract_function_simulator/ephemeral_array_service.js +78 -0
  26. package/dest/contract_function_simulator/execution_note_cache.d.ts +18 -9
  27. package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
  28. package/dest/contract_function_simulator/execution_note_cache.js +45 -28
  29. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +7 -11
  30. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -1
  31. package/dest/contract_function_simulator/execution_tagging_index_cache.js +19 -15
  32. package/dest/contract_function_simulator/index.d.ts +5 -2
  33. package/dest/contract_function_simulator/index.d.ts.map +1 -1
  34. package/dest/contract_function_simulator/index.js +4 -1
  35. package/dest/contract_function_simulator/noir-structs/bounded_vec.d.ts +48 -0
  36. package/dest/contract_function_simulator/noir-structs/bounded_vec.d.ts.map +1 -0
  37. package/dest/contract_function_simulator/noir-structs/bounded_vec.js +45 -0
  38. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +5 -7
  39. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
  40. package/dest/contract_function_simulator/noir-structs/event_validation_request.js +9 -10
  41. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +13 -3
  42. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts.map +1 -1
  43. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.js +35 -4
  44. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +2 -2
  45. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
  46. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +2 -4
  47. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +5 -8
  48. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
  49. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +7 -11
  50. package/dest/contract_function_simulator/noir-structs/option.d.ts +61 -0
  51. package/dest/contract_function_simulator/noir-structs/option.d.ts.map +1 -0
  52. package/dest/contract_function_simulator/noir-structs/option.js +62 -0
  53. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +4 -10
  54. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -1
  55. package/dest/contract_function_simulator/noir-structs/utility_context.js +7 -18
  56. package/dest/contract_function_simulator/oracle/interfaces.d.ts +70 -50
  57. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
  58. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +3 -1
  59. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
  60. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +7 -7
  61. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
  62. package/dest/contract_function_simulator/oracle/note_packing_utils.js +10 -10
  63. package/dest/contract_function_simulator/oracle/oracle.d.ts +74 -43
  64. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
  65. package/dest/contract_function_simulator/oracle/oracle.js +471 -264
  66. package/dest/contract_function_simulator/oracle/oracle_registry.d.ts +147 -0
  67. package/dest/contract_function_simulator/oracle/oracle_registry.d.ts.map +1 -0
  68. package/dest/contract_function_simulator/oracle/oracle_registry.js +1199 -0
  69. package/dest/contract_function_simulator/oracle/private_execution.d.ts +2 -26
  70. package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
  71. package/dest/contract_function_simulator/oracle/private_execution.js +5 -38
  72. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +74 -91
  73. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  74. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +164 -110
  75. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +156 -78
  76. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  77. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +459 -186
  78. package/dest/contract_function_simulator/pick_notes.d.ts +1 -1
  79. package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -1
  80. package/dest/contract_function_simulator/pick_notes.js +20 -3
  81. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +1 -1
  82. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -1
  83. package/dest/contract_function_simulator/proxied_contract_data_source.js +35 -64
  84. package/dest/contract_logging.d.ts +27 -0
  85. package/dest/contract_logging.d.ts.map +1 -0
  86. package/dest/contract_logging.js +38 -0
  87. package/dest/contract_sync/contract_sync_service.d.ts +42 -0
  88. package/dest/contract_sync/contract_sync_service.d.ts.map +1 -0
  89. package/dest/contract_sync/contract_sync_service.js +135 -0
  90. package/dest/contract_sync/helpers.d.ts +27 -0
  91. package/dest/contract_sync/helpers.d.ts.map +1 -0
  92. package/dest/contract_sync/helpers.js +53 -0
  93. package/dest/debug/pxe_debug_utils.d.ts +19 -10
  94. package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
  95. package/dest/debug/pxe_debug_utils.js +22 -17
  96. package/dest/entrypoints/client/bundle/index.d.ts +3 -1
  97. package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
  98. package/dest/entrypoints/client/bundle/index.js +2 -0
  99. package/dest/entrypoints/client/bundle/utils.d.ts +2 -2
  100. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  101. package/dest/entrypoints/client/bundle/utils.js +33 -11
  102. package/dest/entrypoints/client/lazy/index.d.ts +3 -1
  103. package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
  104. package/dest/entrypoints/client/lazy/index.js +2 -0
  105. package/dest/entrypoints/client/lazy/utils.d.ts +3 -3
  106. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  107. package/dest/entrypoints/client/lazy/utils.js +34 -12
  108. package/dest/entrypoints/pxe_creation_options.d.ts +11 -2
  109. package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
  110. package/dest/entrypoints/pxe_creation_options.js +3 -1
  111. package/dest/entrypoints/server/index.d.ts +6 -2
  112. package/dest/entrypoints/server/index.d.ts.map +1 -1
  113. package/dest/entrypoints/server/index.js +5 -1
  114. package/dest/entrypoints/server/utils.d.ts +4 -3
  115. package/dest/entrypoints/server/utils.d.ts.map +1 -1
  116. package/dest/entrypoints/server/utils.js +40 -13
  117. package/dest/events/event_service.d.ts +17 -8
  118. package/dest/events/event_service.d.ts.map +1 -1
  119. package/dest/events/event_service.js +58 -28
  120. package/dest/events/private_event_filter_validator.d.ts +6 -5
  121. package/dest/events/private_event_filter_validator.d.ts.map +1 -1
  122. package/dest/events/private_event_filter_validator.js +20 -6
  123. package/dest/hooks/authorize_utility_call.d.ts +41 -0
  124. package/dest/hooks/authorize_utility_call.d.ts.map +1 -0
  125. package/dest/hooks/authorize_utility_call.js +4 -0
  126. package/dest/hooks/execution_hooks.d.ts +42 -0
  127. package/dest/hooks/execution_hooks.d.ts.map +1 -0
  128. package/dest/hooks/execution_hooks.js +9 -0
  129. package/dest/hooks/index.d.ts +4 -0
  130. package/dest/hooks/index.d.ts.map +1 -0
  131. package/dest/hooks/index.js +1 -0
  132. package/dest/job_coordinator/job_coordinator.d.ts +3 -2
  133. package/dest/job_coordinator/job_coordinator.d.ts.map +1 -1
  134. package/dest/job_coordinator/job_coordinator.js +3 -2
  135. package/dest/logs/log_service.d.ts +13 -10
  136. package/dest/logs/log_service.d.ts.map +1 -1
  137. package/dest/logs/log_service.js +132 -84
  138. package/dest/messages/message_context_service.d.ts +17 -0
  139. package/dest/messages/message_context_service.d.ts.map +1 -0
  140. package/dest/messages/message_context_service.js +38 -0
  141. package/dest/notes/note_service.d.ts +31 -9
  142. package/dest/notes/note_service.d.ts.map +1 -1
  143. package/dest/notes/note_service.js +97 -77
  144. package/dest/notes_filter.d.ts +24 -0
  145. package/dest/notes_filter.d.ts.map +1 -0
  146. package/dest/notes_filter.js +4 -0
  147. package/dest/oracle_version.d.ts +4 -3
  148. package/dest/oracle_version.d.ts.map +1 -1
  149. package/dest/oracle_version.js +20 -9
  150. package/dest/private_kernel/batch_planner.d.ts +47 -0
  151. package/dest/private_kernel/batch_planner.d.ts.map +1 -0
  152. package/dest/private_kernel/batch_planner.js +104 -0
  153. package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts +4 -0
  154. package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts.map +1 -0
  155. package/dest/private_kernel/hints/{compute_tx_include_by_timestamp.js → compute_tx_expiration_timestamp.js} +12 -12
  156. package/dest/private_kernel/hints/index.d.ts +3 -3
  157. package/dest/private_kernel/hints/index.d.ts.map +1 -1
  158. package/dest/private_kernel/hints/index.js +2 -2
  159. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +29 -0
  160. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -0
  161. package/dest/private_kernel/hints/{build_private_kernel_reset_private_inputs.js → private_kernel_reset_private_inputs_builder.js} +141 -74
  162. package/dest/private_kernel/hints/test_utils.d.ts +122 -0
  163. package/dest/private_kernel/hints/test_utils.d.ts.map +1 -0
  164. package/dest/private_kernel/hints/test_utils.js +202 -0
  165. package/dest/private_kernel/private_kernel_execution_prover.d.ts +7 -2
  166. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
  167. package/dest/private_kernel/private_kernel_execution_prover.js +168 -67
  168. package/dest/private_kernel/private_kernel_oracle.d.ts +28 -29
  169. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
  170. package/dest/private_kernel/private_kernel_oracle.js +96 -2
  171. package/dest/pxe.d.ts +126 -59
  172. package/dest/pxe.d.ts.map +1 -1
  173. package/dest/pxe.js +257 -200
  174. package/dest/storage/address_store/address_store.d.ts +1 -1
  175. package/dest/storage/address_store/address_store.d.ts.map +1 -1
  176. package/dest/storage/address_store/address_store.js +12 -11
  177. package/dest/storage/anchor_block_store/anchor_block_store.d.ts +9 -1
  178. package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -1
  179. package/dest/storage/anchor_block_store/anchor_block_store.js +9 -2
  180. package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.d.ts +42 -0
  181. package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.d.ts.map +1 -0
  182. package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.js +93 -0
  183. package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts +15 -0
  184. package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts.map +1 -0
  185. package/dest/storage/backwards_compatibility_tests/schema_tests.js +591 -0
  186. package/dest/storage/backwards_compatibility_tests/store_spy.d.ts +19 -0
  187. package/dest/storage/backwards_compatibility_tests/store_spy.d.ts.map +1 -0
  188. package/dest/storage/backwards_compatibility_tests/store_spy.js +63 -0
  189. package/dest/storage/capsule_store/capsule_service.d.ts +21 -0
  190. package/dest/storage/capsule_store/capsule_service.d.ts.map +1 -0
  191. package/dest/storage/capsule_store/capsule_service.js +50 -0
  192. package/dest/storage/capsule_store/capsule_store.d.ts +25 -10
  193. package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -1
  194. package/dest/storage/capsule_store/capsule_store.js +143 -28
  195. package/dest/storage/capsule_store/index.d.ts +2 -1
  196. package/dest/storage/capsule_store/index.d.ts.map +1 -1
  197. package/dest/storage/capsule_store/index.js +1 -0
  198. package/dest/storage/contract_store/contract_store.d.ts +42 -16
  199. package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
  200. package/dest/storage/contract_store/contract_store.js +158 -102
  201. package/dest/storage/metadata.d.ts +1 -1
  202. package/dest/storage/metadata.js +1 -1
  203. package/dest/storage/note_store/note_store.d.ts +50 -51
  204. package/dest/storage/note_store/note_store.d.ts.map +1 -1
  205. package/dest/storage/note_store/note_store.js +284 -263
  206. package/dest/storage/note_store/stored_note.d.ts +16 -0
  207. package/dest/storage/note_store/stored_note.d.ts.map +1 -0
  208. package/dest/storage/note_store/stored_note.js +43 -0
  209. package/dest/storage/open_pxe_stores.d.ts +33 -0
  210. package/dest/storage/open_pxe_stores.d.ts.map +1 -0
  211. package/dest/storage/open_pxe_stores.js +27 -0
  212. package/dest/storage/private_event_store/private_event_store.d.ts +43 -8
  213. package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -1
  214. package/dest/storage/private_event_store/private_event_store.js +229 -111
  215. package/dest/storage/private_event_store/stored_private_event.d.ts +23 -0
  216. package/dest/storage/private_event_store/stored_private_event.d.ts.map +1 -0
  217. package/dest/storage/private_event_store/stored_private_event.js +56 -0
  218. package/dest/storage/tagging_store/recipient_tagging_store.d.ts +16 -9
  219. package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -1
  220. package/dest/storage/tagging_store/recipient_tagging_store.js +88 -19
  221. package/dest/storage/tagging_store/sender_address_book_store.d.ts +1 -1
  222. package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +1 -1
  223. package/dest/storage/tagging_store/sender_address_book_store.js +20 -14
  224. package/dest/storage/tagging_store/sender_tagging_store.d.ts +43 -32
  225. package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
  226. package/dest/storage/tagging_store/sender_tagging_store.js +300 -122
  227. package/dest/tagging/get_all_logs_by_tags.d.ts +48 -0
  228. package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -0
  229. package/dest/tagging/get_all_logs_by_tags.js +59 -0
  230. package/dest/tagging/index.d.ts +7 -5
  231. package/dest/tagging/index.d.ts.map +1 -1
  232. package/dest/tagging/index.js +5 -3
  233. package/dest/tagging/persist_sender_tagging_index_ranges.d.ts +29 -0
  234. package/dest/tagging/persist_sender_tagging_index_ranges.d.ts.map +1 -0
  235. package/dest/tagging/persist_sender_tagging_index_ranges.js +42 -0
  236. package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts +56 -0
  237. package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts.map +1 -0
  238. package/dest/tagging/recipient_sync/sync_tagged_private_logs.js +163 -0
  239. package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts +3 -3
  240. package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts.map +1 -1
  241. package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +2 -2
  242. package/dest/tagging/reconcile_tagging_index_ranges.d.ts +36 -0
  243. package/dest/tagging/reconcile_tagging_index_ranges.d.ts.map +1 -0
  244. package/dest/tagging/reconcile_tagging_index_ranges.js +74 -0
  245. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +5 -9
  246. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
  247. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +34 -18
  248. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +13 -7
  249. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -1
  250. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +44 -16
  251. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +8 -7
  252. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -1
  253. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +44 -27
  254. package/package.json +31 -19
  255. package/src/bin/check_oracle_version.ts +42 -31
  256. package/src/bin/index.ts +1 -0
  257. package/src/block_synchronizer/block_stream_source.ts +81 -0
  258. package/src/block_synchronizer/block_synchronizer.ts +116 -36
  259. package/src/config/index.ts +21 -1
  260. package/src/config/package_info.ts +1 -1
  261. package/src/contract_function_simulator/benchmarked_node.ts +103 -0
  262. package/src/contract_function_simulator/contract_function_simulator.ts +417 -156
  263. package/src/contract_function_simulator/ephemeral_array_service.ts +110 -0
  264. package/src/contract_function_simulator/execution_note_cache.ts +44 -25
  265. package/src/contract_function_simulator/execution_tagging_index_cache.ts +19 -18
  266. package/src/contract_function_simulator/index.ts +4 -1
  267. package/src/contract_function_simulator/noir-structs/bounded_vec.ts +55 -0
  268. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +11 -10
  269. package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +36 -3
  270. package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +2 -5
  271. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +6 -11
  272. package/src/contract_function_simulator/noir-structs/option.ts +69 -0
  273. package/src/contract_function_simulator/noir-structs/utility_context.ts +6 -25
  274. package/src/contract_function_simulator/oracle/interfaces.ts +93 -70
  275. package/src/contract_function_simulator/oracle/note_packing_utils.ts +13 -13
  276. package/src/contract_function_simulator/oracle/oracle.ts +567 -461
  277. package/src/contract_function_simulator/oracle/oracle_registry.ts +904 -0
  278. package/src/contract_function_simulator/oracle/private_execution.ts +5 -71
  279. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +213 -209
  280. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +657 -254
  281. package/src/contract_function_simulator/pick_notes.ts +22 -3
  282. package/src/contract_function_simulator/proxied_contract_data_source.ts +41 -64
  283. package/src/contract_logging.ts +52 -0
  284. package/src/contract_sync/contract_sync_service.ts +189 -0
  285. package/src/contract_sync/helpers.ts +86 -0
  286. package/src/debug/pxe_debug_utils.ts +55 -18
  287. package/src/entrypoints/client/bundle/index.ts +2 -0
  288. package/src/entrypoints/client/bundle/utils.ts +26 -20
  289. package/src/entrypoints/client/lazy/index.ts +2 -0
  290. package/src/entrypoints/client/lazy/utils.ts +28 -21
  291. package/src/entrypoints/pxe_creation_options.ts +16 -1
  292. package/src/entrypoints/server/index.ts +5 -1
  293. package/src/entrypoints/server/utils.ts +37 -32
  294. package/src/events/event_service.ts +79 -39
  295. package/src/events/private_event_filter_validator.ts +23 -5
  296. package/src/hooks/authorize_utility_call.ts +44 -0
  297. package/src/hooks/execution_hooks.ts +48 -0
  298. package/src/hooks/index.ts +7 -0
  299. package/src/job_coordinator/job_coordinator.ts +4 -3
  300. package/src/logs/log_service.ts +171 -141
  301. package/src/messages/message_context_service.ts +45 -0
  302. package/src/notes/note_service.ts +137 -107
  303. package/src/notes_filter.ts +24 -0
  304. package/src/oracle_version.ts +20 -9
  305. package/src/private_kernel/batch_planner.ts +169 -0
  306. package/src/private_kernel/hints/{compute_tx_include_by_timestamp.ts → compute_tx_expiration_timestamp.ts} +13 -13
  307. package/src/private_kernel/hints/index.ts +2 -2
  308. package/src/private_kernel/hints/{build_private_kernel_reset_private_inputs.ts → private_kernel_reset_private_inputs_builder.ts} +196 -137
  309. package/src/private_kernel/hints/test_utils.ts +318 -0
  310. package/src/private_kernel/private_kernel_execution_prover.ts +261 -93
  311. package/src/private_kernel/private_kernel_oracle.ts +129 -40
  312. package/src/pxe.ts +467 -273
  313. package/src/storage/address_store/address_store.ts +15 -15
  314. package/src/storage/anchor_block_store/anchor_block_store.ts +9 -1
  315. package/src/storage/backwards_compatibility_tests/__snapshots__/AddressStore.json +22 -0
  316. package/src/storage/backwards_compatibility_tests/__snapshots__/AnchorBlockStore.json +3 -0
  317. package/src/storage/backwards_compatibility_tests/__snapshots__/CapsuleStore.json +16 -0
  318. package/src/storage/backwards_compatibility_tests/__snapshots__/ContractStore.json +28 -0
  319. package/src/storage/backwards_compatibility_tests/__snapshots__/KeyStore.json +52 -0
  320. package/src/storage/backwards_compatibility_tests/__snapshots__/L2TipsKVStore.json +46 -0
  321. package/src/storage/backwards_compatibility_tests/__snapshots__/NoteStore.json +36 -0
  322. package/src/storage/backwards_compatibility_tests/__snapshots__/PrivateEventStore.json +44 -0
  323. package/src/storage/backwards_compatibility_tests/__snapshots__/RecipientTaggingStore.json +18 -0
  324. package/src/storage/backwards_compatibility_tests/__snapshots__/SenderAddressBookStore.json +16 -0
  325. package/src/storage/backwards_compatibility_tests/__snapshots__/SenderTaggingStore.json +22 -0
  326. package/src/storage/backwards_compatibility_tests/__snapshots__/opened_stores.json +97 -0
  327. package/src/storage/backwards_compatibility_tests/kv_store_snapshot.ts +122 -0
  328. package/src/storage/backwards_compatibility_tests/schema_tests.ts +712 -0
  329. package/src/storage/backwards_compatibility_tests/store_spy.ts +73 -0
  330. package/src/storage/capsule_store/capsule_service.ts +90 -0
  331. package/src/storage/capsule_store/capsule_store.ts +183 -29
  332. package/src/storage/capsule_store/index.ts +1 -0
  333. package/src/storage/contract_store/contract_store.ts +194 -125
  334. package/src/storage/metadata.ts +1 -1
  335. package/src/storage/note_store/note_store.ts +323 -320
  336. package/src/storage/note_store/stored_note.ts +48 -0
  337. package/src/storage/open_pxe_stores.ts +49 -0
  338. package/src/storage/private_event_store/private_event_store.ts +296 -124
  339. package/src/storage/private_event_store/stored_private_event.ts +73 -0
  340. package/src/storage/tagging_store/recipient_tagging_store.ts +107 -21
  341. package/src/storage/tagging_store/sender_address_book_store.ts +20 -14
  342. package/src/storage/tagging_store/sender_tagging_store.ts +366 -134
  343. package/src/tagging/get_all_logs_by_tags.ts +120 -0
  344. package/src/tagging/index.ts +6 -4
  345. package/src/tagging/persist_sender_tagging_index_ranges.ts +57 -0
  346. package/src/tagging/recipient_sync/sync_tagged_private_logs.ts +240 -0
  347. package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +4 -4
  348. package/src/tagging/reconcile_tagging_index_ranges.ts +102 -0
  349. package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +59 -21
  350. package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +47 -29
  351. package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +41 -29
  352. package/dest/contract_function_simulator/proxied_node.d.ts +0 -9
  353. package/dest/contract_function_simulator/proxied_node.d.ts.map +0 -1
  354. package/dest/contract_function_simulator/proxied_node.js +0 -27
  355. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +0 -28
  356. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +0 -1
  357. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +0 -4
  358. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts.map +0 -1
  359. package/dest/private_kernel/private_kernel_oracle_impl.d.ts +0 -46
  360. package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +0 -1
  361. package/dest/private_kernel/private_kernel_oracle_impl.js +0 -85
  362. package/dest/public_storage/public_storage_service.d.ts +0 -24
  363. package/dest/public_storage/public_storage_service.d.ts.map +0 -1
  364. package/dest/public_storage/public_storage_service.js +0 -26
  365. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +0 -14
  366. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +0 -1
  367. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +0 -99
  368. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +0 -14
  369. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +0 -1
  370. package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +0 -29
  371. package/dest/tree_membership/tree_membership_service.d.ts +0 -52
  372. package/dest/tree_membership/tree_membership_service.d.ts.map +0 -1
  373. package/dest/tree_membership/tree_membership_service.js +0 -84
  374. package/src/contract_function_simulator/proxied_node.ts +0 -33
  375. package/src/private_kernel/private_kernel_oracle_impl.ts +0 -127
  376. package/src/public_storage/public_storage_service.ts +0 -33
  377. package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +0 -132
  378. package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +0 -43
  379. package/src/tree_membership/tree_membership_service.ts +0 -112
@@ -1,20 +1,20 @@
1
- import type { AztecAddress } from '@aztec/stdlib/aztec-address';
1
+ import type { BlockHash } from '@aztec/stdlib/block';
2
2
  import type { AztecNode } from '@aztec/stdlib/interfaces/server';
3
- import type { DirectionalAppTaggingSecret } from '@aztec/stdlib/logs';
3
+ import type { AppTaggingSecret } from '@aztec/stdlib/logs';
4
4
 
5
5
  import type { SenderTaggingStore } from '../../storage/tagging_store/sender_tagging_store.js';
6
6
  import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../constants.js';
7
- import { getStatusChangeOfPending } from './utils/get_status_change_of_pending.js';
7
+ import {
8
+ EMPTY_STATUS_CHANGE,
9
+ getStatusChangeOfPending,
10
+ mergeStatusChanges,
11
+ } from './utils/get_status_change_of_pending.js';
8
12
  import { loadAndStoreNewTaggingIndexes } from './utils/load_and_store_new_tagging_indexes.js';
9
13
 
10
14
  /**
11
15
  * Syncs tagging indexes. This function needs to be called whenever a private log is being sent.
12
16
  *
13
- * @param secret - The secret that's unique for (sender, recipient, contract) tuple while the direction of
14
- * sender -> recipient matters.
15
- * @param app - The address of the contract that the logs are tagged for. Needs to be provided because we perform
16
- * second round of siloing in this function which is necessary because kernels do it as well (they silo first field
17
- * of the private log which corresponds to the tag).
17
+ * @param secret - The sender-side tagging `AppTaggingSecret`.
18
18
  * @remarks When syncing the indexes as sender we don't care about the log contents - we only care about the highest
19
19
  * pending and highest finalized indexes as that guides the next index choice when sending a log. The next index choice
20
20
  * is simply the highest pending index plus one (or finalized if pending is undefined).
@@ -22,10 +22,11 @@ import { loadAndStoreNewTaggingIndexes } from './utils/load_and_store_new_taggin
22
22
  * updates its status accordingly.
23
23
  */
24
24
  export async function syncSenderTaggingIndexes(
25
- secret: DirectionalAppTaggingSecret,
26
- app: AztecAddress,
25
+ secret: AppTaggingSecret,
27
26
  aztecNode: AztecNode,
28
27
  taggingStore: SenderTaggingStore,
28
+ anchorBlockHash: BlockHash,
29
+ jobId: string,
29
30
  ): Promise<void> {
30
31
  // # Explanation of how syncing works
31
32
  //
@@ -45,7 +46,7 @@ export async function syncSenderTaggingIndexes(
45
46
  // Each window advance requires two queries (logs + tx status). For example, syncing indexes 0–500 with a window of
46
47
  // 100 takes at least 10 round trips (5 windows × 2 queries).
47
48
 
48
- const finalizedIndex = await taggingStore.getLastFinalizedIndex(secret);
49
+ const finalizedIndex = await taggingStore.getLastFinalizedIndex(secret, jobId);
49
50
 
50
51
  let start = finalizedIndex === undefined ? 0 : finalizedIndex + 1;
51
52
  let end = start + UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN;
@@ -54,23 +55,60 @@ export async function syncSenderTaggingIndexes(
54
55
  let newFinalizedIndex = undefined;
55
56
 
56
57
  while (true) {
57
- // Load and store indexes for the current window. These indexes may already exist in the database if txs using
58
- // them were previously sent from this PXE. Any duplicates are handled by the tagging data provider.
59
- await loadAndStoreNewTaggingIndexes(secret, app, start, end, aztecNode, taggingStore);
58
+ // Pending tx hashes already in the store for this window (from prior syncs or txs this PXE itself sent).
59
+ // Reading these before issuing any RPC lets us fetch their receipts in parallel with the logs query below.
60
+ const knownPendingTxHashes = await taggingStore.getTxHashesOfPendingIndexes(secret, start, end, jobId);
60
61
 
61
- // Retrieve all indexes within the current window from storage and update their status accordingly.
62
- const pendingTxHashes = await taggingStore.getTxHashesOfPendingIndexes(secret, start, end);
63
- if (pendingTxHashes.length === 0) {
62
+ // Fire the logs query and the known-pending receipts query in parallel
63
+ const [, statusOfKnown] = await Promise.all([
64
+ loadAndStoreNewTaggingIndexes(secret, start, end, aztecNode, taggingStore, anchorBlockHash, jobId),
65
+ knownPendingTxHashes.length > 0
66
+ ? getStatusChangeOfPending(knownPendingTxHashes, aztecNode)
67
+ : Promise.resolve(EMPTY_STATUS_CHANGE),
68
+ ]);
69
+
70
+ // Re-read pending tx hashes after the logs query writes any newly-discovered ones to the store.
71
+ const allPendingTxHashes = await taggingStore.getTxHashesOfPendingIndexes(secret, start, end, jobId);
72
+ if (allPendingTxHashes.length === 0) {
64
73
  break;
65
74
  }
66
75
 
67
- const { txHashesToFinalize, txHashesToDrop } = await getStatusChangeOfPending(pendingTxHashes, aztecNode);
76
+ // Receipts for pending tx hashes that the logs query just surfaced still need a sequential follow-up call.
77
+ // `storePendingIndexes` is idempotent on (secret, txHash), so a re-discovered hash stays classified as known
78
+ // and is not re-fetched here.
79
+ const knownSet = new Set(knownPendingTxHashes.map(h => h.toString()));
80
+ const newPendingTxHashes = allPendingTxHashes.filter(h => !knownSet.has(h.toString()));
81
+
82
+ const statusOfNew =
83
+ newPendingTxHashes.length > 0
84
+ ? await getStatusChangeOfPending(newPendingTxHashes, aztecNode)
85
+ : EMPTY_STATUS_CHANGE;
86
+
87
+ const { txHashesToFinalize, txHashesToDrop, txHashesWithExecutionReverted } = mergeStatusChanges(
88
+ statusOfKnown,
89
+ statusOfNew,
90
+ );
68
91
 
69
- await taggingStore.dropPendingIndexes(txHashesToDrop);
70
- await taggingStore.finalizePendingIndexes(txHashesToFinalize);
92
+ await taggingStore.dropPendingIndexes(txHashesToDrop, jobId);
93
+ await taggingStore.finalizePendingIndexes(txHashesToFinalize, jobId);
94
+
95
+ if (txHashesWithExecutionReverted.length > 0) {
96
+ const indexedTxEffects = await Promise.all(
97
+ txHashesWithExecutionReverted.map(txHash => aztecNode.getTxEffect(txHash)),
98
+ );
99
+ for (const indexedTxEffect of indexedTxEffects) {
100
+ if (indexedTxEffect === undefined) {
101
+ throw new Error(
102
+ 'TxEffect not found for execution-reverted tx. This is either a bug or a reorg has occurred.',
103
+ );
104
+ }
105
+
106
+ await taggingStore.finalizePendingIndexesOfAPartiallyRevertedTx(indexedTxEffect.data, jobId);
107
+ }
108
+ }
71
109
 
72
110
  // We check if the finalized index has been updated.
73
- newFinalizedIndex = await taggingStore.getLastFinalizedIndex(secret);
111
+ newFinalizedIndex = await taggingStore.getLastFinalizedIndex(secret, jobId);
74
112
  if (previousFinalizedIndex !== newFinalizedIndex) {
75
113
  // A new finalized index was found, so we'll run the loop again. For example:
76
114
  // - Previous finalized index: 10
@@ -1,48 +1,66 @@
1
1
  import type { AztecNode } from '@aztec/stdlib/interfaces/server';
2
2
  import { TxHash, TxStatus } from '@aztec/stdlib/tx';
3
3
 
4
+ /** Classification of a batch of pending tx hashes by the status change implied by their receipts. */
5
+ export type StatusChange = {
6
+ txHashesToFinalize: TxHash[];
7
+ txHashesToDrop: TxHash[];
8
+ txHashesWithExecutionReverted: TxHash[];
9
+ };
10
+
11
+ export const EMPTY_STATUS_CHANGE: StatusChange = {
12
+ txHashesToFinalize: [],
13
+ txHashesToDrop: [],
14
+ txHashesWithExecutionReverted: [],
15
+ };
16
+
17
+ /** Concatenates two status changes field-by-field. */
18
+ export function mergeStatusChanges(a: StatusChange, b: StatusChange): StatusChange {
19
+ return {
20
+ txHashesToFinalize: [...a.txHashesToFinalize, ...b.txHashesToFinalize],
21
+ txHashesToDrop: [...a.txHashesToDrop, ...b.txHashesToDrop],
22
+ txHashesWithExecutionReverted: [...a.txHashesWithExecutionReverted, ...b.txHashesWithExecutionReverted],
23
+ };
24
+ }
25
+
4
26
  /**
5
- * Based on receipts obtained from `aztecNode` returns which pending transactions changed their status to finalized or
6
- * dropped.
27
+ * Based on receipts obtained from `aztecNode` returns which pending transactions changed their status to finalized,
28
+ * dropped, or execution-reverted (but mined).
7
29
  */
8
- export async function getStatusChangeOfPending(
9
- pending: TxHash[],
10
- aztecNode: AztecNode,
11
- ): Promise<{ txHashesToFinalize: TxHash[]; txHashesToDrop: TxHash[] }> {
12
- // Get receipts for all pending tx hashes and the finalized block number.
13
- const [receipts, tips] = await Promise.all([
14
- Promise.all(pending.map(pendingTxHash => aztecNode.getTxReceipt(pendingTxHash))),
15
- aztecNode.getL2Tips(),
16
- ]);
30
+ export async function getStatusChangeOfPending(pending: TxHash[], aztecNode: AztecNode): Promise<StatusChange> {
31
+ // Get receipts for all pending tx hashes.
32
+ const receipts = await Promise.all(pending.map(pendingTxHash => aztecNode.getTxReceipt(pendingTxHash)));
17
33
 
18
34
  const txHashesToFinalize: TxHash[] = [];
19
35
  const txHashesToDrop: TxHash[] = [];
36
+ const txHashesWithExecutionReverted: TxHash[] = [];
20
37
 
21
38
  for (let i = 0; i < receipts.length; i++) {
22
39
  const receipt = receipts[i];
23
40
  const txHash = pending[i];
24
41
 
25
- if (
26
- receipt.status === TxStatus.SUCCESS &&
27
- receipt.blockNumber &&
28
- receipt.blockNumber <= tips.finalized.block.number
29
- ) {
30
- // Tx has been included in a block and the corresponding block is finalized --> we mark the indexes as
31
- // finalized.
32
- txHashesToFinalize.push(txHash);
33
- } else if (
34
- receipt.status === TxStatus.DROPPED ||
35
- receipt.status === TxStatus.APP_LOGIC_REVERTED ||
36
- receipt.status === TxStatus.TEARDOWN_REVERTED ||
37
- receipt.status === TxStatus.BOTH_REVERTED
38
- ) {
39
- // Tx was dropped or reverted --> we drop the corresponding pending indexes.
40
- // TODO(#17615): Don't drop pending indexes corresponding to non-revertible phases.
42
+ if (receipt.status === TxStatus.FINALIZED) {
43
+ // Tx has been included in a block and the corresponding block is finalized
44
+ if (receipt.hasExecutionSucceeded()) {
45
+ // No part of execution reverted - we just finalize all the indexes.
46
+ txHashesToFinalize.push(txHash);
47
+ } else if (receipt.hasExecutionReverted()) {
48
+ // Tx was mined but execution reverted (app logic, teardown, or both). Some logs from the non-revertible
49
+ // phase may still be onchain. We check which tags made it onchain and finalize those; drop the rest.
50
+ txHashesWithExecutionReverted.push(txHash);
51
+ } else {
52
+ // Defensive check - this branch should never be triggered
53
+ throw new Error(
54
+ 'Both hasExecutionSucceeded and hasExecutionReverted on the receipt returned false. This should never happen and it implies a bug. Please open an issue.',
55
+ );
56
+ }
57
+ } else if (receipt.isDropped()) {
58
+ // Tx was dropped from the mempool --> we drop the corresponding pending indexes.
41
59
  txHashesToDrop.push(txHash);
42
60
  } else {
43
- // Tx is still pending or the corresponding block is not yet finalized --> we don't do anything.
61
+ // Tx is still pending, not yet finalized, or was mined successfully but not yet finalized --> we don't do anything.
44
62
  }
45
63
  }
46
64
 
47
- return { txHashesToFinalize, txHashesToDrop };
65
+ return { txHashesToFinalize, txHashesToDrop, txHashesWithExecutionReverted };
48
66
  }
@@ -1,72 +1,84 @@
1
- import type { AztecAddress } from '@aztec/stdlib/aztec-address';
1
+ import type { BlockHash } from '@aztec/stdlib/block';
2
2
  import type { AztecNode } from '@aztec/stdlib/interfaces/server';
3
- import type { DirectionalAppTaggingSecret, PreTag } from '@aztec/stdlib/logs';
4
- import { SiloedTag, Tag } from '@aztec/stdlib/logs';
3
+ import { type AppTaggingSecret, SiloedTag } from '@aztec/stdlib/logs';
5
4
  import { TxHash } from '@aztec/stdlib/tx';
6
5
 
7
6
  import type { SenderTaggingStore } from '../../../storage/tagging_store/sender_tagging_store.js';
7
+ import { getAllPrivateLogsByTags } from '../../get_all_logs_by_tags.js';
8
8
 
9
9
  /**
10
10
  * Loads tagging indexes from the Aztec node and stores them in the tagging data provider.
11
11
  * @remarks This function is one of two places by which a pending index can get to the tagging data provider. The other
12
12
  * place is when a tx is being sent from this PXE.
13
- * @param secret - The directional app tagging secret that's unique for (sender, recipient, contract) tuple.
14
- * @param app - The address of the contract that the logs are tagged for. Used for siloing tags to match
15
- * kernel circuit behavior.
13
+ * @param extendedSecret - The app tagging secret whose indexes are being synced.
16
14
  * @param start - The starting index (inclusive) of the window to process.
17
15
  * @param end - The ending index (exclusive) of the window to process.
18
16
  * @param aztecNode - The Aztec node instance to query for logs.
19
17
  * @param taggingStore - The data provider to store pending indexes.
18
+ * @param anchorBlockHash - Hash of a block to use as reference block when querying node.
19
+ * @param jobId - Job identifier, used to keep writes in-memory until they can be persisted in a data integrity
20
+ * preserving way.
20
21
  */
21
22
  export async function loadAndStoreNewTaggingIndexes(
22
- secret: DirectionalAppTaggingSecret,
23
- app: AztecAddress,
23
+ extendedSecret: AppTaggingSecret,
24
24
  start: number,
25
25
  end: number,
26
26
  aztecNode: AztecNode,
27
27
  taggingStore: SenderTaggingStore,
28
+ anchorBlockHash: BlockHash,
29
+ jobId: string,
28
30
  ) {
29
31
  // We compute the tags for the current window of indexes
30
- const preTagsForWindow: PreTag[] = Array(end - start)
31
- .fill(0)
32
- .map((_, i) => ({ secret, index: start + i }));
33
32
  const siloedTagsForWindow = await Promise.all(
34
- preTagsForWindow.map(async preTag => SiloedTag.compute(await Tag.compute(preTag), app)),
33
+ Array.from({ length: end - start }, (_, i) => SiloedTag.compute({ extendedSecret, index: start + i })),
35
34
  );
36
35
 
37
- const txsForTags = await getTxsContainingTags(siloedTagsForWindow, aztecNode);
38
- const highestIndexMap = getTxHighestIndexMap(txsForTags, preTagsForWindow);
36
+ const txsForTags = await getTxsContainingTags(siloedTagsForWindow, aztecNode, anchorBlockHash);
37
+ const txIndexesMap = getTxIndexesMap(txsForTags, start, siloedTagsForWindow.length);
39
38
 
40
- // Now we iterate over the map, reconstruct the preTags and tx hash and store them in the db.
41
- for (const [txHashStr, highestIndex] of highestIndexMap.entries()) {
39
+ // Now we iterate over the map, construct the tagging index ranges and store them in the db.
40
+ for (const [txHashStr, indexes] of txIndexesMap.entries()) {
42
41
  const txHash = TxHash.fromString(txHashStr);
43
- await taggingStore.storePendingIndexes([{ secret, index: highestIndex }], txHash);
42
+ const ranges = [{ extendedSecret, lowestIndex: Math.min(...indexes), highestIndex: Math.max(...indexes) }];
43
+ await taggingStore.storePendingIndexes(ranges, txHash, jobId);
44
44
  }
45
45
  }
46
46
 
47
47
  // Returns txs that used the given tags. A tag might have been used in multiple txs and for this reason we return
48
48
  // an array for each tag.
49
- async function getTxsContainingTags(tags: SiloedTag[], aztecNode: AztecNode): Promise<TxHash[][]> {
50
- const allLogs = await aztecNode.getPrivateLogsByTags(tags);
49
+ async function getTxsContainingTags(
50
+ tags: SiloedTag[],
51
+ aztecNode: AztecNode,
52
+ anchorBlockHash: BlockHash,
53
+ ): Promise<TxHash[][]> {
54
+ // We use the utility function below to retrieve all logs for the tags across all pages, so we don't need to handle
55
+ // pagination here. Sender sync only needs `txHash` from each log, so we leave `includeEffects` off.
56
+ const allLogs = await getAllPrivateLogsByTags(aztecNode, tags, anchorBlockHash);
51
57
  return allLogs.map(logs => logs.map(log => log.txHash));
52
58
  }
53
59
 
54
- // Returns a map of txHash to the highest index for that txHash.
55
- function getTxHighestIndexMap(txHashesForTags: TxHash[][], preTagsForWindow: PreTag[]): Map<string, number> {
56
- if (txHashesForTags.length !== preTagsForWindow.length) {
57
- throw new Error(
58
- `Number of tx hashes arrays does not match number of pre-tags. ${txHashesForTags.length} !== ${preTagsForWindow.length}`,
59
- );
60
+ // Returns a map of txHash to all indexes for that txHash.
61
+ function getTxIndexesMap(txHashesForTags: TxHash[][], start: number, count: number): Map<string, number[]> {
62
+ if (txHashesForTags.length !== count) {
63
+ throw new Error(`Number of tx hashes arrays does not match number of tags. ${txHashesForTags.length} !== ${count}`);
60
64
  }
61
65
 
62
- const highestIndexMap = new Map<string, number>();
66
+ const indexesMap = new Map<string, number[]>();
67
+ // Iterate over indexes
63
68
  for (let i = 0; i < txHashesForTags.length; i++) {
64
- const taggingIndex = preTagsForWindow[i].index;
69
+ const taggingIndex = start + i;
65
70
  const txHashesForTag = txHashesForTags[i];
71
+ // iterate over tx hashes that used that index (tag)
66
72
  for (const txHash of txHashesForTag) {
67
73
  const key = txHash.toString();
68
- highestIndexMap.set(key, Math.max(highestIndexMap.get(key) ?? 0, taggingIndex));
74
+ const existing = indexesMap.get(key);
75
+ // Add the index to the tx's indexes
76
+ if (existing) {
77
+ existing.push(taggingIndex);
78
+ } else {
79
+ indexesMap.set(key, [taggingIndex]);
80
+ }
69
81
  }
70
82
  }
71
- return highestIndexMap;
83
+ return indexesMap;
72
84
  }
@@ -1,9 +0,0 @@
1
- import type { AztecNode } from '@aztec/stdlib/interfaces/client';
2
- import type { NodeStats } from '@aztec/stdlib/tx';
3
- export type ProxiedNode = AztecNode & {
4
- getStats(): NodeStats;
5
- };
6
- export declare class ProxiedNodeFactory {
7
- static create(node: AztecNode): ProxiedNode;
8
- }
9
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJveGllZF9ub2RlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY29udHJhY3RfZnVuY3Rpb25fc2ltdWxhdG9yL3Byb3hpZWRfbm9kZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNqRSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUtsRCxNQUFNLE1BQU0sV0FBVyxHQUFHLFNBQVMsR0FBRztJQUFFLFFBQVEsSUFBSSxTQUFTLENBQUE7Q0FBRSxDQUFDO0FBRWhFLHFCQUFhLGtCQUFrQjtJQUM3QixNQUFNLENBQUMsTUFBTSxDQUFDLElBQUksRUFBRSxTQUFTLGVBcUI1QjtDQUNGIn0=
@@ -1 +0,0 @@
1
- {"version":3,"file":"proxied_node.d.ts","sourceRoot":"","sources":["../../src/contract_function_simulator/proxied_node.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAKlD,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG;IAAE,QAAQ,IAAI,SAAS,CAAA;CAAE,CAAC;AAEhE,qBAAa,kBAAkB;IAC7B,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,eAqB5B;CACF"}
@@ -1,27 +0,0 @@
1
- import { Timer } from '@aztec/foundation/timer';
2
- export class ProxiedNodeFactory {
3
- static create(node) {
4
- const stats = {};
5
- return new Proxy(node, {
6
- get (target, prop) {
7
- if (prop === 'getStats') {
8
- return ()=>{
9
- return stats;
10
- };
11
- } else {
12
- return async function(...args) {
13
- if (!stats[prop]) {
14
- stats[prop] = {
15
- times: []
16
- };
17
- }
18
- const timer = new Timer();
19
- const result = await target[prop].apply(target, args);
20
- stats[prop].times.push(timer.ms());
21
- return result;
22
- };
23
- }
24
- }
25
- });
26
- }
27
- }
@@ -1,28 +0,0 @@
1
- import { type PrivateKernelCircuitPublicInputs, PrivateKernelResetCircuitPrivateInputs, type PrivateKernelSimulateOutput } from '@aztec/stdlib/kernel';
2
- import { type PrivateCallExecutionResult } from '@aztec/stdlib/tx';
3
- import type { PrivateKernelOracle } from '../private_kernel_oracle.js';
4
- export declare class PrivateKernelResetPrivateInputsBuilder {
5
- private previousKernelOutput;
6
- private executionStack;
7
- private noteHashNullifierCounterMap;
8
- private splitCounter;
9
- private previousKernel;
10
- private nextIteration?;
11
- private noteHashResetActions;
12
- private nullifierResetActions;
13
- private numTransientData?;
14
- private transientDataSquashingHints;
15
- private requestedDimensions;
16
- constructor(previousKernelOutput: PrivateKernelSimulateOutput<PrivateKernelCircuitPublicInputs>, executionStack: PrivateCallExecutionResult[], noteHashNullifierCounterMap: Map<number, number>, splitCounter: number);
17
- needsReset(): boolean;
18
- build(oracle: PrivateKernelOracle): Promise<PrivateKernelResetCircuitPrivateInputs>;
19
- private reduceReadRequestActions;
20
- private needsResetNoteHashReadRequests;
21
- private needsResetNullifierReadRequests;
22
- private needsResetNullifierKeys;
23
- private needsResetTransientData;
24
- private needsSiloNoteHashes;
25
- private needsSiloNullifiers;
26
- private needsSiloPrivateLogs;
27
- }
28
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVpbGRfcHJpdmF0ZV9rZXJuZWxfcmVzZXRfcHJpdmF0ZV9pbnB1dHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9wcml2YXRlX2tlcm5lbC9oaW50cy9idWlsZF9wcml2YXRlX2tlcm5lbF9yZXNldF9wcml2YXRlX2lucHV0cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFlQSxPQUFPLEVBS0wsS0FBSyxnQ0FBZ0MsRUFFckMsc0NBQXNDLEVBR3RDLEtBQUssMkJBQTJCLEVBZWpDLE1BQU0sc0JBQXNCLENBQUM7QUFDOUIsT0FBTyxFQUFFLEtBQUssMEJBQTBCLEVBQWlCLE1BQU0sa0JBQWtCLENBQUM7QUFHbEYsT0FBTyxLQUFLLEVBQUUsbUJBQW1CLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQTRDdkUscUJBQWEsc0NBQXNDO0lBWS9DLE9BQU8sQ0FBQyxvQkFBb0I7SUFDNUIsT0FBTyxDQUFDLGNBQWM7SUFDdEIsT0FBTyxDQUFDLDJCQUEyQjtJQUNuQyxPQUFPLENBQUMsWUFBWTtJQWR0QixPQUFPLENBQUMsY0FBYyxDQUFtQztJQUV6RCxPQUFPLENBQUMsYUFBYSxDQUFDLENBQTZCO0lBRW5ELE9BQU8sQ0FBQyxvQkFBb0IsQ0FBcUU7SUFDakcsT0FBTyxDQUFDLHFCQUFxQixDQUFxRTtJQUNsRyxPQUFPLENBQUMsZ0JBQWdCLENBQUMsQ0FBUztJQUNsQyxPQUFPLENBQUMsMkJBQTJCLENBQWtFO0lBQ3JHLE9BQU8sQ0FBQyxtQkFBbUIsQ0FBK0I7SUFFMUQsWUFDVSxvQkFBb0IsRUFBRSwyQkFBMkIsQ0FBQyxnQ0FBZ0MsQ0FBQyxFQUNuRixjQUFjLEVBQUUsMEJBQTBCLEVBQUUsRUFDNUMsMkJBQTJCLEVBQUUsR0FBRyxDQUFDLE1BQU0sRUFBRSxNQUFNLENBQUMsRUFDaEQsWUFBWSxFQUFFLE1BQU0sRUFXN0I7SUFFRCxVQUFVLElBQUksT0FBTyxDQXNCcEI7SUFFSyxLQUFLLENBQUMsTUFBTSxFQUFFLG1CQUFtQixtREFtRXRDO0lBRUQsT0FBTyxDQUFDLHdCQUF3QjtJQTJCaEMsT0FBTyxDQUFDLDhCQUE4QjtJQXVEdEMsT0FBTyxDQUFDLCtCQUErQjtJQXVEdkMsT0FBTyxDQUFDLHVCQUF1QjtJQWEvQixPQUFPLENBQUMsdUJBQXVCO0lBc0UvQixPQUFPLENBQUMsbUJBQW1CO0lBYzNCLE9BQU8sQ0FBQyxtQkFBbUI7SUFrQjNCLE9BQU8sQ0FBQyxvQkFBb0I7Q0FxQjdCIn0=
@@ -1 +0,0 @@
1
- {"version":3,"file":"build_private_kernel_reset_private_inputs.d.ts","sourceRoot":"","sources":["../../../src/private_kernel/hints/build_private_kernel_reset_private_inputs.ts"],"names":[],"mappings":"AAeA,OAAO,EAKL,KAAK,gCAAgC,EAErC,sCAAsC,EAGtC,KAAK,2BAA2B,EAejC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,KAAK,0BAA0B,EAAiB,MAAM,kBAAkB,CAAC;AAGlF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AA4CvE,qBAAa,sCAAsC;IAY/C,OAAO,CAAC,oBAAoB;IAC5B,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,2BAA2B;IACnC,OAAO,CAAC,YAAY;IAdtB,OAAO,CAAC,cAAc,CAAmC;IAEzD,OAAO,CAAC,aAAa,CAAC,CAA6B;IAEnD,OAAO,CAAC,oBAAoB,CAAqE;IACjG,OAAO,CAAC,qBAAqB,CAAqE;IAClG,OAAO,CAAC,gBAAgB,CAAC,CAAS;IAClC,OAAO,CAAC,2BAA2B,CAAkE;IACrG,OAAO,CAAC,mBAAmB,CAA+B;IAE1D,YACU,oBAAoB,EAAE,2BAA2B,CAAC,gCAAgC,CAAC,EACnF,cAAc,EAAE,0BAA0B,EAAE,EAC5C,2BAA2B,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAChD,YAAY,EAAE,MAAM,EAW7B;IAED,UAAU,IAAI,OAAO,CAsBpB;IAEK,KAAK,CAAC,MAAM,EAAE,mBAAmB,mDAmEtC;IAED,OAAO,CAAC,wBAAwB;IA2BhC,OAAO,CAAC,8BAA8B;IAuDtC,OAAO,CAAC,+BAA+B;IAuDvC,OAAO,CAAC,uBAAuB;IAa/B,OAAO,CAAC,uBAAuB;IAsE/B,OAAO,CAAC,mBAAmB;IAc3B,OAAO,CAAC,mBAAmB;IAkB3B,OAAO,CAAC,oBAAoB;CAqB7B"}
@@ -1,4 +0,0 @@
1
- import type { PrivateKernelCircuitPublicInputs } from '@aztec/stdlib/kernel';
2
- import type { UInt64 } from '@aztec/stdlib/types';
3
- export declare function computeTxIncludeByTimestamp(previousKernel: PrivateKernelCircuitPublicInputs, maxDuration?: number): UInt64;
4
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tcHV0ZV90eF9pbmNsdWRlX2J5X3RpbWVzdGFtcC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3ByaXZhdGVfa2VybmVsL2hpbnRzL2NvbXB1dGVfdHhfaW5jbHVkZV9ieV90aW1lc3RhbXAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxLQUFLLEVBQUUsZ0NBQWdDLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUM3RSxPQUFPLEtBQUssRUFBRSxNQUFNLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQXFCbEQsd0JBQWdCLDJCQUEyQixDQUN6QyxjQUFjLEVBQUUsZ0NBQWdDLEVBQ2hELFdBQVcsU0FBb0MsR0FDOUMsTUFBTSxDQStCUiJ9
@@ -1 +0,0 @@
1
- {"version":3,"file":"compute_tx_include_by_timestamp.d.ts","sourceRoot":"","sources":["../../../src/private_kernel/hints/compute_tx_include_by_timestamp.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAqBlD,wBAAgB,2BAA2B,CACzC,cAAc,EAAE,gCAAgC,EAChD,WAAW,SAAoC,GAC9C,MAAM,CA+BR"}
@@ -1,46 +0,0 @@
1
- import { NOTE_HASH_TREE_HEIGHT } from '@aztec/constants';
2
- import type { Fr } from '@aztec/foundation/curves/bn254';
3
- import type { GrumpkinScalar, Point } from '@aztec/foundation/curves/grumpkin';
4
- import { MembershipWitness } from '@aztec/foundation/trees';
5
- import type { KeyStore } from '@aztec/key-store';
6
- import type { FunctionSelector } from '@aztec/stdlib/abi';
7
- import type { AztecAddress } from '@aztec/stdlib/aztec-address';
8
- import type { BlockParameter } from '@aztec/stdlib/block';
9
- import type { AztecNode } from '@aztec/stdlib/interfaces/client';
10
- import { UpdatedClassIdHints } from '@aztec/stdlib/kernel';
11
- import type { NullifierMembershipWitness } from '@aztec/stdlib/trees';
12
- import type { VerificationKeyAsFields } from '@aztec/stdlib/vks';
13
- import type { ContractStore } from '../storage/contract_store/contract_store.js';
14
- import type { PrivateKernelOracle } from './private_kernel_oracle.js';
15
- /**
16
- * A data oracle that provides information needed for simulating a transaction.
17
- */
18
- export declare class PrivateKernelOracleImpl implements PrivateKernelOracle {
19
- private contractStore;
20
- private keyStore;
21
- private node;
22
- private blockNumber;
23
- private log;
24
- constructor(contractStore: ContractStore, keyStore: KeyStore, node: AztecNode, blockNumber?: BlockParameter, log?: import("@aztec/foundation/log").Logger);
25
- getContractAddressPreimage(address: AztecAddress): Promise<{
26
- version: 1;
27
- salt: Fr;
28
- deployer: AztecAddress;
29
- currentContractClassId: Fr;
30
- originalContractClassId: Fr;
31
- initializationHash: Fr;
32
- publicKeys: import("../../../stdlib/dest/keys/public_keys.js").PublicKeys;
33
- address: AztecAddress;
34
- saltedInitializationHash: Fr;
35
- }>;
36
- getContractClassIdPreimage(contractClassId: Fr): Promise<import("@aztec/stdlib/contract").ContractClassIdPreimage>;
37
- getFunctionMembershipWitness(contractClassId: Fr, selector: FunctionSelector): Promise<MembershipWitness<7>>;
38
- getVkMembershipWitness(vk: VerificationKeyAsFields): Promise<MembershipWitness<7>>;
39
- getNoteHashMembershipWitness(noteHash: Fr): Promise<MembershipWitness<typeof NOTE_HASH_TREE_HEIGHT> | undefined>;
40
- getNullifierMembershipWitness(nullifier: Fr): Promise<NullifierMembershipWitness | undefined>;
41
- getNoteHashTreeRoot(): Promise<Fr>;
42
- getMasterSecretKey(masterPublicKey: Point): Promise<GrumpkinScalar>;
43
- getDebugFunctionName(contractAddress: AztecAddress, selector: FunctionSelector): Promise<string>;
44
- getUpdatedClassIdHints(contractAddress: AztecAddress): Promise<UpdatedClassIdHints>;
45
- }
46
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJpdmF0ZV9rZXJuZWxfb3JhY2xlX2ltcGwuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wcml2YXRlX2tlcm5lbC9wcml2YXRlX2tlcm5lbF9vcmFjbGVfaW1wbC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUscUJBQXFCLEVBQTJDLE1BQU0sa0JBQWtCLENBQUM7QUFDbEcsT0FBTyxLQUFLLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDekQsT0FBTyxLQUFLLEVBQUUsY0FBYyxFQUFFLEtBQUssRUFBRSxNQUFNLG1DQUFtQyxDQUFDO0FBRS9FLE9BQU8sRUFBRSxpQkFBaUIsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBQzVELE9BQU8sS0FBSyxFQUFFLFFBQVEsRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBR2pELE9BQU8sS0FBSyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFDMUQsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFDaEUsT0FBTyxLQUFLLEVBQUUsY0FBYyxFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFJMUQsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFDakUsT0FBTyxFQUFFLG1CQUFtQixFQUFFLE1BQU0sc0JBQXNCLENBQUM7QUFDM0QsT0FBTyxLQUFLLEVBQUUsMEJBQTBCLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUN0RSxPQUFPLEtBQUssRUFBRSx1QkFBdUIsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBRWpFLE9BQU8sS0FBSyxFQUFFLGFBQWEsRUFBRSxNQUFNLDZDQUE2QyxDQUFDO0FBQ2pGLE9BQU8sS0FBSyxFQUFFLG1CQUFtQixFQUFFLE1BQU0sNEJBQTRCLENBQUM7QUFLdEU7O0dBRUc7QUFDSCxxQkFBYSx1QkFBd0IsWUFBVyxtQkFBbUI7SUFFL0QsT0FBTyxDQUFDLGFBQWE7SUFDckIsT0FBTyxDQUFDLFFBQVE7SUFDaEIsT0FBTyxDQUFDLElBQUk7SUFDWixPQUFPLENBQUMsV0FBVztJQUNuQixPQUFPLENBQUMsR0FBRztJQUxiLFlBQ1UsYUFBYSxFQUFFLGFBQWEsRUFDNUIsUUFBUSxFQUFFLFFBQVEsRUFDbEIsSUFBSSxFQUFFLFNBQVMsRUFDZixXQUFXLEdBQUUsY0FBeUIsRUFDdEMsR0FBRyx5Q0FBb0MsRUFDN0M7SUFFUywwQkFBMEIsQ0FBQyxPQUFPLEVBQUUsWUFBWTs7Ozs7Ozs7OztPQVM1RDtJQUVZLDBCQUEwQixDQUFDLGVBQWUsRUFBRSxFQUFFLHFFQU0xRDtJQUVZLDRCQUE0QixDQUFDLGVBQWUsRUFBRSxFQUFFLEVBQUUsUUFBUSxFQUFFLGdCQUFnQixpQ0FReEY7SUFFTSxzQkFBc0IsQ0FBQyxFQUFFLEVBQUUsdUJBQXVCLGlDQUd4RDtJQUVELDRCQUE0QixDQUFDLFFBQVEsRUFBRSxFQUFFLEdBQUcsT0FBTyxDQUFDLGlCQUFpQixDQUFDLE9BQU8scUJBQXFCLENBQUMsR0FBRyxTQUFTLENBQUMsQ0FFL0c7SUFFRCw2QkFBNkIsQ0FBQyxTQUFTLEVBQUUsRUFBRSxHQUFHLE9BQU8sQ0FBQywwQkFBMEIsR0FBRyxTQUFTLENBQUMsQ0FFNUY7SUFFSyxtQkFBbUIsSUFBSSxPQUFPLENBQUMsRUFBRSxDQUFDLENBTXZDO0lBRU0sa0JBQWtCLENBQUMsZUFBZSxFQUFFLEtBQUssR0FBRyxPQUFPLENBQUMsY0FBYyxDQUFDLENBRXpFO0lBRU0sb0JBQW9CLENBQUMsZUFBZSxFQUFFLFlBQVksRUFBRSxRQUFRLEVBQUUsZ0JBQWdCLEdBQUcsT0FBTyxDQUFDLE1BQU0sQ0FBQyxDQUV0RztJQUVZLHNCQUFzQixDQUFDLGVBQWUsRUFBRSxZQUFZLEdBQUcsT0FBTyxDQUFDLG1CQUFtQixDQUFDLENBOEIvRjtDQUNGIn0=
@@ -1 +0,0 @@
1
- {"version":3,"file":"private_kernel_oracle_impl.d.ts","sourceRoot":"","sources":["../../src/private_kernel/private_kernel_oracle_impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAA2C,MAAM,kBAAkB,CAAC;AAClG,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAE/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAI1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAEjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AACjF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAKtE;;GAEG;AACH,qBAAa,uBAAwB,YAAW,mBAAmB;IAE/D,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,IAAI;IACZ,OAAO,CAAC,WAAW;IACnB,OAAO,CAAC,GAAG;IALb,YACU,aAAa,EAAE,aAAa,EAC5B,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,SAAS,EACf,WAAW,GAAE,cAAyB,EACtC,GAAG,yCAAoC,EAC7C;IAES,0BAA0B,CAAC,OAAO,EAAE,YAAY;;;;;;;;;;OAS5D;IAEY,0BAA0B,CAAC,eAAe,EAAE,EAAE,qEAM1D;IAEY,4BAA4B,CAAC,eAAe,EAAE,EAAE,EAAE,QAAQ,EAAE,gBAAgB,iCAQxF;IAEM,sBAAsB,CAAC,EAAE,EAAE,uBAAuB,iCAGxD;IAED,4BAA4B,CAAC,QAAQ,EAAE,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,OAAO,qBAAqB,CAAC,GAAG,SAAS,CAAC,CAE/G;IAED,6BAA6B,CAAC,SAAS,EAAE,EAAE,GAAG,OAAO,CAAC,0BAA0B,GAAG,SAAS,CAAC,CAE5F;IAEK,mBAAmB,IAAI,OAAO,CAAC,EAAE,CAAC,CAMvC;IAEM,kBAAkB,CAAC,eAAe,EAAE,KAAK,GAAG,OAAO,CAAC,cAAc,CAAC,CAEzE;IAEM,oBAAoB,CAAC,eAAe,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CAEtG;IAEY,sBAAsB,CAAC,eAAe,EAAE,YAAY,GAAG,OAAO,CAAC,mBAAmB,CAAC,CA8B/F;CACF"}
@@ -1,85 +0,0 @@
1
- import { PUBLIC_DATA_TREE_HEIGHT, VK_TREE_HEIGHT } from '@aztec/constants';
2
- import { createLogger } from '@aztec/foundation/log';
3
- import { MembershipWitness } from '@aztec/foundation/trees';
4
- import { getVKIndex, getVKSiblingPath } from '@aztec/noir-protocol-circuits-types/vk-tree';
5
- import { ProtocolContractAddress } from '@aztec/protocol-contracts';
6
- import { computeContractClassIdPreimage, computeSaltedInitializationHash } from '@aztec/stdlib/contract';
7
- import { DelayedPublicMutableValues, DelayedPublicMutableValuesWithHash } from '@aztec/stdlib/delayed-public-mutable';
8
- import { computePublicDataTreeLeafSlot } from '@aztec/stdlib/hash';
9
- import { UpdatedClassIdHints } from '@aztec/stdlib/kernel';
10
- // TODO: Block number should not be "latest".
11
- // It should be fixed at the time the proof is being simulated. I.e., it should be the same as the value defined in the constant data.
12
- /**
13
- * A data oracle that provides information needed for simulating a transaction.
14
- */ export class PrivateKernelOracleImpl {
15
- contractStore;
16
- keyStore;
17
- node;
18
- blockNumber;
19
- log;
20
- constructor(contractStore, keyStore, node, blockNumber = 'latest', log = createLogger('pxe:kernel_oracle')){
21
- this.contractStore = contractStore;
22
- this.keyStore = keyStore;
23
- this.node = node;
24
- this.blockNumber = blockNumber;
25
- this.log = log;
26
- }
27
- async getContractAddressPreimage(address) {
28
- const instance = await this.contractStore.getContractInstance(address);
29
- if (!instance) {
30
- throw new Error(`Contract instance not found when getting address preimage. Contract address: ${address}.`);
31
- }
32
- return {
33
- saltedInitializationHash: await computeSaltedInitializationHash(instance),
34
- ...instance
35
- };
36
- }
37
- async getContractClassIdPreimage(contractClassId) {
38
- const contractClass = await this.contractStore.getContractClass(contractClassId);
39
- if (!contractClass) {
40
- throw new Error(`Contract class not found when getting class id preimage. Class id: ${contractClassId}.`);
41
- }
42
- return computeContractClassIdPreimage(contractClass);
43
- }
44
- async getFunctionMembershipWitness(contractClassId, selector) {
45
- const membershipWitness = await this.contractStore.getFunctionMembershipWitness(contractClassId, selector);
46
- if (!membershipWitness) {
47
- throw new Error(`Membership witness not found for contract class id ${contractClassId} and selector ${selector}.`);
48
- }
49
- return membershipWitness;
50
- }
51
- getVkMembershipWitness(vk) {
52
- const leafIndex = getVKIndex(vk);
53
- return Promise.resolve(new MembershipWitness(VK_TREE_HEIGHT, BigInt(leafIndex), getVKSiblingPath(leafIndex)));
54
- }
55
- getNoteHashMembershipWitness(noteHash) {
56
- return this.node.getNoteHashMembershipWitness(this.blockNumber, noteHash);
57
- }
58
- getNullifierMembershipWitness(nullifier) {
59
- return this.node.getNullifierMembershipWitness(this.blockNumber, nullifier);
60
- }
61
- async getNoteHashTreeRoot() {
62
- const header = await this.node.getBlockHeader(this.blockNumber);
63
- if (!header) {
64
- throw new Error(`No block header found for block number ${this.blockNumber}`);
65
- }
66
- return header.state.partial.noteHashTree.root;
67
- }
68
- getMasterSecretKey(masterPublicKey) {
69
- return this.keyStore.getMasterSecretKey(masterPublicKey);
70
- }
71
- getDebugFunctionName(contractAddress, selector) {
72
- return this.contractStore.getDebugFunctionName(contractAddress, selector);
73
- }
74
- async getUpdatedClassIdHints(contractAddress) {
75
- const { delayedPublicMutableSlot, delayedPublicMutableHashSlot } = await DelayedPublicMutableValuesWithHash.getContractUpdateSlots(contractAddress);
76
- const hashLeafSlot = await computePublicDataTreeLeafSlot(ProtocolContractAddress.ContractInstanceRegistry, delayedPublicMutableHashSlot);
77
- const updatedClassIdWitness = await this.node.getPublicDataWitness(this.blockNumber, hashLeafSlot);
78
- if (!updatedClassIdWitness) {
79
- throw new Error(`No public data tree witness found for ${hashLeafSlot}`);
80
- }
81
- const readStorage = (storageSlot)=>this.node.getPublicStorageAt(this.blockNumber, ProtocolContractAddress.ContractInstanceRegistry, storageSlot);
82
- const delayedPublicMutableValues = await DelayedPublicMutableValues.readFromTree(delayedPublicMutableSlot, readStorage);
83
- return new UpdatedClassIdHints(new MembershipWitness(PUBLIC_DATA_TREE_HEIGHT, updatedClassIdWitness.index, updatedClassIdWitness.siblingPath.toTuple()), updatedClassIdWitness.leafPreimage, delayedPublicMutableValues);
84
- }
85
- }
@@ -1,24 +0,0 @@
1
- import type { Fr } from '@aztec/foundation/curves/bn254';
2
- import type { AztecAddress } from '@aztec/stdlib/aztec-address';
3
- import type { BlockParameter } from '@aztec/stdlib/block';
4
- import type { AztecNode } from '@aztec/stdlib/interfaces/server';
5
- import type { AnchorBlockStore } from '../storage/anchor_block_store/anchor_block_store.js';
6
- export declare class PublicStorageService {
7
- private readonly anchorBlockStore;
8
- private readonly aztecNode;
9
- constructor(anchorBlockStore: AnchorBlockStore, aztecNode: AztecNode);
10
- /**
11
- * Gets the storage value at the given contract storage slot.
12
- *
13
- * @remarks The storage slot here refers to the slot as it is defined in Noir not the index in the merkle tree.
14
- * Aztec's version of `eth_getStorageAt`.
15
- *
16
- * @param blockNumber - The block number at which to get the data.
17
- * @param contract - Address of the contract to query.
18
- * @param slot - Slot to query.
19
- * @returns Storage value at the given contract slot.
20
- * @throws If the contract is not deployed.
21
- */
22
- getPublicStorageAt(blockNumber: BlockParameter, contract: AztecAddress, slot: Fr): Promise<Fr>;
23
- }
24
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljX3N0b3JhZ2Vfc2VydmljZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3B1YmxpY19zdG9yYWdlL3B1YmxpY19zdG9yYWdlX3NlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDekQsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFDaEUsT0FBTyxLQUFLLEVBQUUsY0FBYyxFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFDMUQsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFFakUsT0FBTyxLQUFLLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxxREFBcUQsQ0FBQztBQUU1RixxQkFBYSxvQkFBb0I7SUFFN0IsT0FBTyxDQUFDLFFBQVEsQ0FBQyxnQkFBZ0I7SUFDakMsT0FBTyxDQUFDLFFBQVEsQ0FBQyxTQUFTO0lBRjVCLFlBQ21CLGdCQUFnQixFQUFFLGdCQUFnQixFQUNsQyxTQUFTLEVBQUUsU0FBUyxFQUNuQztJQUVKOzs7Ozs7Ozs7OztPQVdHO0lBQ1Usa0JBQWtCLENBQUMsV0FBVyxFQUFFLGNBQWMsRUFBRSxRQUFRLEVBQUUsWUFBWSxFQUFFLElBQUksRUFBRSxFQUFFLEdBQUcsT0FBTyxDQUFDLEVBQUUsQ0FBQyxDQU0xRztDQUNGIn0=
@@ -1 +0,0 @@
1
- {"version":3,"file":"public_storage_service.d.ts","sourceRoot":"","sources":["../../src/public_storage/public_storage_service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qDAAqD,CAAC;AAE5F,qBAAa,oBAAoB;IAE7B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,SAAS;IAF5B,YACmB,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,SAAS,EACnC;IAEJ;;;;;;;;;;;OAWG;IACU,kBAAkB,CAAC,WAAW,EAAE,cAAc,EAAE,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,GAAG,OAAO,CAAC,EAAE,CAAC,CAM1G;CACF"}
@@ -1,26 +0,0 @@
1
- export class PublicStorageService {
2
- anchorBlockStore;
3
- aztecNode;
4
- constructor(anchorBlockStore, aztecNode){
5
- this.anchorBlockStore = anchorBlockStore;
6
- this.aztecNode = aztecNode;
7
- }
8
- /**
9
- * Gets the storage value at the given contract storage slot.
10
- *
11
- * @remarks The storage slot here refers to the slot as it is defined in Noir not the index in the merkle tree.
12
- * Aztec's version of `eth_getStorageAt`.
13
- *
14
- * @param blockNumber - The block number at which to get the data.
15
- * @param contract - Address of the contract to query.
16
- * @param slot - Slot to query.
17
- * @returns Storage value at the given contract slot.
18
- * @throws If the contract is not deployed.
19
- */ async getPublicStorageAt(blockNumber, contract, slot) {
20
- const anchorBlockNumber = (await this.anchorBlockStore.getBlockHeader()).getBlockNumber();
21
- if (blockNumber !== 'latest' && blockNumber > anchorBlockNumber) {
22
- throw new Error(`Block number ${blockNumber} is higher than current block ${anchorBlockNumber}`);
23
- }
24
- return await this.aztecNode.getPublicStorageAt(blockNumber, contract, slot);
25
- }
26
- }