@aztec/pxe 0.0.1-commit.d3ec352c → 0.0.1-commit.e6bd8901

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 -12
  19. package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
  20. package/dest/contract_function_simulator/execution_note_cache.js +48 -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 +3 -3
  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 +1 -1
  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 +20 -16
  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 +10 -8
  52. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
  53. package/dest/contract_function_simulator/oracle/oracle.js +58 -36
  54. package/dest/contract_function_simulator/oracle/private_execution.d.ts +2 -28
  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 +33 -25
  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 +43 -45
  60. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +75 -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 +170 -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 +56 -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 +129 -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 +149 -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 +186 -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 -4
  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 +18 -18
  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 -29
  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 +2 -2
  237. package/src/contract_function_simulator/noir-structs/utility_context.ts +6 -25
  238. package/src/contract_function_simulator/oracle/interfaces.ts +25 -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 +74 -45
  242. package/src/contract_function_simulator/oracle/private_execution.ts +2 -69
  243. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +126 -59
  244. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +259 -81
  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 +100 -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 +221 -0
  262. package/src/notes/index.ts +1 -0
  263. package/src/notes/note_service.ts +198 -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 +7 -9
  268. package/src/private_kernel/private_kernel_oracle.ts +118 -37
  269. package/src/pxe.ts +258 -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 -12
  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 -267
  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 -123
  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 -696
  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 -314
  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 -36
  350. package/dest/synchronizer/synchronizer.d.ts.map +0 -1
  351. package/dest/synchronizer/synchronizer.js +0 -102
  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 -342
  362. package/src/contract_function_simulator/proxied_node.ts +0 -33
  363. package/src/contract_function_simulator/pxe_oracle_interface.ts +0 -1023
  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 -403
  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 -121
  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,221 @@
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 { L2BlockHash } from '@aztec/stdlib/block';
6
+ import type { CompleteAddress } from '@aztec/stdlib/contract';
7
+ import type { AztecNode } from '@aztec/stdlib/interfaces/server';
8
+ import { DirectionalAppTaggingSecret, PendingTaggedLog, SiloedTag, Tag, TxScopedL2Log } from '@aztec/stdlib/logs';
9
+
10
+ import type { LogRetrievalRequest } from '../contract_function_simulator/noir-structs/log_retrieval_request.js';
11
+ import { LogRetrievalResponse } from '../contract_function_simulator/noir-structs/log_retrieval_response.js';
12
+ import { AddressStore } from '../storage/address_store/address_store.js';
13
+ import { AnchorBlockStore } from '../storage/anchor_block_store/anchor_block_store.js';
14
+ import { CapsuleStore } from '../storage/capsule_store/capsule_store.js';
15
+ import type { RecipientTaggingStore } from '../storage/tagging_store/recipient_tagging_store.js';
16
+ import type { SenderAddressBookStore } from '../storage/tagging_store/sender_address_book_store.js';
17
+ import {
18
+ getAllPrivateLogsByTags,
19
+ getAllPublicLogsByTagsFromContract,
20
+ loadPrivateLogsForSenderRecipientPair,
21
+ } from '../tagging/index.js';
22
+
23
+ export class LogService {
24
+ private log = createLogger('log_service');
25
+
26
+ constructor(
27
+ private readonly aztecNode: AztecNode,
28
+ private readonly anchorBlockStore: AnchorBlockStore,
29
+ private readonly keyStore: KeyStore,
30
+ private readonly capsuleStore: CapsuleStore,
31
+ private readonly recipientTaggingStore: RecipientTaggingStore,
32
+ private readonly senderAddressBookStore: SenderAddressBookStore,
33
+ private readonly addressStore: AddressStore,
34
+ private readonly jobId: string,
35
+ ) {}
36
+
37
+ public async bulkRetrieveLogs(logRetrievalRequests: LogRetrievalRequest[]): Promise<(LogRetrievalResponse | null)[]> {
38
+ return await Promise.all(
39
+ logRetrievalRequests.map(async request => {
40
+ const [publicLog, privateLog] = await Promise.all([
41
+ this.#getPublicLogByTag(request.tag, request.contractAddress),
42
+ this.#getPrivateLogByTag(await SiloedTag.compute(request.tag, request.contractAddress)),
43
+ ]);
44
+
45
+ if (publicLog !== null && privateLog !== null) {
46
+ throw new Error(
47
+ `Found both a public and private log when searching for tag ${request.tag} from contract ${request.contractAddress}`,
48
+ );
49
+ }
50
+
51
+ return publicLog ?? privateLog;
52
+ }),
53
+ );
54
+ }
55
+
56
+ async #getPublicLogByTag(tag: Tag, contractAddress: AztecAddress): Promise<LogRetrievalResponse | null> {
57
+ const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
58
+ const anchorBlockHash = L2BlockHash.fromField(await anchorBlockHeader.hash());
59
+ const allLogsPerTag = await getAllPublicLogsByTagsFromContract(
60
+ this.aztecNode,
61
+ contractAddress,
62
+ [tag],
63
+ anchorBlockHash,
64
+ );
65
+ const logsForTag = allLogsPerTag[0];
66
+
67
+ if (logsForTag.length === 0) {
68
+ return null;
69
+ } else if (logsForTag.length > 1) {
70
+ // TODO(#11627): handle this case
71
+ throw new Error(
72
+ `Got ${logsForTag.length} logs for tag ${tag} and contract ${contractAddress.toString()}. getPublicLogByTag currently only supports a single log per tag`,
73
+ );
74
+ }
75
+
76
+ const scopedLog = logsForTag[0];
77
+
78
+ return new LogRetrievalResponse(
79
+ scopedLog.logData.slice(1), // Skip the tag
80
+ scopedLog.txHash,
81
+ scopedLog.noteHashes,
82
+ scopedLog.firstNullifier,
83
+ );
84
+ }
85
+
86
+ async #getPrivateLogByTag(siloedTag: SiloedTag): Promise<LogRetrievalResponse | null> {
87
+ const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
88
+ const anchorBlockHash = L2BlockHash.fromField(await anchorBlockHeader.hash());
89
+ const allLogsPerTag = await getAllPrivateLogsByTags(this.aztecNode, [siloedTag], anchorBlockHash);
90
+ const logsForTag = allLogsPerTag[0];
91
+
92
+ if (logsForTag.length === 0) {
93
+ return null;
94
+ } else if (logsForTag.length > 1) {
95
+ // TODO(#11627): handle this case
96
+ throw new Error(
97
+ `Got ${logsForTag.length} logs for tag ${siloedTag}. getPrivateLogByTag currently only supports a single log per tag`,
98
+ );
99
+ }
100
+
101
+ const scopedLog = logsForTag[0];
102
+
103
+ return new LogRetrievalResponse(
104
+ scopedLog.logData.slice(1), // Skip the tag
105
+ scopedLog.txHash,
106
+ scopedLog.noteHashes,
107
+ scopedLog.firstNullifier,
108
+ );
109
+ }
110
+
111
+ public async syncTaggedLogs(
112
+ contractAddress: AztecAddress,
113
+ pendingTaggedLogArrayBaseSlot: Fr,
114
+ scopes?: AztecAddress[],
115
+ ) {
116
+ this.log.verbose('Searching for tagged logs', { contract: contractAddress });
117
+
118
+ // We only load logs from block up to and including the anchor block number
119
+ const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
120
+ const anchorBlockNumber = anchorBlockHeader.getBlockNumber();
121
+ const anchorBlockHash = L2BlockHash.fromField(await anchorBlockHeader.hash());
122
+
123
+ // Determine recipients: use scopes if provided, otherwise get all accounts
124
+ const recipients = scopes && scopes.length > 0 ? scopes : await this.keyStore.getAccounts();
125
+
126
+ // For each recipient, fetch secrets, load logs, and store them.
127
+ // We run these per-recipient tasks in parallel so that logs are loaded for all recipients concurrently.
128
+ await Promise.all(
129
+ recipients.map(async recipient => {
130
+ // Get all secrets for this recipient (one per sender)
131
+ const secrets = await this.#getSecretsForSenders(contractAddress, recipient);
132
+
133
+ // Load logs for all sender-recipient pairs in parallel
134
+ const logArrays = await Promise.all(
135
+ secrets.map(secret =>
136
+ loadPrivateLogsForSenderRecipientPair(
137
+ secret,
138
+ contractAddress,
139
+ this.aztecNode,
140
+ this.recipientTaggingStore,
141
+ anchorBlockNumber,
142
+ anchorBlockHash,
143
+ this.jobId,
144
+ ),
145
+ ),
146
+ );
147
+
148
+ // Flatten all logs from all secrets
149
+ const allLogs = logArrays.flat();
150
+
151
+ // Store the logs for this recipient
152
+ if (allLogs.length > 0) {
153
+ await this.#storePendingTaggedLogs(contractAddress, pendingTaggedLogArrayBaseSlot, recipient, allLogs);
154
+ }
155
+ }),
156
+ );
157
+ }
158
+
159
+ async #getSecretsForSenders(
160
+ contractAddress: AztecAddress,
161
+ recipient: AztecAddress,
162
+ ): Promise<DirectionalAppTaggingSecret[]> {
163
+ const recipientCompleteAddress = await this.#getCompleteAddress(recipient);
164
+ const recipientIvsk = await this.keyStore.getMasterIncomingViewingSecretKey(recipient);
165
+
166
+ // We implicitly add all PXE accounts as senders, this helps us decrypt tags on notes that we send to ourselves
167
+ // (recipient = us, sender = us)
168
+ const allSenders = [...(await this.senderAddressBookStore.getSenders()), ...(await this.keyStore.getAccounts())];
169
+
170
+ // We deduplicate the senders by adding them to a set and then converting the set back to an array
171
+ const deduplicatedSenders = Array.from(new Set(allSenders.map(sender => sender.toString()))).map(sender =>
172
+ AztecAddress.fromString(sender),
173
+ );
174
+
175
+ return Promise.all(
176
+ deduplicatedSenders.map(sender => {
177
+ return DirectionalAppTaggingSecret.compute(
178
+ recipientCompleteAddress,
179
+ recipientIvsk,
180
+ sender,
181
+ contractAddress,
182
+ recipient,
183
+ );
184
+ }),
185
+ );
186
+ }
187
+
188
+ #storePendingTaggedLogs(
189
+ contractAddress: AztecAddress,
190
+ capsuleArrayBaseSlot: Fr,
191
+ recipient: AztecAddress,
192
+ privateLogs: TxScopedL2Log[],
193
+ ) {
194
+ // Build all pending tagged logs from the scoped logs
195
+ const pendingTaggedLogs = privateLogs.map(scopedLog => {
196
+ const pendingTaggedLog = new PendingTaggedLog(
197
+ scopedLog.logData,
198
+ scopedLog.txHash,
199
+ scopedLog.noteHashes,
200
+ scopedLog.firstNullifier,
201
+ recipient,
202
+ );
203
+
204
+ return pendingTaggedLog.toFields();
205
+ });
206
+
207
+ // TODO: This looks like it could belong more at the oracle interface level
208
+ return this.capsuleStore.appendToCapsuleArray(contractAddress, capsuleArrayBaseSlot, pendingTaggedLogs, this.jobId);
209
+ }
210
+
211
+ async #getCompleteAddress(account: AztecAddress): Promise<CompleteAddress> {
212
+ const completeAddress = await this.addressStore.getCompleteAddress(account);
213
+ if (!completeAddress) {
214
+ throw new Error(
215
+ `No public key registered for address ${account}.
216
+ 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`,
217
+ );
218
+ }
219
+ return completeAddress;
220
+ }
221
+ }
@@ -0,0 +1 @@
1
+ export { NoteService } from './note_service.js';
@@ -0,0 +1,198 @@
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 { L2BlockHash } from '@aztec/stdlib/block';
5
+ import { computeUniqueNoteHash, siloNoteHash, siloNullifier } from '@aztec/stdlib/hash';
6
+ import { type AztecNode, MAX_RPC_LEN } from '@aztec/stdlib/interfaces/client';
7
+ import { Note, NoteDao, NoteStatus } from '@aztec/stdlib/note';
8
+ import { MerkleTreeId } from '@aztec/stdlib/trees';
9
+ import type { TxHash } from '@aztec/stdlib/tx';
10
+
11
+ import type { AnchorBlockStore } from '../storage/anchor_block_store/anchor_block_store.js';
12
+ import type { NoteStore } from '../storage/note_store/note_store.js';
13
+
14
+ export class NoteService {
15
+ constructor(
16
+ private readonly noteStore: NoteStore,
17
+ private readonly aztecNode: AztecNode,
18
+ private readonly anchorBlockStore: AnchorBlockStore,
19
+ private readonly jobId: string,
20
+ ) {}
21
+
22
+ /**
23
+ * Retrieves a set of notes stored in the database for a given contract address and storage slot.
24
+ * The query result is paginated using 'limit' and 'offset' values.
25
+ * Returns an object containing an array of note data.
26
+ *
27
+ * @param owner - The owner of the notes. If undefined, returns notes for all known owners.
28
+ * @param status - The status of notes to fetch.
29
+ * @param scopes - The accounts whose notes we can access in this call. Currently optional and will default to all.
30
+ */
31
+ public async getNotes(
32
+ contractAddress: AztecAddress,
33
+ owner: AztecAddress | undefined,
34
+ storageSlot: Fr,
35
+ status: NoteStatus,
36
+ scopes?: AztecAddress[],
37
+ ) {
38
+ const noteDaos = await this.noteStore.getNotes(
39
+ {
40
+ contractAddress,
41
+ owner,
42
+ storageSlot,
43
+ status,
44
+ scopes,
45
+ },
46
+ this.jobId,
47
+ );
48
+ return noteDaos.map(
49
+ ({ contractAddress, owner, storageSlot, randomness, noteNonce, note, noteHash, siloedNullifier }) => ({
50
+ contractAddress,
51
+ owner,
52
+ storageSlot,
53
+ randomness,
54
+ noteNonce,
55
+ note,
56
+ noteHash,
57
+ isPending: false, // Note service deals only with settled notes
58
+ siloedNullifier,
59
+ }),
60
+ );
61
+ }
62
+
63
+ /**
64
+ * Looks for nullifiers of active contract notes and marks them as nullified if a nullifier is found.
65
+ *
66
+ * Fetches notes from the NoteStore and checks which nullifiers are present in the
67
+ * onchain nullifier Merkle tree - up to the latest locally synced block. We use the
68
+ * locally synced block instead of querying the chain's 'latest' block to ensure correctness:
69
+ * notes are only marked nullified once their corresponding nullifier has been included in a
70
+ * block up to which the PXE has synced.
71
+ * This allows recent nullifications to be processed even if the node is not an archive node.
72
+ *
73
+ * @param contractAddress - The contract whose notes should be checked and nullified.
74
+ */
75
+ public async syncNoteNullifiers(contractAddress: AztecAddress): Promise<void> {
76
+ const anchorBlockHash = L2BlockHash.fromField(await (await this.anchorBlockStore.getBlockHeader()).hash());
77
+
78
+ const contractNotes = await this.noteStore.getNotes({ contractAddress }, this.jobId);
79
+
80
+ if (contractNotes.length === 0) {
81
+ return;
82
+ }
83
+
84
+ const nullifiersToCheck = contractNotes.map(note => note.siloedNullifier);
85
+ const nullifierBatches = nullifiersToCheck.reduce(
86
+ (acc, nullifier) => {
87
+ if (acc[acc.length - 1].length < MAX_RPC_LEN) {
88
+ acc[acc.length - 1].push(nullifier);
89
+ } else {
90
+ acc.push([nullifier]);
91
+ }
92
+ return acc;
93
+ },
94
+ [[]] as Fr[][],
95
+ );
96
+ const nullifierIndexes = (
97
+ await Promise.all(
98
+ nullifierBatches.map(batch =>
99
+ this.aztecNode.findLeavesIndexes(anchorBlockHash, MerkleTreeId.NULLIFIER_TREE, batch),
100
+ ),
101
+ )
102
+ ).flat();
103
+
104
+ const foundNullifiers = nullifiersToCheck
105
+ .map((nullifier, i) => {
106
+ if (nullifierIndexes[i] !== undefined) {
107
+ return { ...nullifierIndexes[i], ...{ data: nullifier } } as DataInBlock<Fr>;
108
+ }
109
+ })
110
+ .filter(nullifier => nullifier !== undefined) as DataInBlock<Fr>[];
111
+
112
+ await this.noteStore.applyNullifiers(foundNullifiers, this.jobId);
113
+ }
114
+
115
+ public async validateAndStoreNote(
116
+ contractAddress: AztecAddress,
117
+ owner: AztecAddress,
118
+ storageSlot: Fr,
119
+ randomness: Fr,
120
+ noteNonce: Fr,
121
+ content: Fr[],
122
+ noteHash: Fr,
123
+ nullifier: Fr,
124
+ txHash: TxHash,
125
+ recipient: AztecAddress,
126
+ ): Promise<void> {
127
+ // We are going to store the new note in the NoteStore, which will let us later return it via `getNotes`.
128
+ // There's two things we need to check before we do this however:
129
+ // - we must make sure the note does actually exist in the note hash tree
130
+ // - we need to check if the note has already been nullified
131
+ //
132
+ // Failing to do either of the above would result in circuits getting either non-existent notes and failing to
133
+ // produce inclusion proofs for them, or getting nullified notes and producing duplicate nullifiers, both of which
134
+ // are catastrophic failure modes.
135
+ //
136
+ // Note that adding a note and removing it is *not* equivalent to never adding it in the first place. A nullifier
137
+ // emitted in a block that comes after note creation might result in the note being de-nullified by a chain reorg,
138
+ // so we must store both the note hash and nullifier block information.
139
+
140
+ // We avoid making node queries at 'latest' since we don't want to process notes or nullifiers that only exist ahead
141
+ // in time of the locally synced state.
142
+ // Note that while this technically results in historical queries, we perform it at the latest locally synced block
143
+ // number which *should* be recent enough to be available, even for non-archive nodes.
144
+ // Also note that the note should never be ahead of the synced block here since `fetchTaggedLogs` only processes
145
+ // logs up to the synced block making this only an additional safety check.
146
+ const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
147
+ const anchorBlockNumber = anchorBlockHeader.getBlockNumber();
148
+ const anchorBlockHash = L2BlockHash.fromField(await anchorBlockHeader.hash());
149
+
150
+ // By computing siloed and unique note hashes ourselves we prevent contracts from interfering with the note storage
151
+ // of other contracts, which would constitute a security breach.
152
+ const uniqueNoteHash = await computeUniqueNoteHash(noteNonce, await siloNoteHash(contractAddress, noteHash));
153
+ const siloedNullifier = await siloNullifier(contractAddress, nullifier);
154
+
155
+ const [txEffect, [nullifierIndex]] = await Promise.all([
156
+ this.aztecNode.getTxEffect(txHash),
157
+ this.aztecNode.findLeavesIndexes(anchorBlockHash, MerkleTreeId.NULLIFIER_TREE, [siloedNullifier]),
158
+ ]);
159
+ if (!txEffect) {
160
+ throw new Error(`Could not find tx effect for tx hash ${txHash}`);
161
+ }
162
+
163
+ if (txEffect.l2BlockNumber > anchorBlockNumber) {
164
+ throw new Error(`Could not find tx effect for tx hash ${txHash} as of block number ${anchorBlockNumber}`);
165
+ }
166
+
167
+ // Find the index of the note hash in the noteHashes array to determine note ordering within the tx
168
+ const noteIndexInTx = txEffect.data.noteHashes.findIndex(nh => nh.equals(uniqueNoteHash));
169
+ if (noteIndexInTx === -1) {
170
+ throw new Error(`Note hash ${noteHash} (uniqued as ${uniqueNoteHash}) is not present in tx ${txHash}`);
171
+ }
172
+
173
+ const noteDao = new NoteDao(
174
+ new Note(content),
175
+ contractAddress,
176
+ owner,
177
+ storageSlot,
178
+ randomness,
179
+ noteNonce,
180
+ noteHash,
181
+ siloedNullifier,
182
+ txHash,
183
+ txEffect.l2BlockNumber,
184
+ txEffect.l2BlockHash.toString(),
185
+ txEffect.txIndexInBlock,
186
+ noteIndexInTx,
187
+ );
188
+
189
+ // The note was found by `recipient`, so we use that as the scope when storing the note.
190
+ await this.noteStore.addNotes([noteDao], recipient, this.jobId);
191
+
192
+ if (nullifierIndex !== undefined) {
193
+ // We found nullifier index which implies that the note has already been nullified.
194
+ const { data: _, ...blockHashAndNum } = nullifierIndex;
195
+ await this.noteStore.applyNullifiers([{ data: siloedNullifier, ...blockHashAndNum }], this.jobId);
196
+ }
197
+ }
198
+ }
@@ -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