@aztec/pxe 0.0.0-test.1 → 0.0.1-commit.023c3e5

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 (458) 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 +129 -0
  5. package/dest/block_synchronizer/block_synchronizer.d.ts +43 -0
  6. package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -0
  7. package/dest/block_synchronizer/block_synchronizer.js +147 -0
  8. package/dest/block_synchronizer/index.d.ts +2 -0
  9. package/dest/block_synchronizer/index.d.ts.map +1 -0
  10. package/dest/block_synchronizer/index.js +1 -0
  11. package/dest/config/index.d.ts +13 -24
  12. package/dest/config/index.d.ts.map +1 -1
  13. package/dest/config/index.js +35 -33
  14. package/dest/config/package_info.d.ts +1 -1
  15. package/dest/config/package_info.js +1 -1
  16. package/dest/contract_function_simulator/benchmarked_node.d.ts +9 -0
  17. package/dest/contract_function_simulator/benchmarked_node.d.ts.map +1 -0
  18. package/dest/contract_function_simulator/benchmarked_node.js +77 -0
  19. package/dest/contract_function_simulator/contract_function_simulator.d.ts +82 -0
  20. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -0
  21. package/dest/contract_function_simulator/contract_function_simulator.js +339 -0
  22. package/dest/contract_function_simulator/execution_note_cache.d.ts +104 -0
  23. package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -0
  24. package/dest/contract_function_simulator/execution_note_cache.js +208 -0
  25. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +16 -0
  26. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -0
  27. package/dest/contract_function_simulator/execution_tagging_index_cache.js +26 -0
  28. package/dest/contract_function_simulator/hashed_values_cache.d.ts +28 -0
  29. package/dest/contract_function_simulator/hashed_values_cache.d.ts.map +1 -0
  30. package/dest/contract_function_simulator/hashed_values_cache.js +36 -0
  31. package/dest/contract_function_simulator/index.d.ts +14 -0
  32. package/dest/contract_function_simulator/index.d.ts.map +1 -0
  33. package/dest/contract_function_simulator/index.js +12 -0
  34. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +21 -0
  35. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -0
  36. package/dest/contract_function_simulator/noir-structs/event_validation_request.js +40 -0
  37. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +16 -0
  38. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts.map +1 -0
  39. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.js +26 -0
  40. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +17 -0
  41. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -0
  42. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +65 -0
  43. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +24 -0
  44. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -0
  45. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +51 -0
  46. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +16 -0
  47. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -0
  48. package/dest/contract_function_simulator/noir-structs/utility_context.js +22 -0
  49. package/dest/contract_function_simulator/oracle/index.d.ts +14 -0
  50. package/dest/contract_function_simulator/oracle/index.d.ts.map +1 -0
  51. package/dest/contract_function_simulator/oracle/index.js +2 -0
  52. package/dest/contract_function_simulator/oracle/interfaces.d.ts +107 -0
  53. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -0
  54. package/dest/contract_function_simulator/oracle/interfaces.js +4 -0
  55. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +19 -0
  56. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -0
  57. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.js +24 -0
  58. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +28 -0
  59. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -0
  60. package/dest/contract_function_simulator/oracle/note_packing_utils.js +54 -0
  61. package/dest/contract_function_simulator/oracle/oracle.d.ts +60 -0
  62. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -0
  63. package/dest/contract_function_simulator/oracle/oracle.js +356 -0
  64. package/dest/contract_function_simulator/oracle/private_execution.d.ts +23 -0
  65. package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -0
  66. package/dest/contract_function_simulator/oracle/private_execution.js +87 -0
  67. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +239 -0
  68. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -0
  69. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +426 -0
  70. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +209 -0
  71. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -0
  72. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +376 -0
  73. package/dest/contract_function_simulator/pick_notes.d.ts +85 -0
  74. package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -0
  75. package/dest/contract_function_simulator/pick_notes.js +51 -0
  76. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +6 -0
  77. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -0
  78. package/dest/contract_function_simulator/proxied_contract_data_source.js +80 -0
  79. package/dest/contract_sync/index.d.ts +23 -0
  80. package/dest/contract_sync/index.d.ts.map +1 -0
  81. package/dest/contract_sync/index.js +54 -0
  82. package/dest/debug/pxe_debug_utils.d.ts +41 -0
  83. package/dest/debug/pxe_debug_utils.d.ts.map +1 -0
  84. package/dest/debug/pxe_debug_utils.js +47 -0
  85. package/dest/entrypoints/client/bundle/index.d.ts +4 -3
  86. package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
  87. package/dest/entrypoints/client/bundle/index.js +2 -2
  88. package/dest/entrypoints/client/bundle/utils.d.ts +10 -10
  89. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  90. package/dest/entrypoints/client/bundle/utils.js +33 -12
  91. package/dest/entrypoints/client/lazy/index.d.ts +4 -3
  92. package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
  93. package/dest/entrypoints/client/lazy/index.js +2 -2
  94. package/dest/entrypoints/client/lazy/utils.d.ts +10 -10
  95. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  96. package/dest/entrypoints/client/lazy/utils.js +33 -12
  97. package/dest/entrypoints/pxe_creation_options.d.ts +18 -0
  98. package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -0
  99. package/dest/entrypoints/server/index.d.ts +8 -4
  100. package/dest/entrypoints/server/index.d.ts.map +1 -1
  101. package/dest/entrypoints/server/index.js +6 -3
  102. package/dest/entrypoints/server/utils.d.ts +8 -16
  103. package/dest/entrypoints/server/utils.d.ts.map +1 -1
  104. package/dest/entrypoints/server/utils.js +46 -36
  105. package/dest/error_enriching.d.ts +11 -0
  106. package/dest/error_enriching.d.ts.map +1 -0
  107. package/dest/{pxe_service/error_enriching.js → error_enriching.js} +30 -22
  108. package/dest/events/event_service.d.ts +15 -0
  109. package/dest/events/event_service.d.ts.map +1 -0
  110. package/dest/events/event_service.js +44 -0
  111. package/dest/events/index.d.ts +2 -0
  112. package/dest/events/index.d.ts.map +1 -0
  113. package/dest/events/index.js +1 -0
  114. package/dest/events/private_event_filter_validator.d.ts +9 -0
  115. package/dest/events/private_event_filter_validator.d.ts.map +1 -0
  116. package/dest/events/private_event_filter_validator.js +38 -0
  117. package/dest/job_coordinator/job_coordinator.d.ts +75 -0
  118. package/dest/job_coordinator/job_coordinator.d.ts.map +1 -0
  119. package/dest/job_coordinator/job_coordinator.js +94 -0
  120. package/dest/logs/log_service.d.ts +28 -0
  121. package/dest/logs/log_service.d.ts.map +1 -0
  122. package/dest/logs/log_service.js +125 -0
  123. package/dest/notes/index.d.ts +2 -0
  124. package/dest/notes/index.d.ts.map +1 -0
  125. package/dest/notes/index.js +1 -0
  126. package/dest/notes/note_service.d.ts +48 -0
  127. package/dest/notes/note_service.d.ts.map +1 -0
  128. package/dest/notes/note_service.js +147 -0
  129. package/dest/oracle_version.d.ts +3 -0
  130. package/dest/oracle_version.d.ts.map +1 -0
  131. package/dest/oracle_version.js +11 -0
  132. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +4 -0
  133. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts.map +1 -0
  134. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.js +41 -0
  135. package/dest/private_kernel/hints/index.d.ts +3 -0
  136. package/dest/private_kernel/hints/index.d.ts.map +1 -0
  137. package/dest/private_kernel/hints/index.js +2 -0
  138. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +28 -0
  139. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -0
  140. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.js +277 -0
  141. package/dest/private_kernel/index.d.ts +3 -0
  142. package/dest/private_kernel/index.d.ts.map +1 -0
  143. package/dest/private_kernel/index.js +2 -0
  144. package/dest/private_kernel/private_kernel_execution_prover.d.ts +45 -0
  145. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -0
  146. package/dest/private_kernel/private_kernel_execution_prover.js +285 -0
  147. package/dest/private_kernel/private_kernel_oracle.d.ts +59 -0
  148. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -0
  149. package/dest/private_kernel/private_kernel_oracle.js +92 -0
  150. package/dest/pxe.d.ts +204 -0
  151. package/dest/pxe.d.ts.map +1 -0
  152. package/dest/pxe.js +742 -0
  153. package/dest/storage/address_store/address_store.d.ts +11 -0
  154. package/dest/storage/address_store/address_store.d.ts.map +1 -0
  155. package/dest/storage/{address_data_provider/address_data_provider.js → address_store/address_store.js} +13 -15
  156. package/dest/storage/address_store/index.d.ts +2 -0
  157. package/dest/storage/address_store/index.d.ts.map +1 -0
  158. package/dest/storage/address_store/index.js +1 -0
  159. package/dest/storage/anchor_block_store/anchor_block_store.d.ts +17 -0
  160. package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -0
  161. package/dest/storage/anchor_block_store/anchor_block_store.js +26 -0
  162. package/dest/storage/anchor_block_store/index.d.ts +2 -0
  163. package/dest/storage/anchor_block_store/index.d.ts.map +1 -0
  164. package/dest/storage/anchor_block_store/index.js +1 -0
  165. package/dest/storage/capsule_store/capsule_store.d.ts +72 -0
  166. package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -0
  167. package/dest/storage/capsule_store/capsule_store.js +253 -0
  168. package/dest/storage/capsule_store/index.d.ts +2 -0
  169. package/dest/storage/capsule_store/index.d.ts.map +1 -0
  170. package/dest/storage/capsule_store/index.js +1 -0
  171. package/dest/storage/contract_store/contract_store.d.ts +66 -0
  172. package/dest/storage/contract_store/contract_store.d.ts.map +1 -0
  173. package/dest/storage/contract_store/contract_store.js +233 -0
  174. package/dest/storage/contract_store/index.d.ts +2 -0
  175. package/dest/storage/contract_store/index.d.ts.map +1 -0
  176. package/dest/storage/contract_store/index.js +1 -0
  177. package/dest/storage/contract_store/private_functions_tree.d.ts +27 -0
  178. package/dest/storage/contract_store/private_functions_tree.d.ts.map +1 -0
  179. package/dest/storage/contract_store/private_functions_tree.js +47 -0
  180. package/dest/storage/index.d.ts +9 -10
  181. package/dest/storage/index.d.ts.map +1 -1
  182. package/dest/storage/index.js +8 -9
  183. package/dest/storage/metadata.d.ts +2 -0
  184. package/dest/storage/metadata.d.ts.map +1 -0
  185. package/dest/storage/metadata.js +1 -0
  186. package/dest/storage/note_store/index.d.ts +3 -0
  187. package/dest/storage/note_store/index.d.ts.map +1 -0
  188. package/dest/storage/note_store/index.js +2 -0
  189. package/dest/storage/note_store/note_store.d.ts +83 -0
  190. package/dest/storage/note_store/note_store.d.ts.map +1 -0
  191. package/dest/storage/note_store/note_store.js +341 -0
  192. package/dest/storage/note_store/stored_note.d.ts +16 -0
  193. package/dest/storage/note_store/stored_note.d.ts.map +1 -0
  194. package/dest/storage/note_store/stored_note.js +43 -0
  195. package/dest/storage/private_event_store/private_event_store.d.ts +91 -0
  196. package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -0
  197. package/dest/storage/private_event_store/private_event_store.js +273 -0
  198. package/dest/storage/private_event_store/stored_private_event.d.ts +23 -0
  199. package/dest/storage/private_event_store/stored_private_event.d.ts.map +1 -0
  200. package/dest/storage/private_event_store/stored_private_event.js +56 -0
  201. package/dest/storage/tagging_store/index.d.ts +4 -0
  202. package/dest/storage/tagging_store/index.d.ts.map +1 -0
  203. package/dest/storage/tagging_store/index.js +3 -0
  204. package/dest/storage/tagging_store/recipient_tagging_store.d.ts +28 -0
  205. package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -0
  206. package/dest/storage/tagging_store/recipient_tagging_store.js +111 -0
  207. package/dest/storage/tagging_store/sender_address_book_store.d.ts +14 -0
  208. package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +1 -0
  209. package/dest/storage/tagging_store/sender_address_book_store.js +36 -0
  210. package/dest/storage/tagging_store/sender_tagging_store.d.ts +77 -0
  211. package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -0
  212. package/dest/storage/tagging_store/sender_tagging_store.js +348 -0
  213. package/dest/tagging/constants.d.ts +2 -0
  214. package/dest/tagging/constants.d.ts.map +1 -0
  215. package/dest/tagging/constants.js +10 -0
  216. package/dest/tagging/get_all_logs_by_tags.d.ts +24 -0
  217. package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -0
  218. package/dest/tagging/get_all_logs_by_tags.js +46 -0
  219. package/dest/tagging/index.d.ts +17 -0
  220. package/dest/tagging/index.d.ts.map +1 -0
  221. package/dest/tagging/index.js +15 -0
  222. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +15 -0
  223. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -0
  224. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +99 -0
  225. package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts +12 -0
  226. package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts.map +1 -0
  227. package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +20 -0
  228. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +15 -0
  229. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -0
  230. package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +32 -0
  231. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +21 -0
  232. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -0
  233. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +74 -0
  234. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +11 -0
  235. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -0
  236. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +29 -0
  237. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +21 -0
  238. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -0
  239. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +60 -0
  240. package/package.json +37 -34
  241. package/src/bin/check_oracle_version.ts +161 -0
  242. package/src/block_synchronizer/block_synchronizer.ts +172 -0
  243. package/src/block_synchronizer/index.ts +1 -0
  244. package/src/config/index.ts +41 -55
  245. package/src/config/package_info.ts +1 -1
  246. package/src/contract_function_simulator/benchmarked_node.ts +103 -0
  247. package/src/contract_function_simulator/contract_function_simulator.ts +633 -0
  248. package/src/contract_function_simulator/execution_note_cache.ts +252 -0
  249. package/src/contract_function_simulator/execution_tagging_index_cache.ts +32 -0
  250. package/src/contract_function_simulator/hashed_values_cache.ts +47 -0
  251. package/src/contract_function_simulator/index.ts +13 -0
  252. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +51 -0
  253. package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +28 -0
  254. package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +69 -0
  255. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +64 -0
  256. package/src/contract_function_simulator/noir-structs/utility_context.ts +23 -0
  257. package/src/contract_function_simulator/oracle/index.ts +16 -0
  258. package/src/contract_function_simulator/oracle/interfaces.ts +185 -0
  259. package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +23 -0
  260. package/src/contract_function_simulator/oracle/note_packing_utils.ts +68 -0
  261. package/src/contract_function_simulator/oracle/oracle.ts +630 -0
  262. package/src/contract_function_simulator/oracle/private_execution.ts +141 -0
  263. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +699 -0
  264. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +554 -0
  265. package/src/contract_function_simulator/pick_notes.ts +141 -0
  266. package/src/contract_function_simulator/proxied_contract_data_source.ts +83 -0
  267. package/src/contract_sync/index.ts +98 -0
  268. package/src/debug/pxe_debug_utils.ts +63 -0
  269. package/src/entrypoints/client/bundle/index.ts +3 -2
  270. package/src/entrypoints/client/bundle/utils.ts +35 -36
  271. package/src/entrypoints/client/lazy/index.ts +3 -2
  272. package/src/entrypoints/client/lazy/utils.ts +36 -32
  273. package/src/entrypoints/pxe_creation_options.ts +14 -0
  274. package/src/entrypoints/server/index.ts +7 -3
  275. package/src/entrypoints/server/utils.ts +52 -52
  276. package/src/{pxe_service/error_enriching.ts → error_enriching.ts} +40 -39
  277. package/src/events/event_service.ts +71 -0
  278. package/src/events/index.ts +1 -0
  279. package/src/events/private_event_filter_validator.ts +46 -0
  280. package/src/job_coordinator/job_coordinator.ts +150 -0
  281. package/src/logs/log_service.ts +220 -0
  282. package/src/notes/index.ts +1 -0
  283. package/src/notes/note_service.ts +195 -0
  284. package/src/oracle_version.ts +12 -0
  285. package/src/private_kernel/hints/compute_tx_include_by_timestamp.ts +58 -0
  286. package/src/private_kernel/hints/index.ts +2 -0
  287. package/src/{kernel_prover/hints/build_private_kernel_reset_private_inputs.ts → private_kernel/hints/private_kernel_reset_private_inputs_builder.ts} +179 -156
  288. package/src/private_kernel/index.ts +2 -0
  289. package/src/private_kernel/private_kernel_execution_prover.ts +433 -0
  290. package/src/private_kernel/private_kernel_oracle.ts +152 -0
  291. package/src/pxe.ts +1070 -0
  292. package/src/storage/{address_data_provider/address_data_provider.ts → address_store/address_store.ts} +15 -21
  293. package/src/storage/address_store/index.ts +1 -0
  294. package/src/storage/{sync_data_provider/sync_data_provider.ts → anchor_block_store/anchor_block_store.ts} +10 -17
  295. package/src/storage/anchor_block_store/index.ts +1 -0
  296. package/src/storage/capsule_store/capsule_store.ts +315 -0
  297. package/src/storage/capsule_store/index.ts +1 -0
  298. package/src/storage/contract_store/contract_store.ts +330 -0
  299. package/src/storage/contract_store/index.ts +1 -0
  300. package/src/storage/contract_store/private_functions_tree.ts +67 -0
  301. package/src/storage/index.ts +8 -10
  302. package/src/storage/metadata.ts +1 -0
  303. package/src/storage/note_store/index.ts +2 -0
  304. package/src/storage/note_store/note_store.ts +411 -0
  305. package/src/storage/note_store/stored_note.ts +48 -0
  306. package/src/storage/private_event_store/private_event_store.ts +384 -0
  307. package/src/storage/private_event_store/stored_private_event.ts +73 -0
  308. package/src/storage/tagging_store/index.ts +3 -0
  309. package/src/storage/tagging_store/recipient_tagging_store.ts +139 -0
  310. package/src/storage/tagging_store/sender_address_book_store.ts +48 -0
  311. package/src/storage/tagging_store/sender_tagging_store.ts +429 -0
  312. package/src/tagging/constants.ts +10 -0
  313. package/src/tagging/get_all_logs_by_tags.ts +68 -0
  314. package/src/tagging/index.ts +19 -0
  315. package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +143 -0
  316. package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +34 -0
  317. package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +49 -0
  318. package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +99 -0
  319. package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +36 -0
  320. package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +84 -0
  321. package/dest/bin/index.d.ts +0 -3
  322. package/dest/bin/index.d.ts.map +0 -1
  323. package/dest/bin/index.js +0 -28
  324. package/dest/entrypoints/client/pxe_creation_options.d.ts +0 -11
  325. package/dest/entrypoints/client/pxe_creation_options.d.ts.map +0 -1
  326. package/dest/kernel_oracle/index.d.ts +0 -45
  327. package/dest/kernel_oracle/index.d.ts.map +0 -1
  328. package/dest/kernel_oracle/index.js +0 -76
  329. package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.d.ts +0 -28
  330. package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.d.ts.map +0 -1
  331. package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.js +0 -270
  332. package/dest/kernel_prover/hints/index.d.ts +0 -2
  333. package/dest/kernel_prover/hints/index.d.ts.map +0 -1
  334. package/dest/kernel_prover/hints/index.js +0 -1
  335. package/dest/kernel_prover/index.d.ts +0 -3
  336. package/dest/kernel_prover/index.d.ts.map +0 -1
  337. package/dest/kernel_prover/index.js +0 -2
  338. package/dest/kernel_prover/kernel_prover.d.ts +0 -38
  339. package/dest/kernel_prover/kernel_prover.d.ts.map +0 -1
  340. package/dest/kernel_prover/kernel_prover.js +0 -217
  341. package/dest/kernel_prover/proving_data_oracle.d.ts +0 -73
  342. package/dest/kernel_prover/proving_data_oracle.d.ts.map +0 -1
  343. package/dest/kernel_prover/proving_data_oracle.js +0 -4
  344. package/dest/note_decryption_utils/add_public_values_to_payload.d.ts +0 -11
  345. package/dest/note_decryption_utils/add_public_values_to_payload.d.ts.map +0 -1
  346. package/dest/note_decryption_utils/add_public_values_to_payload.js +0 -47
  347. package/dest/pxe_http/index.d.ts +0 -2
  348. package/dest/pxe_http/index.d.ts.map +0 -1
  349. package/dest/pxe_http/index.js +0 -1
  350. package/dest/pxe_http/pxe_http_server.d.ts +0 -16
  351. package/dest/pxe_http/pxe_http_server.d.ts.map +0 -1
  352. package/dest/pxe_http/pxe_http_server.js +0 -27
  353. package/dest/pxe_oracle_interface/index.d.ts +0 -159
  354. package/dest/pxe_oracle_interface/index.d.ts.map +0 -1
  355. package/dest/pxe_oracle_interface/index.js +0 -692
  356. package/dest/pxe_oracle_interface/tagging_utils.d.ts +0 -17
  357. package/dest/pxe_oracle_interface/tagging_utils.d.ts.map +0 -1
  358. package/dest/pxe_oracle_interface/tagging_utils.js +0 -23
  359. package/dest/pxe_service/error_enriching.d.ts +0 -11
  360. package/dest/pxe_service/error_enriching.d.ts.map +0 -1
  361. package/dest/pxe_service/index.d.ts +0 -3
  362. package/dest/pxe_service/index.d.ts.map +0 -1
  363. package/dest/pxe_service/index.js +0 -2
  364. package/dest/pxe_service/pxe_service.d.ts +0 -111
  365. package/dest/pxe_service/pxe_service.d.ts.map +0 -1
  366. package/dest/pxe_service/pxe_service.js +0 -664
  367. package/dest/storage/address_data_provider/address_data_provider.d.ts +0 -13
  368. package/dest/storage/address_data_provider/address_data_provider.d.ts.map +0 -1
  369. package/dest/storage/address_data_provider/index.d.ts +0 -2
  370. package/dest/storage/address_data_provider/index.d.ts.map +0 -1
  371. package/dest/storage/address_data_provider/index.js +0 -1
  372. package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.d.ts +0 -11
  373. package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.d.ts.map +0 -1
  374. package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.js +0 -20
  375. package/dest/storage/auth_witness_data_provider/index.d.ts +0 -2
  376. package/dest/storage/auth_witness_data_provider/index.d.ts.map +0 -1
  377. package/dest/storage/auth_witness_data_provider/index.js +0 -1
  378. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts +0 -16
  379. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +0 -1
  380. package/dest/storage/capsule_data_provider/capsule_data_provider.js +0 -57
  381. package/dest/storage/capsule_data_provider/index.d.ts +0 -2
  382. package/dest/storage/capsule_data_provider/index.d.ts.map +0 -1
  383. package/dest/storage/capsule_data_provider/index.js +0 -1
  384. package/dest/storage/contract_data_provider/contract_data_provider.d.ts +0 -109
  385. package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +0 -1
  386. package/dest/storage/contract_data_provider/contract_data_provider.js +0 -183
  387. package/dest/storage/contract_data_provider/index.d.ts +0 -3
  388. package/dest/storage/contract_data_provider/index.d.ts.map +0 -1
  389. package/dest/storage/contract_data_provider/index.js +0 -2
  390. package/dest/storage/contract_data_provider/private_functions_tree.d.ts +0 -66
  391. package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +0 -1
  392. package/dest/storage/contract_data_provider/private_functions_tree.js +0 -99
  393. package/dest/storage/data_provider.d.ts +0 -4
  394. package/dest/storage/data_provider.d.ts.map +0 -1
  395. package/dest/storage/data_provider.js +0 -1
  396. package/dest/storage/note_data_provider/index.d.ts +0 -3
  397. package/dest/storage/note_data_provider/index.d.ts.map +0 -1
  398. package/dest/storage/note_data_provider/index.js +0 -2
  399. package/dest/storage/note_data_provider/note_dao.d.ts +0 -106
  400. package/dest/storage/note_data_provider/note_dao.d.ts.map +0 -1
  401. package/dest/storage/note_data_provider/note_dao.js +0 -106
  402. package/dest/storage/note_data_provider/note_data_provider.d.ts +0 -20
  403. package/dest/storage/note_data_provider/note_data_provider.d.ts.map +0 -1
  404. package/dest/storage/note_data_provider/note_data_provider.js +0 -249
  405. package/dest/storage/sync_data_provider/index.d.ts +0 -2
  406. package/dest/storage/sync_data_provider/index.d.ts.map +0 -1
  407. package/dest/storage/sync_data_provider/index.js +0 -1
  408. package/dest/storage/sync_data_provider/sync_data_provider.d.ts +0 -12
  409. package/dest/storage/sync_data_provider/sync_data_provider.d.ts.map +0 -1
  410. package/dest/storage/sync_data_provider/sync_data_provider.js +0 -29
  411. package/dest/storage/tagging_data_provider/index.d.ts +0 -2
  412. package/dest/storage/tagging_data_provider/index.d.ts.map +0 -1
  413. package/dest/storage/tagging_data_provider/index.js +0 -1
  414. package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts +0 -18
  415. package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts.map +0 -1
  416. package/dest/storage/tagging_data_provider/tagging_data_provider.js +0 -65
  417. package/dest/synchronizer/index.d.ts +0 -2
  418. package/dest/synchronizer/index.d.ts.map +0 -1
  419. package/dest/synchronizer/index.js +0 -1
  420. package/dest/synchronizer/synchronizer.d.ts +0 -37
  421. package/dest/synchronizer/synchronizer.d.ts.map +0 -1
  422. package/dest/synchronizer/synchronizer.js +0 -103
  423. package/dest/test/pxe_test_suite.d.ts +0 -3
  424. package/dest/test/pxe_test_suite.d.ts.map +0 -1
  425. package/dest/test/pxe_test_suite.js +0 -97
  426. package/src/bin/index.ts +0 -38
  427. package/src/entrypoints/client/pxe_creation_options.ts +0 -7
  428. package/src/kernel_oracle/index.ts +0 -117
  429. package/src/kernel_prover/hints/index.ts +0 -1
  430. package/src/kernel_prover/index.ts +0 -2
  431. package/src/kernel_prover/kernel_prover.ts +0 -351
  432. package/src/kernel_prover/proving_data_oracle.ts +0 -83
  433. package/src/note_decryption_utils/add_public_values_to_payload.ts +0 -64
  434. package/src/pxe_http/index.ts +0 -1
  435. package/src/pxe_http/pxe_http_server.ts +0 -29
  436. package/src/pxe_oracle_interface/index.ts +0 -925
  437. package/src/pxe_oracle_interface/tagging_utils.ts +0 -32
  438. package/src/pxe_service/index.ts +0 -2
  439. package/src/pxe_service/pxe_service.ts +0 -949
  440. package/src/storage/address_data_provider/index.ts +0 -1
  441. package/src/storage/auth_witness_data_provider/auth_witness_data_provider.ts +0 -34
  442. package/src/storage/auth_witness_data_provider/index.ts +0 -1
  443. package/src/storage/capsule_data_provider/capsule_data_provider.ts +0 -80
  444. package/src/storage/capsule_data_provider/index.ts +0 -1
  445. package/src/storage/contract_data_provider/contract_data_provider.ts +0 -261
  446. package/src/storage/contract_data_provider/index.ts +0 -2
  447. package/src/storage/contract_data_provider/private_functions_tree.ts +0 -131
  448. package/src/storage/data_provider.ts +0 -3
  449. package/src/storage/note_data_provider/index.ts +0 -2
  450. package/src/storage/note_data_provider/note_dao.ts +0 -162
  451. package/src/storage/note_data_provider/note_data_provider.ts +0 -345
  452. package/src/storage/sync_data_provider/index.ts +0 -1
  453. package/src/storage/tagging_data_provider/index.ts +0 -1
  454. package/src/storage/tagging_data_provider/tagging_data_provider.ts +0 -92
  455. package/src/synchronizer/index.ts +0 -1
  456. package/src/synchronizer/synchronizer.ts +0 -121
  457. package/src/test/pxe_test_suite.ts +0 -111
  458. /package/dest/entrypoints/{client/pxe_creation_options.js → pxe_creation_options.js} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utility_execution_oracle.d.ts","sourceRoot":"","sources":["../../../src/contract_function_simulator/oracle/utility_execution_oracle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAEnE,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAE1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAEhF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM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AAE,EACrC,kCAAkC,EAAE,EAAE,iBAqCvC;IAEM,mBAAmB,CAAC,eAAe,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAOhG;IAEY,kBAAkB,CAAC,eAAe,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,GAAG,OAAO,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,CAU7F;IAEM,oBAAoB,CAAC,eAAe,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAOlF;IAEM,kBAAkB,CACvB,eAAe,EAAE,YAAY,EAC7B,OAAO,EAAE,EAAE,EACX,OAAO,EAAE,EAAE,EACX,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC,CAMf;IAGM,oBAAoB,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAG3F;IAED;;;;;OAKG;IACI,sBAAsB,CAAC,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,CAEjF;IAED,UAAgB,eAAe,CAAC,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,CAQnF;CACF"}
