@aztec/pxe 0.0.1-commit.fce3e4f → 0.0.1-commit.fffb133c

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (379) hide show
  1. package/dest/bin/check_oracle_version.js +105 -15
  2. package/dest/block_synchronizer/block_synchronizer.d.ts +43 -0
  3. package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -0
  4. package/dest/block_synchronizer/block_synchronizer.js +147 -0
  5. package/dest/block_synchronizer/index.d.ts +2 -0
  6. package/dest/block_synchronizer/index.d.ts.map +1 -0
  7. package/dest/block_synchronizer/index.js +1 -0
  8. package/dest/config/index.d.ts +6 -4
  9. package/dest/config/index.d.ts.map +1 -1
  10. package/dest/config/index.js +17 -0
  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 +42 -14
  16. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  17. package/dest/contract_function_simulator/contract_function_simulator.js +71 -30
  18. package/dest/contract_function_simulator/execution_note_cache.d.ts +21 -11
  19. package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
  20. package/dest/contract_function_simulator/execution_note_cache.js +49 -31
  21. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +1 -1
  22. package/dest/contract_function_simulator/execution_tagging_index_cache.js +1 -1
  23. package/dest/contract_function_simulator/hashed_values_cache.d.ts +2 -2
  24. package/dest/contract_function_simulator/hashed_values_cache.d.ts.map +1 -1
  25. package/dest/contract_function_simulator/index.d.ts +2 -2
  26. package/dest/contract_function_simulator/index.d.ts.map +1 -1
  27. package/dest/contract_function_simulator/index.js +1 -1
  28. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +5 -4
  29. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
  30. package/dest/contract_function_simulator/noir-structs/event_validation_request.js +6 -3
  31. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +5 -4
  32. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts.map +1 -1
  33. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.js +7 -6
  34. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +2 -2
  35. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
  36. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +1 -1
  37. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +6 -5
  38. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
  39. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +7 -4
  40. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +4 -10
  41. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -1
  42. package/dest/contract_function_simulator/noir-structs/utility_context.js +7 -18
  43. package/dest/contract_function_simulator/oracle/interfaces.d.ts +25 -18
  44. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
  45. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +4 -2
  46. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
  47. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.js +1 -1
  48. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +11 -7
  49. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
  50. package/dest/contract_function_simulator/oracle/note_packing_utils.js +14 -10
  51. package/dest/contract_function_simulator/oracle/oracle.d.ts +11 -9
  52. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
  53. package/dest/contract_function_simulator/oracle/oracle.js +62 -39
  54. package/dest/contract_function_simulator/oracle/private_execution.d.ts +2 -27
  55. package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
  56. package/dest/contract_function_simulator/oracle/private_execution.js +2 -38
  57. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +35 -26
  58. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  59. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +46 -48
  60. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +77 -25
  61. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  62. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +171 -64
  63. package/dest/contract_function_simulator/pick_notes.d.ts +2 -2
  64. package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -1
  65. package/dest/contract_function_simulator/pick_notes.js +1 -1
  66. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +4 -4
  67. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -1
  68. package/dest/contract_function_simulator/proxied_contract_data_source.js +23 -5
  69. package/dest/contract_sync/index.d.ts +23 -0
  70. package/dest/contract_sync/index.d.ts.map +1 -0
  71. package/dest/contract_sync/index.js +54 -0
  72. package/dest/debug/pxe_debug_utils.d.ts +31 -0
  73. package/dest/debug/pxe_debug_utils.d.ts.map +1 -0
  74. package/dest/debug/pxe_debug_utils.js +38 -0
  75. package/dest/entrypoints/client/bundle/index.d.ts +1 -2
  76. package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
  77. package/dest/entrypoints/client/bundle/index.js +0 -1
  78. package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
  79. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  80. package/dest/entrypoints/client/bundle/utils.js +12 -3
  81. package/dest/entrypoints/client/lazy/index.d.ts +1 -2
  82. package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
  83. package/dest/entrypoints/client/lazy/index.js +0 -1
  84. package/dest/entrypoints/client/lazy/utils.d.ts +1 -1
  85. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  86. package/dest/entrypoints/client/lazy/utils.js +12 -3
  87. package/dest/entrypoints/pxe_creation_options.d.ts +5 -2
  88. package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
  89. package/dest/entrypoints/server/index.d.ts +4 -2
  90. package/dest/entrypoints/server/index.d.ts.map +1 -1
  91. package/dest/entrypoints/server/index.js +3 -1
  92. package/dest/entrypoints/server/utils.d.ts +1 -1
  93. package/dest/entrypoints/server/utils.d.ts.map +1 -1
  94. package/dest/entrypoints/server/utils.js +12 -8
  95. package/dest/error_enriching.d.ts +4 -4
  96. package/dest/error_enriching.d.ts.map +1 -1
  97. package/dest/error_enriching.js +6 -6
  98. package/dest/events/event_service.d.ts +16 -0
  99. package/dest/events/event_service.d.ts.map +1 -0
  100. package/dest/events/event_service.js +45 -0
  101. package/dest/events/index.d.ts +2 -0
  102. package/dest/events/index.d.ts.map +1 -0
  103. package/dest/events/index.js +1 -0
  104. package/dest/events/private_event_filter_validator.d.ts +9 -0
  105. package/dest/events/private_event_filter_validator.d.ts.map +1 -0
  106. package/dest/events/private_event_filter_validator.js +38 -0
  107. package/dest/job_coordinator/job_coordinator.d.ts +74 -0
  108. package/dest/job_coordinator/job_coordinator.d.ts.map +1 -0
  109. package/dest/job_coordinator/job_coordinator.js +93 -0
  110. package/dest/logs/log_service.d.ts +27 -0
  111. package/dest/logs/log_service.d.ts.map +1 -0
  112. package/dest/logs/log_service.js +128 -0
  113. package/dest/notes/index.d.ts +2 -0
  114. package/dest/notes/index.d.ts.map +1 -0
  115. package/dest/notes/index.js +1 -0
  116. package/dest/notes/note_service.d.ts +49 -0
  117. package/dest/notes/note_service.d.ts.map +1 -0
  118. package/dest/notes/note_service.js +148 -0
  119. package/dest/oracle_version.d.ts +3 -3
  120. package/dest/oracle_version.d.ts.map +1 -1
  121. package/dest/oracle_version.js +4 -3
  122. package/dest/private_kernel/hints/index.d.ts +2 -2
  123. package/dest/private_kernel/hints/index.d.ts.map +1 -1
  124. package/dest/private_kernel/hints/index.js +1 -1
  125. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +28 -0
  126. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -0
  127. package/dest/private_kernel/hints/{build_private_kernel_reset_private_inputs.js → private_kernel_reset_private_inputs_builder.js} +13 -7
  128. package/dest/private_kernel/private_kernel_execution_prover.d.ts +1 -1
  129. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
  130. package/dest/private_kernel/private_kernel_execution_prover.js +8 -9
  131. package/dest/private_kernel/private_kernel_oracle.d.ts +26 -29
  132. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
  133. package/dest/private_kernel/private_kernel_oracle.js +90 -2
  134. package/dest/pxe.d.ts +45 -81
  135. package/dest/pxe.d.ts.map +1 -1
  136. package/dest/pxe.js +185 -216
  137. package/dest/storage/address_store/address_store.d.ts +11 -0
  138. package/dest/storage/address_store/address_store.d.ts.map +1 -0
  139. package/dest/storage/{address_data_provider/address_data_provider.js → address_store/address_store.js} +1 -1
  140. package/dest/storage/address_store/index.d.ts +2 -0
  141. package/dest/storage/address_store/index.d.ts.map +1 -0
  142. package/dest/storage/address_store/index.js +1 -0
  143. package/dest/storage/{sync_data_provider/sync_data_provider.d.ts → anchor_block_store/anchor_block_store.d.ts} +2 -3
  144. package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -0
  145. package/dest/storage/{sync_data_provider/sync_data_provider.js → anchor_block_store/anchor_block_store.js} +2 -9
  146. package/dest/storage/{sync_data_provider → anchor_block_store}/index.d.ts +2 -2
  147. package/dest/storage/anchor_block_store/index.d.ts.map +1 -0
  148. package/dest/storage/anchor_block_store/index.js +1 -0
  149. package/dest/storage/capsule_store/capsule_store.d.ts +72 -0
  150. package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -0
  151. package/dest/storage/capsule_store/capsule_store.js +255 -0
  152. package/dest/storage/capsule_store/index.d.ts +2 -0
  153. package/dest/storage/capsule_store/index.d.ts.map +1 -0
  154. package/dest/storage/capsule_store/index.js +1 -0
  155. package/dest/storage/{contract_data_provider/contract_data_provider.d.ts → contract_store/contract_store.d.ts} +7 -5
  156. package/dest/storage/contract_store/contract_store.d.ts.map +1 -0
  157. package/dest/storage/{contract_data_provider/contract_data_provider.js → contract_store/contract_store.js} +34 -3
  158. package/dest/storage/contract_store/index.d.ts +2 -0
  159. package/dest/storage/contract_store/index.d.ts.map +1 -0
  160. package/dest/storage/contract_store/index.js +1 -0
  161. package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.d.ts +1 -1
  162. package/dest/storage/contract_store/private_functions_tree.d.ts.map +1 -0
  163. package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.js +1 -1
  164. package/dest/storage/index.d.ts +8 -8
  165. package/dest/storage/index.d.ts.map +1 -1
  166. package/dest/storage/index.js +7 -7
  167. package/dest/storage/note_store/index.d.ts +3 -0
  168. package/dest/storage/note_store/index.d.ts.map +1 -0
  169. package/dest/storage/note_store/index.js +2 -0
  170. package/dest/storage/note_store/note_store.d.ts +73 -0
  171. package/dest/storage/note_store/note_store.d.ts.map +1 -0
  172. package/dest/storage/note_store/note_store.js +303 -0
  173. package/dest/storage/note_store/stored_note.d.ts +16 -0
  174. package/dest/storage/note_store/stored_note.d.ts.map +1 -0
  175. package/dest/storage/note_store/stored_note.js +43 -0
  176. package/dest/storage/private_event_store/private_event_store.d.ts +91 -0
  177. package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -0
  178. package/dest/storage/private_event_store/private_event_store.js +250 -0
  179. package/dest/storage/private_event_store/stored_private_event.d.ts +23 -0
  180. package/dest/storage/private_event_store/stored_private_event.d.ts.map +1 -0
  181. package/dest/storage/private_event_store/stored_private_event.js +56 -0
  182. package/dest/storage/tagging_store/index.d.ts +4 -0
  183. package/dest/storage/tagging_store/index.d.ts.map +1 -0
  184. package/dest/storage/tagging_store/index.js +3 -0
  185. package/dest/storage/tagging_store/recipient_tagging_store.d.ts +28 -0
  186. package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -0
  187. package/dest/storage/tagging_store/recipient_tagging_store.js +99 -0
  188. package/dest/storage/tagging_store/sender_address_book_store.d.ts +14 -0
  189. package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +1 -0
  190. package/dest/storage/tagging_store/sender_address_book_store.js +30 -0
  191. package/dest/storage/tagging_store/sender_tagging_store.d.ts +77 -0
  192. package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -0
  193. package/dest/storage/tagging_store/sender_tagging_store.js +278 -0
  194. package/dest/tagging/constants.d.ts +2 -2
  195. package/dest/tagging/constants.d.ts.map +1 -1
  196. package/dest/tagging/constants.js +10 -2
  197. package/dest/tagging/get_all_logs_by_tags.d.ts +24 -0
  198. package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -0
  199. package/dest/tagging/get_all_logs_by_tags.js +46 -0
  200. package/dest/tagging/index.d.ts +16 -6
  201. package/dest/tagging/index.d.ts.map +1 -1
  202. package/dest/tagging/index.js +15 -5
  203. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +15 -0
  204. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -0
  205. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +99 -0
  206. package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts +12 -0
  207. package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts.map +1 -0
  208. package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +20 -0
  209. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +15 -0
  210. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -0
  211. package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +32 -0
  212. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +21 -0
  213. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -0
  214. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +74 -0
  215. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +11 -0
  216. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -0
  217. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +29 -0
  218. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +21 -0
  219. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -0
  220. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +60 -0
  221. package/package.json +19 -19
  222. package/src/bin/check_oracle_version.ts +131 -20
  223. package/src/block_synchronizer/block_synchronizer.ts +174 -0
  224. package/src/block_synchronizer/index.ts +1 -0
  225. package/src/config/index.ts +17 -3
  226. package/src/config/package_info.ts +1 -1
  227. package/src/contract_function_simulator/benchmarked_node.ts +103 -0
  228. package/src/contract_function_simulator/contract_function_simulator.ts +113 -33
  229. package/src/contract_function_simulator/execution_note_cache.ts +51 -28
  230. package/src/contract_function_simulator/execution_tagging_index_cache.ts +1 -1
  231. package/src/contract_function_simulator/hashed_values_cache.ts +1 -1
  232. package/src/contract_function_simulator/index.ts +1 -1
  233. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +6 -2
  234. package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +6 -5
  235. package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +1 -1
  236. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +6 -3
  237. package/src/contract_function_simulator/noir-structs/utility_context.ts +6 -25
  238. package/src/contract_function_simulator/oracle/interfaces.ts +30 -15
  239. package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +1 -1
  240. package/src/contract_function_simulator/oracle/note_packing_utils.ts +27 -13
  241. package/src/contract_function_simulator/oracle/oracle.ts +78 -41
  242. package/src/contract_function_simulator/oracle/private_execution.ts +2 -68
  243. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +129 -59
  244. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +261 -71
  245. package/src/contract_function_simulator/pick_notes.ts +1 -1
  246. package/src/contract_function_simulator/proxied_contract_data_source.ts +24 -7
  247. package/src/contract_sync/index.ts +98 -0
  248. package/src/debug/pxe_debug_utils.ts +49 -0
  249. package/src/entrypoints/client/bundle/index.ts +0 -1
  250. package/src/entrypoints/client/bundle/utils.ts +9 -3
  251. package/src/entrypoints/client/lazy/index.ts +0 -1
  252. package/src/entrypoints/client/lazy/utils.ts +9 -4
  253. package/src/entrypoints/pxe_creation_options.ts +4 -1
  254. package/src/entrypoints/server/index.ts +3 -1
  255. package/src/entrypoints/server/utils.ts +12 -16
  256. package/src/error_enriching.ts +7 -15
  257. package/src/events/event_service.ts +73 -0
  258. package/src/events/index.ts +1 -0
  259. package/src/events/private_event_filter_validator.ts +46 -0
  260. package/src/job_coordinator/job_coordinator.ts +149 -0
  261. package/src/logs/log_service.ts +220 -0
  262. package/src/notes/index.ts +1 -0
  263. package/src/notes/note_service.ts +197 -0
  264. package/src/oracle_version.ts +4 -3
  265. package/src/private_kernel/hints/index.ts +1 -1
  266. package/src/private_kernel/hints/{build_private_kernel_reset_private_inputs.ts → private_kernel_reset_private_inputs_builder.ts} +34 -23
  267. package/src/private_kernel/private_kernel_execution_prover.ts +8 -9
  268. package/src/private_kernel/private_kernel_oracle.ts +118 -37
  269. package/src/pxe.ts +257 -280
  270. package/src/storage/{address_data_provider/address_data_provider.ts → address_store/address_store.ts} +1 -1
  271. package/src/storage/address_store/index.ts +1 -0
  272. package/src/storage/{sync_data_provider/sync_data_provider.ts → anchor_block_store/anchor_block_store.ts} +2 -11
  273. package/src/storage/anchor_block_store/index.ts +1 -0
  274. package/src/storage/capsule_store/capsule_store.ts +315 -0
  275. package/src/storage/capsule_store/index.ts +1 -0
  276. package/src/storage/{contract_data_provider/contract_data_provider.ts → contract_store/contract_store.ts} +45 -3
  277. package/src/storage/contract_store/index.ts +1 -0
  278. package/src/storage/{contract_data_provider → contract_store}/private_functions_tree.ts +1 -1
  279. package/src/storage/index.ts +7 -7
  280. package/src/storage/note_store/index.ts +2 -0
  281. package/src/storage/note_store/note_store.ts +381 -0
  282. package/src/storage/note_store/stored_note.ts +48 -0
  283. package/src/storage/private_event_store/private_event_store.ts +363 -0
  284. package/src/storage/private_event_store/stored_private_event.ts +73 -0
  285. package/src/storage/tagging_store/index.ts +3 -0
  286. package/src/storage/tagging_store/recipient_tagging_store.ts +129 -0
  287. package/src/storage/tagging_store/sender_address_book_store.ts +42 -0
  288. package/src/storage/tagging_store/sender_tagging_store.ts +345 -0
  289. package/src/tagging/constants.ts +10 -2
  290. package/src/tagging/get_all_logs_by_tags.ts +68 -0
  291. package/src/tagging/index.ts +18 -5
  292. package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +143 -0
  293. package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +34 -0
  294. package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +49 -0
  295. package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +99 -0
  296. package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +36 -0
  297. package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +84 -0
  298. package/dest/contract_function_simulator/execution_data_provider.d.ts +0 -265
  299. package/dest/contract_function_simulator/execution_data_provider.d.ts.map +0 -1
  300. package/dest/contract_function_simulator/execution_data_provider.js +0 -14
  301. package/dest/contract_function_simulator/proxied_node.d.ts +0 -9
  302. package/dest/contract_function_simulator/proxied_node.d.ts.map +0 -1
  303. package/dest/contract_function_simulator/proxied_node.js +0 -27
  304. package/dest/contract_function_simulator/pxe_oracle_interface.d.ts +0 -122
  305. package/dest/contract_function_simulator/pxe_oracle_interface.d.ts.map +0 -1
  306. package/dest/contract_function_simulator/pxe_oracle_interface.js +0 -694
  307. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +0 -28
  308. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +0 -1
  309. package/dest/private_kernel/private_kernel_oracle_impl.d.ts +0 -45
  310. package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +0 -1
  311. package/dest/private_kernel/private_kernel_oracle_impl.js +0 -86
  312. package/dest/storage/address_data_provider/address_data_provider.d.ts +0 -11
  313. package/dest/storage/address_data_provider/address_data_provider.d.ts.map +0 -1
  314. package/dest/storage/address_data_provider/index.d.ts +0 -2
  315. package/dest/storage/address_data_provider/index.d.ts.map +0 -1
  316. package/dest/storage/address_data_provider/index.js +0 -1
  317. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts +0 -25
  318. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +0 -1
  319. package/dest/storage/capsule_data_provider/capsule_data_provider.js +0 -118
  320. package/dest/storage/capsule_data_provider/index.d.ts +0 -2
  321. package/dest/storage/capsule_data_provider/index.d.ts.map +0 -1
  322. package/dest/storage/capsule_data_provider/index.js +0 -1
  323. package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +0 -1
  324. package/dest/storage/contract_data_provider/index.d.ts +0 -2
  325. package/dest/storage/contract_data_provider/index.d.ts.map +0 -1
  326. package/dest/storage/contract_data_provider/index.js +0 -1
  327. package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +0 -1
  328. package/dest/storage/note_data_provider/index.d.ts +0 -3
  329. package/dest/storage/note_data_provider/index.d.ts.map +0 -1
  330. package/dest/storage/note_data_provider/index.js +0 -2
  331. package/dest/storage/note_data_provider/note_data_provider.d.ts +0 -83
  332. package/dest/storage/note_data_provider/note_data_provider.d.ts.map +0 -1
  333. package/dest/storage/note_data_provider/note_data_provider.js +0 -311
  334. package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +0 -37
  335. package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts.map +0 -1
  336. package/dest/storage/private_event_data_provider/private_event_data_provider.js +0 -105
  337. package/dest/storage/sync_data_provider/index.d.ts.map +0 -1
  338. package/dest/storage/sync_data_provider/index.js +0 -1
  339. package/dest/storage/sync_data_provider/sync_data_provider.d.ts.map +0 -1
  340. package/dest/storage/tagging_data_provider/index.d.ts +0 -2
  341. package/dest/storage/tagging_data_provider/index.d.ts.map +0 -1
  342. package/dest/storage/tagging_data_provider/index.js +0 -1
  343. package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts +0 -40
  344. package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts.map +0 -1
  345. package/dest/storage/tagging_data_provider/tagging_data_provider.js +0 -89
  346. package/dest/synchronizer/index.d.ts +0 -2
  347. package/dest/synchronizer/index.d.ts.map +0 -1
  348. package/dest/synchronizer/index.js +0 -1
  349. package/dest/synchronizer/synchronizer.d.ts +0 -35
  350. package/dest/synchronizer/synchronizer.d.ts.map +0 -1
  351. package/dest/synchronizer/synchronizer.js +0 -101
  352. package/dest/tagging/siloed_tag.d.ts +0 -14
  353. package/dest/tagging/siloed_tag.d.ts.map +0 -1
  354. package/dest/tagging/siloed_tag.js +0 -20
  355. package/dest/tagging/tag.d.ts +0 -12
  356. package/dest/tagging/tag.d.ts.map +0 -1
  357. package/dest/tagging/tag.js +0 -17
  358. package/dest/tagging/utils.d.ts +0 -18
  359. package/dest/tagging/utils.d.ts.map +0 -1
  360. package/dest/tagging/utils.js +0 -24
  361. package/src/contract_function_simulator/execution_data_provider.ts +0 -333
  362. package/src/contract_function_simulator/proxied_node.ts +0 -33
  363. package/src/contract_function_simulator/pxe_oracle_interface.ts +0 -1008
  364. package/src/private_kernel/private_kernel_oracle_impl.ts +0 -132
  365. package/src/storage/address_data_provider/index.ts +0 -1
  366. package/src/storage/capsule_data_provider/capsule_data_provider.ts +0 -147
  367. package/src/storage/capsule_data_provider/index.ts +0 -1
  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 -399
  371. package/src/storage/private_event_data_provider/private_event_data_provider.ts +0 -143
  372. package/src/storage/sync_data_provider/index.ts +0 -1
  373. package/src/storage/tagging_data_provider/index.ts +0 -1
  374. package/src/storage/tagging_data_provider/tagging_data_provider.ts +0 -120
  375. package/src/synchronizer/index.ts +0 -1
  376. package/src/synchronizer/synchronizer.ts +0 -120
  377. package/src/tagging/siloed_tag.ts +0 -22
  378. package/src/tagging/tag.ts +0 -16
  379. package/src/tagging/utils.ts +0 -31
