@aztec/pxe 0.0.0-test.0 → 0.0.1-commit.24de95ac

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 (309) hide show
  1. package/README.md +5 -5
  2. package/dest/bin/check_oracle_version.d.ts +2 -0
  3. package/dest/bin/check_oracle_version.d.ts.map +1 -0
  4. package/dest/bin/check_oracle_version.js +39 -0
  5. package/dest/config/index.d.ts +10 -15
  6. package/dest/config/index.d.ts.map +1 -1
  7. package/dest/config/index.js +11 -20
  8. package/dest/config/package_info.js +1 -1
  9. package/dest/contract_function_simulator/contract_function_simulator.d.ts +56 -0
  10. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -0
  11. package/dest/contract_function_simulator/contract_function_simulator.js +301 -0
  12. package/dest/contract_function_simulator/execution_data_provider.d.ts +274 -0
  13. package/dest/contract_function_simulator/execution_data_provider.d.ts.map +1 -0
  14. package/dest/contract_function_simulator/execution_data_provider.js +14 -0
  15. package/dest/contract_function_simulator/execution_note_cache.d.ts +93 -0
  16. package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -0
  17. package/dest/contract_function_simulator/execution_note_cache.js +183 -0
  18. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +16 -0
  19. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -0
  20. package/dest/contract_function_simulator/execution_tagging_index_cache.js +26 -0
  21. package/dest/contract_function_simulator/hashed_values_cache.d.ts +28 -0
  22. package/dest/contract_function_simulator/hashed_values_cache.d.ts.map +1 -0
  23. package/dest/contract_function_simulator/hashed_values_cache.js +36 -0
  24. package/dest/contract_function_simulator/index.d.ts +14 -0
  25. package/dest/contract_function_simulator/index.d.ts.map +1 -0
  26. package/dest/contract_function_simulator/index.js +12 -0
  27. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +20 -0
  28. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -0
  29. package/dest/contract_function_simulator/noir-structs/event_validation_request.js +37 -0
  30. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +15 -0
  31. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts.map +1 -0
  32. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.js +25 -0
  33. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +17 -0
  34. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -0
  35. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +65 -0
  36. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +22 -0
  37. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -0
  38. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +42 -0
  39. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +22 -0
  40. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -0
  41. package/dest/contract_function_simulator/noir-structs/utility_context.js +33 -0
  42. package/dest/contract_function_simulator/oracle/index.d.ts +14 -0
  43. package/dest/contract_function_simulator/oracle/index.d.ts.map +1 -0
  44. package/dest/contract_function_simulator/oracle/index.js +2 -0
  45. package/dest/contract_function_simulator/oracle/interfaces.d.ts +97 -0
  46. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -0
  47. package/dest/contract_function_simulator/oracle/interfaces.js +4 -0
  48. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +19 -0
  49. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -0
  50. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.js +24 -0
  51. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +22 -0
  52. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -0
  53. package/dest/contract_function_simulator/oracle/note_packing_utils.js +49 -0
  54. package/dest/contract_function_simulator/oracle/oracle.d.ts +57 -0
  55. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -0
  56. package/dest/contract_function_simulator/oracle/oracle.js +328 -0
  57. package/dest/contract_function_simulator/oracle/private_execution.d.ts +48 -0
  58. package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -0
  59. package/dest/contract_function_simulator/oracle/private_execution.js +123 -0
  60. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +236 -0
  61. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -0
  62. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +417 -0
  63. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +154 -0
  64. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -0
  65. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +265 -0
  66. package/dest/contract_function_simulator/pick_notes.d.ts +85 -0
  67. package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -0
  68. package/dest/contract_function_simulator/pick_notes.js +51 -0
  69. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +6 -0
  70. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -0
  71. package/dest/contract_function_simulator/proxied_contract_data_source.js +62 -0
  72. package/dest/contract_function_simulator/proxied_node.d.ts +9 -0
  73. package/dest/contract_function_simulator/proxied_node.d.ts.map +1 -0
  74. package/dest/contract_function_simulator/proxied_node.js +27 -0
  75. package/dest/contract_function_simulator/pxe_oracle_interface.d.ts +122 -0
  76. package/dest/contract_function_simulator/pxe_oracle_interface.d.ts.map +1 -0
  77. package/dest/contract_function_simulator/pxe_oracle_interface.js +701 -0
  78. package/dest/entrypoints/client/bundle/index.d.ts +4 -2
  79. package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
  80. package/dest/entrypoints/client/bundle/index.js +3 -2
  81. package/dest/entrypoints/client/bundle/utils.d.ts +9 -9
  82. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  83. package/dest/entrypoints/client/bundle/utils.js +18 -12
  84. package/dest/entrypoints/client/lazy/index.d.ts +4 -2
  85. package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
  86. package/dest/entrypoints/client/lazy/index.js +3 -2
  87. package/dest/entrypoints/client/lazy/utils.d.ts +8 -8
  88. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  89. package/dest/entrypoints/client/lazy/utils.js +17 -11
  90. package/dest/entrypoints/{client/pxe_creation_options.d.ts → pxe_creation_options.d.ts} +4 -1
  91. package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -0
  92. package/dest/entrypoints/server/index.d.ts +5 -3
  93. package/dest/entrypoints/server/index.d.ts.map +1 -1
  94. package/dest/entrypoints/server/index.js +4 -3
  95. package/dest/entrypoints/server/utils.d.ts +7 -15
  96. package/dest/entrypoints/server/utils.d.ts.map +1 -1
  97. package/dest/entrypoints/server/utils.js +34 -28
  98. package/dest/{pxe_service/error_enriching.d.ts → error_enriching.d.ts} +1 -1
  99. package/dest/error_enriching.d.ts.map +1 -0
  100. package/dest/{pxe_service/error_enriching.js → error_enriching.js} +26 -18
  101. package/dest/oracle_version.d.ts +3 -0
  102. package/dest/oracle_version.d.ts.map +1 -0
  103. package/dest/oracle_version.js +10 -0
  104. package/dest/{kernel_prover → private_kernel}/hints/build_private_kernel_reset_private_inputs.d.ts +6 -6
  105. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +1 -0
  106. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.js +271 -0
  107. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +4 -0
  108. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts.map +1 -0
  109. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.js +41 -0
  110. package/dest/private_kernel/hints/index.d.ts +3 -0
  111. package/dest/private_kernel/hints/index.d.ts.map +1 -0
  112. package/dest/{kernel_prover → private_kernel}/hints/index.js +1 -0
  113. package/dest/private_kernel/index.d.ts +3 -0
  114. package/dest/private_kernel/index.d.ts.map +1 -0
  115. package/dest/private_kernel/index.js +2 -0
  116. package/dest/private_kernel/private_kernel_execution_prover.d.ts +44 -0
  117. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -0
  118. package/dest/private_kernel/private_kernel_execution_prover.js +285 -0
  119. package/dest/{kernel_prover/proving_data_oracle.d.ts → private_kernel/private_kernel_oracle.d.ts} +17 -28
  120. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -0
  121. package/dest/private_kernel/private_kernel_oracle.js +4 -0
  122. package/dest/{kernel_oracle/index.d.ts → private_kernel/private_kernel_oracle_impl.d.ts} +8 -8
  123. package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +1 -0
  124. package/dest/{kernel_oracle/index.js → private_kernel/private_kernel_oracle_impl.js} +19 -9
  125. package/dest/pxe.d.ts +233 -0
  126. package/dest/pxe.d.ts.map +1 -0
  127. package/dest/pxe.js +789 -0
  128. package/dest/storage/address_data_provider/address_data_provider.d.ts +1 -3
  129. package/dest/storage/address_data_provider/address_data_provider.d.ts.map +1 -1
  130. package/dest/storage/address_data_provider/address_data_provider.js +0 -3
  131. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts +14 -5
  132. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +1 -1
  133. package/dest/storage/capsule_data_provider/capsule_data_provider.js +85 -24
  134. package/dest/storage/contract_data_provider/contract_data_provider.d.ts +12 -47
  135. package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +1 -1
  136. package/dest/storage/contract_data_provider/contract_data_provider.js +92 -70
  137. package/dest/storage/contract_data_provider/index.d.ts +0 -1
  138. package/dest/storage/contract_data_provider/index.d.ts.map +1 -1
  139. package/dest/storage/contract_data_provider/index.js +0 -1
  140. package/dest/storage/contract_data_provider/private_functions_tree.d.ts +2 -41
  141. package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +1 -1
  142. package/dest/storage/contract_data_provider/private_functions_tree.js +9 -61
  143. package/dest/storage/index.d.ts +2 -3
  144. package/dest/storage/index.d.ts.map +1 -1
  145. package/dest/storage/index.js +2 -3
  146. package/dest/storage/metadata.d.ts +2 -0
  147. package/dest/storage/metadata.d.ts.map +1 -0
  148. package/dest/storage/metadata.js +1 -0
  149. package/dest/storage/note_data_provider/note_dao.d.ts +16 -22
  150. package/dest/storage/note_data_provider/note_dao.d.ts.map +1 -1
  151. package/dest/storage/note_data_provider/note_dao.js +16 -20
  152. package/dest/storage/note_data_provider/note_data_provider.d.ts +71 -8
  153. package/dest/storage/note_data_provider/note_data_provider.d.ts.map +1 -1
  154. package/dest/storage/note_data_provider/note_data_provider.js +133 -74
  155. package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +43 -0
  156. package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts.map +1 -0
  157. package/dest/storage/private_event_data_provider/private_event_data_provider.js +104 -0
  158. package/dest/storage/sync_data_provider/sync_data_provider.d.ts +2 -4
  159. package/dest/storage/sync_data_provider/sync_data_provider.d.ts.map +1 -1
  160. package/dest/storage/sync_data_provider/sync_data_provider.js +2 -5
  161. package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts +28 -6
  162. package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts.map +1 -1
  163. package/dest/storage/tagging_data_provider/tagging_data_provider.js +48 -24
  164. package/dest/synchronizer/synchronizer.d.ts +7 -9
  165. package/dest/synchronizer/synchronizer.d.ts.map +1 -1
  166. package/dest/synchronizer/synchronizer.js +17 -19
  167. package/dest/tagging/constants.d.ts +2 -0
  168. package/dest/tagging/constants.d.ts.map +1 -0
  169. package/dest/tagging/constants.js +2 -0
  170. package/dest/tagging/index.d.ts +7 -0
  171. package/dest/tagging/index.d.ts.map +1 -0
  172. package/dest/tagging/index.js +5 -0
  173. package/dest/tagging/siloed_tag.d.ts +14 -0
  174. package/dest/tagging/siloed_tag.d.ts.map +1 -0
  175. package/dest/tagging/siloed_tag.js +20 -0
  176. package/dest/tagging/tag.d.ts +12 -0
  177. package/dest/tagging/tag.d.ts.map +1 -0
  178. package/dest/tagging/tag.js +17 -0
  179. package/dest/tagging/utils.d.ts +18 -0
  180. package/dest/tagging/utils.d.ts.map +1 -0
  181. package/dest/tagging/utils.js +24 -0
  182. package/package.json +34 -32
  183. package/src/bin/check_oracle_version.ts +50 -0
  184. package/src/config/index.ts +20 -33
  185. package/src/config/package_info.ts +1 -1
  186. package/src/contract_function_simulator/contract_function_simulator.ts +548 -0
  187. package/src/contract_function_simulator/execution_data_provider.ts +343 -0
  188. package/src/contract_function_simulator/execution_note_cache.ts +222 -0
  189. package/src/contract_function_simulator/execution_tagging_index_cache.ts +32 -0
  190. package/src/contract_function_simulator/hashed_values_cache.ts +47 -0
  191. package/src/contract_function_simulator/index.ts +13 -0
  192. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +47 -0
  193. package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +27 -0
  194. package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +69 -0
  195. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +52 -0
  196. package/src/contract_function_simulator/noir-structs/utility_context.ts +42 -0
  197. package/src/contract_function_simulator/oracle/index.ts +16 -0
  198. package/src/contract_function_simulator/oracle/interfaces.ts +160 -0
  199. package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +23 -0
  200. package/src/contract_function_simulator/oracle/note_packing_utils.ts +52 -0
  201. package/src/contract_function_simulator/oracle/oracle.ts +575 -0
  202. package/src/contract_function_simulator/oracle/private_execution.ts +207 -0
  203. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +625 -0
  204. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +358 -0
  205. package/src/contract_function_simulator/pick_notes.ts +141 -0
  206. package/src/contract_function_simulator/proxied_contract_data_source.ts +66 -0
  207. package/src/contract_function_simulator/proxied_node.ts +33 -0
  208. package/src/contract_function_simulator/pxe_oracle_interface.ts +1019 -0
  209. package/src/entrypoints/client/bundle/index.ts +4 -2
  210. package/src/entrypoints/client/bundle/utils.ts +36 -36
  211. package/src/entrypoints/client/lazy/index.ts +4 -2
  212. package/src/entrypoints/client/lazy/utils.ts +36 -31
  213. package/src/entrypoints/{client/pxe_creation_options.ts → pxe_creation_options.ts} +4 -1
  214. package/src/entrypoints/server/index.ts +5 -3
  215. package/src/entrypoints/server/utils.ts +69 -47
  216. package/src/{pxe_service/error_enriching.ts → error_enriching.ts} +36 -27
  217. package/src/oracle_version.ts +11 -0
  218. package/src/{kernel_prover → private_kernel}/hints/build_private_kernel_reset_private_inputs.ts +158 -142
  219. package/src/private_kernel/hints/compute_tx_include_by_timestamp.ts +58 -0
  220. package/src/{kernel_prover → private_kernel}/hints/index.ts +1 -0
  221. package/src/private_kernel/index.ts +2 -0
  222. package/src/private_kernel/private_kernel_execution_prover.ts +436 -0
  223. package/src/{kernel_prover/proving_data_oracle.ts → private_kernel/private_kernel_oracle.ts} +17 -29
  224. package/src/{kernel_oracle/index.ts → private_kernel/private_kernel_oracle_impl.ts} +30 -15
  225. package/src/pxe.ts +1113 -0
  226. package/src/storage/address_data_provider/address_data_provider.ts +1 -7
  227. package/src/storage/capsule_data_provider/capsule_data_provider.ts +97 -30
  228. package/src/storage/contract_data_provider/contract_data_provider.ts +114 -81
  229. package/src/storage/contract_data_provider/index.ts +0 -1
  230. package/src/storage/contract_data_provider/private_functions_tree.ts +11 -75
  231. package/src/storage/index.ts +2 -4
  232. package/src/storage/metadata.ts +1 -0
  233. package/src/storage/note_data_provider/note_dao.ts +19 -27
  234. package/src/storage/note_data_provider/note_data_provider.ts +161 -113
  235. package/src/storage/private_event_data_provider/private_event_data_provider.ts +148 -0
  236. package/src/storage/sync_data_provider/sync_data_provider.ts +4 -10
  237. package/src/storage/tagging_data_provider/tagging_data_provider.ts +58 -30
  238. package/src/synchronizer/synchronizer.ts +21 -22
  239. package/src/tagging/constants.ts +2 -0
  240. package/src/tagging/index.ts +6 -0
  241. package/src/tagging/siloed_tag.ts +22 -0
  242. package/src/tagging/tag.ts +16 -0
  243. package/src/tagging/utils.ts +31 -0
  244. package/dest/bin/index.d.ts +0 -3
  245. package/dest/bin/index.d.ts.map +0 -1
  246. package/dest/bin/index.js +0 -28
  247. package/dest/entrypoints/client/pxe_creation_options.d.ts.map +0 -1
  248. package/dest/kernel_oracle/index.d.ts.map +0 -1
  249. package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.d.ts.map +0 -1
  250. package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.js +0 -270
  251. package/dest/kernel_prover/hints/index.d.ts +0 -2
  252. package/dest/kernel_prover/hints/index.d.ts.map +0 -1
  253. package/dest/kernel_prover/index.d.ts +0 -3
  254. package/dest/kernel_prover/index.d.ts.map +0 -1
  255. package/dest/kernel_prover/index.js +0 -2
  256. package/dest/kernel_prover/kernel_prover.d.ts +0 -38
  257. package/dest/kernel_prover/kernel_prover.d.ts.map +0 -1
  258. package/dest/kernel_prover/kernel_prover.js +0 -217
  259. package/dest/kernel_prover/proving_data_oracle.d.ts.map +0 -1
  260. package/dest/kernel_prover/proving_data_oracle.js +0 -4
  261. package/dest/note_decryption_utils/add_public_values_to_payload.d.ts +0 -11
  262. package/dest/note_decryption_utils/add_public_values_to_payload.d.ts.map +0 -1
  263. package/dest/note_decryption_utils/add_public_values_to_payload.js +0 -47
  264. package/dest/pxe_http/index.d.ts +0 -2
  265. package/dest/pxe_http/index.d.ts.map +0 -1
  266. package/dest/pxe_http/index.js +0 -1
  267. package/dest/pxe_http/pxe_http_server.d.ts +0 -16
  268. package/dest/pxe_http/pxe_http_server.d.ts.map +0 -1
  269. package/dest/pxe_http/pxe_http_server.js +0 -27
  270. package/dest/pxe_oracle_interface/index.d.ts +0 -159
  271. package/dest/pxe_oracle_interface/index.d.ts.map +0 -1
  272. package/dest/pxe_oracle_interface/index.js +0 -692
  273. package/dest/pxe_oracle_interface/tagging_utils.d.ts +0 -17
  274. package/dest/pxe_oracle_interface/tagging_utils.d.ts.map +0 -1
  275. package/dest/pxe_oracle_interface/tagging_utils.js +0 -23
  276. package/dest/pxe_service/error_enriching.d.ts.map +0 -1
  277. package/dest/pxe_service/index.d.ts +0 -3
  278. package/dest/pxe_service/index.d.ts.map +0 -1
  279. package/dest/pxe_service/index.js +0 -2
  280. package/dest/pxe_service/pxe_service.d.ts +0 -111
  281. package/dest/pxe_service/pxe_service.d.ts.map +0 -1
  282. package/dest/pxe_service/pxe_service.js +0 -664
  283. package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.d.ts +0 -11
  284. package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.d.ts.map +0 -1
  285. package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.js +0 -20
  286. package/dest/storage/auth_witness_data_provider/index.d.ts +0 -2
  287. package/dest/storage/auth_witness_data_provider/index.d.ts.map +0 -1
  288. package/dest/storage/auth_witness_data_provider/index.js +0 -1
  289. package/dest/storage/data_provider.d.ts +0 -4
  290. package/dest/storage/data_provider.d.ts.map +0 -1
  291. package/dest/storage/data_provider.js +0 -1
  292. package/dest/test/pxe_test_suite.d.ts +0 -3
  293. package/dest/test/pxe_test_suite.d.ts.map +0 -1
  294. package/dest/test/pxe_test_suite.js +0 -97
  295. package/src/bin/index.ts +0 -38
  296. package/src/kernel_prover/index.ts +0 -2
  297. package/src/kernel_prover/kernel_prover.ts +0 -351
  298. package/src/note_decryption_utils/add_public_values_to_payload.ts +0 -64
  299. package/src/pxe_http/index.ts +0 -1
  300. package/src/pxe_http/pxe_http_server.ts +0 -29
  301. package/src/pxe_oracle_interface/index.ts +0 -925
  302. package/src/pxe_oracle_interface/tagging_utils.ts +0 -32
  303. package/src/pxe_service/index.ts +0 -2
  304. package/src/pxe_service/pxe_service.ts +0 -949
  305. package/src/storage/auth_witness_data_provider/auth_witness_data_provider.ts +0 -34
  306. package/src/storage/auth_witness_data_provider/index.ts +0 -1
  307. package/src/storage/data_provider.ts +0 -3
  308. package/src/test/pxe_test_suite.ts +0 -111
  309. /package/dest/entrypoints/{client/pxe_creation_options.js → pxe_creation_options.js} +0 -0