@@ -0,0 +1,376 @@
1
+ import { Aes128 } from '@aztec/foundation/crypto/aes128';
2
+ import { Fr } from '@aztec/foundation/curves/bn254';
3
+ import { LogLevels, applyStringFormatting, createLogger } from '@aztec/foundation/log';
4
+ import { siloNullifier } from '@aztec/stdlib/hash';
5
+ import { computeAddressSecret } from '@aztec/stdlib/keys';
6
+ import { deriveEcdhSharedSecret } from '@aztec/stdlib/logs';
7
+ import { getNonNullifiedL1ToL2MessageWitness } from '@aztec/stdlib/messaging';
8
+ import { MerkleTreeId } from '@aztec/stdlib/trees';
9
+ import { EventService } from '../../events/event_service.js';
10
+ import { LogService } from '../../logs/log_service.js';
11
+ import { NoteService } from '../../notes/note_service.js';
12
+ import { ORACLE_VERSION } from '../../oracle_version.js';
13
+ import { EventValidationRequest } from '../noir-structs/event_validation_request.js';
14
+ import { LogRetrievalRequest } from '../noir-structs/log_retrieval_request.js';
15
+ import { LogRetrievalResponse } from '../noir-structs/log_retrieval_response.js';
16
+ import { NoteValidationRequest } from '../noir-structs/note_validation_request.js';
17
+ import { UtilityContext } from '../noir-structs/utility_context.js';
18
+ import { pickNotes } from '../pick_notes.js';
19
+ import { MessageLoadOracleInputs } from './message_load_oracle_inputs.js';
20
+ /**
21
+ * The oracle for an execution of utility contract functions.
22
+ */ export class UtilityExecutionOracle {
23
+ contractAddress;
24
+ authWitnesses;
25
+ capsules;
26
+ anchorBlockHeader;
27
+ contractStore;
28
+ noteStore;
29
+ keyStore;
30
+ addressStore;
31
+ aztecNode;
32
+ recipientTaggingStore;
33
+ senderAddressBookStore;
34
+ capsuleStore;
35
+ privateEventStore;
36
+ jobId;
37
+ log;
38
+ scopes;
39
+ isMisc;
40
+ isUtility;
41
+ aztecNrDebugLog;
42
+ constructor(contractAddress, /** List of transient auth witnesses to be used during this simulation */ authWitnesses, capsules, anchorBlockHeader, contractStore, noteStore, keyStore, addressStore, aztecNode, recipientTaggingStore, senderAddressBookStore, capsuleStore, privateEventStore, jobId, log = createLogger('simulator:client_view_context'), scopes){
43
+ this.contractAddress = contractAddress;
44
+ this.authWitnesses = authWitnesses;
45
+ this.capsules = capsules;
46
+ this.anchorBlockHeader = anchorBlockHeader;
47
+ this.contractStore = contractStore;
48
+ this.noteStore = noteStore;
49
+ this.keyStore = keyStore;
50
+ this.addressStore = addressStore;
51
+ this.aztecNode = aztecNode;
52
+ this.recipientTaggingStore = recipientTaggingStore;
53
+ this.senderAddressBookStore = senderAddressBookStore;
54
+ this.capsuleStore = capsuleStore;
55
+ this.privateEventStore = privateEventStore;
56
+ this.jobId = jobId;
57
+ this.log = log;
58
+ this.scopes = scopes;
59
+ this.isMisc = true;
60
+ this.isUtility = true;
61
+ this.aztecNrDebugLog = createLogger('aztec-nr:debug_log');
62
+ }
63
+ utilityAssertCompatibleOracleVersion(version) {
64
+ if (version !== ORACLE_VERSION) {
65
+ throw new Error(`Incompatible oracle version. Expected version ${ORACLE_VERSION}, got ${version}.`);
66
+ }
67
+ }
68
+ utilityGetRandomField() {
69
+ return Fr.random();
70
+ }
71
+ utilityGetUtilityContext() {
72
+ return new UtilityContext(this.anchorBlockHeader, this.contractAddress);
73
+ }
74
+ /**
75
+ * Retrieve keys associated with a specific master public key and app address.
76
+ * @param pkMHash - The master public key hash.
77
+ * @returns A Promise that resolves to nullifier keys.
78
+ * @throws If the keys are not registered in the key store.
79
+ */ utilityGetKeyValidationRequest(pkMHash) {
80
+ return this.keyStore.getKeyValidationRequest(pkMHash, this.contractAddress);
81
+ }
82
+ /**
83
+ * Fetches the index and sibling path of a leaf at a given block from the note hash tree.
84
+ * @param anchorBlockHash - The hash of a block that contains the note hash tree root in which to find the membership
85
+ * witness.
86
+ * @param noteHash - The note hash to find in the note hash tree.
87
+ * @returns The membership witness containing the leaf index and sibling path
88
+ */ utilityGetNoteHashMembershipWitness(anchorBlockHash, noteHash) {
89
+ return this.aztecNode.getNoteHashMembershipWitness(anchorBlockHash, noteHash);
90
+ }
91
+ /**
92
+ * Fetches the index and sibling path of a block hash in the archive tree.
93
+ *
94
+ * Block hashes are the leaves of the archive tree. Each time a new block is added to the chain,
95
+ * its block hash is appended as a new leaf to the archive tree.
96
+ *
97
+ * @param anchorBlockHash - The hash of a block that contains the archive tree root in which to find the membership
98
+ * witness.
99
+ * @param blockHash - The block hash to find in the archive tree.
100
+ * @returns The membership witness containing the leaf index and sibling path
101
+ */ utilityGetBlockHashMembershipWitness(anchorBlockHash, blockHash) {
102
+ return this.aztecNode.getBlockHashMembershipWitness(anchorBlockHash, blockHash);
103
+ }
104
+ /**
105
+ * Returns a nullifier membership witness for a given nullifier at a given block.
106
+ * @param blockHash - The block hash at which to get the index.
107
+ * @param nullifier - Nullifier we try to find witness for.
108
+ * @returns The nullifier membership witness (if found).
109
+ */ utilityGetNullifierMembershipWitness(blockHash, nullifier) {
110
+ return this.aztecNode.getNullifierMembershipWitness(blockHash, nullifier);
111
+ }
112
+ /**
113
+ * Returns a low nullifier membership witness for a given nullifier at a given block.
114
+ * @param blockHash - The block hash at which to get the index.
115
+ * @param nullifier - Nullifier we try to find the low nullifier witness for.
116
+ * @returns The low nullifier membership witness (if found).
117
+ * @remarks Low nullifier witness can be used to perform a nullifier non-inclusion proof by leveraging the "linked
118
+ * list structure" of leaves and proving that a lower nullifier is pointing to a bigger next value than the nullifier
119
+ * we are trying to prove non-inclusion for.
120
+ */ utilityGetLowNullifierMembershipWitness(blockHash, nullifier) {
121
+ return this.aztecNode.getLowNullifierMembershipWitness(blockHash, nullifier);
122
+ }
123
+ /**
124
+ * Returns a public data tree witness for a given leaf slot at a given block.
125
+ * @param blockHash - The block hash at which to get the index.
126
+ * @param leafSlot - The slot of the public data tree to get the witness for.
127
+ * @returns - The witness
128
+ */ utilityGetPublicDataWitness(blockHash, leafSlot) {
129
+ return this.aztecNode.getPublicDataWitness(blockHash, leafSlot);
130
+ }
131
+ /**
132
+ * Fetches a block header of a given block.
133
+ * @param blockNumber - The number of a block of which to get the block header.
134
+ * @returns Block extracted from a block with block number `blockNumber`.
135
+ */ async utilityGetBlockHeader(blockNumber) {
136
+ const anchorBlockNumber = this.anchorBlockHeader.getBlockNumber();
137
+ if (blockNumber > anchorBlockNumber) {
138
+ throw new Error(`Block number ${blockNumber} is higher than current block ${anchorBlockNumber}`);
139
+ }
140
+ const block = await this.aztecNode.getBlock(blockNumber);
141
+ return block?.header;
142
+ }
143
+ /**
144
+ * Retrieve the complete address associated to a given address.
145
+ * @param account - The account address.
146
+ * @returns A complete address associated with the input address.
147
+ * @throws An error if the account is not registered in the database.
148
+ */ utilityGetPublicKeysAndPartialAddress(account) {
149
+ return this.getCompleteAddress(account);
150
+ }
151
+ async getCompleteAddress(account) {
152
+ const completeAddress = await this.addressStore.getCompleteAddress(account);
153
+ if (!completeAddress) {
154
+ throw new Error(`No public key registered for address ${account}.
155
+ 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`);
156
+ }
157
+ return completeAddress;
158
+ }
159
+ /**
160
+ * Returns a contract instance associated with an address or throws if not found.
161
+ * @param address - Address.
162
+ * @returns A contract instance.
163
+ */ utilityGetContractInstance(address) {
164
+ return this.getContractInstance(address);
165
+ }
166
+ async getContractInstance(address) {
167
+ const instance = await this.contractStore.getContractInstance(address);
168
+ if (!instance) {
169
+ throw new Error(`No contract instance found for address ${address.toString()}`);
170
+ }
171
+ return instance;
172
+ }
173
+ /**
174
+ * Returns an auth witness for the given message hash. Checks on the list of transient witnesses
175
+ * for this transaction first, and falls back to the local database if not found.
176
+ * @param messageHash - Hash of the message to authenticate.
177
+ * @returns Authentication witness for the requested message hash.
178
+ */ utilityGetAuthWitness(messageHash) {
179
+ return Promise.resolve(this.authWitnesses.find((w)=>w.requestHash.equals(messageHash))?.witness);
180
+ }
181
+ /**
182
+ * Gets some notes for a contract address and storage slot.
183
+ * Returns a flattened array containing filtered notes.
184
+ *
185
+ * @remarks
186
+ * Check for pending notes with matching slot.
187
+ * Real notes coming from DB will have a leafIndex which
188
+ * represents their index in the note hash tree.
189
+ *
190
+ * @param owner - The owner of the notes. If undefined, returns notes for all owners.
191
+ * @param storageSlot - The storage slot.
192
+ * @param numSelects - The number of valid selects in selectBy and selectValues.
193
+ * @param selectBy - An array of indices of the fields to selects.
194
+ * @param selectValues - The values to match.
195
+ * @param selectComparators - The comparators to use to match values.
196
+ * @param sortBy - An array of indices of the fields to sort.
197
+ * @param sortOrder - The order of the corresponding index in sortBy. (1: DESC, 2: ASC, 0: Do nothing)
198
+ * @param limit - The number of notes to retrieve per query.
199
+ * @param offset - The starting index for pagination.
200
+ * @param status - The status of notes to fetch.
201
+ * @returns Array of note data.
202
+ */ async utilityGetNotes(owner, storageSlot, numSelects, selectByIndexes, selectByOffsets, selectByLengths, selectValues, selectComparators, sortByIndexes, sortByOffsets, sortByLengths, sortOrder, limit, offset, status) {
203
+ const noteService = new NoteService(this.noteStore, this.aztecNode, this.anchorBlockHeader, this.jobId);
204
+ const dbNotes = await noteService.getNotes(this.contractAddress, owner, storageSlot, status, this.scopes);
205
+ return pickNotes(dbNotes, {
206
+ selects: selectByIndexes.slice(0, numSelects).map((index, i)=>({
207
+ selector: {
208
+ index,
209
+ offset: selectByOffsets[i],
210
+ length: selectByLengths[i]
211
+ },
212
+ value: selectValues[i],
213
+ comparator: selectComparators[i]
214
+ })),
215
+ sorts: sortByIndexes.map((index, i)=>({
216
+ selector: {
217
+ index,
218
+ offset: sortByOffsets[i],
219
+ length: sortByLengths[i]
220
+ },
221
+ order: sortOrder[i]
222
+ })),
223
+ limit,
224
+ offset
225
+ });
226
+ }
227
+ /**
228
+ * Check if a nullifier exists in the nullifier tree.
229
+ * @param innerNullifier - The inner nullifier.
230
+ * @returns A boolean indicating whether the nullifier exists in the tree or not.
231
+ */ async utilityCheckNullifierExists(innerNullifier) {
232
+ const nullifier = await siloNullifier(this.contractAddress, innerNullifier);
233
+ const [leafIndex] = await this.aztecNode.findLeavesIndexes('latest', MerkleTreeId.NULLIFIER_TREE, [
234
+ nullifier
235
+ ]);
236
+ return leafIndex?.data !== undefined;
237
+ }
238
+ /**
239
+ * Fetches a message from the executionStore, given its key.
240
+ * @param contractAddress - Address of a contract by which the message was emitted.
241
+ * @param messageHash - Hash of the message.
242
+ * @param secret - Secret used to compute a nullifier.
243
+ * @dev Contract address and secret are only used to compute the nullifier to get non-nullified messages
244
+ * @returns The l1 to l2 membership witness (index of message in the tree and sibling path).
245
+ */ async utilityGetL1ToL2MembershipWitness(contractAddress, messageHash, secret) {
246
+ const [messageIndex, siblingPath] = await getNonNullifiedL1ToL2MessageWitness(this.aztecNode, contractAddress, messageHash, secret);
247
+ return new MessageLoadOracleInputs(messageIndex, siblingPath);
248
+ }
249
+ /**
250
+ * Read the public storage data.
251
+ * @param blockHash - The block hash to read storage at.
252
+ * @param contractAddress - The address to read storage from.
253
+ * @param startStorageSlot - The starting storage slot.
254
+ * @param numberOfElements - Number of elements to read from the starting storage slot.
255
+ */ async utilityStorageRead(blockHash, contractAddress, startStorageSlot, numberOfElements) {
256
+ const slots = Array(numberOfElements).fill(0).map((_, i)=>new Fr(startStorageSlot.value + BigInt(i)));
257
+ const values = await Promise.all(slots.map((storageSlot)=>this.aztecNode.getPublicStorageAt(blockHash, contractAddress, storageSlot)));
258
+ this.log.debug(`Oracle storage read: slots=[${slots.map((slot)=>slot.toString()).join(', ')}] address=${contractAddress.toString()} values=[${values.join(', ')}]`);
259
+ return values;
260
+ }
261
+ utilityDebugLog(level, message, fields) {
262
+ if (!LogLevels[level]) {
263
+ throw new Error(`Invalid debug log level: ${level}`);
264
+ }
265
+ const levelName = LogLevels[level];
266
+ this.aztecNrDebugLog[levelName](`${applyStringFormatting(message, fields)}`);
267
+ }
268
+ async utilityFetchTaggedLogs(pendingTaggedLogArrayBaseSlot) {
269
+ const logService = new LogService(this.aztecNode, this.anchorBlockHeader, this.keyStore, this.capsuleStore, this.recipientTaggingStore, this.senderAddressBookStore, this.addressStore, this.jobId, this.log.getBindings());
270
+ const noteService = new NoteService(this.noteStore, this.aztecNode, this.anchorBlockHeader, this.jobId);
271
+ // It is acceptable to run the following operations in parallel for several reasons:
272
+ // 1. syncTaggedLogs does not write to the note store — it only stores the pending tagged logs in a capsule array,
273
+ // which is then processed in Noir after this handler returns.
274
+ // 2. Even if syncTaggedLogs did write to the note store, it would not cause inconsistent state.
275
+ await Promise.all([
276
+ logService.syncTaggedLogs(this.contractAddress, pendingTaggedLogArrayBaseSlot, this.scopes),
277
+ noteService.syncNoteNullifiers(this.contractAddress)
278
+ ]);
279
+ }
280
+ /**
281
+ * Validates all note and event validation requests enqueued via `enqueue_note_for_validation` and
282
+ * `enqueue_event_for_validation`, inserting them into the note database and event store respectively, making them
283
+ * queryable via `get_notes` and `getPrivateEvents`.
284
+ *
285
+ * This automatically clears both validation request queues, so no further work needs to be done by the caller.
286
+ * @param contractAddress - The address of the contract that the logs are tagged for.
287
+ * @param noteValidationRequestsArrayBaseSlot - The base slot of capsule array containing note validation requests.
288
+ * @param eventValidationRequestsArrayBaseSlot - The base slot of capsule array containing event validation requests.
289
+ */ async utilityValidateAndStoreEnqueuedNotesAndEvents(contractAddress, noteValidationRequestsArrayBaseSlot, eventValidationRequestsArrayBaseSlot) {
290
+ // TODO(#10727): allow other contracts to store notes
291
+ if (!this.contractAddress.equals(contractAddress)) {
292
+ throw new Error(`Got a note validation request from ${contractAddress}, expected ${this.contractAddress}`);
293
+ }
294
+ // We read all note and event validation requests and process them all concurrently. This makes the process much
295
+ // faster as we don't need to wait for the network round-trip.
296
+ const noteValidationRequests = (await this.capsuleStore.readCapsuleArray(contractAddress, noteValidationRequestsArrayBaseSlot, this.jobId)).map(NoteValidationRequest.fromFields);
297
+ const eventValidationRequests = (await this.capsuleStore.readCapsuleArray(contractAddress, eventValidationRequestsArrayBaseSlot, this.jobId)).map(EventValidationRequest.fromFields);
298
+ const noteService = new NoteService(this.noteStore, this.aztecNode, this.anchorBlockHeader, this.jobId);
299
+ const noteStorePromises = noteValidationRequests.map((request)=>noteService.validateAndStoreNote(request.contractAddress, request.owner, request.storageSlot, request.randomness, request.noteNonce, request.content, request.noteHash, request.nullifier, request.txHash, request.recipient));
300
+ const eventService = new EventService(this.anchorBlockHeader, this.aztecNode, this.privateEventStore, this.jobId);
301
+ const eventStorePromises = eventValidationRequests.map((request)=>eventService.validateAndStoreEvent(request.contractAddress, request.eventTypeId, request.randomness, request.serializedEvent, request.eventCommitment, request.txHash, request.recipient));
302
+ await Promise.all([
303
+ ...noteStorePromises,
304
+ ...eventStorePromises
305
+ ]);
306
+ // Requests are cleared once we're done.
307
+ await this.capsuleStore.setCapsuleArray(contractAddress, noteValidationRequestsArrayBaseSlot, [], this.jobId);
308
+ await this.capsuleStore.setCapsuleArray(contractAddress, eventValidationRequestsArrayBaseSlot, [], this.jobId);
309
+ }
310
+ async utilityBulkRetrieveLogs(contractAddress, logRetrievalRequestsArrayBaseSlot, logRetrievalResponsesArrayBaseSlot) {
311
+ // TODO(#10727): allow other contracts to process partial notes
312
+ if (!this.contractAddress.equals(contractAddress)) {
313
+ throw new Error(`Got a note validation request from ${contractAddress}, expected ${this.contractAddress}`);
314
+ }
315
+ // We read all log retrieval requests and process them all concurrently. This makes the process much faster as we
316
+ // don't need to wait for the network round-trip.
317
+ const logRetrievalRequests = (await this.capsuleStore.readCapsuleArray(contractAddress, logRetrievalRequestsArrayBaseSlot, this.jobId)).map(LogRetrievalRequest.fromFields);
318
+ const logService = new LogService(this.aztecNode, this.anchorBlockHeader, this.keyStore, this.capsuleStore, this.recipientTaggingStore, this.senderAddressBookStore, this.addressStore, this.jobId, this.log.getBindings());
319
+ const maybeLogRetrievalResponses = await logService.bulkRetrieveLogs(logRetrievalRequests);
320
+ // Requests are cleared once we're done.
321
+ await this.capsuleStore.setCapsuleArray(contractAddress, logRetrievalRequestsArrayBaseSlot, [], this.jobId);
322
+ // The responses are stored as Option<LogRetrievalResponse> in a second CapsuleArray.
323
+ await this.capsuleStore.setCapsuleArray(contractAddress, logRetrievalResponsesArrayBaseSlot, maybeLogRetrievalResponses.map(LogRetrievalResponse.toSerializedOption), this.jobId);
324
+ }
325
+ utilityStoreCapsule(contractAddress, slot, capsule) {
326
+ if (!contractAddress.equals(this.contractAddress)) {
327
+ // TODO(#10727): instead of this check that this.contractAddress is allowed to access the external DB
328
+ throw new Error(`Contract ${contractAddress} is not allowed to access ${this.contractAddress}'s PXE DB`);
329
+ }
330
+ this.capsuleStore.storeCapsule(this.contractAddress, slot, capsule, this.jobId);
331
+ return Promise.resolve();
332
+ }
333
+ async utilityLoadCapsule(contractAddress, slot) {
334
+ if (!contractAddress.equals(this.contractAddress)) {
335
+ // TODO(#10727): instead of this check that this.contractAddress is allowed to access the external DB
336
+ throw new Error(`Contract ${contractAddress} is not allowed to access ${this.contractAddress}'s PXE DB`);
337
+ }
338
+ return(// TODO(#12425): On the following line, the pertinent capsule gets overshadowed by the transient one. Tackle this.
339
+ this.capsules.find((c)=>c.contractAddress.equals(contractAddress) && c.storageSlot.equals(slot))?.data ?? await this.capsuleStore.loadCapsule(this.contractAddress, slot, this.jobId));
340
+ }
341
+ utilityDeleteCapsule(contractAddress, slot) {
342
+ if (!contractAddress.equals(this.contractAddress)) {
343
+ // TODO(#10727): instead of this check that this.contractAddress is allowed to access the external DB
344
+ throw new Error(`Contract ${contractAddress} is not allowed to access ${this.contractAddress}'s PXE DB`);
345
+ }
346
+ this.capsuleStore.deleteCapsule(this.contractAddress, slot, this.jobId);
347
+ return Promise.resolve();
348
+ }
349
+ utilityCopyCapsule(contractAddress, srcSlot, dstSlot, numEntries) {
350
+ if (!contractAddress.equals(this.contractAddress)) {
351
+ // TODO(#10727): instead of this check that this.contractAddress is allowed to access the external DB
352
+ throw new Error(`Contract ${contractAddress} is not allowed to access ${this.contractAddress}'s PXE DB`);
353
+ }
354
+ return this.capsuleStore.copyCapsule(this.contractAddress, srcSlot, dstSlot, numEntries, this.jobId);
355
+ }
356
+ // TODO(#11849): consider replacing this oracle with a pure Noir implementation of aes decryption.
357
+ utilityAes128Decrypt(ciphertext, iv, symKey) {
358
+ const aes128 = new Aes128();
359
+ return aes128.decryptBufferCBC(ciphertext, iv, symKey);
360
+ }
361
+ /**
362
+ * Retrieves the shared secret for a given address and ephemeral public key.
363
+ * @param address - The address to get the secret for.
364
+ * @param ephPk - The ephemeral public key to get the secret for.
365
+ * @returns The secret for the given address.
366
+ */ utilityGetSharedSecret(address, ephPk) {
367
+ return this.getSharedSecret(address, ephPk);
368
+ }
369
+ async getSharedSecret(address, ephPk) {
370
+ // TODO(#12656): return an app-siloed secret
371
+ const recipientCompleteAddress = await this.getCompleteAddress(address);
372
+ const ivskM = await this.keyStore.getMasterSecretKey(recipientCompleteAddress.publicKeys.masterIncomingViewingPublicKey);
373
+ const addressSecret = await computeAddressSecret(await recipientCompleteAddress.getPreaddress(), ivskM);
374
+ return deriveEcdhSharedSecret(addressSecret, ephPk);
375
+ }
376
+ }
@@ -0,0 +1,85 @@
1
+ import { Fr } from '@aztec/foundation/curves/bn254';
2
+ import { Comparator, type Note } from '@aztec/stdlib/note';
3
+ export interface PropertySelector {
4
+ index: number;
5
+ offset: number;
6
+ length: number;
7
+ }
8
+ /**
9
+ * Configuration for selecting values.
10
+ */
11
+ export interface Select {
12
+ /**
13
+ * Selector of the field to select and match.
14
+ */
15
+ selector: PropertySelector;
16
+ /**
17
+ * Required value of the field.
18
+ */
19
+ value: Fr;
20
+ /**
21
+ * The comparator to use
22
+ */
23
+ comparator: Comparator;
24
+ }
25
+ /**
26
+ * The order to sort an array.
27
+ */
28
+ export declare enum SortOrder {
29
+ NADA = 0,
30
+ DESC = 1,
31
+ ASC = 2
32
+ }
33
+ /**
34
+ * Configuration for sorting values.
35
+ */
36
+ export interface Sort {
37
+ /**
38
+ * Selector of the field to sort.
39
+ */
40
+ selector: PropertySelector;
41
+ /**
42
+ * Order to sort the field.
43
+ */
44
+ order: SortOrder;
45
+ }
46
+ /**
47
+ * Options for picking items from an array of BasicNoteData.
48
+ */
49
+ interface GetOptions {
50
+ /**
51
+ * Configurations for selecting items.
52
+ * Default: empty array.
53
+ */
54
+ selects?: Select[];
55
+ /**
56
+ * Configurations for sorting items.
57
+ * Default: empty array.
58
+ */
59
+ sorts?: Sort[];
60
+ /**
61
+ * The number of items to retrieve per query.
62
+ * Default: 0. No limit.
63
+ */
64
+ limit?: number;
65
+ /**
66
+ * The starting index for pagination.
67
+ * Default: 0.
68
+ */
69
+ offset?: number;
70
+ }
71
+ /**
72
+ * Data needed from to perform sort.
73
+ */
74
+ interface ContainsNote {
75
+ /**
76
+ * The note.
77
+ */
78
+ note: Note;
79
+ }
80
+ /**
81
+ * Pick from a note array a number of notes that meet the criteria.
82
+ */
83
+ export declare function pickNotes<T extends ContainsNote>(noteDatas: T[], { selects, sorts, limit, offset }: GetOptions): T[];
84
+ export {};
85
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGlja19ub3Rlcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbnRyYWN0X2Z1bmN0aW9uX3NpbXVsYXRvci9waWNrX25vdGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUNwRCxPQUFPLEVBQUUsVUFBVSxFQUFFLEtBQUssSUFBSSxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFFM0QsTUFBTSxXQUFXLGdCQUFnQjtJQUMvQixLQUFLLEVBQUUsTUFBTSxDQUFDO0lBQ2QsTUFBTSxFQUFFLE1BQU0sQ0FBQztJQUNmLE1BQU0sRUFBRSxNQUFNLENBQUM7Q0FDaEI7QUFFRDs7R0FFRztBQUNILE1BQU0sV0FBVyxNQUFNO0lBQ3JCOztPQUVHO0lBQ0gsUUFBUSxFQUFFLGdCQUFnQixDQUFDO0lBQzNCOztPQUVHO0lBQ0gsS0FBSyxFQUFFLEVBQUUsQ0FBQztJQUNWOztPQUVHO0lBQ0gsVUFBVSxFQUFFLFVBQVUsQ0FBQztDQUN4QjtBQUVEOztHQUVHO0FBQ0gsb0JBQVksU0FBUztJQUNuQixJQUFJLElBQUk7SUFDUixJQUFJLElBQUk7SUFDUixHQUFHLElBQUk7Q0FDUjtBQUVEOztHQUVHO0FBQ0gsTUFBTSxXQUFXLElBQUk7SUFDbkI7O09BRUc7SUFDSCxRQUFRLEVBQUUsZ0JBQWdCLENBQUM7SUFDM0I7O09BRUc7SU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U,CAAC;CACxB;AAED;;GAEG;AACH,oBAAY,SAAS;IACnB,IAAI,IAAI;IACR,IAAI,IAAI;IACR,GAAG,IAAI;CACR;AAED;;GAEG;AACH,MAAM,WAAW,IAAI;IACnB;;OAEG;IACH,QAAQ,EAAE,gBAAgB,CAAC;IAC3B;;OAEG;IACH,KAAK,EAAE,SAAS,CAAC;CAClB;AAED;;GAEG;AACH,UAAU,UAAU;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB;;;OAGG;IACH,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,UAAU,YAAY;IACpB;;OAEG;IACH,IAAI,EAAE,IAAI,CAAC;CACZ;AA8CD;;GAEG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,YAAY,EAC9C,SAAS,EAAE,CAAC,EAAE,EACd,EAAE,OAAY,EAAE,KAAU,EAAE,KAAS,EAAE,MAAU,EAAE,EAAE,UAAU,GAC9D,CAAC,EAAE,CAIL"}
@@ -0,0 +1,51 @@
1
+ import { Fr } from '@aztec/foundation/curves/bn254';
2
+ import { Comparator } from '@aztec/stdlib/note';
3
+ /**
4
+ * The order to sort an array.
5
+ */ export var SortOrder = /*#__PURE__*/ function(SortOrder) {
6
+ SortOrder[SortOrder["NADA"] = 0] = "NADA";
7
+ SortOrder[SortOrder["DESC"] = 1] = "DESC";
8
+ SortOrder[SortOrder["ASC"] = 2] = "ASC";
9
+ return SortOrder;
10
+ }({});
11
+ const selectPropertyFromPackedNoteContent = (noteData, selector)=>{
12
+ const noteValueBuffer = noteData[selector.index].toBuffer();
13
+ const noteValue = noteValueBuffer.subarray(selector.offset, selector.offset + selector.length);
14
+ return Fr.fromBuffer(noteValue);
15
+ };
16
+ const selectNotes = (noteDatas, selects)=>noteDatas.filter((noteData)=>selects.every(({ selector, value, comparator })=>{
17
+ const noteValueFr = selectPropertyFromPackedNoteContent(noteData.note.items, selector);
18
+ const comparatorSelector = {
19
+ [Comparator.EQ]: ()=>noteValueFr.equals(value),
20
+ [Comparator.NEQ]: ()=>!noteValueFr.equals(value),
21
+ [Comparator.LT]: ()=>noteValueFr.lt(value),
22
+ [Comparator.LTE]: ()=>noteValueFr.lt(value) || noteValueFr.equals(value),
23
+ [Comparator.GT]: ()=>!noteValueFr.lt(value) && !noteValueFr.equals(value),
24
+ [Comparator.GTE]: ()=>!noteValueFr.lt(value)
25
+ };
26
+ return comparatorSelector[comparator]();
27
+ }));
28
+ const sortNotes = (a, b, sorts, level = 0)=>{
29
+ if (sorts[level] === undefined) {
30
+ return 0;
31
+ }
32
+ const { selector, order } = sorts[level];
33
+ if (order === 0) {
34
+ return 0;
35
+ }
36
+ const aValue = selectPropertyFromPackedNoteContent(a, selector);
37
+ const bValue = selectPropertyFromPackedNoteContent(b, selector);
38
+ const dir = order === 1 ? [
39
+ -1,
40
+ 1
41
+ ] : [
42
+ 1,
43
+ -1
44
+ ];
45
+ return aValue.toBigInt() === bValue.toBigInt() ? sortNotes(a, b, sorts, level + 1) : aValue.toBigInt() > bValue.toBigInt() ? dir[0] : dir[1];
46
+ };
47
+ /**
48
+ * Pick from a note array a number of notes that meet the criteria.
49
+ */ export function pickNotes(noteDatas, { selects = [], sorts = [], limit = 0, offset = 0 }) {
50
+ return selectNotes(noteDatas, selects).sort((a, b)=>sortNotes(a.note.items, b.note.items, sorts)).slice(offset, limit ? offset + limit : undefined);
51
+ }
@@ -0,0 +1,6 @@
1
+ import type { ContractOverrides } from '@aztec/stdlib/tx';
2
+ import type { ContractStore } from '../storage/contract_store/contract_store.js';
3
+ export declare class ProxiedContractStoreFactory {
4
+ static create(contractStore: ContractStore, overrides?: ContractOverrides): ContractStore;
5
+ }
6
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJveGllZF9jb250cmFjdF9kYXRhX3NvdXJjZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbnRyYWN0X2Z1bmN0aW9uX3NpbXVsYXRvci9wcm94aWVkX2NvbnRyYWN0X2RhdGFfc291cmNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUVBLE9BQU8sS0FBSyxFQUFFLGlCQUFpQixFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFFMUQsT0FBTyxLQUFLLEVBQUUsYUFBYSxFQUFFLE1BQU0sNkNBQTZDLENBQUM7QUFPakYscUJBQWEsMkJBQTJCO0lBQ3RDLE1BQU0sQ0FBQyxNQUFNLENBQUMsYUFBYSxFQUFFLGFBQWEsRUFBRSxTQUFTLENBQUMsRUFBRSxpQkFBaUIsaUJBcUV4RTtDQUNGIn0=
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proxied_contract_data_source.d.ts","sourceRoot":"","sources":["../../src/contract_function_simulator/proxied_contract_data_source.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAOjF,qBAAa,2BAA2B;IACtC,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,aAAa,EAAE,SAAS,CAAC,EAAE,iBAAiB,iBAqExE;CACF"}
@@ -0,0 +1,80 @@
1
+ import { FunctionSelector } from '@aztec/stdlib/abi';
2
+ /*
3
+ * Proxy generator for a ContractStore that allows overriding contract instances and artifacts, so
4
+ * the contract function simulator can execute different bytecode on certain addresses. An example use case
5
+ * would be overriding your own account contract so that valid signatures don't have to be provided while simulating.
6
+ */ export class ProxiedContractStoreFactory {
7
+ static create(contractStore, overrides) {
8
+ if (!overrides) {
9
+ return contractStore;
10
+ }
11
+ return new Proxy(contractStore, {
12
+ get (target, prop) {
13
+ switch(prop){
14
+ case 'getContractInstance':
15
+ {
16
+ return async (address)=>{
17
+ if (overrides[address.toString()]) {
18
+ const { instance } = overrides[address.toString()];
19
+ instance.address = address;
20
+ const realInstance = await target.getContractInstance(address);
21
+ if (!realInstance) {
22
+ throw new Error(`Contract instance not found for address: ${address}`);
23
+ }
24
+ instance.currentContractClassId = realInstance.currentContractClassId;
25
+ instance.originalContractClassId = realInstance.originalContractClassId;
26
+ return instance;
27
+ } else {
28
+ return target.getContractInstance(address);
29
+ }
30
+ };
31
+ }
32
+ case 'getFunctionArtifact':
33
+ {
34
+ return async (contractAddress, selector)=>{
35
+ if (overrides[contractAddress.toString()]) {
36
+ const { artifact } = overrides[contractAddress.toString()];
37
+ const functions = artifact.functions;
38
+ for(let i = 0; i < functions.length; i++){
39
+ const fn = functions[i];
40
+ const fnSelector = await FunctionSelector.fromNameAndParameters(fn.name, fn.parameters);
41
+ if (fnSelector.equals(selector)) {
42
+ return fn;
43
+ }
44
+ }
45
+ } else {
46
+ return target.getFunctionArtifact(contractAddress, selector);
47
+ }
48
+ };
49
+ }
50
+ case 'getFunctionArtifactWithDebugMetadata':
51
+ {
52
+ return async (contractAddress, selector)=>{
53
+ if (overrides[contractAddress.toString()]) {
54
+ const { artifact } = overrides[contractAddress.toString()];
55
+ const functions = artifact.functions;
56
+ for(let i = 0; i < functions.length; i++){
57
+ const fn = functions[i];
58
+ const fnSelector = await FunctionSelector.fromNameAndParameters(fn.name, fn.parameters);
59
+ if (fnSelector.equals(selector)) {
60
+ return fn;
61
+ }
62
+ }
63
+ } else {
64
+ return target.getFunctionArtifactWithDebugMetadata(contractAddress, selector);
65
+ }
66
+ };
67
+ }
68
+ default:
69
+ {
70
+ const value = Reflect.get(target, prop);
71
+ if (typeof value === 'function') {
72
+ return value.bind(target);
73
+ }
74
+ return value;
75
+ }
76
+ }
77
+ }
78
+ });
79
+ }
80
+ }
@@ -0,0 +1,23 @@
1
+ import type { FunctionCall, FunctionSelector } from '@aztec/stdlib/abi';
2
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
3
+ import type { ContractInstance } from '@aztec/stdlib/contract';
4
+ import type { AztecNode } from '@aztec/stdlib/interfaces/client';
5
+ import type { BlockHeader } from '@aztec/stdlib/tx';
6
+ import type { ContractStore } from '../storage/contract_store/contract_store.js';
7
+ /**
8
+ * Read the current class id of a contract from the execution data provider or AztecNode. If not found, class id
9
+ * from the instance is used.
10
+ * @param contractAddress - The address of the contract to read the class id for.
11
+ * @param instance - The instance of the contract.
12
+ * @param aztecNode - The Aztec node to query for storage.
13
+ * @param header - The header of the block at which to load the DelayedPublicMutable storing the class id.
14
+ * @returns The current class id.
15
+ */
16
+ export declare function readCurrentClassId(contractAddress: AztecAddress, instance: ContractInstance, aztecNode: AztecNode, header: BlockHeader): Promise<import("@aztec/foundation/schemas").Fr>;
17
+ export declare function syncState(contractAddress: AztecAddress, contractStore: ContractStore, functionToInvokeAfterSync: FunctionSelector | null, utilityExecutor: (privateSyncCall: FunctionCall) => Promise<any>): Promise<any>;
18
+ /**
19
+ * Ensures the contract's private state is synchronized and that the PXE holds the current class artifact for
20
+ * the contract.
21
+ */
22
+ export declare function ensureContractSynced(contractAddress: AztecAddress, functionToInvokeAfterSync: FunctionSelector | null, utilityExecutor: (call: FunctionCall) => Promise<any>, aztecNode: AztecNode, contractStore: ContractStore, header: BlockHeader): Promise<void>;
23
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb250cmFjdF9zeW5jL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBQ3hFLE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBQ2hFLE9BQU8sS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