@@ -0,0 +1,220 @@
1
+ import type { Fr } from '@aztec/foundation/curves/bn254';
2
+ import { createLogger } from '@aztec/foundation/log';
3
+ import type { KeyStore } from '@aztec/key-store';
4
+ import { AztecAddress } from '@aztec/stdlib/aztec-address';
5
+ import type { CompleteAddress } from '@aztec/stdlib/contract';
6
+ import type { AztecNode } from '@aztec/stdlib/interfaces/server';
7
+ import { DirectionalAppTaggingSecret, PendingTaggedLog, SiloedTag, Tag, TxScopedL2Log } from '@aztec/stdlib/logs';
8
+
9
+ import type { LogRetrievalRequest } from '../contract_function_simulator/noir-structs/log_retrieval_request.js';
10
+ import { LogRetrievalResponse } from '../contract_function_simulator/noir-structs/log_retrieval_response.js';
11
+ import { AddressStore } from '../storage/address_store/address_store.js';
12
+ import { AnchorBlockStore } from '../storage/anchor_block_store/anchor_block_store.js';
13
+ import { CapsuleStore } from '../storage/capsule_store/capsule_store.js';
14
+ import type { RecipientTaggingStore } from '../storage/tagging_store/recipient_tagging_store.js';
15
+ import type { SenderAddressBookStore } from '../storage/tagging_store/sender_address_book_store.js';
16
+ import {
17
+ getAllPrivateLogsByTags,
18
+ getAllPublicLogsByTagsFromContract,
19
+ loadPrivateLogsForSenderRecipientPair,
20
+ } from '../tagging/index.js';
21
+
22
+ export class LogService {
23
+ private log = createLogger('log_service');
24
+
25
+ constructor(
26
+ private readonly aztecNode: AztecNode,
27
+ private readonly anchorBlockStore: AnchorBlockStore,
28
+ private readonly keyStore: KeyStore,
29
+ private readonly capsuleStore: CapsuleStore,
30
+ private readonly recipientTaggingStore: RecipientTaggingStore,
31
+ private readonly senderAddressBookStore: SenderAddressBookStore,
32
+ private readonly addressStore: AddressStore,
33
+ private readonly jobId: string,
34
+ ) {}
35
+
36
+ public async bulkRetrieveLogs(logRetrievalRequests: LogRetrievalRequest[]): Promise<(LogRetrievalResponse | null)[]> {
37
+ return await Promise.all(
38
+ logRetrievalRequests.map(async request => {
39
+ const [publicLog, privateLog] = await Promise.all([
40
+ this.#getPublicLogByTag(request.tag, request.contractAddress),
41
+ this.#getPrivateLogByTag(await SiloedTag.compute(request.tag, request.contractAddress)),
42
+ ]);
43
+
44
+ if (publicLog !== null && privateLog !== null) {
45
+ throw new Error(
46
+ `Found both a public and private log when searching for tag ${request.tag} from contract ${request.contractAddress}`,
47
+ );
48
+ }
49
+
50
+ return publicLog ?? privateLog;
51
+ }),
52
+ );
53
+ }
54
+
55
+ async #getPublicLogByTag(tag: Tag, contractAddress: AztecAddress): Promise<LogRetrievalResponse | null> {
56
+ const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
57
+ const anchorBlockHash = await anchorBlockHeader.hash();
58
+ const allLogsPerTag = await getAllPublicLogsByTagsFromContract(
59
+ this.aztecNode,
60
+ contractAddress,
61
+ [tag],
62
+ anchorBlockHash,
63
+ );
64
+ const logsForTag = allLogsPerTag[0];
65
+
66
+ if (logsForTag.length === 0) {
67
+ return null;
68
+ } else if (logsForTag.length > 1) {
69
+ // TODO(#11627): handle this case
70
+ throw new Error(
71
+ `Got ${logsForTag.length} logs for tag ${tag} and contract ${contractAddress.toString()}. getPublicLogByTag currently only supports a single log per tag`,
72
+ );
73
+ }
74
+
75
+ const scopedLog = logsForTag[0];
76
+
77
+ return new LogRetrievalResponse(
78
+ scopedLog.logData.slice(1), // Skip the tag
79
+ scopedLog.txHash,
80
+ scopedLog.noteHashes,
81
+ scopedLog.firstNullifier,
82
+ );
83
+ }
84
+
85
+ async #getPrivateLogByTag(siloedTag: SiloedTag): Promise<LogRetrievalResponse | null> {
86
+ const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
87
+ const anchorBlockHash = await anchorBlockHeader.hash();
88
+ const allLogsPerTag = await getAllPrivateLogsByTags(this.aztecNode, [siloedTag], anchorBlockHash);
89
+ const logsForTag = allLogsPerTag[0];
90
+
91
+ if (logsForTag.length === 0) {
92
+ return null;
93
+ } else if (logsForTag.length > 1) {
94
+ // TODO(#11627): handle this case
95
+ throw new Error(
96
+ `Got ${logsForTag.length} logs for tag ${siloedTag}. getPrivateLogByTag currently only supports a single log per tag`,
97
+ );
98
+ }
99
+
100
+ const scopedLog = logsForTag[0];
101
+
102
+ return new LogRetrievalResponse(
103
+ scopedLog.logData.slice(1), // Skip the tag
104
+ scopedLog.txHash,
105
+ scopedLog.noteHashes,
106
+ scopedLog.firstNullifier,
107
+ );
108
+ }
109
+
110
+ public async syncTaggedLogs(
111
+ contractAddress: AztecAddress,
112
+ pendingTaggedLogArrayBaseSlot: Fr,
113
+ scopes?: AztecAddress[],
114
+ ) {
115
+ this.log.verbose('Searching for tagged logs', { contract: contractAddress });
116
+
117
+ // We only load logs from block up to and including the anchor block number
118
+ const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
119
+ const anchorBlockNumber = anchorBlockHeader.getBlockNumber();
120
+ const anchorBlockHash = await anchorBlockHeader.hash();
121
+
122
+ // Determine recipients: use scopes if provided, otherwise get all accounts
123
+ const recipients = scopes && scopes.length > 0 ? scopes : await this.keyStore.getAccounts();
124
+
125
+ // For each recipient, fetch secrets, load logs, and store them.
126
+ // We run these per-recipient tasks in parallel so that logs are loaded for all recipients concurrently.
127
+ await Promise.all(
128
+ recipients.map(async recipient => {
129
+ // Get all secrets for this recipient (one per sender)
130
+ const secrets = await this.#getSecretsForSenders(contractAddress, recipient);
131
+
132
+ // Load logs for all sender-recipient pairs in parallel
133
+ const logArrays = await Promise.all(
134
+ secrets.map(secret =>
135
+ loadPrivateLogsForSenderRecipientPair(
136
+ secret,
137
+ contractAddress,
138
+ this.aztecNode,
139
+ this.recipientTaggingStore,
140
+ anchorBlockNumber,
141
+ anchorBlockHash,
142
+ this.jobId,
143
+ ),
144
+ ),
145
+ );
146
+
147
+ // Flatten all logs from all secrets
148
+ const allLogs = logArrays.flat();
149
+
150
+ // Store the logs for this recipient
151
+ if (allLogs.length > 0) {
152
+ await this.#storePendingTaggedLogs(contractAddress, pendingTaggedLogArrayBaseSlot, recipient, allLogs);
153
+ }
154
+ }),
155
+ );
156
+ }
157
+
158
+ async #getSecretsForSenders(
159
+ contractAddress: AztecAddress,
160
+ recipient: AztecAddress,
161
+ ): Promise<DirectionalAppTaggingSecret[]> {
162
+ const recipientCompleteAddress = await this.#getCompleteAddress(recipient);
163
+ const recipientIvsk = await this.keyStore.getMasterIncomingViewingSecretKey(recipient);
164
+
165
+ // We implicitly add all PXE accounts as senders, this helps us decrypt tags on notes that we send to ourselves
166
+ // (recipient = us, sender = us)
167
+ const allSenders = [...(await this.senderAddressBookStore.getSenders()), ...(await this.keyStore.getAccounts())];
168
+
169
+ // We deduplicate the senders by adding them to a set and then converting the set back to an array
170
+ const deduplicatedSenders = Array.from(new Set(allSenders.map(sender => sender.toString()))).map(sender =>
171
+ AztecAddress.fromString(sender),
172
+ );
173
+
174
+ return Promise.all(
175
+ deduplicatedSenders.map(sender => {
176
+ return DirectionalAppTaggingSecret.compute(
177
+ recipientCompleteAddress,
178
+ recipientIvsk,
179
+ sender,
180
+ contractAddress,
181
+ recipient,
182
+ );
183
+ }),
184
+ );
185
+ }
186
+
187
+ #storePendingTaggedLogs(
188
+ contractAddress: AztecAddress,
189
+ capsuleArrayBaseSlot: Fr,
190
+ recipient: AztecAddress,
191
+ privateLogs: TxScopedL2Log[],
192
+ ) {
193
+ // Build all pending tagged logs from the scoped logs
194
+ const pendingTaggedLogs = privateLogs.map(scopedLog => {
195
+ const pendingTaggedLog = new PendingTaggedLog(
196
+ scopedLog.logData,
197
+ scopedLog.txHash,
198
+ scopedLog.noteHashes,
199
+ scopedLog.firstNullifier,
200
+ recipient,
201
+ );
202
+
203
+ return pendingTaggedLog.toFields();
204
+ });
205
+
206
+ // TODO: This looks like it could belong more at the oracle interface level
207
+ return this.capsuleStore.appendToCapsuleArray(contractAddress, capsuleArrayBaseSlot, pendingTaggedLogs, this.jobId);
208
+ }
209
+
210
+ async #getCompleteAddress(account: AztecAddress): Promise<CompleteAddress> {
211
+ const completeAddress = await this.addressStore.getCompleteAddress(account);
212
+ if (!completeAddress) {
213
+ throw new Error(
214
+ `No public key registered for address ${account}.
215
+ Register it by calling pxe.addAccount(...).\nSee docs for context: https://docs.aztec.network/developers/resources/debugging/aztecnr-errors#simulation-error-no-public-key-registered-for-address-0x0-register-it-by-calling-pxeregisterrecipient-or-pxeregisteraccount`,
216
+ );
217
+ }
218
+ return completeAddress;
219
+ }
220
+ }
@@ -0,0 +1 @@
1
+ export { NoteService } from './note_service.js';
@@ -0,0 +1,197 @@
1
+ import { Fr } from '@aztec/foundation/curves/bn254';
2
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
3
+ import type { DataInBlock } from '@aztec/stdlib/block';
4
+ import { computeUniqueNoteHash, siloNoteHash, siloNullifier } from '@aztec/stdlib/hash';
5
+ import { type AztecNode, MAX_RPC_LEN } from '@aztec/stdlib/interfaces/client';
6
+ import { Note, NoteDao, NoteStatus } from '@aztec/stdlib/note';
7
+ import { MerkleTreeId } from '@aztec/stdlib/trees';
8
+ import type { TxHash } from '@aztec/stdlib/tx';
9
+
10
+ import type { AnchorBlockStore } from '../storage/anchor_block_store/anchor_block_store.js';
11
+ import type { NoteStore } from '../storage/note_store/note_store.js';
12
+
13
+ export class NoteService {
14
+ constructor(
15
+ private readonly noteStore: NoteStore,
16
+ private readonly aztecNode: AztecNode,
17
+ private readonly anchorBlockStore: AnchorBlockStore,
18
+ private readonly jobId: string,
19
+ ) {}
20
+
21
+ /**
22
+ * Retrieves a set of notes stored in the database for a given contract address and storage slot.
23
+ * The query result is paginated using 'limit' and 'offset' values.
24
+ * Returns an object containing an array of note data.
25
+ *
26
+ * @param owner - The owner of the notes. If undefined, returns notes for all known owners.
27
+ * @param status - The status of notes to fetch.
28
+ * @param scopes - The accounts whose notes we can access in this call. Currently optional and will default to all.
29
+ */
30
+ public async getNotes(
31
+ contractAddress: AztecAddress,
32
+ owner: AztecAddress | undefined,
33
+ storageSlot: Fr,
34
+ status: NoteStatus,
35
+ scopes?: AztecAddress[],
36
+ ) {
37
+ const noteDaos = await this.noteStore.getNotes(
38
+ {
39
+ contractAddress,
40
+ owner,
41
+ storageSlot,
42
+ status,
43
+ scopes,
44
+ },
45
+ this.jobId,
46
+ );
47
+ return noteDaos.map(
48
+ ({ contractAddress, owner, storageSlot, randomness, noteNonce, note, noteHash, siloedNullifier }) => ({
49
+ contractAddress,
50
+ owner,
51
+ storageSlot,
52
+ randomness,
53
+ noteNonce,
54
+ note,
55
+ noteHash,
56
+ isPending: false, // Note service deals only with settled notes
57
+ siloedNullifier,
58
+ }),
59
+ );
60
+ }
61
+
62
+ /**
63
+ * Looks for nullifiers of active contract notes and marks them as nullified if a nullifier is found.
64
+ *
65
+ * Fetches notes from the NoteStore and checks which nullifiers are present in the
66
+ * onchain nullifier Merkle tree - up to the latest locally synced block. We use the
67
+ * locally synced block instead of querying the chain's 'latest' block to ensure correctness:
68
+ * notes are only marked nullified once their corresponding nullifier has been included in a
69
+ * block up to which the PXE has synced.
70
+ * This allows recent nullifications to be processed even if the node is not an archive node.
71
+ *
72
+ * @param contractAddress - The contract whose notes should be checked and nullified.
73
+ */
74
+ public async syncNoteNullifiers(contractAddress: AztecAddress): Promise<void> {
75
+ const anchorBlockHash = await (await this.anchorBlockStore.getBlockHeader()).hash();
76
+
77
+ const contractNotes = await this.noteStore.getNotes({ contractAddress }, this.jobId);
78
+
79
+ if (contractNotes.length === 0) {
80
+ return;
81
+ }
82
+
83
+ const nullifiersToCheck = contractNotes.map(note => note.siloedNullifier);
84
+ const nullifierBatches = nullifiersToCheck.reduce(
85
+ (acc, nullifier) => {
86
+ if (acc[acc.length - 1].length < MAX_RPC_LEN) {
87
+ acc[acc.length - 1].push(nullifier);
88
+ } else {
89
+ acc.push([nullifier]);
90
+ }
91
+ return acc;
92
+ },
93
+ [[]] as Fr[][],
94
+ );
95
+ const nullifierIndexes = (
96
+ await Promise.all(
97
+ nullifierBatches.map(batch =>
98
+ this.aztecNode.findLeavesIndexes(anchorBlockHash, MerkleTreeId.NULLIFIER_TREE, batch),
99
+ ),
100
+ )
101
+ ).flat();
102
+
103
+ const foundNullifiers = nullifiersToCheck
104
+ .map((nullifier, i) => {
105
+ if (nullifierIndexes[i] !== undefined) {
106
+ return { ...nullifierIndexes[i], ...{ data: nullifier } } as DataInBlock<Fr>;
107
+ }
108
+ })
109
+ .filter(nullifier => nullifier !== undefined) as DataInBlock<Fr>[];
110
+
111
+ await this.noteStore.applyNullifiers(foundNullifiers, this.jobId);
112
+ }
113
+
114
+ public async validateAndStoreNote(
115
+ contractAddress: AztecAddress,
116
+ owner: AztecAddress,
117
+ storageSlot: Fr,
118
+ randomness: Fr,
119
+ noteNonce: Fr,
120
+ content: Fr[],
121
+ noteHash: Fr,
122
+ nullifier: Fr,
123
+ txHash: TxHash,
124
+ recipient: AztecAddress,
125
+ ): Promise<void> {
126
+ // We are going to store the new note in the NoteStore, which will let us later return it via `getNotes`.
127
+ // There's two things we need to check before we do this however:
128
+ // - we must make sure the note does actually exist in the note hash tree
129
+ // - we need to check if the note has already been nullified
130
+ //
131
+ // Failing to do either of the above would result in circuits getting either non-existent notes and failing to
132
+ // produce inclusion proofs for them, or getting nullified notes and producing duplicate nullifiers, both of which
133
+ // are catastrophic failure modes.
134
+ //
135
+ // Note that adding a note and removing it is *not* equivalent to never adding it in the first place. A nullifier
136
+ // emitted in a block that comes after note creation might result in the note being de-nullified by a chain reorg,
137
+ // so we must store both the note hash and nullifier block information.
138
+
139
+ // We avoid making node queries at 'latest' since we don't want to process notes or nullifiers that only exist ahead
140
+ // in time of the locally synced state.
141
+ // Note that while this technically results in historical queries, we perform it at the latest locally synced block
142
+ // number which *should* be recent enough to be available, even for non-archive nodes.
143
+ // Also note that the note should never be ahead of the synced block here since `fetchTaggedLogs` only processes
144
+ // logs up to the synced block making this only an additional safety check.
145
+ const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
146
+ const anchorBlockNumber = anchorBlockHeader.getBlockNumber();
147
+ const anchorBlockHash = await anchorBlockHeader.hash();
148
+
149
+ // By computing siloed and unique note hashes ourselves we prevent contracts from interfering with the note storage
150
+ // of other contracts, which would constitute a security breach.
151
+ const uniqueNoteHash = await computeUniqueNoteHash(noteNonce, await siloNoteHash(contractAddress, noteHash));
152
+ const siloedNullifier = await siloNullifier(contractAddress, nullifier);
153
+
154
+ const [txEffect, [nullifierIndex]] = await Promise.all([
155
+ this.aztecNode.getTxEffect(txHash),
156
+ this.aztecNode.findLeavesIndexes(anchorBlockHash, MerkleTreeId.NULLIFIER_TREE, [siloedNullifier]),
157
+ ]);
158
+ if (!txEffect) {
159
+ throw new Error(`Could not find tx effect for tx hash ${txHash}`);
160
+ }
161
+
162
+ if (txEffect.l2BlockNumber > anchorBlockNumber) {
163
+ throw new Error(`Could not find tx effect for tx hash ${txHash} as of block number ${anchorBlockNumber}`);
164
+ }
165
+
166
+ // Find the index of the note hash in the noteHashes array to determine note ordering within the tx
167
+ const noteIndexInTx = txEffect.data.noteHashes.findIndex(nh => nh.equals(uniqueNoteHash));
168
+ if (noteIndexInTx === -1) {
169
+ throw new Error(`Note hash ${noteHash} (uniqued as ${uniqueNoteHash}) is not present in tx ${txHash}`);
170
+ }
171
+
172
+ const noteDao = new NoteDao(
173
+ new Note(content),
174
+ contractAddress,
175
+ owner,
176
+ storageSlot,
177
+ randomness,
178
+ noteNonce,
179
+ noteHash,
180
+ siloedNullifier,
181
+ txHash,
182
+ txEffect.l2BlockNumber,
183
+ txEffect.l2BlockHash.toString(),
184
+ txEffect.txIndexInBlock,
185
+ noteIndexInTx,
186
+ );
187
+
188
+ // The note was found by `recipient`, so we use that as the scope when storing the note.
189
+ await this.noteStore.addNotes([noteDao], recipient, this.jobId);
190
+
191
+ if (nullifierIndex !== undefined) {
192
+ // We found nullifier index which implies that the note has already been nullified.
193
+ const { data: _, ...blockHashAndNum } = nullifierIndex;
194
+ await this.noteStore.applyNullifiers([{ data: siloedNullifier, ...blockHashAndNum }], this.jobId);
195
+ }
196
+ }
197
+ }
@@ -4,8 +4,9 @@
4
4
  ///
