@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,196 +0,0 @@
1
- import { toArray } from '@aztec/foundation/iterable';
2
- import { TxHash } from '@aztec/stdlib/tx';
3
- import { UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN } from '../../tagging/sync/sync_sender_tagging_indexes.js';
4
- /**
5
- * Data provider of tagging data used when syncing the sender tagging indexes. The recipient counterpart of this class
6
- * is called RecipientTaggingDataProvider. We have the providers separate for the sender and recipient because
7
- * the algorithms are completely disjoint and there is not data reuse between the two.
8
- */ export class SenderTaggingDataProvider {
9
- #store;
10
- // Stores the pending indexes for each directional app tagging secret. Pending here means that the tx that contained
11
- // the private logs with tags corresponding to these indexes has not been finalized yet.
12
- //
13
- // We don't store just the highest index because if their transaction is dropped we'd then need the information about
14
- // the lower pending indexes. For each secret-tx pair however we only store the largest index used in that tx, since
15
- // the smaller ones are irrelevant due to tx atomicity.
16
- //
17
- // TODO(#17615): This assumes no logs are used in the non-revertible phase.
18
- #pendingIndexes;
19
- // Stores the last (highest) finalized index for each directional app tagging secret. We care only about the last
20
- // index because unlike the pending indexes, it will never happen that a finalized index would be removed and hence
21
- // we don't need to store the history.
22
- #lastFinalizedIndexes;
23
- constructor(store){
24
- this.#store = store;
25
- this.#pendingIndexes = this.#store.openMap('pending_indexes');
26
- this.#lastFinalizedIndexes = this.#store.openMap('last_finalized_indexes');
27
- }
28
- /**
29
- * Stores pending indexes.
30
- * @remarks Ignores the index if the same preTag + txHash combination already exists in the db with the same index.
31
- * This is expected to happen because whenever we start sync we start from the last finalized index and we can have
32
- * pending indexes already stored from previous syncs.
33
- * @param preTags - The pre-tags containing the directional app tagging secrets and the indexes that are to be
34
- * stored in the db.
35
- * @param txHash - The tx in which the pretags were used in private logs.
36
- * @throws If any two pre-tags contain the same directional app tagging secret. This is enforced because we care
37
- * only about the highest index for a given secret that was used in the tx. Hence this check is a good way to catch
38
- * bugs.
39
- * @throws If the newly stored pending index is further than window length from the highest finalized index for the
40
- * same secret. This is enforced in order to give a guarantee to a recipient that he doesn't need to look further than
41
- * window length ahead of the highest finalized index.
42
- * @throws If a secret + txHash pair already exists in the db with a different index value. It should never happen
43
- * that we would attempt to store a different index for a given secret-txHash pair because we always store just the
44
- * highest index for a given secret-txHash pair. Hence this is a good way to catch bugs.
45
- * @throws If the newly stored pending index is lower than or equal to the last finalized index for the same secret.
46
- * This is enforced because this should never happen if the syncing is done correctly as we look for logs from higher
47
- * indexes than finalized ones.
48
- */ async storePendingIndexes(preTags, txHash) {
49
- // The secrets in pre-tags should be unique because we always store just the highest index per given secret-txHash
50
- // pair. Below we check that this is the case.
51
- const secretsSet = new Set(preTags.map((preTag)=>preTag.secret.toString()));
52
- if (secretsSet.size !== preTags.length) {
53
- throw new Error(`Duplicate secrets found when storing pending indexes`);
54
- }
55
- for (const { secret, index } of preTags){
56
- // First we check that for any secret the highest used index in tx is not further than window length from
57
- // the highest finalized index.
58
- const finalizedIndex = await this.getLastFinalizedIndex(secret) ?? 0;
59
- if (index > finalizedIndex + UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN) {
60
- throw new Error(`Highest used index ${index} is further than window length from the highest finalized index ${finalizedIndex}.
61
- Tagging window length ${UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN} is configured too low. Contact the Aztec team
62
- to increase it!`);
63
- }
64
- // Throw if the new pending index is lower than or equal to the last finalized index
65
- const secretStr = secret.toString();
66
- const lastFinalizedIndex = await this.#lastFinalizedIndexes.getAsync(secretStr);
67
- if (lastFinalizedIndex !== undefined && index <= lastFinalizedIndex) {
68
- throw new Error(`Cannot store pending index ${index} for secret ${secretStr}: ` + `it is lower than or equal to the last finalized index ${lastFinalizedIndex}`);
69
- }
70
- // Check if this secret + txHash combination already exists
71
- const txHashStr = txHash.toString();
72
- const existingForSecret = await this.#pendingIndexes.getAsync(secretStr) ?? [];
73
- const existingForSecretAndTx = existingForSecret.find((entry)=>entry.txHash === txHashStr);
74
- if (existingForSecretAndTx) {
75
- // If it exists with a different index, throw an error
76
- if (existingForSecretAndTx.index !== index) {
77
- throw new Error(`Cannot store index ${index} for secret ${secretStr} and txHash ${txHashStr}: ` + `a different index ${existingForSecretAndTx.index} already exists for this secret-txHash pair`);
78
- }
79
- // If it exists with the same index, ignore the update (no-op)
80
- } else {
81
- // If it doesn't exist, add it
82
- await this.#pendingIndexes.set(secretStr, [
83
- ...existingForSecret,
84
- {
85
- index,
86
- txHash: txHashStr
87
- }
88
- ]);
89
- }
90
- }
91
- }
92
- /**
93
- * Returns the transaction hashes of all pending transactions that contain indexes within a specified range
94
- * for a given directional app tagging secret.
95
- * @param secret - The directional app tagging secret to query pending indexes for.
96
- * @param startIndex - The lower bound of the index range (inclusive).
97
- * @param endIndex - The upper bound of the index range (exclusive).
98
- * @returns An array of unique transaction hashes for pending transactions that contain indexes in the range
99
- * [startIndex, endIndex). Returns an empty array if no pending indexes exist in the range.
100
- */ async getTxHashesOfPendingIndexes(secret, startIndex, endIndex) {
101
- const existing = await this.#pendingIndexes.getAsync(secret.toString()) ?? [];
102
- const txHashes = existing.filter((entry)=>entry.index >= startIndex && entry.index < endIndex).map((entry)=>entry.txHash);
103
- return Array.from(new Set(txHashes)).map(TxHash.fromString);
104
- }
105
- /**
106
- * Returns the last (highest) finalized index for a given secret.
107
- * @param secret - The secret to get the last finalized index for.
108
- * @returns The last (highest) finalized index for the given secret.
109
- */ getLastFinalizedIndex(secret) {
110
- return this.#lastFinalizedIndexes.getAsync(secret.toString());
111
- }
112
- /**
113
- * Returns the last used index for a given directional app tagging secret, considering both finalized and pending
114
- * indexes.
115
- * @param secret - The directional app tagging secret to query the last used index for.
116
- * @returns The last used index.
117
- */ async getLastUsedIndex(secret) {
118
- const secretStr = secret.toString();
119
- const pendingTxScopedIndexes = await this.#pendingIndexes.getAsync(secretStr) ?? [];
120
- const pendingIndexes = pendingTxScopedIndexes.map((entry)=>entry.index);
121
- if (pendingTxScopedIndexes.length === 0) {
122
- return this.#lastFinalizedIndexes.getAsync(secretStr);
123
- }
124
- // As the last used index we return the highest one from the pending indexes. Note that this value will be always
125
- // higher than the last finalized index because we prune lower pending indexes when a tx is finalized.
126
- return Math.max(...pendingIndexes);
127
- }
128
- /**
129
- * Drops all pending indexes corresponding to the given transaction hashes.
130
- */ async dropPendingIndexes(txHashes) {
131
- if (txHashes.length === 0) {
132
- return;
133
- }
134
- const txHashStrs = new Set(txHashes.map((txHash)=>txHash.toString()));
135
- const allSecrets = await toArray(this.#pendingIndexes.keysAsync());
136
- for (const secret of allSecrets){
137
- const pendingData = await this.#pendingIndexes.getAsync(secret);
138
- if (pendingData) {
139
- const filtered = pendingData.filter((item)=>!txHashStrs.has(item.txHash));
140
- if (filtered.length === 0) {
141
- await this.#pendingIndexes.delete(secret);
142
- } else if (filtered.length !== pendingData.length) {
143
- // Some items were filtered out, so update the pending data
144
- await this.#pendingIndexes.set(secret, filtered);
145
- }
146
- // else: No items were filtered out (txHashes not found for this secret) --> no-op
147
- }
148
- }
149
- }
150
- /**
151
- * Updates pending indexes corresponding to the given transaction hashes to be finalized and prunes any lower pending
152
- * indexes.
153
- */ async finalizePendingIndexes(txHashes) {
154
- if (txHashes.length === 0) {
155
- return;
156
- }
157
- for (const txHash of txHashes){
158
- const txHashStr = txHash.toString();
159
- const allSecrets = await toArray(this.#pendingIndexes.keysAsync());
160
- for (const secret of allSecrets){
161
- const pendingData = await this.#pendingIndexes.getAsync(secret);
162
- if (!pendingData) {
163
- continue;
164
- }
165
- const matchingIndexes = pendingData.filter((item)=>item.txHash === txHashStr).map((item)=>item.index);
166
- if (matchingIndexes.length === 0) {
167
- continue;
168
- }
169
- if (matchingIndexes.length > 1) {
170
- // We should always just store the highest pending index for a given tx hash and secret because the lower
171
- // values are irrelevant.
172
- throw new Error(`Multiple pending indexes found for tx hash ${txHashStr} and secret ${secret}`);
173
- }
174
- let lastFinalized = await this.#lastFinalizedIndexes.getAsync(secret);
175
- const newFinalized = matchingIndexes[0];
176
- if (newFinalized < (lastFinalized ?? 0)) {
177
- // This should never happen because when last finalized index was finalized we should have pruned the lower
178
- // pending indexes.
179
- throw new Error(`New finalized index ${newFinalized} is smaller than the current last finalized index ${lastFinalized}`);
180
- }
181
- await this.#lastFinalizedIndexes.set(secret, newFinalized);
182
- lastFinalized = newFinalized;
183
- // When we add pending indexes, we ensure they are higher than the last finalized index. However, because we
184
- // cannot control the order in which transactions are finalized, there may be pending indexes that are now
185
- // obsolete because they are lower than the most recently finalized index. For this reason, we prune these
186
- // outdated pending indexes.
187
- const remainingItemsOfHigherIndex = pendingData.filter((item)=>item.index > (lastFinalized ?? 0));
188
- if (remainingItemsOfHigherIndex.length === 0) {
189
- await this.#pendingIndexes.delete(secret);
190
- } else {
191
- await this.#pendingIndexes.set(secret, remainingItemsOfHigherIndex);
192
- }
193
- }
194
- }
195
- }
196
- }
@@ -1,21 +0,0 @@
1
- import type { AztecAsyncKVStore } from '@aztec/kv-store';
2
- import type { DirectionalAppTaggingSecret } from '@aztec/stdlib/logs';
3
- /**
4
- * Data provider of tagging data used when syncing the logs as a recipient. The sender counterpart of this class
5
- * is called SenderTaggingDataProvider. We have the providers separate for the sender and recipient because
6
- * the algorithms are completely disjoint and there is not data reuse between the two.
7
- *
8
- * @dev Chain reorgs do not need to be handled here because both the finalized and aged indexes refer to finalized
9
- * blocks, which by definition cannot be affected by reorgs.
10
- *
11
- * TODO(benesjan): Rename as to RecipientTaggingDataProvider and relocate once the old tagging sync is purged.
12
- */
13
- export declare class NewRecipientTaggingDataProvider {
14
- #private;
15
- constructor(store: AztecAsyncKVStore);
16
- getHighestAgedIndex(secret: DirectionalAppTaggingSecret): Promise<number | undefined>;
17
- updateHighestAgedIndex(secret: DirectionalAppTaggingSecret, index: number): Promise<void>;
18
- getHighestFinalizedIndex(secret: DirectionalAppTaggingSecret): Promise<number | undefined>;
19
- updateHighestFinalizedIndex(secret: DirectionalAppTaggingSecret, index: number): Promise<void>;
20
- }
21
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmV3X3JlY2lwaWVudF90YWdnaW5nX2RhdGFfcHJvdmlkZXIuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy90YWdnaW5nL3JlY2lwaWVudF9zeW5jL25ld19yZWNpcGllbnRfdGFnZ2luZ19kYXRhX3Byb3ZpZGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLGlCQUFpQixFQUFpQixNQUFNLGlCQUFpQixDQUFDO0FBQ3hFLE9BQU8sS0FBSyxFQUFFLDJCQUEyQixFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFFdEU7Ozs7Ozs7OztHQVNHO0FBQ0gscUJBQWEsK0JBQStCOztJQU0xQyxZQUFZLEtBQUssRUFBRSxpQkFBaUIsRUFLbkM7SUFFRCxtQkFBbUIsQ0FBQyxNQUFNLEVBQUUsMkJBQTJCLEdBQUcsT0FBTyxDQUFDLE1BQU0sR0FBRyxTQUFTLENBQUMsQ0FFcEY7SUFFSyxzQkFBc0IsQ0FBQyxNQUFNLEVBQUUsMkJBQTJCLEVBQUUsS0FBSyxFQUFFLE1BQU0sR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLENBTzlGO0lBRUQsd0JBQXdCLENBQUMsTUFBTSxFQUFFLDJCQUEyQixHQUFHLE9BQU8sQ0FBQyxNQUFNLEdBQUcsU0FBUyxDQUFDLENBRXpGO0lBRUssMkJBQTJCLENBQUMsTUFBTSxFQUFFLDJCQUEyQixFQUFFLEtBQUssRUFBRSxNQUFNLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxDQVFuRztDQUNGIn0=
@@ -1 +0,0 @@
1
- {"version":3,"file":"new_recipient_tagging_data_provider.d.ts","sourceRoot":"","sources":["../../../src/tagging/recipient_sync/new_recipient_tagging_data_provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAEtE;;;;;;;;;GASG;AACH,qBAAa,+BAA+B;;IAM1C,YAAY,KAAK,EAAE,iBAAiB,EAKnC;IAED,mBAAmB,CAAC,MAAM,EAAE,2BAA2B,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAEpF;IAEK,sBAAsB,CAAC,MAAM,EAAE,2BAA2B,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAO9F;IAED,wBAAwB,CAAC,MAAM,EAAE,2BAA2B,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAEzF;IAEK,2BAA2B,CAAC,MAAM,EAAE,2BAA2B,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAQnG;CACF"}
@@ -1,42 +0,0 @@
1
- /**
2
- * Data provider of tagging data used when syncing the logs as a recipient. The sender counterpart of this class
3
- * is called SenderTaggingDataProvider. We have the providers separate for the sender and recipient because
4
- * the algorithms are completely disjoint and there is not data reuse between the two.
5
- *
6
- * @dev Chain reorgs do not need to be handled here because both the finalized and aged indexes refer to finalized
7
- * blocks, which by definition cannot be affected by reorgs.
8
- *
9
- * TODO(benesjan): Rename as to RecipientTaggingDataProvider and relocate once the old tagging sync is purged.
10
- */ export class NewRecipientTaggingDataProvider {
11
- #store;
12
- #highestAgedIndex;
13
- #highestFinalizedIndex;
14
- constructor(store){
15
- this.#store = store;
16
- this.#highestAgedIndex = this.#store.openMap('highest_aged_index');
17
- this.#highestFinalizedIndex = this.#store.openMap('highest_finalized_index');
18
- }
19
- getHighestAgedIndex(secret) {
20
- return this.#highestAgedIndex.getAsync(secret.toString());
21
- }
22
- async updateHighestAgedIndex(secret, index) {
23
- const currentIndex = await this.#highestAgedIndex.getAsync(secret.toString());
24
- if (currentIndex !== undefined && index <= currentIndex) {
25
- // Log sync should never set a lower highest aged index.
26
- throw new Error(`New highest aged index (${index}) must be higher than the current one (${currentIndex})`);
27
- }
28
- await this.#highestAgedIndex.set(secret.toString(), index);
29
- }
30
- getHighestFinalizedIndex(secret) {
31
- return this.#highestFinalizedIndex.getAsync(secret.toString());
32
- }
33
- async updateHighestFinalizedIndex(secret, index) {
34
- const currentIndex = await this.#highestFinalizedIndex.getAsync(secret.toString());
35
- if (currentIndex !== undefined && index < currentIndex) {
36
- // Log sync should never set a lower highest finalized index but it can happen that it would try to set the same
37
- // one because we are loading logs from highest aged index + 1 and not from the highest finalized index.
38
- throw new Error(`New highest finalized index (${index}) must be higher than the current one (${currentIndex})`);
39
- }
40
- await this.#highestFinalizedIndex.set(secret.toString(), index);
41
- }
42
- }
@@ -1,21 +0,0 @@
1
- import type { AztecAddress } from '@aztec/stdlib/aztec-address';
2
- import type { AztecNode } from '@aztec/stdlib/interfaces/server';
3
- import type { DirectionalAppTaggingSecret } from '@aztec/stdlib/logs';
4
- import type { SenderTaggingDataProvider } from '../../storage/tagging_data_provider/sender_tagging_data_provider.js';
5
- export declare const UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN = 95;
6
- /**
7
- * Syncs tagging indexes. This function needs to be called whenever a private log is being sent.
8
- *
9
- * @param secret - The secret that's unique for (sender, recipient, contract) tuple while the direction of
10
- * sender -> recipient matters.
11
- * @param app - The address of the contract that the logs are tagged for. Needs to be provided because we perform
12
- * second round of siloing in this function which is necessary because kernels do it as well (they silo first field
13
- * of the private log which corresponds to the tag).
14
- * @remarks When syncing the indexes as sender we don't care about the log contents - we only care about the highest
15
- * pending and highest finalized indexes as that guides the next index choice when sending a log. The next index choice
16
- * is simply the highest pending index plus one (or finalized if pending is undefined).
17
- * @dev This function looks for new indexes, adds them to pending, then it checks status of each pending index and
18
- * updates its status accordingly.
19
- */
20
- export declare function syncSenderTaggingIndexes(secret: DirectionalAppTaggingSecret, app: AztecAddress, aztecNode: AztecNode, taggingDataProvider: SenderTaggingDataProvider): Promise<void>;
21
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3luY19zZW5kZXJfdGFnZ2luZ19pbmRleGVzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvdGFnZ2luZy9zeW5jL3N5bmNfc2VuZGVyX3RhZ2dpbmdfaW5kZXhlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUNoRSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNqRSxPQUFPLEtBQUssRUFBRSwyQkFBMkIsRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBRXRFLE9BQU8sS0FBSyxFQUFFLHlCQUF5QixFQUFFLE1BQU0scUVBQXFFLENBQUM7QUFtQnJILGVBQU8sTUFBTSxzQ0FBc0MsS0FBSyxDQUFDO0FBRXpEOzs7Ozs7Ozs7Ozs7O0dBYUc7QUFDSCx3QkFBc0Isd0JBQXdCLENBQzVDLE1BQU0sRUFBRSwyQkFBMkIsRUFDbkMsR0FBRyxFQUFFLFlBQVksRUFDakIsU0FBUyxFQUFFLFNBQVMsRUFDcEIsbUJBQW1CLEVBQUUseUJBQXlCLEdBQzdDLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FtRWYifQ==
@@ -1 +0,0 @@
1
- {"version":3,"file":"sync_sender_tagging_indexes.d.ts","sourceRoot":"","sources":["../../../src/tagging/sync/sync_sender_tagging_indexes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAEtE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qEAAqE,CAAC;AAmBrH,eAAO,MAAM,sCAAsC,KAAK,CAAC;AAEzD;;;;;;;;;;;;;GAaG;AACH,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,2BAA2B,EACnC,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE,SAAS,EACpB,mBAAmB,EAAE,yBAAyB,GAC7C,OAAO,CAAC,IAAI,CAAC,CAmEf"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"get_status_change_of_pending.d.ts","sourceRoot":"","sources":["../../../../src/tagging/sync/utils/get_status_change_of_pending.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,MAAM,EAAY,MAAM,kBAAkB,CAAC;AAEpD;;;GAGG;AACH,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,MAAM,EAAE,EACjB,SAAS,EAAE,SAAS,GACnB,OAAO,CAAC;IAAE,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAAC,cAAc,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAiCrE"}
@@ -1,18 +0,0 @@
1
- import type { AztecAddress } from '@aztec/stdlib/aztec-address';
2
- import type { AztecNode } from '@aztec/stdlib/interfaces/server';
3
- import type { DirectionalAppTaggingSecret } from '@aztec/stdlib/logs';
4
- import type { SenderTaggingDataProvider } from '../../../storage/tagging_data_provider/sender_tagging_data_provider.js';
5
- /**
6
- * Loads tagging indexes from the Aztec node and stores them in the tagging data provider.
7
- * @remarks This function is one of two places by which a pending index can get to the tagging data provider. The other
8
- * place is when a tx is being sent from this PXE.
9
- * @param secret - The directional app tagging secret that's unique for (sender, recipient, contract) tuple.
10
- * @param app - The address of the contract that the logs are tagged for. Used for siloing tags to match
11
- * kernel circuit behavior.
12
- * @param start - The starting index (inclusive) of the window to process.
13
- * @param end - The ending index (exclusive) of the window to process.
14
- * @param aztecNode - The Aztec node instance to query for logs.
15
- * @param taggingDataProvider - The data provider to store pending indexes.
16
- */
17
- export declare function loadAndStoreNewTaggingIndexes(secret: DirectionalAppTaggingSecret, app: AztecAddress, start: number, end: number, aztecNode: AztecNode, taggingDataProvider: SenderTaggingDataProvider): Promise<void>;
18
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9hZF9hbmRfc3RvcmVfbmV3X3RhZ2dpbmdfaW5kZXhlcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL3RhZ2dpbmcvc3luYy91dGlscy9sb2FkX2FuZF9zdG9yZV9uZXdfdGFnZ2luZ19pbmRleGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBQ2hFLE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQ2pFLE9BQU8sS0FBSyxFQUFFLDJCQUEyQixFQUFVLE1BQU0sb0JBQW9CLENBQUM7QUFJOUUsT0FBTyxLQUFLLEVBQUUseUJBQXlCLEVBQUUsTUFBTSx3RUFBd0UsQ0FBQztBQUV4SDs7Ozs7Ozs7Ozs7R0FXRztBQUNILHdCQUFzQiw2QkFBNkIsQ0FDakQsTUFBTSxFQUFFLDJCQUEyQixFQUNuQyxHQUFHLEVBQUUsWUFBWSxFQUNqQixLQUFLLEVBQUUsTUFBTSxFQUNiLEdBQUcsRUFBRSxNQUFNLEVBQ1gsU0FBUyxFQUFFLFNBQVMsRUFDcEIsbUJBQW1CLEVBQUUseUJBQXlCLGlCQWtCL0MifQ==
@@ -1 +0,0 @@
1
- {"version":3,"file":"load_and_store_new_tagging_indexes.d.ts","sourceRoot":"","sources":["../../../../src/tagging/sync/utils/load_and_store_new_tagging_indexes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,2BAA2B,EAAU,MAAM,oBAAoB,CAAC;AAI9E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,wEAAwE,CAAC;AAExH;;;;;;;;;;;GAWG;AACH,wBAAsB,6BAA6B,CACjD,MAAM,EAAE,2BAA2B,EACnC,GAAG,EAAE,YAAY,EACjB,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,SAAS,EACpB,mBAAmB,EAAE,yBAAyB,iBAkB/C"}
@@ -1,18 +0,0 @@
1
- import type { DirectionalAppTaggingSecret, PreTag } from '@aztec/stdlib/logs';
2
- export declare function getPreTagsForTheWindow(secretsAndWindows: {
3
- secret: DirectionalAppTaggingSecret;
4
- leftMostIndex: number;
5
- rightMostIndex: number;
6
- }[]): PreTag[];
7
- /**
8
- * Creates a map from directional app tagging secret to initial index.
9
- * @param preTags - The pre-tags to get the initial indexes map from.
10
- * @returns The map from directional app tagging secret to initial index.
11
- */
12
- export declare function getInitialIndexesMap(preTags: {
13
- secret: DirectionalAppTaggingSecret;
14
- index: number | undefined;
15
- }[]): {
16
- [k: string]: number;
17
- };
18
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90YWdnaW5nL3V0aWxzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLDJCQUEyQixFQUFFLE1BQU0sRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBSTlFLHdCQUFnQixzQkFBc0IsQ0FDcEMsaUJBQWlCLEVBQUU7SUFBRSxNQUFNLEVBQUUsMkJBQTJCLENBQUM7SUFBQyxhQUFhLEVBQUUsTUFBTSxDQUFDO0lBQUMsY0FBYyxFQUFFLE1BQU0sQ0FBQTtDQUFFLEVBQUUsR0FDMUcsTUFBTSxFQUFFLENBUVY7QUFFRDs7OztHQUlHO0FBQ0gsd0JBQWdCLG9CQUFvQixDQUFDLE9BQU8sRUFBRTtJQUFFLE1BQU0sRUFBRSwyQkFBMkIsQ0FBQztJQUFDLEtBQUssRUFBRSxNQUFNLEdBQUcsU0FBUyxDQUFBO0NBQUUsRUFBRSxHQUFHO0lBQ25ILENBQUMsQ0FBQyxFQUFFLE1BQU0sR0FBRyxNQUFNLENBQUM7Q0FDckIsQ0FRQSJ9
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/tagging/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAI9E,wBAAgB,sBAAsB,CACpC,iBAAiB,EAAE;IAAE,MAAM,EAAE,2BAA2B,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,EAAE,GAC1G,MAAM,EAAE,CAQV;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE;IAAE,MAAM,EAAE,2BAA2B,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,EAAE,GAAG;IACnH,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACrB,CAQA"}
@@ -1,25 +0,0 @@
1
- // TODO(#17775): If this does not get dropped when implementing the linked issue make this return tags instead. This
2
- // will move some complexity from syncTaggedLogs to here.
3
- export function getPreTagsForTheWindow(secretsAndWindows) {
4
- const secrets = [];
5
- for (const secretAndWindow of secretsAndWindows){
6
- for(let i = secretAndWindow.leftMostIndex; i <= secretAndWindow.rightMostIndex; i++){
7
- secrets.push({
8
- secret: secretAndWindow.secret,
9
- index: i
10
- });
11
- }
12
- }
13
- return secrets;
14
- }
15
- /**
16
- * Creates a map from directional app tagging secret to initial index.
17
- * @param preTags - The pre-tags to get the initial indexes map from.
18
- * @returns The map from directional app tagging secret to initial index.
19
- */ export function getInitialIndexesMap(preTags) {
20
- const initialIndexes = {};
21
- for (const preTag of preTags){
22
- initialIndexes[preTag.secret.toString()] = preTag.index ?? 0;
23
- }
24
- return initialIndexes;
25
- }
@@ -1,52 +0,0 @@
1
- import type { L1_TO_L2_MSG_TREE_HEIGHT } from '@aztec/constants';
2
- import type { Fr } from '@aztec/foundation/curves/bn254';
3
- import type { SiblingPath } from '@aztec/foundation/trees';
4
- import type { AztecAddress } from '@aztec/stdlib/aztec-address';
5
- import type { BlockParameter } from '@aztec/stdlib/block';
6
- import type { AztecNode } from '@aztec/stdlib/interfaces/server';
7
- import { MerkleTreeId, NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
8
- import type { AnchorBlockDataProvider } from '../storage/anchor_block_data_provider/anchor_block_data_provider.js';
9
- export declare class TreeMembershipService {
10
- #private;
11
- private readonly aztecNode;
12
- private readonly anchorBlockDataProvider;
13
- constructor(aztecNode: AztecNode, anchorBlockDataProvider: AnchorBlockDataProvider);
14
- /**
15
- * Gets the index of a nullifier in the nullifier tree.
16
- * @returns - The index of the nullifier. Undefined if it does not exist in the tree.
17
- */
18
- getNullifierIndex(nullifier: Fr): Promise<bigint | undefined>;
19
- /**
20
- * Fetches the index and sibling path of a leaf at a given block from a given tree.
21
- * @param blockNumber - The block number at which to get the membership witness.
22
- * @param treeId - Id of the tree to get the sibling path from.
23
- * @param leafValue - The leaf value
24
- * @returns The index and sibling path concatenated [index, sibling_path]
25
- */
26
- getMembershipWitness(blockNumber: BlockParameter, treeId: MerkleTreeId, leafValue: Fr): Promise<Fr[]>;
27
- /**
28
- * Returns a low nullifier membership witness for a given nullifier at a given block.
29
- * @param blockNumber - The block number at which to get the index.
30
- * @param nullifier - Nullifier we try to find the low nullifier witness for.
31
- * @returns The low nullifier membership witness (if found).
32
- * @remarks Low nullifier witness can be used to perform a nullifier non-inclusion proof by leveraging the "linked
33
- * list structure" of leaves and proving that a lower nullifier is pointing to a bigger next value than the nullifier
34
- * we are trying to prove non-inclusion for.
35
- */
36
- getLowNullifierMembershipWitness(blockNumber: BlockParameter, nullifier: Fr): Promise<NullifierMembershipWitness | undefined>;
37
- /**
38
- * Returns a witness for a given slot of the public data tree at a given block.
39
- * @param blockNumber - The block number at which to get the witness.
40
- * @param leafSlot - The slot of the public data in the public data tree.
41
- */
42
- getPublicDataWitness(blockNumber: BlockParameter, leafSlot: Fr): Promise<PublicDataWitness | undefined>;
43
- /**
44
- * Looks for the L1 to L2 membership witness of a message at the Aztec node, given its hash.
45
- * @param contractAddress - Address of a contract by which the message was emitted.
46
- * @dev Contract address and secret are only used to compute the nullifier to get non-nullified messages.
47
- * The message nullifier is computed locally, so the secret is not sent to the node.
48
- * @returns The l1 to l2 membership witness (index of message in the tree and sibling path).
49
- */
50
- getL1ToL2MembershipWitness(contractAddress: AztecAddress, messageHash: Fr, secret: Fr): Promise<[bigint, SiblingPath<typeof L1_TO_L2_MSG_TREE_HEIGHT>]>;
51
- }
52
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJlZV9tZW1iZXJzaGlwX3NlcnZpY2UuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90cmVlX21lbWJlcnNoaXAvdHJlZV9tZW1iZXJzaGlwX3NlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsd0JBQXdCLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUNqRSxPQUFPLEtBQUssRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUN6RCxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUMzRCxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUNoRSxPQUFPLEtBQUssRUFBRSxjQUFjLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUMxRCxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUVqRSxPQUFPLEVBQUUsWUFBWSxFQUFFLDBCQUEwQixFQUFFLGlCQUFpQixFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFFbEcsT0FBTyxLQUFLLEVBQUUsdUJBQXVCLEVBQUUsTUFBTSxxRUFBcUUsQ0FBQztBQUVuSCxxQkFBYSxxQkFBcUI7O0lBRTlCLE9BQU8sQ0FBQyxRQUFRLENBQUMsU0FBUztJQUMxQixPQUFPLENBQUMsUUFBUSxDQUFDLHVCQUF1QjtJQUYxQyxZQUNtQixTQUFTLEVBQUUsU0FBUyxFQUNwQix1QkFBdUIsRUFBRSx1QkFBdUIsRUFDL0Q7SUFFSjs7O09BR0c7SUFDSSxpQkFBaUIsQ0FBQyxTQUFTLEVBQUUsRUFBRSwrQkFFckM7SUFFRDs7Ozs7O09BTUc7SUFDVSxvQkFBb0IsQ0FBQyxXQUFXLEVBQUUsY0FBYyxFQUFFLE1BQU0sRUFBRSxZQUFZLEVBQUUsU0FBUyxFQUFFLEVBQUUsR0FBRyxPQUFPLENBQUMsRUFBRSxFQUFFLENBQUMsQ0FNakg7SUFFRDs7Ozs7Ozs7T0FRRztJQUNVLGdDQUFnQyxDQUMzQyxXQUFXLEVBQUUsY0FBYyxFQUMzQixTQUFTLEVBQUUsRUFBRSxHQUNaLE9BQU8sQ0FBQywwQkFBMEIsR0FBRyxTQUFTLENBQUMsQ0FNakQ7SUFFRDs7OztPQUlHO0lBQ1Usb0JBQW9CLENBQUMsV0FBVyxFQUFFLGNBQWMsRUFBRSxRQUFRLEVBQUUsRUFBRSxHQUFHLE9BQU8sQ0FBQyxpQkFBaUIsR0FBRyxTQUFTLENBQUMsQ0FNbkg7SUFFRDs7Ozs7O09BTUc7SUFDSSwwQkFBMEIsQ0FDL0IsZUFBZSxFQUFFLFlBQVksRUFDN0IsV0FBVyxFQUFFLEVBQUUsRUFDZixNQUFNLEVBQUUsRUFBRSxHQUNULE9BQU8sQ0FBQyxDQUFDLE1BQU0sRUFBRSxXQUFXLENBQUMsT0FBTyx3QkFBd0IsQ0FBQyxDQUFDLENBQUMsQ0FFakU7Q0F5QkYifQ==
@@ -1 +0,0 @@
1
- {"version":3,"file":"tree_membership_service.d.ts","sourceRoot":"","sources":["../../src/tree_membership/tree_membership_service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,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,EAAE,YAAY,EAAE,0BAA0B,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAElG,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qEAAqE,CAAC;AAEnH,qBAAa,qBAAqB;;IAE9B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,uBAAuB;IAF1C,YACmB,SAAS,EAAE,SAAS,EACpB,uBAAuB,EAAE,uBAAuB,EAC/D;IAEJ;;;OAGG;IACI,iBAAiB,CAAC,SAAS,EAAE,EAAE,+BAErC;IAED;;;;;;OAMG;IACU,oBAAoB,CAAC,WAAW,EAAE,cAAc,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,EAAE,GAAG,OAAO,CAAC,EAAE,EAAE,CAAC,CAMjH;IAED;;;;;;;;OAQG;IACU,gCAAgC,CAC3C,WAAW,EAAE,cAAc,EAC3B,SAAS,EAAE,EAAE,GACZ,OAAO,CAAC,0BAA0B,GAAG,SAAS,CAAC,CAMjD;IAED;;;;OAIG;IACU,oBAAoB,CAAC,WAAW,EAAE,cAAc,EAAE,QAAQ,EAAE,EAAE,GAAG,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC,CAMnH;IAED;;;;;;OAMG;IACI,0BAA0B,CAC/B,eAAe,EAAE,YAAY,EAC7B,WAAW,EAAE,EAAE,EACf,MAAM,EAAE,EAAE,GACT,OAAO,CAAC,CAAC,MAAM,EAAE,WAAW,CAAC,OAAO,wBAAwB,CAAC,CAAC,CAAC,CAEjE;CAyBF"}
@@ -1,84 +0,0 @@
1
- import { getNonNullifiedL1ToL2MessageWitness } from '@aztec/stdlib/messaging';
2
- import { MerkleTreeId } from '@aztec/stdlib/trees';
3
- export class TreeMembershipService {
4
- aztecNode;
5
- anchorBlockDataProvider;
6
- constructor(aztecNode, anchorBlockDataProvider){
7
- this.aztecNode = aztecNode;
8
- this.anchorBlockDataProvider = anchorBlockDataProvider;
9
- }
10
- /**
11
- * Gets the index of a nullifier in the nullifier tree.
12
- * @returns - The index of the nullifier. Undefined if it does not exist in the tree.
13
- */ getNullifierIndex(nullifier) {
14
- return this.#findLeafIndex('latest', MerkleTreeId.NULLIFIER_TREE, nullifier);
15
- }
16
- /**
17
- * Fetches the index and sibling path of a leaf at a given block from a given tree.
18
- * @param blockNumber - The block number at which to get the membership witness.
19
- * @param treeId - Id of the tree to get the sibling path from.
20
- * @param leafValue - The leaf value
21
- * @returns The index and sibling path concatenated [index, sibling_path]
22
- */ async getMembershipWitness(blockNumber, treeId, leafValue) {
23
- const witness = await this.#tryGetMembershipWitness(blockNumber, treeId, leafValue);
24
- if (!witness) {
25
- throw new Error(`Leaf value ${leafValue} not found in tree ${MerkleTreeId[treeId]} at block ${blockNumber}`);
26
- }
27
- return witness;
28
- }
29
- /**
30
- * Returns a low nullifier membership witness for a given nullifier at a given block.
31
- * @param blockNumber - The block number at which to get the index.
32
- * @param nullifier - Nullifier we try to find the low nullifier witness for.
33
- * @returns The low nullifier membership witness (if found).
34
- * @remarks Low nullifier witness can be used to perform a nullifier non-inclusion proof by leveraging the "linked
35
- * list structure" of leaves and proving that a lower nullifier is pointing to a bigger next value than the nullifier
36
- * we are trying to prove non-inclusion for.
37
- */ async getLowNullifierMembershipWitness(blockNumber, nullifier) {
38
- const anchorBlockNumber = (await this.anchorBlockDataProvider.getBlockHeader()).getBlockNumber();
39
- if (blockNumber !== 'latest' && blockNumber > anchorBlockNumber) {
40
- throw new Error(`Block number ${blockNumber} is higher than current block ${anchorBlockNumber}`);
41
- }
42
- return this.aztecNode.getLowNullifierMembershipWitness(blockNumber, nullifier);
43
- }
44
- /**
45
- * Returns a witness for a given slot of the public data tree at a given block.
46
- * @param blockNumber - The block number at which to get the witness.
47
- * @param leafSlot - The slot of the public data in the public data tree.
48
- */ async getPublicDataWitness(blockNumber, leafSlot) {
49
- const anchorBlockNumber = (await this.anchorBlockDataProvider.getBlockHeader()).getBlockNumber();
50
- if (blockNumber !== 'latest' && blockNumber > anchorBlockNumber) {
51
- throw new Error(`Block number ${blockNumber} is higher than current block ${anchorBlockNumber}`);
52
- }
53
- return await this.aztecNode.getPublicDataWitness(blockNumber, leafSlot);
54
- }
55
- /**
56
- * Looks for the L1 to L2 membership witness of a message at the Aztec node, given its hash.
57
- * @param contractAddress - Address of a contract by which the message was emitted.
58
- * @dev Contract address and secret are only used to compute the nullifier to get non-nullified messages.
59
- * The message nullifier is computed locally, so the secret is not sent to the node.
60
- * @returns The l1 to l2 membership witness (index of message in the tree and sibling path).
61
- */ getL1ToL2MembershipWitness(contractAddress, messageHash, secret) {
62
- return getNonNullifiedL1ToL2MessageWitness(this.aztecNode, contractAddress, messageHash, secret);
63
- }
64
- async #tryGetMembershipWitness(blockNumber, treeId, value) {
65
- switch(treeId){
66
- case MerkleTreeId.NULLIFIER_TREE:
67
- return (await this.aztecNode.getNullifierMembershipWitness(blockNumber, value))?.withoutPreimage().toFields();
68
- case MerkleTreeId.NOTE_HASH_TREE:
69
- return (await this.aztecNode.getNoteHashMembershipWitness(blockNumber, value))?.toFields();
70
- case MerkleTreeId.PUBLIC_DATA_TREE:
71
- return (await this.aztecNode.getPublicDataWitness(blockNumber, value))?.withoutPreimage().toFields();
72
- case MerkleTreeId.ARCHIVE:
73
- return (await this.aztecNode.getArchiveMembershipWitness(blockNumber, value))?.toFields();
74
- default:
75
- throw new Error('Not implemented');
76
- }
77
- }
78
- async #findLeafIndex(blockNumber, treeId, leafValue) {
79
- const [leafIndex] = await this.aztecNode.findLeavesIndexes(blockNumber, treeId, [
80
- leafValue
81
- ]);
82
- return leafIndex?.data;
83
- }
84
- }
@@ -1,33 +0,0 @@
1
- import { Timer } from '@aztec/foundation/timer';
2
- import type { AztecNode } from '@aztec/stdlib/interfaces/client';
3
- import type { NodeStats } from '@aztec/stdlib/tx';
4
-
5
- /*
6
- * Proxy generator for an AztecNode that tracks the time taken for each RPC call.
7
- */
8
- export type ProxiedNode = AztecNode & { getStats(): NodeStats };
9
-
10
- export class ProxiedNodeFactory {
11
- static create(node: AztecNode) {
12
- const stats: Partial<Record<keyof AztecNode, { times: number[] }>> = {};
13
- return new Proxy(node, {
14
- get(target, prop: keyof ProxiedNode) {
15
- if (prop === 'getStats') {
16
- return () => {
17
- return stats;
18
- };
19
- } else {
20
- return async function (...args: any[]) {
21
- if (!stats[prop]) {
22
- stats[prop] = { times: [] };
23
- }
24
- const timer = new Timer();
25
- const result = await (target[prop] as any).apply(target, args);
26
- stats[prop].times.push(timer.ms());
27
- return result;
28
- };
29
- }
30
- },
31
- }) as ProxiedNode;
32
- }
33
- }