@aztec/pxe 0.0.1-commit.03f7ef2 → 0.0.1-commit.04852196a

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 (380) hide show
  1. package/dest/access_scopes.d.ts +9 -0
  2. package/dest/access_scopes.d.ts.map +1 -0
  3. package/dest/access_scopes.js +6 -0
  4. package/dest/bin/check_oracle_version.js +1 -1
  5. package/dest/block_synchronizer/block_synchronizer.d.ts +17 -11
  6. package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
  7. package/dest/block_synchronizer/block_synchronizer.js +80 -34
  8. package/dest/config/index.d.ts +4 -2
  9. package/dest/config/index.d.ts.map +1 -1
  10. package/dest/config/index.js +18 -1
  11. package/dest/config/package_info.js +1 -1
  12. package/dest/contract_function_simulator/benchmarked_node.d.ts +9 -0
  13. package/dest/contract_function_simulator/benchmarked_node.d.ts.map +1 -0
  14. package/dest/contract_function_simulator/benchmarked_node.js +77 -0
  15. package/dest/contract_function_simulator/contract_function_simulator.d.ts +65 -40
  16. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  17. package/dest/contract_function_simulator/contract_function_simulator.js +212 -92
  18. package/dest/contract_function_simulator/execution_note_cache.d.ts +18 -9
  19. package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
  20. package/dest/contract_function_simulator/execution_note_cache.js +45 -28
  21. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +5 -5
  22. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -1
  23. package/dest/contract_function_simulator/execution_tagging_index_cache.js +3 -3
  24. package/dest/contract_function_simulator/index.d.ts +2 -2
  25. package/dest/contract_function_simulator/index.d.ts.map +1 -1
  26. package/dest/contract_function_simulator/index.js +1 -1
  27. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +4 -3
  28. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
  29. package/dest/contract_function_simulator/noir-structs/event_validation_request.js +7 -4
  30. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +3 -3
  31. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
  32. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +2 -2
  33. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +4 -10
  34. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -1
  35. package/dest/contract_function_simulator/noir-structs/utility_context.js +7 -18
  36. package/dest/contract_function_simulator/oracle/interfaces.d.ts +55 -47
  37. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
  38. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +3 -1
  39. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
  40. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +6 -6
  41. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
  42. package/dest/contract_function_simulator/oracle/note_packing_utils.js +8 -8
  43. package/dest/contract_function_simulator/oracle/oracle.d.ts +44 -42
  44. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
  45. package/dest/contract_function_simulator/oracle/oracle.js +178 -112
  46. package/dest/contract_function_simulator/oracle/private_execution.d.ts +2 -26
  47. package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
  48. package/dest/contract_function_simulator/oracle/private_execution.js +2 -38
  49. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +63 -63
  50. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  51. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +120 -88
  52. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +106 -70
  53. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  54. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +167 -145
  55. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +4 -4
  56. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -1
  57. package/dest/contract_function_simulator/proxied_contract_data_source.js +5 -5
  58. package/dest/contract_logging.d.ts +22 -0
  59. package/dest/contract_logging.d.ts.map +1 -0
  60. package/dest/contract_logging.js +23 -0
  61. package/dest/contract_sync/contract_sync_service.d.ts +43 -0
  62. package/dest/contract_sync/contract_sync_service.d.ts.map +1 -0
  63. package/dest/contract_sync/contract_sync_service.js +97 -0
  64. package/dest/contract_sync/helpers.d.ts +29 -0
  65. package/dest/contract_sync/helpers.d.ts.map +1 -0
  66. package/dest/contract_sync/helpers.js +55 -0
  67. package/dest/debug/pxe_debug_utils.d.ts +26 -12
  68. package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
  69. package/dest/debug/pxe_debug_utils.js +30 -19
  70. package/dest/entrypoints/client/bundle/index.d.ts +4 -1
  71. package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
  72. package/dest/entrypoints/client/bundle/index.js +3 -0
  73. package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
  74. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  75. package/dest/entrypoints/client/bundle/utils.js +31 -8
  76. package/dest/entrypoints/client/lazy/index.d.ts +4 -1
  77. package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
  78. package/dest/entrypoints/client/lazy/index.js +3 -0
  79. package/dest/entrypoints/client/lazy/utils.d.ts +2 -2
  80. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  81. package/dest/entrypoints/client/lazy/utils.js +32 -9
  82. package/dest/entrypoints/pxe_creation_options.d.ts +5 -3
  83. package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
  84. package/dest/entrypoints/server/index.d.ts +5 -1
  85. package/dest/entrypoints/server/index.d.ts.map +1 -1
  86. package/dest/entrypoints/server/index.js +4 -0
  87. package/dest/entrypoints/server/utils.d.ts +1 -1
  88. package/dest/entrypoints/server/utils.d.ts.map +1 -1
  89. package/dest/entrypoints/server/utils.js +39 -16
  90. package/dest/error_enriching.d.ts +4 -4
  91. package/dest/error_enriching.d.ts.map +1 -1
  92. package/dest/error_enriching.js +6 -6
  93. package/dest/events/event_service.d.ts +8 -8
  94. package/dest/events/event_service.d.ts.map +1 -1
  95. package/dest/events/event_service.js +21 -24
  96. package/dest/events/private_event_filter_validator.d.ts +6 -6
  97. package/dest/events/private_event_filter_validator.d.ts.map +1 -1
  98. package/dest/events/private_event_filter_validator.js +5 -6
  99. package/dest/job_coordinator/job_coordinator.d.ts +75 -0
  100. package/dest/job_coordinator/job_coordinator.d.ts.map +1 -0
  101. package/dest/job_coordinator/job_coordinator.js +94 -0
  102. package/dest/logs/log_service.d.ts +18 -32
  103. package/dest/logs/log_service.d.ts.map +1 -1
  104. package/dest/logs/log_service.js +76 -197
  105. package/dest/notes/note_service.d.ts +13 -12
  106. package/dest/notes/note_service.d.ts.map +1 -1
  107. package/dest/notes/note_service.js +42 -46
  108. package/dest/notes_filter.d.ts +25 -0
  109. package/dest/notes_filter.d.ts.map +1 -0
  110. package/dest/notes_filter.js +4 -0
  111. package/dest/oracle_version.d.ts +3 -3
  112. package/dest/oracle_version.d.ts.map +1 -1
  113. package/dest/oracle_version.js +5 -4
  114. package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts +4 -0
  115. package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts.map +1 -0
  116. package/dest/private_kernel/hints/{compute_tx_include_by_timestamp.js → compute_tx_expiration_timestamp.js} +12 -12
  117. package/dest/private_kernel/hints/index.d.ts +3 -3
  118. package/dest/private_kernel/hints/index.d.ts.map +1 -1
  119. package/dest/private_kernel/hints/index.js +2 -2
  120. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +29 -0
  121. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -0
  122. package/dest/private_kernel/hints/{build_private_kernel_reset_private_inputs.js → private_kernel_reset_private_inputs_builder.js} +141 -74
  123. package/dest/private_kernel/hints/test_utils.d.ts +122 -0
  124. package/dest/private_kernel/hints/test_utils.d.ts.map +1 -0
  125. package/dest/private_kernel/hints/test_utils.js +203 -0
  126. package/dest/private_kernel/private_kernel_execution_prover.d.ts +3 -2
  127. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
  128. package/dest/private_kernel/private_kernel_execution_prover.js +24 -17
  129. package/dest/private_kernel/private_kernel_oracle.d.ts +24 -24
  130. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
  131. package/dest/private_kernel/private_kernel_oracle.js +94 -2
  132. package/dest/pxe.d.ts +87 -67
  133. package/dest/pxe.d.ts.map +1 -1
  134. package/dest/pxe.js +211 -189
  135. package/dest/storage/address_store/address_store.d.ts +11 -0
  136. package/dest/storage/address_store/address_store.d.ts.map +1 -0
  137. package/dest/storage/{address_data_provider/address_data_provider.js → address_store/address_store.js} +13 -12
  138. package/dest/storage/address_store/index.d.ts +2 -0
  139. package/dest/storage/address_store/index.d.ts.map +1 -0
  140. package/dest/storage/address_store/index.js +1 -0
  141. package/dest/storage/anchor_block_store/anchor_block_store.d.ts +17 -0
  142. package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -0
  143. package/dest/storage/{anchor_block_data_provider/anchor_block_data_provider.js → anchor_block_store/anchor_block_store.js} +9 -2
  144. package/dest/storage/anchor_block_store/index.d.ts +2 -0
  145. package/dest/storage/anchor_block_store/index.d.ts.map +1 -0
  146. package/dest/storage/anchor_block_store/index.js +1 -0
  147. package/dest/storage/capsule_store/capsule_store.d.ts +72 -0
  148. package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -0
  149. package/dest/storage/capsule_store/capsule_store.js +253 -0
  150. package/dest/storage/capsule_store/index.d.ts +2 -0
  151. package/dest/storage/capsule_store/index.d.ts.map +1 -0
  152. package/dest/storage/capsule_store/index.js +1 -0
  153. package/dest/storage/contract_store/contract_store.d.ts +93 -0
  154. package/dest/storage/contract_store/contract_store.d.ts.map +1 -0
  155. package/dest/storage/contract_store/contract_store.js +309 -0
  156. package/dest/storage/contract_store/index.d.ts +2 -0
  157. package/dest/storage/contract_store/index.d.ts.map +1 -0
  158. package/dest/storage/contract_store/index.js +1 -0
  159. package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.d.ts +1 -1
  160. package/dest/storage/contract_store/private_functions_tree.d.ts.map +1 -0
  161. package/dest/storage/index.d.ts +8 -8
  162. package/dest/storage/index.d.ts.map +1 -1
  163. package/dest/storage/index.js +7 -7
  164. package/dest/storage/metadata.d.ts +1 -1
  165. package/dest/storage/metadata.js +1 -1
  166. package/dest/storage/note_store/index.d.ts +3 -0
  167. package/dest/storage/note_store/index.d.ts.map +1 -0
  168. package/dest/storage/note_store/index.js +2 -0
  169. package/dest/storage/note_store/note_store.d.ts +83 -0
  170. package/dest/storage/note_store/note_store.d.ts.map +1 -0
  171. package/dest/storage/note_store/note_store.js +343 -0
  172. package/dest/storage/note_store/stored_note.d.ts +16 -0
  173. package/dest/storage/note_store/stored_note.d.ts.map +1 -0
  174. package/dest/storage/note_store/stored_note.js +43 -0
  175. package/dest/storage/private_event_store/private_event_store.d.ts +91 -0
  176. package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -0
  177. package/dest/storage/private_event_store/private_event_store.js +273 -0
  178. package/dest/storage/private_event_store/stored_private_event.d.ts +23 -0
  179. package/dest/storage/private_event_store/stored_private_event.d.ts.map +1 -0
  180. package/dest/storage/private_event_store/stored_private_event.js +56 -0
  181. package/dest/storage/tagging_store/index.d.ts +4 -0
  182. package/dest/storage/tagging_store/index.d.ts.map +1 -0
  183. package/dest/storage/tagging_store/index.js +3 -0
  184. package/dest/storage/tagging_store/recipient_tagging_store.d.ts +28 -0
  185. package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -0
  186. package/dest/storage/tagging_store/recipient_tagging_store.js +111 -0
  187. package/dest/storage/tagging_store/sender_address_book_store.d.ts +14 -0
  188. package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +1 -0
  189. package/dest/storage/tagging_store/sender_address_book_store.js +36 -0
  190. package/dest/storage/{tagging_data_provider/sender_tagging_data_provider.d.ts → tagging_store/sender_tagging_store.d.ts} +20 -10
  191. package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -0
  192. package/dest/storage/tagging_store/sender_tagging_store.js +348 -0
  193. package/dest/tagging/constants.d.ts +2 -2
  194. package/dest/tagging/constants.d.ts.map +1 -1
  195. package/dest/tagging/constants.js +10 -3
  196. package/dest/tagging/get_all_logs_by_tags.d.ts +24 -0
  197. package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -0
  198. package/dest/tagging/get_all_logs_by_tags.js +60 -0
  199. package/dest/tagging/index.d.ts +16 -4
  200. package/dest/tagging/index.d.ts.map +1 -1
  201. package/dest/tagging/index.js +15 -3
  202. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +6 -6
  203. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -1
  204. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +13 -13
  205. package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +2 -2
  206. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +7 -7
  207. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -1
  208. package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +16 -12
  209. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +17 -0
  210. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -0
  211. package/dest/tagging/{sync → sender_sync}/sync_sender_tagging_indexes.js +9 -27
  212. package/dest/tagging/{sync → sender_sync}/utils/get_status_change_of_pending.d.ts +1 -1
  213. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -0
  214. package/dest/tagging/{sync → sender_sync}/utils/get_status_change_of_pending.js +5 -8
  215. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +18 -0
  216. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -0
  217. package/dest/tagging/{sync → sender_sync}/utils/load_and_store_new_tagging_indexes.js +25 -21
  218. package/package.json +27 -18
  219. package/src/access_scopes.ts +9 -0
  220. package/src/bin/check_oracle_version.ts +1 -0
  221. package/src/block_synchronizer/block_synchronizer.ts +99 -46
  222. package/src/config/index.ts +15 -1
  223. package/src/config/package_info.ts +1 -1
  224. package/src/contract_function_simulator/benchmarked_node.ts +103 -0
  225. package/src/contract_function_simulator/contract_function_simulator.ts +366 -156
  226. package/src/contract_function_simulator/execution_note_cache.ts +44 -25
  227. package/src/contract_function_simulator/execution_tagging_index_cache.ts +5 -5
  228. package/src/contract_function_simulator/index.ts +1 -1
  229. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +6 -2
  230. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +2 -2
  231. package/src/contract_function_simulator/noir-structs/utility_context.ts +6 -25
  232. package/src/contract_function_simulator/oracle/interfaces.ts +62 -49
  233. package/src/contract_function_simulator/oracle/note_packing_utils.ts +10 -10
  234. package/src/contract_function_simulator/oracle/oracle.ts +194 -134
  235. package/src/contract_function_simulator/oracle/private_execution.ts +2 -70
  236. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +157 -168
  237. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +245 -167
  238. package/src/contract_function_simulator/proxied_contract_data_source.ts +7 -7
  239. package/src/contract_logging.ts +39 -0
  240. package/src/contract_sync/contract_sync_service.ts +152 -0
  241. package/src/contract_sync/helpers.ts +98 -0
  242. package/src/debug/pxe_debug_utils.ts +65 -20
  243. package/src/entrypoints/client/bundle/index.ts +3 -0
  244. package/src/entrypoints/client/bundle/utils.ts +23 -16
  245. package/src/entrypoints/client/lazy/index.ts +3 -0
  246. package/src/entrypoints/client/lazy/utils.ts +24 -17
  247. package/src/entrypoints/pxe_creation_options.ts +4 -2
  248. package/src/entrypoints/server/index.ts +4 -0
  249. package/src/entrypoints/server/utils.ts +33 -41
  250. package/src/error_enriching.ts +7 -15
  251. package/src/events/event_service.ts +22 -28
  252. package/src/events/private_event_filter_validator.ts +4 -6
  253. package/src/job_coordinator/job_coordinator.ts +150 -0
  254. package/src/logs/log_service.ts +122 -273
  255. package/src/notes/note_service.ts +45 -49
  256. package/src/notes_filter.ts +26 -0
  257. package/src/oracle_version.ts +5 -4
  258. package/src/private_kernel/hints/{compute_tx_include_by_timestamp.ts → compute_tx_expiration_timestamp.ts} +13 -13
  259. package/src/private_kernel/hints/index.ts +2 -2
  260. package/src/private_kernel/hints/{build_private_kernel_reset_private_inputs.ts → private_kernel_reset_private_inputs_builder.ts} +196 -138
  261. package/src/private_kernel/hints/test_utils.ts +325 -0
  262. package/src/private_kernel/private_kernel_execution_prover.ts +27 -19
  263. package/src/private_kernel/private_kernel_oracle.ts +116 -36
  264. package/src/pxe.ts +339 -261
  265. package/src/storage/{address_data_provider/address_data_provider.ts → address_store/address_store.ts} +16 -16
  266. package/src/storage/address_store/index.ts +1 -0
  267. package/src/storage/{anchor_block_data_provider/anchor_block_data_provider.ts → anchor_block_store/anchor_block_store.ts} +9 -1
  268. package/src/storage/anchor_block_store/index.ts +1 -0
  269. package/src/storage/capsule_store/capsule_store.ts +315 -0
  270. package/src/storage/capsule_store/index.ts +1 -0
  271. package/src/storage/contract_store/contract_store.ts +429 -0
  272. package/src/storage/contract_store/index.ts +1 -0
  273. package/src/storage/index.ts +7 -7
  274. package/src/storage/metadata.ts +1 -1
  275. package/src/storage/note_store/index.ts +2 -0
  276. package/src/storage/note_store/note_store.ts +418 -0
  277. package/src/storage/note_store/stored_note.ts +48 -0
  278. package/src/storage/private_event_store/private_event_store.ts +384 -0
  279. package/src/storage/private_event_store/stored_private_event.ts +73 -0
  280. package/src/storage/tagging_store/index.ts +3 -0
  281. package/src/storage/tagging_store/recipient_tagging_store.ts +143 -0
  282. package/src/storage/tagging_store/sender_address_book_store.ts +48 -0
  283. package/src/storage/tagging_store/sender_tagging_store.ts +429 -0
  284. package/src/tagging/constants.ts +10 -3
  285. package/src/tagging/get_all_logs_by_tags.ts +92 -0
  286. package/src/tagging/index.ts +18 -3
  287. package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +29 -18
  288. package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +2 -2
  289. package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +17 -16
  290. package/src/tagging/{sync → sender_sync}/sync_sender_tagging_indexes.ts +15 -33
  291. package/src/tagging/{sync → sender_sync}/utils/get_status_change_of_pending.ts +5 -13
  292. package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +75 -0
  293. package/dest/contract_function_simulator/proxied_node.d.ts +0 -9
  294. package/dest/contract_function_simulator/proxied_node.d.ts.map +0 -1
  295. package/dest/contract_function_simulator/proxied_node.js +0 -27
  296. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +0 -28
  297. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +0 -1
  298. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +0 -4
  299. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts.map +0 -1
  300. package/dest/private_kernel/private_kernel_oracle_impl.d.ts +0 -46
  301. package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +0 -1
  302. package/dest/private_kernel/private_kernel_oracle_impl.js +0 -86
  303. package/dest/public_storage/public_storage_service.d.ts +0 -24
  304. package/dest/public_storage/public_storage_service.d.ts.map +0 -1
  305. package/dest/public_storage/public_storage_service.js +0 -26
  306. package/dest/storage/address_data_provider/address_data_provider.d.ts +0 -11
  307. package/dest/storage/address_data_provider/address_data_provider.d.ts.map +0 -1
  308. package/dest/storage/address_data_provider/index.d.ts +0 -2
  309. package/dest/storage/address_data_provider/index.d.ts.map +0 -1
  310. package/dest/storage/address_data_provider/index.js +0 -1
  311. package/dest/storage/anchor_block_data_provider/anchor_block_data_provider.d.ts +0 -9
  312. package/dest/storage/anchor_block_data_provider/anchor_block_data_provider.d.ts.map +0 -1
  313. package/dest/storage/anchor_block_data_provider/index.d.ts +0 -2
  314. package/dest/storage/anchor_block_data_provider/index.d.ts.map +0 -1
  315. package/dest/storage/anchor_block_data_provider/index.js +0 -1
  316. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts +0 -57
  317. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +0 -1
  318. package/dest/storage/capsule_data_provider/capsule_data_provider.js +0 -146
  319. package/dest/storage/capsule_data_provider/index.d.ts +0 -2
  320. package/dest/storage/capsule_data_provider/index.d.ts.map +0 -1
  321. package/dest/storage/capsule_data_provider/index.js +0 -1
  322. package/dest/storage/contract_data_provider/contract_data_provider.d.ts +0 -66
  323. package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +0 -1
  324. package/dest/storage/contract_data_provider/contract_data_provider.js +0 -224
  325. package/dest/storage/contract_data_provider/index.d.ts +0 -2
  326. package/dest/storage/contract_data_provider/index.d.ts.map +0 -1
  327. package/dest/storage/contract_data_provider/index.js +0 -1
  328. package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +0 -1
  329. package/dest/storage/note_data_provider/index.d.ts +0 -3
  330. package/dest/storage/note_data_provider/index.d.ts.map +0 -1
  331. package/dest/storage/note_data_provider/index.js +0 -2
  332. package/dest/storage/note_data_provider/note_data_provider.d.ts +0 -84
  333. package/dest/storage/note_data_provider/note_data_provider.d.ts.map +0 -1
  334. package/dest/storage/note_data_provider/note_data_provider.js +0 -322
  335. package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +0 -51
  336. package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts.map +0 -1
  337. package/dest/storage/private_event_data_provider/private_event_data_provider.js +0 -115
  338. package/dest/storage/tagging_data_provider/index.d.ts +0 -3
  339. package/dest/storage/tagging_data_provider/index.d.ts.map +0 -1
  340. package/dest/storage/tagging_data_provider/index.js +0 -2
  341. package/dest/storage/tagging_data_provider/recipient_tagging_data_provider.d.ts +0 -31
  342. package/dest/storage/tagging_data_provider/recipient_tagging_data_provider.d.ts.map +0 -1
  343. package/dest/storage/tagging_data_provider/recipient_tagging_data_provider.js +0 -65
  344. package/dest/storage/tagging_data_provider/sender_tagging_data_provider.d.ts.map +0 -1
  345. package/dest/storage/tagging_data_provider/sender_tagging_data_provider.js +0 -196
  346. package/dest/tagging/recipient_sync/new_recipient_tagging_data_provider.d.ts +0 -21
  347. package/dest/tagging/recipient_sync/new_recipient_tagging_data_provider.d.ts.map +0 -1
  348. package/dest/tagging/recipient_sync/new_recipient_tagging_data_provider.js +0 -42
  349. package/dest/tagging/sync/sync_sender_tagging_indexes.d.ts +0 -21
  350. package/dest/tagging/sync/sync_sender_tagging_indexes.d.ts.map +0 -1
  351. package/dest/tagging/sync/utils/get_status_change_of_pending.d.ts.map +0 -1
  352. package/dest/tagging/sync/utils/load_and_store_new_tagging_indexes.d.ts +0 -18
  353. package/dest/tagging/sync/utils/load_and_store_new_tagging_indexes.d.ts.map +0 -1
  354. package/dest/tagging/utils.d.ts +0 -18
  355. package/dest/tagging/utils.d.ts.map +0 -1
  356. package/dest/tagging/utils.js +0 -25
  357. package/dest/tree_membership/tree_membership_service.d.ts +0 -52
  358. package/dest/tree_membership/tree_membership_service.d.ts.map +0 -1
  359. package/dest/tree_membership/tree_membership_service.js +0 -84
  360. package/src/contract_function_simulator/proxied_node.ts +0 -33
  361. package/src/private_kernel/private_kernel_oracle_impl.ts +0 -133
  362. package/src/public_storage/public_storage_service.ts +0 -33
  363. package/src/storage/address_data_provider/index.ts +0 -1
  364. package/src/storage/anchor_block_data_provider/index.ts +0 -1
  365. package/src/storage/capsule_data_provider/capsule_data_provider.ts +0 -179
  366. package/src/storage/capsule_data_provider/index.ts +0 -1
  367. package/src/storage/contract_data_provider/contract_data_provider.ts +0 -319
  368. package/src/storage/contract_data_provider/index.ts +0 -1
  369. package/src/storage/note_data_provider/index.ts +0 -2
  370. package/src/storage/note_data_provider/note_data_provider.ts +0 -412
  371. package/src/storage/private_event_data_provider/private_event_data_provider.ts +0 -162
  372. package/src/storage/tagging_data_provider/index.ts +0 -2
  373. package/src/storage/tagging_data_provider/recipient_tagging_data_provider.ts +0 -86
  374. package/src/storage/tagging_data_provider/sender_tagging_data_provider.ts +0 -244
  375. package/src/tagging/recipient_sync/new_recipient_tagging_data_provider.ts +0 -53
  376. package/src/tagging/sync/utils/load_and_store_new_tagging_indexes.ts +0 -72
  377. package/src/tagging/utils.ts +0 -32
  378. package/src/tree_membership/tree_membership_service.ts +0 -112
  379. /package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.js +0 -0
  380. /package/src/storage/{contract_data_provider → contract_store}/private_functions_tree.ts +0 -0