5
5
  /// @dev Whenever a contract function or Noir test is run, the `utilityAssertCompatibleOracleVersion` oracle is called
6
6
  /// and if the oracle version is incompatible an error is thrown.
7
- export const ORACLE_VERSION = 4;
7
+ export const ORACLE_VERSION = 9;
8
8
 
9
9
  /// This hash is computed as by hashing the Oracle interface and it is used to detect when the Oracle interface changes,
10
- /// which in turn implies that you need to update the ORACLE_VERSION constant.
11
- export const ORACLE_INTERFACE_HASH = 'd1496df59c0b51a481d5ef93f218b5c35ddfce6242da28d60bb5c66386940eac';
10
+ /// which in turn implies that you need to update the ORACLE_VERSION constant in this file and in
11
+ /// `noir-projects/aztec-nr/aztec/src/oracle/version.nr`.
12
+ export const ORACLE_INTERFACE_HASH = '9866cc52510acaef75a3d47a0ed501fd9ff92b9d53b2c8a88c8a3ffd04ced81f';
@@ -1,2 +1,2 @@
1
- export * from './build_private_kernel_reset_private_inputs.js';
1
+ export * from './private_kernel_reset_private_inputs_builder.js';
2
2
  export * from './compute_tx_include_by_timestamp.js';
