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

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
@@ -0,0 +1,274 @@
1
+ import type { L1_TO_L2_MSG_TREE_HEIGHT } from '@aztec/constants';
2
+ import type { Fr, Point } from '@aztec/foundation/fields';
3
+ import type { FunctionArtifact, FunctionArtifactWithContractName, FunctionSelector } from '@aztec/stdlib/abi';
4
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
5
+ import type { L2Block } from '@aztec/stdlib/block';
6
+ import type { CompleteAddress, ContractInstance } from '@aztec/stdlib/contract';
7
+ import type { KeyValidationRequest } from '@aztec/stdlib/kernel';
8
+ import type { DirectionalAppTaggingSecret } from '@aztec/stdlib/logs';
9
+ import type { NoteStatus } from '@aztec/stdlib/note';
10
+ import { type MerkleTreeId, type NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
11
+ import type { BlockHeader, NodeStats } from '@aztec/stdlib/tx';
12
+ import type { NoteData } from './oracle/interfaces.js';
13
+ import type { MessageLoadOracleInputs } from './oracle/message_load_oracle_inputs.js';
14
+ /**
15
+ * Error thrown when a contract is not found in the database.
16
+ */
17
+ export declare class ContractNotFoundError extends Error {
18
+ constructor(contractAddress: string);
19
+ }
20
+ /**
21
+ * Error thrown when a contract class is not found in the database.
22
+ */
23
+ export declare class ContractClassNotFoundError extends Error {
24
+ constructor(contractClassId: string);
25
+ }
26
+ export type ExecutionStats = {
27
+ /**
28
+ * Contains an entry for each RPC call performed during the execution
29
+ */
30
+ nodeRPCCalls: NodeStats;
31
+ };
32
+ /**
33
+ * The interface for the data layer required to perform private and utility execution.
34
+ */
35
+ export interface ExecutionDataProvider {
36
+ /**
37
+ * Returns a contract instance associated with an address, if available.
38
+ * @param address - Address.
39
+ * @returns A contract instance.
40
+ */
41
+ getContractInstance(address: AztecAddress): Promise<ContractInstance>;
42
+ /**
43
+ * Retrieve the complete address associated to a given address.
44
+ * @param account - The account address.
45
+ * @returns A complete address associated with the input address.
46
+ * @throws An error if the account is not registered in the database.
47
+ */
48
+ getCompleteAddress(account: AztecAddress): Promise<CompleteAddress>;
49
+ /**
50
+ * Retrieve keys associated with a specific master public key and app address.
51
+ * @param pkMHash - The master public key hash.
52
+ * @returns A Promise that resolves to nullifier keys.
53
+ * @throws If the keys are not registered in the key store.
54
+ */
55
+ getKeyValidationRequest(pkMHash: Fr, contractAddress: AztecAddress): Promise<KeyValidationRequest>;
56
+ /**
57
+ * Retrieves a set of notes stored in the database for a given contract address and storage slot.
58
+ * The query result is paginated using 'limit' and 'offset' values.
59
+ * Returns an object containing an array of note data.
60
+ *
61
+ * @param contractAddress - The contract address of the notes.
62
+ * @param storageSlot - The storage slot of the notes.
63
+ * @param status - The status of notes to fetch.
64
+ * @param scopes - The accounts whose notes we can access in this call. Currently optional and will default to all.
65
+ * @returns A Promise that resolves to an array of note data.
66
+ */
67
+ getNotes(contractAddress: AztecAddress, storageSlot: Fr, status: NoteStatus, scopes?: AztecAddress[]): Promise<NoteData[]>;
68
+ /**
69
+ * Retrieve the artifact information of a specific function within a contract.
70
+ * The function is identified by its selector, which is a unique identifier generated from the function signature.
71
+ *
72
+ * @param contractAddress - The contract address.
73
+ * @param selector - The corresponding function selector.
74
+ * @returns A Promise that resolves to a FunctionArtifact object.
75
+ */
76
+ getFunctionArtifact(contractAddress: AztecAddress, selector: FunctionSelector): Promise<FunctionArtifactWithContractName>;
77
+ /**
78
+ * Generates a stable function name for debug purposes.
79
+ * @param contractAddress - The contract address.
80
+ * @param selector - The corresponding function selector.
81
+ */
82
+ getDebugFunctionName(contractAddress: AztecAddress, selector: FunctionSelector): Promise<string>;
83
+ /**
84
+ * Retrieves the artifact of a specified function within a given contract.
85
+ * The function is identified by its name, which is unique within a contract.
86
+ *
87
+ * @param contractAddress - The AztecAddress representing the contract containing the function.
88
+ * @param functionName - The name of the function.
89
+ * @returns The corresponding function's artifact as an object.
90
+ */
91
+ getFunctionArtifactByName(contractAddress: AztecAddress, functionName: string): Promise<FunctionArtifact | undefined>;
92
+ /**
93
+ * Gets the index of a nullifier in the nullifier tree.
94
+ * @param nullifier - The nullifier.
95
+ * @returns - The index of the nullifier. Undefined if it does not exist in the tree.
96
+ */
97
+ getNullifierIndex(nullifier: Fr): Promise<bigint | undefined>;
98
+ /**
99
+ * Returns a nullifier membership witness for the given nullifier or undefined if not found.
100
+ * REFACTOR: Same as getL1ToL2MembershipWitness, can be combined with aztec-node method that does almost the same thing.
101
+ * @param nullifier - Nullifier we're looking for.
102
+ */
103
+ getNullifierMembershipWitnessAtLatestBlock(nullifier: Fr): Promise<NullifierMembershipWitness | undefined>;
104
+ /**
105
+ * Fetches a message from the db, given its key.
106
+ * @param contractAddress - Address of a contract by which the message was emitted.
107
+ * @param messageHash - Hash of the message.
108
+ * @param secret - Secret used to compute a nullifier.
109
+ * @dev Contract address and secret are only used to compute the nullifier to get non-nullified messages
110
+ * @returns The l1 to l2 membership witness (index of message in the tree and sibling path).
111
+ */
112
+ getL1ToL2MembershipWitness(contractAddress: AztecAddress, messageHash: Fr, secret: Fr): Promise<MessageLoadOracleInputs<typeof L1_TO_L2_MSG_TREE_HEIGHT>>;
113
+ /**
114
+ * Retrieve the latest block header synchronized by the execution data provider. This block header is referred
115
+ * to as the anchor block header in Aztec terminology and it defines the state that is used during private function
116
+ * execution.
117
+ * @returns The anchor block header.
118
+ */
119
+ getAnchorBlockHeader(): Promise<BlockHeader>;
120
+ /**
121
+ * Fetches the index and sibling path of a leaf at a given block from a given tree.
122
+ * @param blockNumber - The block number at which to get the membership witness.
123
+ * @param treeId - Id of the tree to get the sibling path from.
124
+ * @param leafValue - The leaf value
125
+ * @returns The index and sibling path concatenated [index, sibling_path]
126
+ */
127
+ getMembershipWitness(blockNumber: number, treeId: MerkleTreeId, leafValue: Fr): Promise<Fr[]>;
128
+ /**
129
+ * Returns a nullifier membership witness for a given nullifier at a given block.
130
+ * @param blockNumber - The block number at which to get the index.
131
+ * @param nullifier - Nullifier we try to find witness for.
132
+ * @returns The nullifier membership witness (if found).
133
+ */
134
+ getNullifierMembershipWitness(blockNumber: number, nullifier: Fr): Promise<NullifierMembershipWitness | undefined>;
135
+ /**
136
+ * Returns a low nullifier membership witness for a given nullifier at a given block.
137
+ * @param blockNumber - The block number at which to get the index.
138
+ * @param nullifier - Nullifier we try to find the low nullifier witness for.
139
+ * @returns The low nullifier membership witness (if found).
140
+ * @remarks Low nullifier witness can be used to perform a nullifier non-inclusion proof by leveraging the "linked
141
+ * list structure" of leaves and proving that a lower nullifier is pointing to a bigger next value than the nullifier
142
+ * we are trying to prove non-inclusion for.
143
+ */
144
+ getLowNullifierMembershipWitness(blockNumber: number, nullifier: Fr): Promise<NullifierMembershipWitness | undefined>;
145
+ /**
146
+ * Returns a witness for a given slot of the public data tree at a given block.
147
+ * @param blockNumber - The block number at which to get the witness.
148
+ * @param leafSlot - The slot of the public data in the public data tree.
149
+ */
150
+ getPublicDataWitness(blockNumber: number, leafSlot: Fr): Promise<PublicDataWitness | undefined>;
151
+ /**
152
+ * Gets the storage value at the given contract storage slot.
153
+ *
154
+ * @remarks The storage slot here refers to the slot as it is defined in Noir not the index in the merkle tree.
155
+ * Aztec's version of `eth_getStorageAt`.
156
+ *
157
+ * @param blockNumber - The block number at which to get the data.
158
+ * @param contract - Address of the contract to query.
159
+ * @param slot - Slot to query.
160
+ * @returns Storage value at the given contract slot.
161
+ * @throws If the contract is not deployed.
162
+ */
163
+ getPublicStorageAt(blockNumber: number, contract: AztecAddress, slot: Fr): Promise<Fr>;
164
+ /**
165
+ * Fetch a block corresponding to the given block number.
166
+ * @param blockNumber - The block number of a block to fetch.
167
+ * @returns - The block corresponding to the given block number. Undefined if it does not exist.
168
+ */
169
+ getBlock(blockNumber: number): Promise<L2Block | undefined>;
170
+ /**
171
+ * Assert that the oracle version is compatible with the expected version.
172
+ * @param version - The expected version.
173
+ */
174
+ assertCompatibleOracleVersion(version: number): void;
175
+ /**
176
+ * Calculates the directional app tagging secret for a given contract, sender and recipient.
177
+ * @param contractAddress - The contract address to silo the secret for
178
+ * @param sender - The address sending the note
179
+ * @param recipient - The address receiving the note
180
+ * @returns The directional app tagging secret
181
+ */
182
+ calculateDirectionalAppTaggingSecret(contractAddress: AztecAddress, sender: AztecAddress, recipient: AztecAddress): Promise<DirectionalAppTaggingSecret>;
183
+ /**
184
+ * Updates the local index of the shared tagging secret of a (sender, recipient, contract) tuple if a log with
185
+ * a larger index is found from the node.
186
+ * @param secret - The secret that's unique for (sender, recipient, contract) tuple while the direction
187
+ * of sender -> recipient matters.
188
+ * @param contractAddress - The address of the contract that the logs are tagged for. Needs to be provided to store
189
+ * because the function performs second round of siloing which is necessary because kernels do it as well (they silo
190
+ * first field of the private log which corresponds to the tag).
191
+ */
192
+ syncTaggedLogsAsSender(secret: DirectionalAppTaggingSecret, contractAddress: AztecAddress): Promise<void>;
193
+ /**
194
+ * Returns the last used index when sending a log with a given secret.
195
+ * @param secret - The directional app tagging secret.
196
+ * @returns The last used index for the given directional app tagging secret, or undefined if we never sent a log
197
+ * from this sender to a recipient in a given contract (implicitly included in the secret).
198
+ */
199
+ getLastUsedIndexAsSender(secret: DirectionalAppTaggingSecret): Promise<number | undefined>;
200
+ /**
201
+ * Synchronizes the private logs tagged with scoped addresses and all the senders in the address book. Stores the found
202
+ * logs in CapsuleArray ready for a later retrieval in Aztec.nr.
203
+ * @param contractAddress - The address of the contract that the logs are tagged for.
204
+ * @param pendingTaggedLogArrayBaseSlot - The base slot of the pending tagged log capsule array in which found logs will be stored.
205
+ * @param scopes - The scoped addresses to sync logs for. If not provided, all accounts in the address book will be
206
+ * synced.
207
+ */
208
+ syncTaggedLogs(contractAddress: AztecAddress, pendingTaggedLogArrayBaseSlot: Fr, scopes?: AztecAddress[]): Promise<void>;
209
+ /**
210
+ * Validates all note and event validation requests enqueued via `enqueue_note_for_validation` and
211
+ * `enqueue_event_for_validation`, inserting them into the note database and event store respectively, making them
212
+ * queryable via `get_notes` and `getPrivateEvents`.
213
+ *
214
+ * This automatically clears both validation request queues, so no further work needs to be done by the caller.
215
+ * @param contractAddress - The address of the contract that the logs are tagged for.
216
+ * @param noteValidationRequestsArrayBaseSlot - The base slot of capsule array containing note validation requests.
217
+ * @param eventValidationRequestsArrayBaseSlot - The base slot of capsule array containing event validation requests.
218
+ */
219
+ validateEnqueuedNotesAndEvents(contractAddress: AztecAddress, noteValidationRequestsArrayBaseSlot: Fr, eventValidationRequestsArrayBaseSlot: Fr): Promise<void>;
220
+ bulkRetrieveLogs(contractAddress: AztecAddress, logRetrievalRequestsArrayBaseSlot: Fr, logRetrievalResponsesArrayBaseSlot: Fr): Promise<void>;
221
+ /**
222
+ * Looks for nullifiers of active contract notes and marks them as nullified in the db if a nullifier is found.
223
+ */
224
+ syncNoteNullifiers(contractAddress: AztecAddress): Promise<void>;
225
+ /**
226
+ * Stores arbitrary information in a per-contract non-volatile database, which can later be retrieved with `loadCapsule`.
227
+ * * If data was already stored at this slot, it is overwritten.
228
+ * @param contractAddress - The contract address to scope the data under.
229
+ * @param slot - The slot in the database in which to store the value. Slots need not be contiguous.
230
+ * @param capsule - An array of field elements representing the capsule.
231
+ * @remarks A capsule is a "blob" of data that is passed to the contract through an oracle. It works similarly
232
+ * to public contract storage in that it's indexed by the contract address and storage slot but instead of the global
233
+ * network state it's backed by local PXE db.
234
+ */
235
+ storeCapsule(contractAddress: AztecAddress, slot: Fr, capsule: Fr[]): Promise<void>;
236
+ /**
237
+ * Returns data previously stored via `storeCapsule` in the per-contract non-volatile database.
238
+ * @param contractAddress - The contract address under which the data is scoped.
239
+ * @param slot - The slot in the database to read.
240
+ * @returns The stored data or `null` if no data is stored under the slot.
241
+ */
242
+ loadCapsule(contractAddress: AztecAddress, slot: Fr): Promise<Fr[] | null>;
243
+ /**
244
+ * Deletes data in the per-contract non-volatile database. Does nothing if no data was present.
245
+ * @param contractAddress - The contract address under which the data is scoped.
246
+ * @param slot - The slot in the database to delete.
247
+ */
248
+ deleteCapsule(contractAddress: AztecAddress, slot: Fr): Promise<void>;
249
+ /**
250
+ * Copies a number of contiguous entries in the per-contract non-volatile database. This allows for efficient data
251
+ * structures by avoiding repeated calls to `loadCapsule` and `storeCapsule`.
252
+ * Supports overlapping source and destination regions (which will result in the overlapped source values being
253
+ * overwritten). All copied slots must exist in the database (i.e. have been stored and not deleted)
254
+ *
255
+ * @param contractAddress - The contract address under which the data is scoped.
256
+ * @param srcSlot - The first slot to copy from.
257
+ * @param dstSlot - The first slot to copy to.
258
+ * @param numEntries - The number of entries to copy.
259
+ */
260
+ copyCapsule(contractAddress: AztecAddress, srcSlot: Fr, dstSlot: Fr, numEntries: number): Promise<void>;
261
+ /**
262
+ * Retrieves the shared secret for a given address and ephemeral public key.
263
+ * @param address - The address to get the secret for.
264
+ * @param ephPk - The ephemeral public key to get the secret for.
265
+ * @returns The secret for the given address.
266
+ */
267
+ getSharedSecret(address: AztecAddress, ephPk: Point): Promise<Point>;
268
+ /**
269
+ * Returns the execution statistics collected during the simulator run.
270
+ * @returns The execution statistics.
271
+ */
272
+ getStats(): ExecutionStats;
273
+ }
274
+ //# sourceMappingURL=execution_data_provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execution_data_provider.d.ts","sourceRoot":"","sources":["../../src/contract_function_simulator/execution_data_provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,gCAAgC,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC9G,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,KAA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C,eAAe,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpF;;;;;OAKG;IACH,WAAW,CAAC,eAAe,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,GAAG,OAAO,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;IAE3E;;;;OAIG;IACH,aAAa,CAAC,eAAe,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtE;;;;;;;;;;OAUG;IACH,WAAW,CAAC,eAAe,EAAE,YAAY,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExG;;;;;OAKG;IACH,eAAe,CAAC,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAErE;;;OAGG;IACH,QAAQ,IAAI,cAAc,CAAC;CAC5B"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Error thrown when a contract is not found in the database.
3
+ */ export class ContractNotFoundError extends Error {
4
+ constructor(contractAddress){
5
+ super(`DB has no contract with address ${contractAddress}`);
6
+ }
7
+ }
8
+ /**
9
+ * Error thrown when a contract class is not found in the database.
10
+ */ export class ContractClassNotFoundError extends Error {
11
+ constructor(contractClassId){
12
+ super(`DB has no contract class with id ${contractClassId}`);
13
+ }
14
+ }
@@ -0,0 +1,93 @@
1
+ import { Fr } from '@aztec/foundation/fields';
2
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
3
+ import type { NoteData } from './oracle/interfaces.js';
4
+ interface PendingNote {
5
+ note: NoteData;
6
+ counter: number;
7
+ noteHashForConsumption: Fr;
8
+ }
9
+ /**
10
+ * Data that's accessible by all the function calls in an execution.
11
+ */
12
+ export declare class ExecutionNoteCache {
13
+ #private;
14
+ private readonly txRequestHash;
15
+ /**
16
+ * New notes created in this transaction.
17
+ * They are pushed to this array in the same order as they are emitted.
18
+ */
19
+ private notes;
20
+ /**
21
+ * This mapping maps from a contract address to the notes in the contract.
22
+ */
23
+ private noteMap;
24
+ /**
25
+ * This maps from a contract address to the nullifiers emitted from the contract.
26
+ * The note which is nullified might be new or not (i.e., was generated in a previous transaction).
27
+ * Note that their value (bigint representation) is used because Frs cannot be looked up in Sets.
28
+ */
29
+ private nullifierMap;
30
+ /**
31
+ * All nullifiers emitted in this transaction.
32
+ */
33
+ private allNullifiers;
34
+ private minRevertibleSideEffectCounter;
35
+ private inRevertiblePhase;
36
+ /**
37
+ * We don't need to use the tx request hash for nonces if another non revertible nullifier is emitted.
38
+ * In that case we disable injecting the tx request hash as a nullifier.
39
+ */
40
+ private usedTxRequestHashForNonces;
41
+ constructor(txRequestHash: Fr);
42
+ /**
43
+ * Enters the revertible phase of the transaction.
44
+ * @param minRevertibleSideEffectCounter - The counter at which the transaction enters the revertible phase.
45
+ */
46
+ setMinRevertibleSideEffectCounter(minRevertibleSideEffectCounter: number): Promise<void>;
47
+ finish(): {
48
+ usedTxRequestHashForNonces: boolean;
49
+ };
50
+ /**
51
+ * Add a new note to cache.
52
+ * @param note - New note created during execution.
53
+ */
54
+ addNewNote(note: NoteData, counter: number): void;
55
+ /**
56
+ * Add a nullifier to cache. It could be for a db note or a new note created during execution.
57
+ * @param contractAddress - Contract address of the note.
58
+ * @param innerNullifier - Inner nullifier of the note.
59
+ * @param noteHash - A hash of the note. If this value equals 0, it means the note being nullified is from a previous
60
+ * transaction (and thus not a new note).
61
+ */
62
+ nullifyNote(contractAddress: AztecAddress, innerNullifier: Fr, noteHash: Fr): Promise<number | undefined>;
63
+ /**
64
+ * Adds a nullifier to the cache. Note cache needs to track all nullifiers to decide which nullifier to use for note siloing.
65
+ * @param contractAddress - Contract address that emitted the nullifier.
66
+ * @param innerNullifier
67
+ */
68
+ nullifierCreated(contractAddress: AztecAddress, innerNullifier: Fr): Promise<void>;
69
+ /**
70
+ * Return notes created up to current point in execution.
71
+ * If a nullifier for a note in this list is emitted, the note will be deleted.
72
+ * @param contractAddress - Contract address of the notes.
73
+ * @param storageSlot - Storage slot of the notes.
74
+ **/
75
+ getNotes(contractAddress: AztecAddress, storageSlot: Fr): NoteData[];
76
+ /**
77
+ * Check if a note exists in the newNotes array.
78
+ * @param contractAddress - Contract address of the note.
79
+ * @param storageSlot - Storage slot of the note.
80
+ * @param noteHash - A hash of the note.
81
+ **/
82
+ checkNoteExists(contractAddress: AztecAddress, noteHash: Fr): boolean;
83
+ /**
84
+ * Return all nullifiers emitted from a contract.
85
+ * @param contractAddress - Address of the contract.
86
+ */
87
+ getNullifiers(contractAddress: AztecAddress): Set<bigint>;
88
+ getAllNotes(): PendingNote[];
89
+ getAllNullifiers(): Fr[];
90
+ recordNullifier(contractAddress: AztecAddress, siloedNullifier: bigint): void;
91
+ }
92
+ export {};
93
+ //# sourceMappingURL=execution_note_cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execution_note_cache.d.ts","sourceRoot":"","sources":["../../src/contract_function_simulator/execution_note_cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAGhE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEvD,UAAU,WAAW;IACnB,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,sBAAsB,EAAE,EAAE,CAAC;CAC5B;AAED;;GAEG;AACH,qBAAa,kBAAkB;;IAiCjB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAhC1C;;;OAGG;IACH,OAAO,CAAC,KAAK,CAAqB;IAClC;;OAEG;IACH,OAAO,CAAC,OAAO,CAAyC;IAExD;;;;OAIG;IACH,OAAO,CAAC,YAAY,CAAuC;IAE3D;;OAEG;IACH,OAAO,CAAC,aAAa,CAA0B;IAE/C,OAAO,CAAC,8BAA8B,CAAK;IAE3C,OAAO,CAAC,iBAAiB,CAAS;IAElC;;;OAGG;IACH,OAAO,CAAC,0BAA0B,CAAQ;gBAEb,aAAa,EAAE,EAAE;IAE9C;;;OAGG;IACU,iCAAiC,CAAC,8BAA8B,EAAE,MAAM;IAwC9E,MAAM;;;IAWb;;;OAGG;IACI,UAAU,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM;IAWjD;;;;;;OAMG;IACU,WAAW,CAAC,eAAe,EAAE,YAAY,EAAE,cAAc,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE;IA2BxF;;;;OAIG;IACU,gBAAgB,CAAC,eAAe,EAAE,YAAY,EAAE,cAAc,EAAE,EAAE;IAK/E;;;;;QAKI;IACG,QAAQ,CAAC,eAAe,EAAE,YAAY,EAAE,WAAW,EAAE,EAAE;IAK9D;;;;;QAKI;IACG,eAAe,CAAC,eAAe,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE;IAKlE;;;OAGG;IACI,aAAa,CAAC,eAAe,EAAE,YAAY,GAAG,GAAG,CAAC,MAAM,CAAC;IAYhE,WAAW,IAAI,WAAW,EAAE;IAI5B,gBAAgB,IAAI,EAAE,EAAE;IAIxB,eAAe,CAAC,eAAe,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM;CAWvE"}
@@ -0,0 +1,183 @@
1
+ import { Fr } from '@aztec/foundation/fields';
2
+ import { computeNoteHashNonce, computeUniqueNoteHash, siloNoteHash, siloNullifier } from '@aztec/stdlib/hash';
3
+ /**
4
+ * Data that's accessible by all the function calls in an execution.
5
+ */ export class ExecutionNoteCache {
6
+ txRequestHash;
7
+ /**
8
+ * New notes created in this transaction.
9
+ * They are pushed to this array in the same order as they are emitted.
10
+ */ notes;
11
+ /**
12
+ * This mapping maps from a contract address to the notes in the contract.
13
+ */ noteMap;
14
+ /**
15
+ * This maps from a contract address to the nullifiers emitted from the contract.
16
+ * The note which is nullified might be new or not (i.e., was generated in a previous transaction).
17
+ * Note that their value (bigint representation) is used because Frs cannot be looked up in Sets.
18
+ */ nullifierMap;
19
+ /**
20
+ * All nullifiers emitted in this transaction.
21
+ */ allNullifiers;
22
+ minRevertibleSideEffectCounter;
23
+ inRevertiblePhase;
24
+ /**
25
+ * We don't need to use the tx request hash for nonces if another non revertible nullifier is emitted.
26
+ * In that case we disable injecting the tx request hash as a nullifier.
27
+ */ usedTxRequestHashForNonces;
28
+ constructor(txRequestHash){
29
+ this.txRequestHash = txRequestHash;
30
+ this.notes = [];
31
+ this.noteMap = new Map();
32
+ this.nullifierMap = new Map();
33
+ this.allNullifiers = new Set();
34
+ this.minRevertibleSideEffectCounter = 0;
35
+ this.inRevertiblePhase = false;
36
+ this.usedTxRequestHashForNonces = true;
37
+ }
38
+ /**
39
+ * Enters the revertible phase of the transaction.
40
+ * @param minRevertibleSideEffectCounter - The counter at which the transaction enters the revertible phase.
41
+ */ async setMinRevertibleSideEffectCounter(minRevertibleSideEffectCounter) {
42
+ if (this.inRevertiblePhase) {
43
+ throw new Error(`Cannot enter the revertible phase twice. Current counter: ${minRevertibleSideEffectCounter}. Previous enter counter: ${this.minRevertibleSideEffectCounter}`);
44
+ }
45
+ this.inRevertiblePhase = true;
46
+ this.minRevertibleSideEffectCounter = minRevertibleSideEffectCounter;
47
+ let nonceGenerator = this.txRequestHash;
48
+ const nullifiers = this.getAllNullifiers();
49
+ if (nullifiers.length > 0) {
50
+ nonceGenerator = new Fr(nullifiers[0]);
51
+ this.usedTxRequestHashForNonces = false;
52
+ }
53
+ // The existing pending notes are all non-revertible.
54
+ // They cannot be squashed by nullifiers emitted after minRevertibleSideEffectCounter is set.
55
+ // Their indexes in the tx are known at this point and won't change. So we can assign a nonce to each one of them.
56
+ // The nonces will be used to create the "complete" nullifier.
57
+ const updatedNotes = await Promise.all(this.notes.map(async ({ note, counter }, i)=>{
58
+ const noteNonce = await computeNoteHashNonce(nonceGenerator, i);
59
+ const uniqueNoteHash = await computeUniqueNoteHash(noteNonce, await siloNoteHash(note.contractAddress, note.noteHash));
60
+ return {
61
+ counter,
62
+ note: {
63
+ ...note,
64
+ noteNonce
65
+ },
66
+ noteHashForConsumption: uniqueNoteHash
67
+ };
68
+ }));
69
+ // Rebuild the data.
70
+ this.notes = [];
71
+ this.noteMap = new Map();
72
+ updatedNotes.forEach((n)=>this.#addNote(n));
73
+ }
74
+ finish() {
75
+ // If we never entered the revertible phase, we need to use the tx request hash as a nonce for the notes if no nullifiers have been emitted.
76
+ if (!this.inRevertiblePhase) {
77
+ this.usedTxRequestHashForNonces = this.getAllNullifiers().length === 0;
78
+ }
79
+ // If we entered the revertible phase, the nonce generator was decided based on wether or not a nullifier was emitted before entering.
80
+ return {
81
+ usedTxRequestHashForNonces: this.usedTxRequestHashForNonces
82
+ };
83
+ }
84
+ /**
85
+ * Add a new note to cache.
86
+ * @param note - New note created during execution.
87
+ */ addNewNote(note, counter) {
88
+ const previousNote = this.notes[this.notes.length - 1];
89
+ if (previousNote && previousNote.counter >= counter) {
90
+ throw new Error(`Note hash counters must be strictly increasing. Current counter: ${counter}. Previous counter: ${previousNote.counter}.`);
91
+ }
92
+ this.#addNote({
93
+ note,
94
+ counter,
95
+ noteHashForConsumption: note.noteHash
96
+ });
97
+ }
98
+ /**
99
+ * Add a nullifier to cache. It could be for a db note or a new note created during execution.
100
+ * @param contractAddress - Contract address of the note.
101
+ * @param innerNullifier - Inner nullifier of the note.
102
+ * @param noteHash - A hash of the note. If this value equals 0, it means the note being nullified is from a previous
103
+ * transaction (and thus not a new note).
104
+ */ async nullifyNote(contractAddress, innerNullifier, noteHash) {
105
+ const siloedNullifier = (await siloNullifier(contractAddress, innerNullifier)).toBigInt();
106
+ let nullifiedNoteHashCounter = undefined;
107
+ // Find and remove the matching new note and log(s) if the emitted noteHash is not empty.
108
+ if (!noteHash.isEmpty()) {
109
+ const notesInContract = this.noteMap.get(contractAddress.toBigInt()) ?? [];
110
+ const noteIndexToRemove = notesInContract.findIndex((n)=>n.noteHashForConsumption.equals(noteHash));
111
+ if (noteIndexToRemove === -1) {
112
+ throw new Error('Attempt to remove a pending note that does not exist.');
113
+ }
114
+ const note = notesInContract.splice(noteIndexToRemove, 1)[0];
115
+ nullifiedNoteHashCounter = note.counter;
116
+ this.noteMap.set(contractAddress.toBigInt(), notesInContract);
117
+ this.notes = this.notes.filter((n)=>n.counter !== note.counter);
118
+ // If the note is non revertible and the nullifier was emitted in the revertible phase, both the note hash and the nullifier will be emitted
119
+ if (this.inRevertiblePhase && note.counter < this.minRevertibleSideEffectCounter) {
120
+ this.recordNullifier(contractAddress, siloedNullifier);
121
+ }
122
+ } else {
123
+ // If the note being nullified comes from a previous tx the nullifier will be emitted.
124
+ this.recordNullifier(contractAddress, siloedNullifier);
125
+ }
126
+ return nullifiedNoteHashCounter;
127
+ }
128
+ /**
129
+ * Adds a nullifier to the cache. Note cache needs to track all nullifiers to decide which nullifier to use for note siloing.
130
+ * @param contractAddress - Contract address that emitted the nullifier.
131
+ * @param innerNullifier
132
+ */ async nullifierCreated(contractAddress, innerNullifier) {
133
+ const siloedNullifier = (await siloNullifier(contractAddress, innerNullifier)).toBigInt();
134
+ this.recordNullifier(contractAddress, siloedNullifier);
135
+ }
136
+ /**
137
+ * Return notes created up to current point in execution.
138
+ * If a nullifier for a note in this list is emitted, the note will be deleted.
139
+ * @param contractAddress - Contract address of the notes.
140
+ * @param storageSlot - Storage slot of the notes.
141
+ **/ getNotes(contractAddress, storageSlot) {
142
+ const notes = this.noteMap.get(contractAddress.toBigInt()) ?? [];
143
+ return notes.filter((n)=>n.note.storageSlot.equals(storageSlot)).map((n)=>n.note);
144
+ }
145
+ /**
146
+ * Check if a note exists in the newNotes array.
147
+ * @param contractAddress - Contract address of the note.
148
+ * @param storageSlot - Storage slot of the note.
149
+ * @param noteHash - A hash of the note.
150
+ **/ checkNoteExists(contractAddress, noteHash) {
151
+ const notes = this.noteMap.get(contractAddress.toBigInt()) ?? [];
152
+ return notes.some((n)=>n.note.noteHash.equals(noteHash));
153
+ }
154
+ /**
155
+ * Return all nullifiers emitted from a contract.
156
+ * @param contractAddress - Address of the contract.
157
+ */ getNullifiers(contractAddress) {
158
+ return this.nullifierMap.get(contractAddress.toBigInt()) ?? new Set();
159
+ }
160
+ #addNote(note) {
161
+ this.notes.push(note);
162
+ const notes = this.noteMap.get(note.note.contractAddress.toBigInt()) ?? [];
163
+ notes.push(note);
164
+ this.noteMap.set(note.note.contractAddress.toBigInt(), notes);
165
+ }
166
+ getAllNotes() {
167
+ return this.notes;
168
+ }
169
+ getAllNullifiers() {
170
+ return [
171
+ ...this.allNullifiers
172
+ ].map((n)=>new Fr(n));
173
+ }
174
+ recordNullifier(contractAddress, siloedNullifier) {
175
+ const nullifiers = this.getNullifiers(contractAddress);
176
+ if (nullifiers.has(siloedNullifier)) {
177
+ throw new Error(`Duplicate siloed nullifier ${siloedNullifier} emitted by contract ${contractAddress}`);
178
+ }
179
+ nullifiers.add(siloedNullifier);
180
+ this.nullifierMap.set(contractAddress.toBigInt(), nullifiers);
181
+ this.allNullifiers.add(siloedNullifier);
182
+ }
183
+ }
@@ -0,0 +1,16 @@
1
+ import { DirectionalAppTaggingSecret, type PreTag } from '@aztec/stdlib/logs';
2
+ /**
3
+ * A map that stores the tagging index for a given directional app tagging secret.
4
+ * Note: The directional app tagging secret is unique for a (sender, recipient, contract) tuple while the direction
5
+ * of sender -> recipient matters.
6
+ */
7
+ export declare class ExecutionTaggingIndexCache {
8
+ private taggingIndexMap;
9
+ getLastUsedIndex(secret: DirectionalAppTaggingSecret): number | undefined;
10
+ setLastUsedIndex(secret: DirectionalAppTaggingSecret, index: number): void;
11
+ /**
12
+ * Returns the pre tags that were used in this execution (and that need to be stored in the db).
13
+ */
14
+ getUsedPreTags(): PreTag[];
15
+ }
16
+ //# sourceMappingURL=execution_tagging_index_cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execution_tagging_index_cache.d.ts","sourceRoot":"","sources":["../../src/contract_function_simulator/execution_tagging_index_cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE9E;;;;GAIG;AACH,qBAAa,0BAA0B;IACrC,OAAO,CAAC,eAAe,CAAkC;IAElD,gBAAgB,CAAC,MAAM,EAAE,2BAA2B,GAAG,MAAM,GAAG,SAAS;IAIzE,gBAAgB,CAAC,MAAM,EAAE,2BAA2B,EAAE,KAAK,EAAE,MAAM;IAQ1E;;OAEG;IACI,cAAc,IAAI,MAAM,EAAE;CAMlC"}
@@ -0,0 +1,26 @@
1
+ import { DirectionalAppTaggingSecret } from '@aztec/stdlib/logs';
2
+ /**
3
+ * A map that stores the tagging index for a given directional app tagging secret.
4
+ * Note: The directional app tagging secret is unique for a (sender, recipient, contract) tuple while the direction
5
+ * of sender -> recipient matters.
6
+ */ export class ExecutionTaggingIndexCache {
7
+ taggingIndexMap = new Map();
8
+ getLastUsedIndex(secret) {
9
+ return this.taggingIndexMap.get(secret.toString());
10
+ }
11
+ setLastUsedIndex(secret, index) {
12
+ const currentValue = this.taggingIndexMap.get(secret.toString());
13
+ if (currentValue !== undefined && currentValue !== index - 1) {
14
+ throw new Error(`Invalid tagging index update. Current value: ${currentValue}, new value: ${index}`);
15
+ }
16
+ this.taggingIndexMap.set(secret.toString(), index);
17
+ }
18
+ /**
19
+ * Returns the pre tags that were used in this execution (and that need to be stored in the db).
20
+ */ getUsedPreTags() {
21
+ return Array.from(this.taggingIndexMap.entries()).map(([secret, index])=>({
22
+ secret: DirectionalAppTaggingSecret.fromString(secret),
23
+ index
24
+ }));
25
+ }
26
+ }
@@ -0,0 +1,28 @@
1
+ import { Fr } from '@aztec/foundation/fields';
2
+ import { HashedValues } from '@aztec/stdlib/tx';
3
+ /**
4
+ * A cache for hashed values (arguments, returns) during transaction execution.
5
+ */
6
+ export declare class HashedValuesCache {
7
+ private cache;
8
+ constructor(initialArguments?: HashedValues[]);
9
+ /**
10
+ * Creates a new hashed values cache.
11
+ * @param initialArguments - The initial arguments to add to the cache.
12
+ * @returns The new hashed values cache.
13
+ */
14
+ static create(initialArguments?: HashedValues[]): HashedValuesCache;
15
+ /**
16
+ * Gets preimage of a hash.
17
+ * @param hash - The hash to get the preimage of.
18
+ * @returns The preimage.
19
+ */
20
+ getPreimage(hash: Fr): Fr[] | undefined;
21
+ /**
22
+ * Stores values in cache and returns its hash.
23
+ * @param values - The values to store.
24
+ * @returns The hash of the values.
25
+ */
26
+ store(values: Fr[], hash: Fr): void;
27
+ }
28
+ //# sourceMappingURL=hashed_values_cache.d.ts.map