@@ -1,33 +1,34 @@
1
1
  import type { BlockNumber } from '@aztec/foundation/branded-types';
2
- import type { AztecAddress } from '@aztec/stdlib/aztec-address';
2
+ import type { BlockHash } from '@aztec/stdlib/block';
3
3
  import type { AztecNode } from '@aztec/stdlib/interfaces/client';
4
- import type { DirectionalAppTaggingSecret, TxScopedL2Log } from '@aztec/stdlib/logs';
4
+ import type { ExtendedDirectionalAppTaggingSecret, TxScopedL2Log } from '@aztec/stdlib/logs';
5
5
 
6
- import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../sync/sync_sender_tagging_indexes.js';
7
- import type { NewRecipientTaggingDataProvider } from './new_recipient_tagging_data_provider.js';
6
+ import type { RecipientTaggingStore } from '../../storage/tagging_store/recipient_tagging_store.js';
7
+ import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../constants.js';
8
8
  import { findHighestIndexes } from './utils/find_highest_indexes.js';
9
9
  import { loadLogsForRange } from './utils/load_logs_for_range.js';
10
10
 
11
11
  /**
12
- * Loads private logs for `app` and sender-recipient pair defined by `secret` and updates the highest aged and
12
+ * Loads private logs for the app-sender-recipient triplet defined by `secret` and updates the highest aged and
13
13
  * finalized indexes in the db. At most load logs from blocks up to and including `anchorBlockNumber`.
14
14
  *
15
15
  * @dev This function can be safely executed "in parallel" for other sender-recipient pairs because the data in
16
16
  * in the tagging data provider is indexed by the secret and hence completely disjoint.
17
17
  */