@@ -9,7 +9,7 @@ import {
9
9
  } from '@aztec/constants';
10
10
  import { makeTuple } from '@aztec/foundation/array';
11
11
  import { padArrayEnd } from '@aztec/foundation/collection';
12
- import type { Fr } from '@aztec/foundation/fields';
12
+ import type { Fr } from '@aztec/foundation/curves/bn254';
13
13
  import { type Tuple, assertLength } from '@aztec/foundation/serialize';
14
14
  import { MembershipWitness } from '@aztec/foundation/trees';
15
15
  import { privateKernelResetDimensionsConfig } from '@aztec/noir-protocol-circuits-types/client';
@@ -138,7 +138,7 @@ export class PrivateKernelResetPrivateInputsBuilder {
138
138
  }
139
139
  }
140
140
 
141
- async build(oracle: PrivateKernelOracle, noteHashLeafIndexMap: Map<bigint, bigint>) {
141
+ async build(oracle: PrivateKernelOracle) {
142
142
  if (privateKernelResetDimensionNames.every(name => !this.requestedDimensions[name])) {
143
143
  throw new Error('Reset is not required.');
144
144
  }
@@ -157,16 +157,6 @@ export class PrivateKernelResetPrivateInputsBuilder {
157
157
  allowRemainder,
158
158
  );
159
159
 
160
- const previousVkMembershipWitness = await oracle.getVkMembershipWitness(
161
- this.previousKernelOutput.verificationKey.keyAsFields,
162
- );
163
- const vkData = new VkData(
164
- this.previousKernelOutput.verificationKey,
165
- Number(previousVkMembershipWitness.leafIndex),
166
- previousVkMembershipWitness.siblingPath,
167
- );
168
- const previousKernelData = new PrivateKernelData(this.previousKernelOutput.publicInputs, vkData);
169
-
170
160
  this.reduceReadRequestActions(
171
161
  this.noteHashResetActions,
172
162
  dimensions.NOTE_HASH_PENDING_READ,
@@ -178,30 +168,51 @@ export class PrivateKernelResetPrivateInputsBuilder {
178
168
  dimensions.NULLIFIER_SETTLED_READ,
179
169
  );
180
170
 
181
- // TODO: Enable padding when we have a better idea what are the final amounts we should pad to.
182
- const paddedSideEffects = PaddedSideEffects.empty();
183
-
184
- return new PrivateKernelResetCircuitPrivateInputs(
185
- previousKernelData,
186
- paddedSideEffects,
187
- new PrivateKernelResetHints(
188
- await buildNoteHashReadRequestHintsFromResetActions(
171
+ // Execute all the expensive node querying operations in parallel.
172
+ const [previousVkMembershipWitness, noteHashReadRequestHints, nullifierReadRequestHints, keyValidationHints] =
173
+ await Promise.all([
174
+ oracle.getVkMembershipWitness(this.previousKernelOutput.verificationKey.keyAsFields),
175
+ buildNoteHashReadRequestHintsFromResetActions<
176
+ typeof MAX_NOTE_HASH_READ_REQUESTS_PER_TX,
177
+ typeof MAX_NOTE_HASH_READ_REQUESTS_PER_TX
178
+ >(
189
179
  oracle,
190
180
  this.previousKernel.validationRequests.noteHashReadRequests,
191
181
  this.previousKernel.end.noteHashes,
192
182
  this.noteHashResetActions,
193
- noteHashLeafIndexMap,
194
183
  ),
195
- await buildNullifierReadRequestHintsFromResetActions(
184
+ buildNullifierReadRequestHintsFromResetActions<
185
+ typeof MAX_NULLIFIER_READ_REQUESTS_PER_TX,
186
+ typeof MAX_NULLIFIER_READ_REQUESTS_PER_TX
187
+ >(
196
188
  { getNullifierMembershipWitness: getNullifierMembershipWitnessResolver(oracle) },
197
189
  this.previousKernel.validationRequests.nullifierReadRequests,
198
190
  this.nullifierResetActions,
199
191
  ),
200
- await getMasterSecretKeysAndAppKeyGenerators(
192
+ getMasterSecretKeysAndAppKeyGenerators(
201
193
  this.previousKernel.validationRequests.scopedKeyValidationRequestsAndGenerators,
202
194
  dimensions.KEY_VALIDATION,
203
195
  oracle,
204
196
  ),
197
+ ]);
198
+
199
+ const vkData = new VkData(
200
+ this.previousKernelOutput.verificationKey,
201
+ Number(previousVkMembershipWitness.leafIndex),
202
+ previousVkMembershipWitness.siblingPath,
203
+ );
204
+ const previousKernelData = new PrivateKernelData(this.previousKernelOutput.publicInputs, vkData);
205
+
206
+ // TODO: Enable padding when we have a better idea what are the final amounts we should pad to.
207
+ const paddedSideEffects = PaddedSideEffects.empty();
208
+
209
+ return new PrivateKernelResetCircuitPrivateInputs(
210
+ previousKernelData,
211
+ paddedSideEffects,
212
+ new PrivateKernelResetHints(
213
+ noteHashReadRequestHints,
214
+ nullifierReadRequestHints,
215
+ keyValidationHints,
205
216
  this.transientDataSquashingHints,
206
217
  ),
207
218
  dimensions,
@@ -1,5 +1,5 @@
1
- import { vkAsFieldsMegaHonk } from '@aztec/foundation/crypto';
2
- import { Fr } from '@aztec/foundation/fields';
1
+ import { vkAsFieldsMegaHonk } from '@aztec/foundation/crypto/keys';
2
+ import { Fr } from '@aztec/foundation/curves/bn254';
3
3
  import { createLogger } from '@aztec/foundation/log';
4
4
  import { pushTestData } from '@aztec/foundation/testing';
5
5
  import { Timer } from '@aztec/foundation/timer';
@@ -28,13 +28,12 @@ import {
28
28
  type PrivateCallExecutionResult,
29
29
  type PrivateExecutionResult,
30
30
  TxRequest,
31
- collectNoteHashLeafIndexMap,
32
31
  collectNoteHashNullifierCounterMap,
33
32
  getFinalMinRevertibleSideEffectCounter,
34
33
  } from '@aztec/stdlib/tx';
35
34
  import { VerificationKeyAsFields, VerificationKeyData, VkData } from '@aztec/stdlib/vks';
36
35
 
37
- import { PrivateKernelResetPrivateInputsBuilder } from './hints/build_private_kernel_reset_private_inputs.js';
36
+ import { PrivateKernelResetPrivateInputsBuilder } from './hints/private_kernel_reset_private_inputs_builder.js';
38
37
  import type { PrivateKernelOracle } from './private_kernel_oracle.js';
39
38
 
40
39
  const NULL_SIMULATE_OUTPUT: PrivateKernelSimulateOutput<PrivateKernelCircuitPublicInputs> = {
@@ -101,7 +100,6 @@ export class PrivateKernelExecutionProver {
101
100
 
102
101
  const executionSteps: PrivateExecutionStep[] = [];
103
102
 
104
- const noteHashLeafIndexMap = collectNoteHashLeafIndexMap(executionResult);
105
103
  const noteHashNullifierCounterMap = collectNoteHashNullifierCounterMap(executionResult);
106
104
  const minRevertibleSideEffectCounter = getFinalMinRevertibleSideEffectCounter(executionResult);
107
105
  const splitCounter = isPrivateOnlyTx ? 0 : minRevertibleSideEffectCounter;
@@ -116,7 +114,7 @@ export class PrivateKernelExecutionProver {
116
114
  );
117
115
  while (resetBuilder.needsReset()) {
118
116
  const witgenTimer = new Timer();
119
- const privateInputs = await resetBuilder.build(this.oracle, noteHashLeafIndexMap);
117
+ const privateInputs = await resetBuilder.build(this.oracle);
120
118
  output = generateWitnesses
121
119
  ? await this.proofCreator.generateResetOutput(privateInputs)
122
120
  : await this.proofCreator.simulateReset(privateInputs);
@@ -224,7 +222,7 @@ export class PrivateKernelExecutionProver {
224
222
  );
225
223
  while (resetBuilder.needsReset()) {
226
224
  const witgenTimer = new Timer();
227
- const privateInputs = await resetBuilder.build(this.oracle, noteHashLeafIndexMap);
225
+ const privateInputs = await resetBuilder.build(this.oracle);
228
226
  output = generateWitnesses
229
227
  ? await this.proofCreator.generateResetOutput(privateInputs)
230
228
  : await this.proofCreator.simulateReset(privateInputs);
@@ -290,8 +288,8 @@ export class PrivateKernelExecutionProver {
290
288
  },
291
289
  });
292
290
 
293
- // Hiding circuit is only executed if we are generating witnesses.
294
- // For simulation, we can end with the tail, since the hiding circuit will simply return the same tail output.
291
+ // Hiding kernel is only executed if we are generating witnesses.
292
+ // For simulation, we can end with the tail, since the Hiding kernel will simply return the same tail output.
295
293
  if (generateWitnesses) {
296
294
  const previousKernelVkData = await this.getVkData(tailOutput.verificationKey);
297
295
 
@@ -415,6 +413,7 @@ export class PrivateKernelExecutionProver {
415
413
  await this.oracle.getContractClassIdPreimage(currentContractClassId);
416
414
 
417
415
  const updatedClassIdHints = await this.oracle.getUpdatedClassIdHints(contractAddress);
416
+
418
417
  return PrivateCallData.from({
419
418
  publicInputs,
420
419
  vk,