@@ -1,10 +1,6 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- /// <reference types="node" resolution-mode="require"/>
3
1
  import { FUNCTION_TREE_HEIGHT } from '@aztec/constants';
4
- import { Fr } from '@aztec/foundation/fields';
5
- import { MembershipWitness, type MerkleTree } from '@aztec/foundation/trees';
2
+ import { MembershipWitness } from '@aztec/foundation/trees';
6
3
  import { type ContractArtifact, FunctionSelector } from '@aztec/stdlib/abi';
7
- import { type ContractClassWithId } from '@aztec/stdlib/contract';
8
4
  /**
9
5
  * Represents a Merkle tree of functions for a particular Contract Class.
10
6
  * It manages the construction of the function tree, computes its root, and generates membership witnesses
@@ -12,45 +8,10 @@ import { type ContractClassWithId } from '@aztec/stdlib/contract';
12
8
  * It is used in combination with the AztecNode to compute various data for executing private transactions.
13
9
  */
14
10
  export declare class PrivateFunctionsTree {
15
- private readonly artifact;
16
- private contractClass;
11
+ private readonly privateFunctions;
17
12
  private tree?;
18
13
  private constructor();
19
14
  static create(artifact: ContractArtifact): Promise<PrivateFunctionsTree>;
20
- /**
21
- * Retrieve the artifact of a given function.
22
- * The function is identified by its selector, which represents a unique identifier for the function's signature.
23
- * Throws an error if the function with the provided selector is not found in the contract.
24
- *
25
- * @param selector - The function selector.
26
- * @returns The artifact object containing relevant information about the targeted function.
27
- */
28
- getFunctionArtifact(selector: FunctionSelector): Promise<import("@aztec/stdlib/abi").FunctionArtifact>;
29
- /**
30
- * Retrieve the bytecode of a function in the contract by its function selector.
31
- * The function selector is a unique identifier for each function in a contract.
32
- * Throws an error if the function with the given selector is not found in the contract.
33
- *
34
- * @param selector - The selector of a function to get bytecode for.
35
- * @returns The bytecode of the function as a string.
36
- */
37
- getBytecode(selector: FunctionSelector): Promise<Buffer>;
38
- /**
39
- * Calculate and return the root of the function tree for the current contract.
40
- * This root is a cryptographic commitment to the set of constrained functions within the contract,
41
- * which is used in the Aztec node's proof system. The root will be cached after the first call.
42
- *
43
- * @returns A promise that resolves to the Fr (finite field element) representation of the function tree root.
44
- */
45
- getFunctionTreeRoot(): Promise<MerkleTree>;
46
- /** Returns the contract class object. */
47
- getContractClass(): ContractClassWithId;
48
- /** Returns the contract artifact. */
49
- getArtifact(): ContractArtifact;
50
- /**
51
- * Returns the contract class identifier for the given artifact.
52
- */
53
- getContractClassId(): Fr;
54
15
  /**
55
16
  * Retrieve the membership witness of a function within a contract's function tree.
56
17
  * A membership witness represents the position and authentication path of a target function
@@ -1 +1 @@
1
- {"version":3,"file":"private_functions_tree.d.ts","sourceRoot":"","sources":["../../../src/storage/contract_data_provider/private_functions_tree.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,EAAE,iBAAiB,EAAE,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EAAE,KAAK,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EACL,KAAK,mBAAmB,EAIzB,MAAM,wBAAwB,CAAC;AAEhC;;;;;GAKG;AACH,qBAAa,oBAAoB;IAGX,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAAoB,OAAO,CAAC,aAAa;IAFtF,OAAO,CAAC,IAAI,CAAC,CAAa;IAE1B,OAAO;WAEM,MAAM,CAAC,QAAQ,EAAE,gBAAgB;IAK9C;;;;;;;OAOG;IACU,mBAAmB,CAAC,QAAQ,EAAE,gBAAgB;IAkB3D;;;;;;;OAOG;IACU,WAAW,CAAC,QAAQ,EAAE,gBAAgB;IAKnD;;;;;;OAMG;IACI,mBAAmB;IAI1B,yCAAyC;IAClC,gBAAgB;IAIvB,qCAAqC;IAC9B,WAAW;IAIlB;;OAEG;IACI,kBAAkB;IAIzB;;;;;;;;OAQG;IACU,4BAA4B,CACvC,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,iBAAiB,CAAC,OAAO,oBAAoB,CAAC,CAAC;YAiB5C,OAAO;CAOtB"}
1
+ {"version":3,"file":"private_functions_tree.d.ts","sourceRoot":"","sources":["../../../src/storage/contract_data_provider/private_functions_tree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAGxD,OAAO,EAAE,iBAAiB,EAAmB,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EAAE,KAAK,gBAAgB,EAAE,gBAAgB,EAAgB,MAAM,mBAAmB,CAAC;AAQ1F;;;;;GAKG;AACH,qBAAa,oBAAoB;IAGX,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAFrD,OAAO,CAAC,IAAI,CAAC,CAAa;IAE1B,OAAO;WAEM,MAAM,CAAC,QAAQ,EAAE,gBAAgB;IAS9C;;;;;;;;OAQG;IACU,4BAA4B,CACvC,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,iBAAiB,CAAC,OAAO,oBAAoB,CAAC,CAAC;YAiB5C,OAAO;CAMtB"}
@@ -2,73 +2,22 @@ import { FUNCTION_TREE_HEIGHT } from '@aztec/constants';
2
2
  import { Fr } from '@aztec/foundation/fields';
3
3
  import { assertLength } from '@aztec/foundation/serialize';
4
4
  import { MembershipWitness } from '@aztec/foundation/trees';
5
- import { FunctionSelector } from '@aztec/stdlib/abi';
6
- import { computePrivateFunctionLeaf, computePrivateFunctionsTree, getContractClassFromArtifact } from '@aztec/stdlib/contract';
5
+ import { FunctionType } from '@aztec/stdlib/abi';
6
+ import { computePrivateFunctionLeaf, computePrivateFunctionsTree, getContractClassPrivateFunctionFromArtifact } from '@aztec/stdlib/contract';
7
7
  /**
8
8
  * Represents a Merkle tree of functions for a particular Contract Class.
9
9
  * It manages the construction of the function tree, computes its root, and generates membership witnesses
10
10
  * for constrained functions. This class also enables lookup of specific function artifact using selectors.
11
11
  * It is used in combination with the AztecNode to compute various data for executing private transactions.
12
12
  */ export class PrivateFunctionsTree {
13
- artifact;
14
- contractClass;
13
+ privateFunctions;
15
14
  tree;
16
- constructor(artifact, contractClass){
17
- this.artifact = artifact;
18
- this.contractClass = contractClass;
15
+ constructor(privateFunctions){
16
+ this.privateFunctions = privateFunctions;
19
17
  }
20
18
  static async create(artifact) {
21
- const contractClass = await getContractClassFromArtifact(artifact);
22
- return new PrivateFunctionsTree(artifact, contractClass);
23
- }
24
- /**
25
- * Retrieve the artifact of a given function.
26
- * The function is identified by its selector, which represents a unique identifier for the function's signature.
27
- * Throws an error if the function with the provided selector is not found in the contract.
28
- *
29
- * @param selector - The function selector.
30
- * @returns The artifact object containing relevant information about the targeted function.
31
- */ async getFunctionArtifact(selector) {
32
- const functionsAndSelectors = await Promise.all(this.artifact.functions.map(async (f)=>({
33
- f,
34
- selector: await FunctionSelector.fromNameAndParameters(f.name, f.parameters)
35
- })));
36
- const artifact = functionsAndSelectors.find((f)=>selector.equals(f.selector))?.f;
37
- if (!artifact) {
38
- throw new Error(`Unknown function. Selector ${selector.toString()} not found in the artifact ${this.artifact.name} with class ${this.getContractClassId().toString()}.`);
39
- }
40
- return artifact;
41
- }
42
- /**
43
- * Retrieve the bytecode of a function in the contract by its function selector.
44
- * The function selector is a unique identifier for each function in a contract.
45
- * Throws an error if the function with the given selector is not found in the contract.
46
- *
47
- * @param selector - The selector of a function to get bytecode for.
48
- * @returns The bytecode of the function as a string.
49
- */ async getBytecode(selector) {
50
- const artifact = await this.getFunctionArtifact(selector);
51
- return artifact.bytecode;
52
- }
53
- /**
54
- * Calculate and return the root of the function tree for the current contract.
55
- * This root is a cryptographic commitment to the set of constrained functions within the contract,
56
- * which is used in the Aztec node's proof system. The root will be cached after the first call.
57
- *
58
- * @returns A promise that resolves to the Fr (finite field element) representation of the function tree root.
59
- */ getFunctionTreeRoot() {
60
- return this.getTree();
61
- }
62
- /** Returns the contract class object. */ getContractClass() {
63
- return this.contractClass;
64
- }
65
- /** Returns the contract artifact. */ getArtifact() {
66
- return this.artifact;
67
- }
68
- /**
69
- * Returns the contract class identifier for the given artifact.
70
- */ getContractClassId() {
71
- return this.getContractClass().id;
19
+ const privateFunctions = await Promise.all(artifact.functions.filter((fn)=>fn.functionType === FunctionType.PRIVATE).map(getContractClassPrivateFunctionFromArtifact));
20
+ return new PrivateFunctionsTree(privateFunctions);
72
21
  }
73
22
  /**
74
23
  * Retrieve the membership witness of a function within a contract's function tree.
@@ -79,7 +28,7 @@ import { computePrivateFunctionLeaf, computePrivateFunctionsTree, getContractCla
79
28
  * @param selector - The function selector.
80
29
  * @returns A MembershipWitness instance representing the position and authentication path of the function in the function tree.
81
30
  */ async getFunctionMembershipWitness(selector) {
82
- const fn = this.getContractClass().privateFunctions.find((f)=>f.selector.equals(selector));
31
+ const fn = this.privateFunctions.find((f)=>f.selector.equals(selector));
83
32
  if (!fn) {
84
33
  throw new Error(`Private function with selector ${selector.toString()} not found in contract class.`);
85
34
  }
@@ -91,8 +40,7 @@ import { computePrivateFunctionLeaf, computePrivateFunctionsTree, getContractCla
91
40
  }
92
41
  async getTree() {
93
42
  if (!this.tree) {
94
- const fns = this.getContractClass().privateFunctions;
95
- this.tree = await computePrivateFunctionsTree(fns);
43
+ this.tree = await computePrivateFunctionsTree(this.privateFunctions);
96
44
  }
97
45
  return this.tree;
98
46
  }
@@ -1,10 +1,9 @@
1
1
  export * from './address_data_provider/index.js';
2
- export * from './auth_witness_data_provider/index.js';
3
2
  export * from './capsule_data_provider/index.js';
4
3
  export * from './contract_data_provider/index.js';
5
4
  export * from './note_data_provider/index.js';
6
5
  export * from './sync_data_provider/index.js';
7
6
  export * from './tagging_data_provider/index.js';
8
- export * from './data_provider.js';
9
- export declare const PXE_DATA_SCHEMA_VERSION = 2;
7
+ export * from './metadata.js';
8
+ export * from './private_event_data_provider/private_event_data_provider.js';
10
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,uCAAuC,CAAC;AACtD,cAAc,kCAAkC,CAAC;AACjD,cAAc,mCAAmC,CAAC;AAClD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,oBAAoB,CAAC;AAEnC,eAAO,MAAM,uBAAuB,IAAI,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,mCAAmC,CAAC;AAClD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,eAAe,CAAC;AAC9B,cAAc,8DAA8D,CAAC"}
@@ -1,9 +1,8 @@
1
1
  export * from './address_data_provider/index.js';
2
- export * from './auth_witness_data_provider/index.js';
3
2
  export * from './capsule_data_provider/index.js';
4
3
  export * from './contract_data_provider/index.js';
5
4
  export * from './note_data_provider/index.js';
6
5
  export * from './sync_data_provider/index.js';
7
6
  export * from './tagging_data_provider/index.js';
8
- export * from './data_provider.js';
9
- export const PXE_DATA_SCHEMA_VERSION = 2;
7
+ export * from './metadata.js';
8
+ export * from './private_event_data_provider/private_event_data_provider.js';
@@ -0,0 +1,2 @@
1
+ export declare const PXE_DATA_SCHEMA_VERSION = 2;
2
+ //# sourceMappingURL=metadata.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../src/storage/metadata.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,IAAI,CAAC"}
@@ -0,0 +1 @@
1
+ export const PXE_DATA_SCHEMA_VERSION = 2;
@@ -1,13 +1,9 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- /// <reference types="node" resolution-mode="require"/>
3
1
  import { Fr } from '@aztec/foundation/fields';
4
2
  import { BufferReader } from '@aztec/foundation/serialize';
5
- import type { NoteData } from '@aztec/simulator/client';
6
- import { NoteSelector } from '@aztec/stdlib/abi';
7
3
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
8
- import type { PublicKey } from '@aztec/stdlib/keys';
9
4
  import { Note } from '@aztec/stdlib/note';
10
5
  import { TxHash } from '@aztec/stdlib/tx';
6
+ import type { NoteData } from '../../contract_function_simulator/oracle/interfaces.js';
11
7
  /**
12
8
  * A Note Data Access Object, representing a note that was committed to the note hash tree, holding all of the
13
9
  * information required to use it during execution and manage its state.
@@ -20,10 +16,10 @@ export declare class NoteDao implements NoteData {
20
16
  /**
21
17
  * The storage location of the note. This value is not used for anything in PXE, but we do index by storage slot
22
18
  * since contracts typically make queries based on it.
23
- * */
19
+ */
24
20
  storageSlot: Fr;
25
- /** The kernel-provided nonce of the note, required to compute the uniqueNoteHash. */
26
- nonce: Fr;
21
+ /** The nonce that was injected into the note hash preimage in order to guarantee uniqueness. */
22
+ noteNonce: Fr;
27
23
  /**
28
24
  * The inner hash (non-unique, non-siloed) of the note. Each contract determines how the note is hashed. Can
29
25
  * be used alongside contractAddress and nonce to compute the uniqueNoteHash and the siloedNoteHash.
@@ -46,12 +42,11 @@ export declare class NoteDao implements NoteData {
46
42
  l2BlockHash: string;
47
43
  /** The index of the leaf in the global note hash tree the note is stored at */
48
44
  index: bigint;
49
- /** The public key with which the note log was encrypted during delivery. */
50
- addressPoint: PublicKey;
51
- /** The note type identifier for the contract.
52
- * TODO(#12013): remove
45
+ /**
46
+ * The address whose public key was used to encrypt the note log during delivery.
47
+ * (This is the x-coordinate of the public key.)
53
48
  */
54
- noteTypeId: NoteSelector;
49
+ recipient: AztecAddress;
55
50
  constructor(
56
51
  /** The packed content of the note, as will be returned in the getNotes oracle. */
57
52
  note: Note,
@@ -60,10 +55,10 @@ export declare class NoteDao implements NoteData {
60
55
  /**
61
56
  * The storage location of the note. This value is not used for anything in PXE, but we do index by storage slot
62
57
  * since contracts typically make queries based on it.
63
- * */
58
+ */
64
59
  storageSlot: Fr,
65
- /** The kernel-provided nonce of the note, required to compute the uniqueNoteHash. */
66
- nonce: Fr,
60
+ /** The nonce that was injected into the note hash preimage in order to guarantee uniqueness. */
61
+ noteNonce: Fr,
67
62
  /**
68
63
  * The inner hash (non-unique, non-siloed) of the note. Each contract determines how the note is hashed. Can
69
64
  * be used alongside contractAddress and nonce to compute the uniqueNoteHash and the siloedNoteHash.
@@ -86,12 +81,11 @@ export declare class NoteDao implements NoteData {
86
81
  l2BlockHash: string,
87
82
  /** The index of the leaf in the global note hash tree the note is stored at */
88
83
  index: bigint,
89
- /** The public key with which the note log was encrypted during delivery. */
90
- addressPoint: PublicKey,
91
- /** The note type identifier for the contract.
92
- * TODO(#12013): remove
84
+ /**
85
+ * The address whose public key was used to encrypt the note log during delivery.
86
+ * (This is the x-coordinate of the public key.)
93
87
  */
94
- noteTypeId: NoteSelector);
88
+ recipient: AztecAddress);
95
89
  toBuffer(): Buffer;
96
90
  static fromBuffer(buffer: Buffer | BufferReader): NoteDao;
97
91
  toString(): string;
@@ -101,6 +95,6 @@ export declare class NoteDao implements NoteData {
101
95
  * @returns - Its size in bytes.
102
96
  */
103
97
  getSize(): number;
104
- static random({ note, contractAddress, storageSlot, nonce, noteHash, siloedNullifier, txHash, l2BlockNumber, l2BlockHash, index, addressPoint, noteTypeId, }?: Partial<NoteDao>): Promise<NoteDao>;
98
+ static random({ note, contractAddress, storageSlot, noteNonce, noteHash, siloedNullifier, txHash, l2BlockNumber, l2BlockHash, index, recipient, }?: Partial<NoteDao>): Promise<NoteDao>;
105
99
  }
106
100
  //# sourceMappingURL=note_dao.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"note_dao.d.ts","sourceRoot":"","sources":["../../../src/storage/note_data_provider/note_dao.ts"],"names":[],"mappings":";;AACA,OAAO,EAAE,EAAE,EAAS,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC;AAC9E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CA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M;IACpB;;;OAGG;IACI,SAAS,EAAE,YAAY;;IAzC9B,kFAAkF;IAC3E,IAAI,EAAE,IAAI;IACjB,8GAA8G;IACvG,eAAe,EAAE,YAAY;IACpC;;;OAGG;IACI,WAAW,EAAE,EAAE;IACtB,gGAAgG;IACzF,SAAS,EAAE,EAAE;IAGpB;;;OAGG;IACI,QAAQ,EAAE,EAAE;IACnB;;;OAGG;IACI,eAAe,EAAE,EAAE;IAG1B;;OAEG;IACI,MAAM,EAAE,MAAM;IACrB;gBACY;IACL,aAAa,EAAE,MAAM;IAC5B;gBACY;IACL,WAAW,EAAE,MAAM;IAC1B,+EAA+E;IACxE,KAAK,EAAE,MAAM;IACpB;;;OAGG;IACI,SAAS,EAAE,YAAY;IAGhC,QAAQ,IAAI,MAAM;IAgBlB,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY;IA8B/C,QAAQ;IAIR,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM;IAK7B;;;OAGG;IACI,OAAO;WAMD,MAAM,CAAC,EAClB,IAAoB,EACpB,eAA2B,EAC3B,WAAyB,EACzB,SAAuB,EACvB,QAAsB,EACtB,eAA6B,EAC7B,MAAwB,EACxB,aAAgD,EAChD,WAAoC,EACpC,KAA8B,EAC9B,SAAqB,GACtB,GAAE,OAAO,CAAC,OAAO,CAAM;CAezB"}
@@ -1,7 +1,6 @@
1
1
  import { toBigIntBE } from '@aztec/foundation/bigint-buffer';
2
2
  import { Fr, Point } from '@aztec/foundation/fields';
3
3
  import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
4
- import { NoteSelector } from '@aztec/stdlib/abi';
5
4
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
6
5
  import { Note } from '@aztec/stdlib/note';
7
6
  import { TxHash } from '@aztec/stdlib/tx';
@@ -12,20 +11,19 @@ import { TxHash } from '@aztec/stdlib/tx';
12
11
  note;
13
12
  contractAddress;
14
13
  storageSlot;
15
- nonce;
14
+ noteNonce;
16
15
  noteHash;
17
16
  siloedNullifier;
18
17
  txHash;
19
18
  l2BlockNumber;
20
19
  l2BlockHash;
21
20
  index;
22
- addressPoint;
23
- noteTypeId;
21
+ recipient;
24
22
  constructor(// Note information
25
23
  /** The packed content of the note, as will be returned in the getNotes oracle. */ note, /** The address of the contract that created the note (i.e. the address used by the kernel during siloing). */ contractAddress, /**
26
24
  * The storage location of the note. This value is not used for anything in PXE, but we do index by storage slot
27
25
  * since contracts typically make queries based on it.
28
- * */ storageSlot, /** The kernel-provided nonce of the note, required to compute the uniqueNoteHash. */ nonce, // Computed values
26
+ */ storageSlot, /** The nonce that was injected into the note hash preimage in order to guarantee uniqueness. */ noteNonce, // Computed values
29
27
  /**
30
28
  * The inner hash (non-unique, non-siloed) of the note. Each contract determines how the note is hashed. Can
31
29
  * be used alongside contractAddress and nonce to compute the uniqueNoteHash and the siloedNoteHash.
@@ -37,36 +35,35 @@ import { TxHash } from '@aztec/stdlib/tx';
37
35
  * when searching for txEffects.
38
36
  */ txHash, /** The L2 block number in which the tx with this note was included. Used for note management while processing
39
37
  * reorgs.*/ l2BlockNumber, /** The L2 block hash in which the tx with this note was included. Used for note management while processing
40
- * reorgs.*/ l2BlockHash, /** The index of the leaf in the global note hash tree the note is stored at */ index, /** The public key with which the note log was encrypted during delivery. */ addressPoint, /** The note type identifier for the contract.
41
- * TODO(#12013): remove
42
- */ noteTypeId){
38
+ * reorgs.*/ l2BlockHash, /** The index of the leaf in the global note hash tree the note is stored at */ index, /**
39
+ * The address whose public key was used to encrypt the note log during delivery.
40
+ * (This is the x-coordinate of the public key.)
41
+ */ recipient){
43
42
  this.note = note;
44
43
  this.contractAddress = contractAddress;
45
44
  this.storageSlot = storageSlot;
46
- this.nonce = nonce;
45
+ this.noteNonce = noteNonce;
47
46
  this.noteHash = noteHash;
48
47
  this.siloedNullifier = siloedNullifier;
49
48
  this.txHash = txHash;
50
49
  this.l2BlockNumber = l2BlockNumber;
51
50
  this.l2BlockHash = l2BlockHash;
52
51
  this.index = index;
53
- this.addressPoint = addressPoint;
54
- this.noteTypeId = noteTypeId;
52
+ this.recipient = recipient;
55
53
  }
56
54
  toBuffer() {
57
55
  return serializeToBuffer([
58
56
  this.note,
59
57
  this.contractAddress,
60
58
  this.storageSlot,
61
- this.nonce,
59
+ this.noteNonce,
62
60
  this.noteHash,
63
61
  this.siloedNullifier,
64
62
  this.txHash,
65
63
  this.l2BlockNumber,
66
64
  Fr.fromHexString(this.l2BlockHash),
67
65
  this.index,
68
- this.addressPoint,
69
- this.noteTypeId
66
+ this.recipient
70
67
  ]);
71
68
  }
72
69
  static fromBuffer(buffer) {
@@ -74,16 +71,15 @@ import { TxHash } from '@aztec/stdlib/tx';
74
71
  const note = Note.fromBuffer(reader);
75
72
  const contractAddress = AztecAddress.fromBuffer(reader);
76
73
  const storageSlot = Fr.fromBuffer(reader);
77
- const nonce = Fr.fromBuffer(reader);
74
+ const noteNonce = Fr.fromBuffer(reader);
78
75
  const noteHash = Fr.fromBuffer(reader);
79
76
  const siloedNullifier = Fr.fromBuffer(reader);
80
77
  const txHash = reader.readObject(TxHash);
81
78
  const l2BlockNumber = reader.readNumber();
82
79
  const l2BlockHash = Fr.fromBuffer(reader).toString();
83
80
  const index = toBigIntBE(reader.readBytes(32));
84
- const publicKey = Point.fromBuffer(reader);
85
- const noteTypeId = reader.readObject(NoteSelector);
86
- return new NoteDao(note, contractAddress, storageSlot, nonce, noteHash, siloedNullifier, txHash, l2BlockNumber, l2BlockHash, index, publicKey, noteTypeId);
81
+ const recipient = AztecAddress.fromBuffer(reader);
82
+ return new NoteDao(note, contractAddress, storageSlot, noteNonce, noteHash, siloedNullifier, txHash, l2BlockNumber, l2BlockHash, index, recipient);
87
83
  }
88
84
  toString() {
89
85
  return '0x' + this.toBuffer().toString('hex');
@@ -100,7 +96,7 @@ import { TxHash } from '@aztec/stdlib/tx';
100
96
  const noteSize = 4 + this.note.items.length * Fr.SIZE_IN_BYTES;
101
97
  return noteSize + AztecAddress.SIZE_IN_BYTES + Fr.SIZE_IN_BYTES * 4 + TxHash.SIZE + Point.SIZE_IN_BYTES + indexSize;
102
98
  }
103
- static async random({ note = Note.random(), contractAddress = undefined, storageSlot = Fr.random(), nonce = Fr.random(), noteHash = Fr.random(), siloedNullifier = Fr.random(), txHash = TxHash.random(), l2BlockNumber = Math.floor(Math.random() * 1000), l2BlockHash = Fr.random().toString(), index = Fr.random().toBigInt(), addressPoint = undefined, noteTypeId = NoteSelector.random() } = {}) {
104
- return new NoteDao(note, contractAddress ?? await AztecAddress.random(), storageSlot, nonce, noteHash, siloedNullifier, txHash, l2BlockNumber, l2BlockHash, index, addressPoint ?? await Point.random(), noteTypeId);
99
+ static async random({ note = Note.random(), contractAddress = undefined, storageSlot = Fr.random(), noteNonce = Fr.random(), noteHash = Fr.random(), siloedNullifier = Fr.random(), txHash = TxHash.random(), l2BlockNumber = Math.floor(Math.random() * 1000), l2BlockHash = Fr.random().toString(), index = Fr.random().toBigInt(), recipient = undefined } = {}) {
100
+ return new NoteDao(note, contractAddress ?? await AztecAddress.random(), storageSlot, noteNonce, noteHash, siloedNullifier, txHash, l2BlockNumber, l2BlockHash, index, recipient ?? await AztecAddress.random());
105
101
  }
106
102
  }
@@ -1,20 +1,83 @@
1
- import type { Fr, Point } from '@aztec/foundation/fields';
1
+ import type { Fr } from '@aztec/foundation/fields';
2
2
  import type { AztecAsyncKVStore } from '@aztec/kv-store';
3
3
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
4
4
  import type { InBlock } from '@aztec/stdlib/block';
5
5
  import { type NotesFilter } from '@aztec/stdlib/note';
6
- import type { DataProvider } from '../data_provider.js';
7
6
  import { NoteDao } from './note_dao.js';
8
- export declare class NoteDataProvider implements DataProvider {
7
+ /**
8
+ * NoteDataProvider manages the storage and retrieval of notes.
9
+ *
10
+ * Notes can be active or nullified. This class processes new notes, nullifications,
11
+ * and performs rollback handling in the case of a reorg.
12
+ **/
13
+ export declare class NoteDataProvider {
9
14
  #private;
10
15
  private constructor();
16
+ /**
17
+ * Creates and initializes a new NoteDataProvider instance.
18
+ *
19
+ * This factory method creates a NoteDataProvider and restores any existing
20
+ * scope-specific indexes from the database.
21
+ *
22
+ * @param store - The key-value store to use for persistence
23
+ * @returns Promise resolving to a fully initialized NoteDataProvider instance
24
+ */
11
25
  static create(store: AztecAsyncKVStore): Promise<NoteDataProvider>;
26
+ /**
27
+ * Adds a new scope to the note data provider.
28
+ *
29
+ * Scopes provide privacy isolation by creating separate indexes for each user.
30
+ * Each scope gets its own set of indexes for efficient note retrieval by various criteria.
31
+ *
32
+ * @param scope - The AztecAddress representing the scope/user to add
33
+ * @returns Promise resolving to true if scope was added, false if it already existed
34
+ */
12
35
  addScope(scope: AztecAddress): Promise<boolean>;
13
- addNotes(notes: NoteDao[], scope?: AztecAddress): Promise<void>;
14
- removeNotesAfter(blockNumber: number): Promise<void>;
15
- unnullifyNotesAfter(blockNumber: number, synchedBlockNumber?: number): Promise<void>;
36
+ /**
37
+ * Adds multiple notes to the data provider under the specified scope.
38
+ *
39
+ * Notes are stored using their index from the notes hash tree as the key, which provides
40
+ * uniqueness and maintains creation order. Each note is indexed by multiple criteria
41
+ * for efficient retrieval.
42
+ *
43
+ * @param notes - Notes to store
44
+ * @param scope - The scope (user/account) under which to store the notes
45
+ */
46
+ addNotes(notes: NoteDao[], scope: AztecAddress): Promise<void>;
47
+ /**
48
+ * Synchronizes notes and nullifiers to a specific block number.
49
+ *
50
+ * This method ensures that the state of notes and nullifiers is consistent with the
51
+ * specified block number. It restores any notes that were nullified after the given block
52
+ * and deletes any active notes created after that block.
53
+ *
54
+ * @param blockNumber - The new chain tip after a reorg
55
+ * @param synchedBlockNumber - The block number up to which PXE managed to sync before the reorg happened.
56
+ */
57
+ rollbackNotesAndNullifiers(blockNumber: number, synchedBlockNumber: number): Promise<void>;
58
+ /**
59
+ * Retrieves notes based on the provided filter criteria.
60
+ *
61
+ * This method queries both active and optionally nullified notes based on the filter
62
+ * parameters.
63
+ *
64
+ * @param filter - Filter criteria including contractAddress (required), and optional
65
+ * storageSlot, status, scopes and siloedNullifier.
66
+ * @returns Promise resolving to array of NoteDao objects matching the filter
67
+ * @throws If filtering by an empty scopes array. Scopes have to be set to undefined or to a non-empty array.
68
+ */
16
69
  getNotes(filter: NotesFilter): Promise<NoteDao[]>;
17
- removeNullifiedNotes(nullifiers: InBlock<Fr>[], accountAddressPoint: Point): Promise<NoteDao[]>;
18
- getSize(): Promise<number>;
70
+ /**
71
+ * Transitions notes from "active" to "nullified" state.
72
+ *
73
+ * This operation processes a batch of nullifiers to mark the corresponding notes
74
+ * as spent/nullified. The operation is atomic - if any nullifier is not found,
75
+ * the entire operation fails and no notes are modified.
76
+ *
77
+ * @param nullifiers - Array of nullifiers with their block numbers to process
78
+ * @returns Promise resolving to array of nullified NoteDao objects
79
+ * @throws Error if any nullifier is not found in the active notes
80
+ */
81
+ applyNullifiers(nullifiers: InBlock<Fr>[]): Promise<NoteDao[]>;
19
82
  }
20
83
  //# sourceMappingURL=note_data_provider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"note_data_provider.d.ts","sourceRoot":"","sources":["../../../src/storage/note_data_provider/note_data_provider.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,KAAK,EAAE,iBAAiB,EAAqC,MAAM,iBAAiB,CAAC;AAC5F,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD,OAAO,EAAc,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAElE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,qBAAa,gBAAiB,YAAW,YAAY;;IAsBnD,OAAO;WAsBa,MAAM,CAAC,KAAK,EAAE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