18
18
  export async function loadPrivateLogsForSenderRecipientPair(
19
- secret: DirectionalAppTaggingSecret,
20
- app: AztecAddress,
19
+ secret: ExtendedDirectionalAppTaggingSecret,
21
20
  aztecNode: AztecNode,
22
- taggingDataProvider: NewRecipientTaggingDataProvider,
21
+ taggingStore: RecipientTaggingStore,
23
22
  anchorBlockNumber: BlockNumber,
23
+ anchorBlockHash: BlockHash,
24
+ jobId: string,
24
25
  ): Promise<TxScopedL2Log[]> {
25
26
  // # Explanation of how the algorithm works
26
27
  // When we perform the sync we will look at logs that correspond to the tagging index range
27
28
  // (highestAgedIndex, highestFinalizedIndex + WINDOW_LEN]
28
29
  //
29
30
  // highestAgedIndex is the highest index that was used in a tx that is included in a block at least
30
- // `MAX_INCLUDE_BY_TIMESTAMP_DURATION` seconds ago.
31
+ // `MAX_TX_LIFETIME` seconds ago.
31
32
  // highestFinalizedIndex is the highest index that was used in a tx that is included in a finalized block.
32
33
  //
33
34
  // "(" denotes an open end of the range - the index is not included in the range.
@@ -39,19 +40,19 @@ export async function loadPrivateLogsForSenderRecipientPair(
39
40
  // ever appear.
40
41
  //
41
42
  // This relies on the "maximum inclusion timestamp" rule enforced by the kernel and rollup circuits:
42
- // - a transaction's maximum inclusion timestamp is at most `MAX_INCLUDE_BY_TIMESTAMP_DURATION` seconds after
43
+ // - a transaction's maximum inclusion timestamp is at most `MAX_TX_LIFETIME` seconds after
43
44
  // the timestamp of its anchor block; and
44
45
  // - a rollup only includes transactions whose inclusion timestamp is >= the L2 block's timestamp.
45
46
  //
46
47
  // Suppose some device used index `I` in a transaction anchored to block `B_N` at time `N`, and that block is now at
47
- // least `MAX_INCLUDE_BY_TIMESTAMP_DURATION` seconds in the past. Then there is no possibility of any *other* device
48
+ // least `MAX_TX_LIFETIME` seconds in the past. Then there is no possibility of any *other* device
48
49
  // trying to use an index <= `I` while anchoring to a *newer* block than `B_N` because if we were anchoring to
49
50
  // a newer block than `B_N` then we would already have seen the log with index `I` and hence the device would have
50
51
  // chosen a larger index.
51
52
  // If that *other* device would anchor to a block older than `B_N` then that tx could never be included in a block
52
53
  // because it would already have been expired.
53
54
  //
54
- // Therefore, once we see that index `I` has been used in a block that is at least `MAX_INCLUDE_BY_TIMESTAMP_DURATION`
55
+ // Therefore, once we see that index `I` has been used in a block that is at least `MAX_TX_LIFETIME`
55
56
  // seconds old, we can safely stop syncing logs for all indexes <= `I` and set highestAgedIndex = `I`.
56
57
  //
57
58
  // ## Explanation of the upper bound `highestFinalizedIndex + WINDOW_LEN`
@@ -68,13 +69,16 @@ export async function loadPrivateLogsForSenderRecipientPair(
68
69
  throw new Error('Node failed to return latest block header when syncing logs');
69
70
  }
70
71
 
71
- [finalizedBlockNumber, currentTimestamp] = [l2Tips.finalized.number, latestBlockHeader.globalVariables.timestamp];
72
+ [finalizedBlockNumber, currentTimestamp] = [
73
+ l2Tips.finalized.block.number,
74
+ latestBlockHeader.globalVariables.timestamp,
75
+ ];
72
76
  }
73
77
 
74
78
  let start: number, end: number;
75
79
  {
76
- const currentHighestAgedIndex = await taggingDataProvider.getHighestAgedIndex(secret);
77
- const currentHighestFinalizedIndex = await taggingDataProvider.getHighestFinalizedIndex(secret);
80
+ const currentHighestAgedIndex = await taggingStore.getHighestAgedIndex(secret, jobId);
81
+ const currentHighestFinalizedIndex = await taggingStore.getHighestFinalizedIndex(secret, jobId);
78
82
 
79
83
  // We don't want to include the highest aged index so we start from `currentHighestAgedIndex + 1` (or 0 if not set)
80
84
  start = currentHighestAgedIndex === undefined ? 0 : currentHighestAgedIndex + 1;
@@ -88,7 +92,14 @@ export async function loadPrivateLogsForSenderRecipientPair(
88
92
 
89
93
  while (true) {
90
94
  // Get private logs with their block timestamps and corresponding tagging indexes
91
- const privateLogsWithIndexes = await loadLogsForRange(secret, app, aztecNode, start, end, anchorBlockNumber);
95
+ const privateLogsWithIndexes = await loadLogsForRange(
96
+ secret,
97
+ aztecNode,
98
+ start,
99
+ end,
100
+ anchorBlockNumber,
101
+ anchorBlockHash,
102
+ );
92
103
 
93
104
  if (privateLogsWithIndexes.length === 0) {
94
105
  break;
@@ -104,7 +115,7 @@ export async function loadPrivateLogsForSenderRecipientPair(
104
115
 
105
116
  // Store updates in data provider and update local variables
106
117
  if (highestAgedIndex !== undefined) {
107
- await taggingDataProvider.updateHighestAgedIndex(secret, highestAgedIndex);
118
+ await taggingStore.updateHighestAgedIndex(secret, highestAgedIndex, jobId);
108
119
  }
109
120
 
110
121
  if (highestFinalizedIndex === undefined) {
@@ -117,7 +128,7 @@ export async function loadPrivateLogsForSenderRecipientPair(
117
128
  throw new Error('Highest aged index lower than highest finalized index invariant violated');
118
129
  }
119
130
 
120
- await taggingDataProvider.updateHighestFinalizedIndex(secret, highestFinalizedIndex);
131
+ await taggingStore.updateHighestFinalizedIndex(secret, highestFinalizedIndex, jobId);
121
132
 
122
133
  // For the next iteration we want to look only at indexes for which we have not attempted to load logs yet while
123
134
  // ensuring that we do not look further than WINDOW_LEN ahead of the highest finalized index.
@@ -1,4 +1,4 @@
1
- import { MAX_INCLUDE_BY_TIMESTAMP_DURATION } from '@aztec/constants';
1
+ import { MAX_TX_LIFETIME } from '@aztec/constants';
2
2
  import type { TxScopedL2Log } from '@aztec/stdlib/logs';
3
3
 
4
4
  /**
@@ -16,7 +16,7 @@ export function findHighestIndexes(
16
16
  const ageInSeconds = currentTimestamp - log.blockTimestamp;
17
17
 
18
18
  if (
19
- ageInSeconds >= BigInt(MAX_INCLUDE_BY_TIMESTAMP_DURATION) &&
19
+ ageInSeconds >= BigInt(MAX_TX_LIFETIME) &&
20
20
  (highestAgedIndex === undefined || taggingIndex > highestAgedIndex)
21
21
  ) {
22
22
  highestAgedIndex = taggingIndex;
@@ -1,37 +1,38 @@
1
1
  import type { BlockNumber } from '@aztec/foundation/branded-types';
2
- import type { AztecAddress } from '@aztec/stdlib/aztec-address';
2
+ import type { BlockHash } from '@aztec/stdlib/block';
3
3
  import type { AztecNode } from '@aztec/stdlib/interfaces/client';
4
- import type { DirectionalAppTaggingSecret, PreTag, TxScopedL2Log } from '@aztec/stdlib/logs';
5
- import { SiloedTag, Tag } from '@aztec/stdlib/logs';
4
+ import type { ExtendedDirectionalAppTaggingSecret, TxScopedL2Log } from '@aztec/stdlib/logs';
5
+ import { SiloedTag } from '@aztec/stdlib/logs';
6
+
7
+ import { getAllPrivateLogsByTags } from '../../get_all_logs_by_tags.js';
6
8
 
7
9
  /**
8
- * Gets private logs with their corresponding block timestamps and tagging indexes for the given index range, `app` and
9
- * `secret`. At most load logs from blocks up to and including `anchorBlockNumber`. `start` is inclusive and `end` is
10
- * exclusive.
10
+ * Gets private logs with their corresponding block timestamps and tagging indexes for the given index range and
11
+ * `extendedSecret`. At most load logs from blocks up to and including `anchorBlockNumber`. `start` is inclusive and
12
+ * `end` is exclusive.
11
13
  */
12
14
  export async function loadLogsForRange(
13
- secret: DirectionalAppTaggingSecret,
14
- app: AztecAddress,
15
+ extendedSecret: ExtendedDirectionalAppTaggingSecret,
15
16
  aztecNode: AztecNode,
16
17
  start: number,
17
18
  end: number,
18
19
  anchorBlockNumber: BlockNumber,
20
+ anchorBlockHash: BlockHash,
19
21
  ): Promise<Array<{ log: TxScopedL2Log; taggingIndex: number }>> {
20
- // Derive tags for the window
21
- const preTags: PreTag[] = Array(end - start)
22
- .fill(0)
23
- .map((_, i) => ({ secret, index: start + i }));
24
- const siloedTags = await Promise.all(preTags.map(preTag => Tag.compute(preTag))).then(tags =>
25
- Promise.all(tags.map(tag => SiloedTag.compute(tag, app))),
22
+ // Derive siloed tags for the window
23
+ const siloedTags = await Promise.all(
24
+ Array.from({ length: end - start }, (_, i) => SiloedTag.compute({ extendedSecret, index: start + i })),
26
25
  );
27
26
 
28
- const logs = await aztecNode.getPrivateLogsByTags(siloedTags);
27
+ // We use the utility function below to retrieve all logs for the tags across all pages, so we don't need to handle
28
+ // pagination here.
29
+ const logs = await getAllPrivateLogsByTags(aztecNode, siloedTags, anchorBlockHash);
29
30
 
30
31
  // Pair logs with their corresponding tagging indexes
31
32
  const logsWithIndexes: Array<{ log: TxScopedL2Log; taggingIndex: number }> = [];
32
33
  for (let i = 0; i < logs.length; i++) {
33
34
  const logsForTag = logs[i];
34
- const taggingIndex = preTags[i].index;
35
+ const taggingIndex = start + i;
35
36
  for (const log of logsForTag) {
36
37
  if (log.blockNumber <= anchorBlockNumber) {
37
38
  logsWithIndexes.push({ log, taggingIndex });
@@ -1,36 +1,17 @@
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 { ExtendedDirectionalAppTaggingSecret } from '@aztec/stdlib/logs';
4
4
 
5
- import type { SenderTaggingDataProvider } from '../../storage/tagging_data_provider/sender_tagging_data_provider.js';
5
+ import type { SenderTaggingStore } from '../../storage/tagging_store/sender_tagging_store.js';
6
+ import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../constants.js';
6
7
  import { getStatusChangeOfPending } from './utils/get_status_change_of_pending.js';
7
8
  import { loadAndStoreNewTaggingIndexes } from './utils/load_and_store_new_tagging_indexes.js';
8
9
 
9
- // This window has to be as large as the largest expected number of logs emitted in a tx for a given directional app
10
- // tagging secret. If we get more tag indexes consumed than this window, an error is thrown in `PXE::proveTx` function.
11
- // This is set to a larger value than MAX_PRIVATE_LOGS_PER_TX (currently 64) because there could be more than
12
- // MAX_PRIVATE_LOGS_PER_TX indexes consumed in case the logs are squashed. This happens when the log contains a note
13
- // and the note is nullified in the same tx.
14
- //
15
- // Rationale for value 95:
16
- // - The `e2e_pending_note_hashes_contract` test's "Should handle overflowing the kernel data structures in nested
17
- // calls" test case hits 95 tagging indexes emitted in a single transaction. This test creates and nullifies many
18
- // notes recursively to test kernel reset circuit behavior, which causes logs to be squashed but still consume
19
- // tagging indexes during the sync process. Since this is testing MAX_PRIVATE_LOGS_PER_TX overflow we can be
20
- // reasonably certain that this value is large enough for standard use cases.
21
- // - This value is below MAX_RPC_LEN (100) which is the limit for array parameters in the JSON RPC schema for
22
- // `getLogsByTags`. Any test that would perform sync over JSON RPC (not by having access to the Aztec node instance
23
- // directly) would error out if that maximum was hit (docs_examples.test.ts is an example of this).
24
- export const UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN = 95;
25
-
26
10
  /**
27
11
  * Syncs tagging indexes. This function needs to be called whenever a private log is being sent.
28
12
  *
29
- * @param secret - The secret that's unique for (sender, recipient, contract) tuple while the direction of
13
+ * @param secret - The secret that's unique for (sender, recipient, app) tuple while the direction of
30
14
  * sender -> recipient matters.
31
- * @param app - The address of the contract that the logs are tagged for. Needs to be provided because we perform
32
- * second round of siloing in this function which is necessary because kernels do it as well (they silo first field
33
- * of the private log which corresponds to the tag).
34
15
  * @remarks When syncing the indexes as sender we don't care about the log contents - we only care about the highest
35
16
  * pending and highest finalized indexes as that guides the next index choice when sending a log. The next index choice
36
17
  * is simply the highest pending index plus one (or finalized if pending is undefined).
@@ -38,10 +19,11 @@ export const UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN = 95;
38
19
  * updates its status accordingly.
39
20
  */
40
21
  export async function syncSenderTaggingIndexes(
41
- secret: DirectionalAppTaggingSecret,
42
- app: AztecAddress,
22
+ secret: ExtendedDirectionalAppTaggingSecret,
43
23
  aztecNode: AztecNode,
44
- taggingDataProvider: SenderTaggingDataProvider,
24
+ taggingStore: SenderTaggingStore,
25
+ anchorBlockHash: BlockHash,
26
+ jobId: string,
45
27
  ): Promise<void> {
46
28
  // # Explanation of how syncing works
47
29
  //
@@ -61,7 +43,7 @@ export async function syncSenderTaggingIndexes(
61
43
  // Each window advance requires two queries (logs + tx status). For example, syncing indexes 0–500 with a window of
62
44
  // 100 takes at least 10 round trips (5 windows × 2 queries).
63
45
 
64
- const finalizedIndex = await taggingDataProvider.getLastFinalizedIndex(secret);
46
+ const finalizedIndex = await taggingStore.getLastFinalizedIndex(secret, jobId);
65
47
 
66
48
  let start = finalizedIndex === undefined ? 0 : finalizedIndex + 1;
67
49
  let end = start + UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN;
@@ -72,21 +54,21 @@ export async function syncSenderTaggingIndexes(
72
54
  while (true) {
73
55
  // Load and store indexes for the current window. These indexes may already exist in the database if txs using
74
56
  // them were previously sent from this PXE. Any duplicates are handled by the tagging data provider.
75
- await loadAndStoreNewTaggingIndexes(secret, app, start, end, aztecNode, taggingDataProvider);
57
+ await loadAndStoreNewTaggingIndexes(secret, start, end, aztecNode, taggingStore, anchorBlockHash, jobId);
76
58
 
77
59
  // Retrieve all indexes within the current window from storage and update their status accordingly.
78
- const pendingTxHashes = await taggingDataProvider.getTxHashesOfPendingIndexes(secret, start, end);
60
+ const pendingTxHashes = await taggingStore.getTxHashesOfPendingIndexes(secret, start, end, jobId);
79
61
  if (pendingTxHashes.length === 0) {
80
62
  break;
81
63
  }
82
64
 
83
65
  const { txHashesToFinalize, txHashesToDrop } = await getStatusChangeOfPending(pendingTxHashes, aztecNode);
84
66
 
85
- await taggingDataProvider.dropPendingIndexes(txHashesToDrop);
86
- await taggingDataProvider.finalizePendingIndexes(txHashesToFinalize);
67
+ await taggingStore.dropPendingIndexes(txHashesToDrop, jobId);
68
+ await taggingStore.finalizePendingIndexes(txHashesToFinalize, jobId);
87
69
 
88
70
  // We check if the finalized index has been updated.
89
- newFinalizedIndex = await taggingDataProvider.getLastFinalizedIndex(secret);
71
+ newFinalizedIndex = await taggingStore.getLastFinalizedIndex(secret, jobId);
90
72
  if (previousFinalizedIndex !== newFinalizedIndex) {
91
73
  // A new finalized index was found, so we'll run the loop again. For example:
92
74
  // - Previous finalized index: 10
@@ -9,11 +9,8 @@ export async function getStatusChangeOfPending(
9
9
  pending: TxHash[],
10
10
  aztecNode: AztecNode,
11
11
  ): Promise<{ txHashesToFinalize: TxHash[]; txHashesToDrop: TxHash[] }> {
12
- // Get receipts for all pending tx hashes and the finalized block number.
13
- const [receipts, { finalized }] = await Promise.all([
14
- Promise.all(pending.map(pendingTxHash => aztecNode.getTxReceipt(pendingTxHash))),
15
- aztecNode.getL2Tips(),
16
- ]);
12
+ // Get receipts for all pending tx hashes.
13
+ const receipts = await Promise.all(pending.map(pendingTxHash => aztecNode.getTxReceipt(pendingTxHash)));
17
14
 
18
15
  const txHashesToFinalize: TxHash[] = [];
19
16
  const txHashesToDrop: TxHash[] = [];
@@ -22,21 +19,16 @@ export async function getStatusChangeOfPending(
22
19
  const receipt = receipts[i];
23
20
  const txHash = pending[i];
24
21
 
25
- if (receipt.status === TxStatus.SUCCESS && receipt.blockNumber && receipt.blockNumber <= finalized.number) {
22
+ if (receipt.status === TxStatus.FINALIZED && receipt.hasExecutionSucceeded()) {
26
23
  // Tx has been included in a block and the corresponding block is finalized --> we mark the indexes as
27
24
  // finalized.
28
25
  txHashesToFinalize.push(txHash);
29
- } else if (
30
- receipt.status === TxStatus.DROPPED ||
31
- receipt.status === TxStatus.APP_LOGIC_REVERTED ||
32
- receipt.status === TxStatus.TEARDOWN_REVERTED ||
33
- receipt.status === TxStatus.BOTH_REVERTED
34
- ) {
26
+ } else if (receipt.isDropped() || receipt.hasExecutionReverted()) {
35
27
  // Tx was dropped or reverted --> we drop the corresponding pending indexes.
36
28
  // TODO(#17615): Don't drop pending indexes corresponding to non-revertible phases.
37
29
  txHashesToDrop.push(txHash);
38
30
  } else {
39
- // Tx is still pending or the corresponding block is not yet finalized --> we don't do anything.
31
+ // Tx is still pending, not yet finalized, or was mined successfully but not yet finalized --> we don't do anything.
40
32
  }
41
33
  }
42
34
 
@@ -0,0 +1,75 @@
1
+ import type { BlockHash } from '@aztec/stdlib/block';
2
+ import type { AztecNode } from '@aztec/stdlib/interfaces/server';
3
+ import type { ExtendedDirectionalAppTaggingSecret } from '@aztec/stdlib/logs';
4
+ import { SiloedTag } from '@aztec/stdlib/logs';
5
+ import { TxHash } from '@aztec/stdlib/tx';
6
+
7
+ import type { SenderTaggingStore } from '../../../storage/tagging_store/sender_tagging_store.js';
8
+ import { getAllPrivateLogsByTags } from '../../get_all_logs_by_tags.js';
9
+
10
+ /**
11
+ * Loads tagging indexes from the Aztec node and stores them in the tagging data provider.
12
+ * @remarks This function is one of two places by which a pending index can get to the tagging data provider. The other
13
+ * place is when a tx is being sent from this PXE.
14
+ * @param extendedSecret - The extended directional app tagging secret that's unique for (sender, recipient, app) tuple.
15
+ * @param start - The starting index (inclusive) of the window to process.
16
+ * @param end - The ending index (exclusive) of the window to process.
17
+ * @param aztecNode - The Aztec node instance to query for logs.
18
+ * @param taggingStore - The data provider to store pending indexes.
19
+ * @param jobId - Job identifier, used to keep writes in-memory until they can be persisted in a data integrity
20
+ * preserving way.
21
+ */
22
+ export async function loadAndStoreNewTaggingIndexes(
23
+ extendedSecret: ExtendedDirectionalAppTaggingSecret,
24
+ start: number,
25
+ end: number,
26
+ aztecNode: AztecNode,
27
+ taggingStore: SenderTaggingStore,
28
+ anchorBlockHash: BlockHash,
29
+ jobId: string,
30
+ ) {
31
+ // We compute the tags for the current window of indexes
32
+ const siloedTagsForWindow = await Promise.all(
33
+ Array.from({ length: end - start }, (_, i) => SiloedTag.compute({ extendedSecret, index: start + i })),
34
+ );
35
+
36
+ const txsForTags = await getTxsContainingTags(siloedTagsForWindow, aztecNode, anchorBlockHash);
37
+ const highestIndexMap = getTxHighestIndexMap(txsForTags, start, siloedTagsForWindow.length);
38
+
39
+ // Now we iterate over the map, reconstruct the preTags and tx hash and store them in the db.
40
+ for (const [txHashStr, highestIndex] of highestIndexMap.entries()) {
41
+ const txHash = TxHash.fromString(txHashStr);
42
+ await taggingStore.storePendingIndexes([{ extendedSecret, index: highestIndex }], txHash, jobId);
43
+ }
44
+ }
45
+
46
+ // Returns txs that used the given tags. A tag might have been used in multiple txs and for this reason we return
47
+ // an array for each tag.
48
+ async function getTxsContainingTags(
49
+ tags: SiloedTag[],
50
+ aztecNode: AztecNode,
51
+ anchorBlockHash: BlockHash,
52
+ ): Promise<TxHash[][]> {
53
+ // We use the utility function below to retrieve all logs for the tags across all pages, so we don't need to handle
54
+ // pagination here.
55
+ const allLogs = await getAllPrivateLogsByTags(aztecNode, tags, anchorBlockHash);
56
+ return allLogs.map(logs => logs.map(log => log.txHash));
57
+ }
58
+
59
+ // Returns a map of txHash to the highest index for that txHash.
60
+ function getTxHighestIndexMap(txHashesForTags: TxHash[][], start: number, count: number): Map<string, number> {
61
+ if (txHashesForTags.length !== count) {
62
+ throw new Error(`Number of tx hashes arrays does not match number of tags. ${txHashesForTags.length} !== ${count}`);
63
+ }
64
+
65
+ const highestIndexMap = new Map<string, number>();
66
+ for (let i = 0; i < txHashesForTags.length; i++) {
67
+ const taggingIndex = start + i;
68
+ const txHashesForTag = txHashesForTags[i];
69
+ for (const txHash of txHashesForTag) {
70
+ const key = txHash.toString();
71
+ highestIndexMap.set(key, Math.max(highestIndexMap.get(key) ?? 0, taggingIndex));
72
+ }
73
+ }
74
+ return highestIndexMap;
75
+ }
@@ -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, noteHashLeafIndexMap: Map<bigint, bigint>): 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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVpbGRfcHJpdmF0ZV9rZXJuZWxfcmVzZXRfcHJpdmF0ZV9pbnB1dHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9wcml2YXRlX2tlcm5lbC9oaW50cy9idWlsZF9wcml2YXRlX2tlcm5lbF9yZXNldF9wcml2YXRlX2lucHV0cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFlQSxPQUFPLEVBS0wsS0FBSyxnQ0FBZ0MsRUFFckMsc0NBQXNDLEVBR3RDLEtBQUssMkJBQTJCLEVBZWpDLE1BQU0sc0JBQXNCLENBQUM7QUFDOUIsT0FBTyxFQUFFLEtBQUssMEJBQTBCLEVBQWlCLE1BQU0sa0JBQWtCLENBQUM7QUFHbEYsT0FBTyxLQUFLLEVBQUUsbUJBQW1CLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQTRDdkUscUJBQWEsc0NBQXND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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,EAAE,oBAAoB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,mDAoEjF;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 { ContractDataProvider } from '../storage/contract_data_provider/contract_data_provider.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 contractDataProvider;
20
- private keyStore;
21
- private node;
22
- private blockNumber;
23
- private log;
24
- constructor(contractDataProvider: ContractDataProvider, 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(leafIndex: bigint): Promise<MembershipWitness<typeof NOTE_HASH_TREE_HEIGHT>>;
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJpdmF0ZV9rZXJuZWxfb3JhY2xlX2ltcGwuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wcml2YXRlX2tlcm5lbC9wcml2YXRlX2tlcm5lbF9vcmFjbGVfaW1wbC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUscUJBQXFCLEVBQTJDLE1BQU0sa0JBQWtCLENBQUM7QUFDbEcsT0FBTyxLQUFLLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDekQsT0FBTyxLQUFLLEVBQUUsY0FBYyxFQUFFLEtBQUssRUFBRSxNQUFNLG1DQUFtQyxDQUFDO0FBRy9FLE9BQU8sRUFBRSxpQkFBaUIsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBQzVELE9BQU8sS0FBSyxFQUFFLFFBQVEsRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBR2pELE9BQU8sS0FBSyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFDMUQsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFDaEUsT0FBTyxLQUFLLEVBQUUsY0FBYyxFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFJMUQsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFDakUsT0FBTyxFQUFFLG1CQUFtQixFQUFFLE1BQU0sc0JBQXNCLENBQUM7QUFD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
- 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
- contractDataProvider;
16
- keyStore;
17
- node;
18
- blockNumber;
19
- log;
20
- constructor(contractDataProvider, keyStore, node, blockNumber = 'latest', log = createLogger('pxe:kernel_oracle')){
21
- this.contractDataProvider = contractDataProvider;
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.contractDataProvider.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.contractDataProvider.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.contractDataProvider.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
- async getNoteHashMembershipWitness(leafIndex) {
56
- const path = await this.node.getNoteHashSiblingPath(this.blockNumber, leafIndex);
57
- return new MembershipWitness(path.pathSize, leafIndex, path.toFields());
58
- }
59
- getNullifierMembershipWitness(nullifier) {
60
- return this.node.getNullifierMembershipWitness(this.blockNumber, nullifier);
61
- }
62
- async getNoteHashTreeRoot() {
63
- const header = await this.node.getBlockHeader(this.blockNumber);
64
- if (!header) {
65
- throw new Error(`No block header found for block number ${this.blockNumber}`);
66
- }
67
- return header.state.partial.noteHashTree.root;
68
- }
69
- getMasterSecretKey(masterPublicKey) {
70
- return this.keyStore.getMasterSecretKey(masterPublicKey);
71
- }
72
- getDebugFunctionName(contractAddress, selector) {
73
- return this.contractDataProvider.getDebugFunctionName(contractAddress, selector);
74
- }
75
- async getUpdatedClassIdHints(contractAddress) {
76
- const { delayedPublicMutableSlot, delayedPublicMutableHashSlot } = await DelayedPublicMutableValuesWithHash.getContractUpdateSlots(contractAddress);
77
- const hashLeafSlot = await computePublicDataTreeLeafSlot(ProtocolContractAddress.ContractInstanceRegistry, delayedPublicMutableHashSlot);
78
- const updatedClassIdWitness = await this.node.getPublicDataWitness(this.blockNumber, hashLeafSlot);
79
- if (!updatedClassIdWitness) {
80
- throw new Error(`No public data tree witness found for ${hashLeafSlot}`);
81
- }
82
- const readStorage = (storageSlot)=>this.node.getPublicStorageAt(this.blockNumber, ProtocolContractAddress.ContractInstanceRegistry, storageSlot);
83
- const delayedPublicMutableValues = await DelayedPublicMutableValues.readFromTree(delayedPublicMutableSlot, readStorage);
84
- return new UpdatedClassIdHints(new MembershipWitness(PUBLIC_DATA_TREE_HEIGHT, updatedClassIdWitness.index, updatedClassIdWitness.siblingPath.toTuple()), updatedClassIdWitness.leafPreimage, delayedPublicMutableValues);
85
- }
86
- }