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

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 (328) 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 +11 -24
  6. package/dest/config/index.d.ts.map +1 -1
  7. package/dest/config/index.js +18 -33
  8. package/dest/config/package_info.d.ts +1 -1
  9. package/dest/config/package_info.js +1 -1
  10. package/dest/contract_function_simulator/contract_function_simulator.d.ts +56 -0
  11. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -0
  12. package/dest/contract_function_simulator/contract_function_simulator.js +300 -0
  13. package/dest/contract_function_simulator/execution_data_provider.d.ts +265 -0
  14. package/dest/contract_function_simulator/execution_data_provider.d.ts.map +1 -0
  15. package/dest/contract_function_simulator/execution_data_provider.js +14 -0
  16. package/dest/contract_function_simulator/execution_note_cache.d.ts +94 -0
  17. package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -0
  18. package/dest/contract_function_simulator/execution_note_cache.js +190 -0
  19. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +16 -0
  20. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -0
  21. package/dest/contract_function_simulator/execution_tagging_index_cache.js +26 -0
  22. package/dest/contract_function_simulator/hashed_values_cache.d.ts +28 -0
  23. package/dest/contract_function_simulator/hashed_values_cache.d.ts.map +1 -0
  24. package/dest/contract_function_simulator/hashed_values_cache.js +36 -0
  25. package/dest/contract_function_simulator/index.d.ts +14 -0
  26. package/dest/contract_function_simulator/index.d.ts.map +1 -0
  27. package/dest/contract_function_simulator/index.js +12 -0
  28. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +20 -0
  29. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -0
  30. package/dest/contract_function_simulator/noir-structs/event_validation_request.js +37 -0
  31. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +15 -0
  32. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts.map +1 -0
  33. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.js +25 -0
  34. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +17 -0
  35. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -0
  36. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +65 -0
  37. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +23 -0
  38. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -0
  39. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +48 -0
  40. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +22 -0
  41. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -0
  42. package/dest/contract_function_simulator/noir-structs/utility_context.js +33 -0
  43. package/dest/contract_function_simulator/oracle/index.d.ts +14 -0
  44. package/dest/contract_function_simulator/oracle/index.d.ts.map +1 -0
  45. package/dest/contract_function_simulator/oracle/index.js +2 -0
  46. package/dest/contract_function_simulator/oracle/interfaces.d.ts +100 -0
  47. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -0
  48. package/dest/contract_function_simulator/oracle/interfaces.js +4 -0
  49. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +17 -0
  50. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -0
  51. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.js +24 -0
  52. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +24 -0
  53. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -0
  54. package/dest/contract_function_simulator/oracle/note_packing_utils.js +50 -0
  55. package/dest/contract_function_simulator/oracle/oracle.d.ts +58 -0
  56. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -0
  57. package/dest/contract_function_simulator/oracle/oracle.js +333 -0
  58. package/dest/contract_function_simulator/oracle/private_execution.d.ts +48 -0
  59. package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -0
  60. package/dest/contract_function_simulator/oracle/private_execution.js +123 -0
  61. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +231 -0
  62. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -0
  63. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +428 -0
  64. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +153 -0
  65. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -0
  66. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +265 -0
  67. package/dest/contract_function_simulator/pick_notes.d.ts +85 -0
  68. package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -0
  69. package/dest/contract_function_simulator/pick_notes.js +51 -0
  70. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +6 -0
  71. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -0
  72. package/dest/contract_function_simulator/proxied_contract_data_source.js +62 -0
  73. package/dest/contract_function_simulator/proxied_node.d.ts +9 -0
  74. package/dest/contract_function_simulator/proxied_node.d.ts.map +1 -0
  75. package/dest/contract_function_simulator/proxied_node.js +27 -0
  76. package/dest/contract_function_simulator/pxe_oracle_interface.d.ts +122 -0
  77. package/dest/contract_function_simulator/pxe_oracle_interface.d.ts.map +1 -0
  78. package/dest/contract_function_simulator/pxe_oracle_interface.js +694 -0
  79. package/dest/entrypoints/client/bundle/index.d.ts +5 -3
  80. package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
  81. package/dest/entrypoints/client/bundle/index.js +3 -2
  82. package/dest/entrypoints/client/bundle/utils.d.ts +10 -10
  83. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  84. package/dest/entrypoints/client/bundle/utils.js +18 -12
  85. package/dest/entrypoints/client/lazy/index.d.ts +5 -3
  86. package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
  87. package/dest/entrypoints/client/lazy/index.js +3 -2
  88. package/dest/entrypoints/client/lazy/utils.d.ts +9 -9
  89. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  90. package/dest/entrypoints/client/lazy/utils.js +17 -11
  91. package/dest/entrypoints/pxe_creation_options.d.ts +14 -0
  92. package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -0
  93. package/dest/entrypoints/server/index.d.ts +6 -4
  94. package/dest/entrypoints/server/index.d.ts.map +1 -1
  95. package/dest/entrypoints/server/index.js +4 -3
  96. package/dest/entrypoints/server/utils.d.ts +8 -16
  97. package/dest/entrypoints/server/utils.d.ts.map +1 -1
  98. package/dest/entrypoints/server/utils.js +30 -35
  99. package/dest/error_enriching.d.ts +11 -0
  100. package/dest/error_enriching.d.ts.map +1 -0
  101. package/dest/{pxe_service/error_enriching.js → error_enriching.js} +26 -18
  102. package/dest/oracle_version.d.ts +3 -0
  103. package/dest/oracle_version.d.ts.map +1 -0
  104. package/dest/oracle_version.js +10 -0
  105. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +28 -0
  106. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +1 -0
  107. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.js +271 -0
  108. package/dest/private_kernel/hints/compute_side_effect_uniqueness_hints.d.ts +3 -0
  109. package/dest/private_kernel/hints/compute_side_effect_uniqueness_hints.d.ts.map +1 -0
  110. package/dest/private_kernel/hints/compute_side_effect_uniqueness_hints.js +48 -0
  111. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +4 -0
  112. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts.map +1 -0
  113. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.js +41 -0
  114. package/dest/private_kernel/hints/index.d.ts +3 -0
  115. package/dest/private_kernel/hints/index.d.ts.map +1 -0
  116. package/dest/{kernel_prover → private_kernel}/hints/index.js +1 -0
  117. package/dest/private_kernel/index.d.ts +3 -0
  118. package/dest/private_kernel/index.d.ts.map +1 -0
  119. package/dest/private_kernel/index.js +2 -0
  120. package/dest/private_kernel/private_kernel_execution_prover.d.ts +44 -0
  121. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -0
  122. package/dest/private_kernel/private_kernel_execution_prover.js +289 -0
  123. package/dest/private_kernel/private_kernel_oracle.d.ts +62 -0
  124. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -0
  125. package/dest/private_kernel/private_kernel_oracle.js +4 -0
  126. package/dest/private_kernel/private_kernel_oracle_impl.d.ts +45 -0
  127. package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +1 -0
  128. package/dest/{kernel_oracle/index.js → private_kernel/private_kernel_oracle_impl.js} +19 -9
  129. package/dest/pxe.d.ts +240 -0
  130. package/dest/pxe.d.ts.map +1 -0
  131. package/dest/pxe.js +771 -0
  132. package/dest/storage/address_data_provider/address_data_provider.d.ts +2 -4
  133. package/dest/storage/address_data_provider/address_data_provider.d.ts.map +1 -1
  134. package/dest/storage/address_data_provider/address_data_provider.js +0 -3
  135. package/dest/storage/address_data_provider/index.d.ts +1 -1
  136. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts +15 -6
  137. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +1 -1
  138. package/dest/storage/capsule_data_provider/capsule_data_provider.js +85 -24
  139. package/dest/storage/capsule_data_provider/index.d.ts +1 -1
  140. package/dest/storage/contract_data_provider/contract_data_provider.d.ts +13 -58
  141. package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +1 -1
  142. package/dest/storage/contract_data_provider/contract_data_provider.js +89 -79
  143. package/dest/storage/contract_data_provider/index.d.ts +1 -2
  144. package/dest/storage/contract_data_provider/index.d.ts.map +1 -1
  145. package/dest/storage/contract_data_provider/index.js +0 -1
  146. package/dest/storage/contract_data_provider/private_functions_tree.d.ts +3 -42
  147. package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +1 -1
  148. package/dest/storage/contract_data_provider/private_functions_tree.js +9 -61
  149. package/dest/storage/index.d.ts +3 -4
  150. package/dest/storage/index.d.ts.map +1 -1
  151. package/dest/storage/index.js +2 -3
  152. package/dest/storage/metadata.d.ts +2 -0
  153. package/dest/storage/metadata.d.ts.map +1 -0
  154. package/dest/storage/metadata.js +1 -0
  155. package/dest/storage/note_data_provider/index.d.ts +2 -2
  156. package/dest/storage/note_data_provider/index.d.ts.map +1 -1
  157. package/dest/storage/note_data_provider/index.js +1 -1
  158. package/dest/storage/note_data_provider/note_data_provider.d.ts +73 -10
  159. package/dest/storage/note_data_provider/note_data_provider.d.ts.map +1 -1
  160. package/dest/storage/note_data_provider/note_data_provider.js +145 -83
  161. package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +37 -0
  162. package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts.map +1 -0
  163. package/dest/storage/private_event_data_provider/private_event_data_provider.js +105 -0
  164. package/dest/storage/sync_data_provider/index.d.ts +1 -1
  165. package/dest/storage/sync_data_provider/sync_data_provider.d.ts +3 -5
  166. package/dest/storage/sync_data_provider/sync_data_provider.d.ts.map +1 -1
  167. package/dest/storage/sync_data_provider/sync_data_provider.js +2 -5
  168. package/dest/storage/tagging_data_provider/index.d.ts +1 -1
  169. package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts +29 -7
  170. package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts.map +1 -1
  171. package/dest/storage/tagging_data_provider/tagging_data_provider.js +48 -24
  172. package/dest/synchronizer/index.d.ts +1 -1
  173. package/dest/synchronizer/synchronizer.d.ts +8 -10
  174. package/dest/synchronizer/synchronizer.d.ts.map +1 -1
  175. package/dest/synchronizer/synchronizer.js +17 -19
  176. package/dest/tagging/constants.d.ts +2 -0
  177. package/dest/tagging/constants.d.ts.map +1 -0
  178. package/dest/tagging/constants.js +2 -0
  179. package/dest/tagging/index.d.ts +7 -0
  180. package/dest/tagging/index.d.ts.map +1 -0
  181. package/dest/tagging/index.js +5 -0
  182. package/dest/tagging/siloed_tag.d.ts +14 -0
  183. package/dest/tagging/siloed_tag.d.ts.map +1 -0
  184. package/dest/tagging/siloed_tag.js +20 -0
  185. package/dest/tagging/tag.d.ts +12 -0
  186. package/dest/tagging/tag.d.ts.map +1 -0
  187. package/dest/tagging/tag.js +17 -0
  188. package/dest/tagging/utils.d.ts +18 -0
  189. package/dest/tagging/utils.d.ts.map +1 -0
  190. package/dest/tagging/utils.js +24 -0
  191. package/package.json +37 -34
  192. package/src/bin/check_oracle_version.ts +50 -0
  193. package/src/config/index.ts +27 -55
  194. package/src/config/package_info.ts +1 -1
  195. package/src/contract_function_simulator/contract_function_simulator.ts +553 -0
  196. package/src/contract_function_simulator/execution_data_provider.ts +333 -0
  197. package/src/contract_function_simulator/execution_note_cache.ts +229 -0
  198. package/src/contract_function_simulator/execution_tagging_index_cache.ts +32 -0
  199. package/src/contract_function_simulator/hashed_values_cache.ts +47 -0
  200. package/src/contract_function_simulator/index.ts +13 -0
  201. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +47 -0
  202. package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +27 -0
  203. package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +69 -0
  204. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +61 -0
  205. package/src/contract_function_simulator/noir-structs/utility_context.ts +42 -0
  206. package/src/contract_function_simulator/oracle/index.ts +16 -0
  207. package/src/contract_function_simulator/oracle/interfaces.ts +170 -0
  208. package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +23 -0
  209. package/src/contract_function_simulator/oracle/note_packing_utils.ts +54 -0
  210. package/src/contract_function_simulator/oracle/oracle.ts +583 -0
  211. package/src/contract_function_simulator/oracle/private_execution.ts +207 -0
  212. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +633 -0
  213. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +358 -0
  214. package/src/contract_function_simulator/pick_notes.ts +141 -0
  215. package/src/contract_function_simulator/proxied_contract_data_source.ts +66 -0
  216. package/src/contract_function_simulator/proxied_node.ts +33 -0
  217. package/src/contract_function_simulator/pxe_oracle_interface.ts +1008 -0
  218. package/src/entrypoints/client/bundle/index.ts +4 -2
  219. package/src/entrypoints/client/bundle/utils.ts +36 -36
  220. package/src/entrypoints/client/lazy/index.ts +4 -2
  221. package/src/entrypoints/client/lazy/utils.ts +36 -31
  222. package/src/entrypoints/{client/pxe_creation_options.ts → pxe_creation_options.ts} +4 -1
  223. package/src/entrypoints/server/index.ts +5 -3
  224. package/src/entrypoints/server/utils.ts +58 -50
  225. package/src/{pxe_service/error_enriching.ts → error_enriching.ts} +36 -27
  226. package/src/oracle_version.ts +11 -0
  227. package/src/{kernel_prover → private_kernel}/hints/build_private_kernel_reset_private_inputs.ts +158 -146
  228. package/src/private_kernel/hints/compute_side_effect_uniqueness_hints.ts +173 -0
  229. package/src/private_kernel/hints/compute_tx_include_by_timestamp.ts +58 -0
  230. package/src/{kernel_prover → private_kernel}/hints/index.ts +1 -0
  231. package/src/private_kernel/index.ts +2 -0
  232. package/src/private_kernel/private_kernel_execution_prover.ts +436 -0
  233. package/src/{kernel_prover/proving_data_oracle.ts → private_kernel/private_kernel_oracle.ts} +17 -29
  234. package/src/{kernel_oracle/index.ts → private_kernel/private_kernel_oracle_impl.ts} +30 -15
  235. package/src/pxe.ts +1085 -0
  236. package/src/storage/address_data_provider/address_data_provider.ts +1 -7
  237. package/src/storage/capsule_data_provider/capsule_data_provider.ts +97 -30
  238. package/src/storage/contract_data_provider/contract_data_provider.ts +109 -93
  239. package/src/storage/contract_data_provider/index.ts +0 -1
  240. package/src/storage/contract_data_provider/private_functions_tree.ts +11 -75
  241. package/src/storage/index.ts +2 -4
  242. package/src/storage/metadata.ts +1 -0
  243. package/src/storage/note_data_provider/index.ts +1 -1
  244. package/src/storage/note_data_provider/note_data_provider.ts +176 -122
  245. package/src/storage/private_event_data_provider/private_event_data_provider.ts +143 -0
  246. package/src/storage/sync_data_provider/sync_data_provider.ts +4 -10
  247. package/src/storage/tagging_data_provider/tagging_data_provider.ts +58 -30
  248. package/src/synchronizer/synchronizer.ts +21 -22
  249. package/src/tagging/constants.ts +2 -0
  250. package/src/tagging/index.ts +6 -0
  251. package/src/tagging/siloed_tag.ts +22 -0
  252. package/src/tagging/tag.ts +16 -0
  253. package/src/tagging/utils.ts +31 -0
  254. package/dest/bin/index.d.ts +0 -3
  255. package/dest/bin/index.d.ts.map +0 -1
  256. package/dest/bin/index.js +0 -28
  257. package/dest/entrypoints/client/pxe_creation_options.d.ts +0 -11
  258. package/dest/entrypoints/client/pxe_creation_options.d.ts.map +0 -1
  259. package/dest/kernel_oracle/index.d.ts +0 -45
  260. package/dest/kernel_oracle/index.d.ts.map +0 -1
  261. package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.d.ts +0 -28
  262. package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.d.ts.map +0 -1
  263. package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.js +0 -270
  264. package/dest/kernel_prover/hints/index.d.ts +0 -2
  265. package/dest/kernel_prover/hints/index.d.ts.map +0 -1
  266. package/dest/kernel_prover/index.d.ts +0 -3
  267. package/dest/kernel_prover/index.d.ts.map +0 -1
  268. package/dest/kernel_prover/index.js +0 -2
  269. package/dest/kernel_prover/kernel_prover.d.ts +0 -38
  270. package/dest/kernel_prover/kernel_prover.d.ts.map +0 -1
  271. package/dest/kernel_prover/kernel_prover.js +0 -217
  272. package/dest/kernel_prover/proving_data_oracle.d.ts +0 -73
  273. package/dest/kernel_prover/proving_data_oracle.d.ts.map +0 -1
  274. package/dest/kernel_prover/proving_data_oracle.js +0 -4
  275. package/dest/note_decryption_utils/add_public_values_to_payload.d.ts +0 -11
  276. package/dest/note_decryption_utils/add_public_values_to_payload.d.ts.map +0 -1
  277. package/dest/note_decryption_utils/add_public_values_to_payload.js +0 -47
  278. package/dest/pxe_http/index.d.ts +0 -2
  279. package/dest/pxe_http/index.d.ts.map +0 -1
  280. package/dest/pxe_http/index.js +0 -1
  281. package/dest/pxe_http/pxe_http_server.d.ts +0 -16
  282. package/dest/pxe_http/pxe_http_server.d.ts.map +0 -1
  283. package/dest/pxe_http/pxe_http_server.js +0 -27
  284. package/dest/pxe_oracle_interface/index.d.ts +0 -159
  285. package/dest/pxe_oracle_interface/index.d.ts.map +0 -1
  286. package/dest/pxe_oracle_interface/index.js +0 -692
  287. package/dest/pxe_oracle_interface/tagging_utils.d.ts +0 -17
  288. package/dest/pxe_oracle_interface/tagging_utils.d.ts.map +0 -1
  289. package/dest/pxe_oracle_interface/tagging_utils.js +0 -23
  290. package/dest/pxe_service/error_enriching.d.ts +0 -11
  291. package/dest/pxe_service/error_enriching.d.ts.map +0 -1
  292. package/dest/pxe_service/index.d.ts +0 -3
  293. package/dest/pxe_service/index.d.ts.map +0 -1
  294. package/dest/pxe_service/index.js +0 -2
  295. package/dest/pxe_service/pxe_service.d.ts +0 -111
  296. package/dest/pxe_service/pxe_service.d.ts.map +0 -1
  297. package/dest/pxe_service/pxe_service.js +0 -664
  298. package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.d.ts +0 -11
  299. package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.d.ts.map +0 -1
  300. package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.js +0 -20
  301. package/dest/storage/auth_witness_data_provider/index.d.ts +0 -2
  302. package/dest/storage/auth_witness_data_provider/index.d.ts.map +0 -1
  303. package/dest/storage/auth_witness_data_provider/index.js +0 -1
  304. package/dest/storage/data_provider.d.ts +0 -4
  305. package/dest/storage/data_provider.d.ts.map +0 -1
  306. package/dest/storage/data_provider.js +0 -1
  307. package/dest/storage/note_data_provider/note_dao.d.ts +0 -106
  308. package/dest/storage/note_data_provider/note_dao.d.ts.map +0 -1
  309. package/dest/storage/note_data_provider/note_dao.js +0 -106
  310. package/dest/test/pxe_test_suite.d.ts +0 -3
  311. package/dest/test/pxe_test_suite.d.ts.map +0 -1
  312. package/dest/test/pxe_test_suite.js +0 -97
  313. package/src/bin/index.ts +0 -38
  314. package/src/kernel_prover/index.ts +0 -2
  315. package/src/kernel_prover/kernel_prover.ts +0 -351
  316. package/src/note_decryption_utils/add_public_values_to_payload.ts +0 -64
  317. package/src/pxe_http/index.ts +0 -1
  318. package/src/pxe_http/pxe_http_server.ts +0 -29
  319. package/src/pxe_oracle_interface/index.ts +0 -925
  320. package/src/pxe_oracle_interface/tagging_utils.ts +0 -32
  321. package/src/pxe_service/index.ts +0 -2
  322. package/src/pxe_service/pxe_service.ts +0 -949
  323. package/src/storage/auth_witness_data_provider/auth_witness_data_provider.ts +0 -34
  324. package/src/storage/auth_witness_data_provider/index.ts +0 -1
  325. package/src/storage/data_provider.ts +0 -3
  326. package/src/storage/note_data_provider/note_dao.ts +0 -162
  327. package/src/test/pxe_test_suite.ts +0 -111
  328. /package/dest/entrypoints/{client/pxe_creation_options.js → pxe_creation_options.js} +0 -0
@@ -0,0 +1,271 @@
1
+ import { MAX_KEY_VALIDATION_REQUESTS_PER_TX, MAX_NOTE_HASHES_PER_TX, MAX_NOTE_HASH_READ_REQUESTS_PER_TX, MAX_NULLIFIERS_PER_TX, MAX_NULLIFIER_READ_REQUESTS_PER_TX, MAX_PRIVATE_LOGS_PER_TX, NULLIFIER_TREE_HEIGHT } from '@aztec/constants';
2
+ import { makeTuple } from '@aztec/foundation/array';
3
+ import { padArrayEnd } from '@aztec/foundation/collection';
4
+ import { assertLength } from '@aztec/foundation/serialize';
5
+ import { MembershipWitness } from '@aztec/foundation/trees';
6
+ import { privateKernelResetDimensionsConfig } from '@aztec/noir-protocol-circuits-types/client';
7
+ import { KeyValidationHint, PaddedSideEffects, PrivateKernelData, PrivateKernelResetCircuitPrivateInputs, PrivateKernelResetDimensions, PrivateKernelResetHints, ReadRequestActionEnum, ReadRequestResetActions, ScopedNoteHash, ScopedNullifier, TransientDataSquashingHint, buildNoteHashReadRequestHintsFromResetActions, buildNullifierReadRequestHintsFromResetActions, buildTransientDataHints, findPrivateKernelResetDimensions, getNoteHashReadRequestResetActions, getNullifierReadRequestResetActions, privateKernelResetDimensionNames } from '@aztec/stdlib/kernel';
8
+ import { collectNested } from '@aztec/stdlib/tx';
9
+ import { VkData } from '@aztec/stdlib/vks';
10
+ function collectNestedReadRequests(executionStack, extractReadRequests) {
11
+ return collectNested(executionStack, (executionResult)=>{
12
+ return extractReadRequests(executionResult).getActiveItems();
13
+ });
14
+ }
15
+ function getNullifierMembershipWitnessResolver(oracle) {
16
+ return async (nullifier)=>{
17
+ const res = await oracle.getNullifierMembershipWitness(nullifier);
18
+ if (!res) {
19
+ throw new Error(`Cannot find the leaf for nullifier ${nullifier}.`);
20
+ }
21
+ const { index, siblingPath, leafPreimage } = res;
22
+ return {
23
+ membershipWitness: new MembershipWitness(NULLIFIER_TREE_HEIGHT, index, siblingPath.toTuple()),
24
+ leafPreimage
25
+ };
26
+ };
27
+ }
28
+ async function getMasterSecretKeysAndAppKeyGenerators(keyValidationRequests, numRequestsToVerify, oracle) {
29
+ const numRequestsToProcess = Math.min(keyValidationRequests.claimedLength, numRequestsToVerify);
30
+ const keysHints = await Promise.all(keyValidationRequests.array.slice(0, numRequestsToProcess).map(async ({ request })=>{
31
+ const secretKeys = await oracle.getMasterSecretKey(request.request.pkM);
32
+ return new KeyValidationHint(secretKeys);
33
+ }));
34
+ return padArrayEnd(keysHints, KeyValidationHint.empty(), MAX_KEY_VALIDATION_REQUESTS_PER_TX);
35
+ }
36
+ export class PrivateKernelResetPrivateInputsBuilder {
37
+ previousKernelOutput;
38
+ executionStack;
39
+ noteHashNullifierCounterMap;
40
+ splitCounter;
41
+ previousKernel;
42
+ // If there's no next iteration, it's the final reset.
43
+ nextIteration;
44
+ noteHashResetActions;
45
+ nullifierResetActions;
46
+ numTransientData;
47
+ transientDataSquashingHints;
48
+ requestedDimensions;
49
+ constructor(previousKernelOutput, executionStack, noteHashNullifierCounterMap, splitCounter){
50
+ this.previousKernelOutput = previousKernelOutput;
51
+ this.executionStack = executionStack;
52
+ this.noteHashNullifierCounterMap = noteHashNullifierCounterMap;
53
+ this.splitCounter = splitCounter;
54
+ this.previousKernel = previousKernelOutput.publicInputs;
55
+ this.requestedDimensions = PrivateKernelResetDimensions.empty();
56
+ this.noteHashResetActions = ReadRequestResetActions.empty(MAX_NOTE_HASH_READ_REQUESTS_PER_TX);
57
+ this.nullifierResetActions = ReadRequestResetActions.empty(MAX_NULLIFIER_READ_REQUESTS_PER_TX);
58
+ this.transientDataSquashingHints = makeTuple(MAX_NULLIFIERS_PER_TX, ()=>new TransientDataSquashingHint(MAX_NULLIFIERS_PER_TX, MAX_NOTE_HASHES_PER_TX));
59
+ this.nextIteration = executionStack[this.executionStack.length - 1]?.publicInputs;
60
+ }
61
+ needsReset() {
62
+ const fns = [
63
+ ()=>this.needsResetNoteHashReadRequests(),
64
+ ()=>this.needsResetNullifierReadRequests(),
65
+ ()=>this.needsResetNullifierKeys(),
66
+ ()=>this.needsResetTransientData()
67
+ ];
68
+ if (this.nextIteration) {
69
+ // If there's a next iteration, reset is needed only when data of a dimension is about to overflow.
70
+ // fns are executed until a dimension that needs reset is found.
71
+ return fns.some((fn)=>fn());
72
+ } else {
73
+ // Siloing is only needed after processing all iterations.
74
+ fns.push(...[
75
+ ()=>this.needsSiloNoteHashes(),
76
+ ()=>this.needsSiloNullifiers(),
77
+ ()=>this.needsSiloPrivateLogs()
78
+ ]);
79
+ // If there's no next iteration, reset is needed when any of the dimension has non empty data.
80
+ // All the fns should to be executed so that data in all dimensions will be reset.
81
+ const result = fns.map((fn)=>fn());
82
+ return result.some((r)=>r);
83
+ }
84
+ }
85
+ async build(oracle, noteHashLeafIndexMap) {
86
+ if (privateKernelResetDimensionNames.every((name)=>!this.requestedDimensions[name])) {
87
+ throw new Error('Reset is not required.');
88
+ }
89
+ const isInner = !!this.nextIteration;
90
+ // "final" reset must be done at most once.
91
+ // Because the code that silo note hashes can't be run repeatedly.
92
+ // The dimensions found must be big enough to reset all values, i.e. empty remainder.
93
+ const allowRemainder = isInner;
94
+ const dimensions = findPrivateKernelResetDimensions(this.requestedDimensions, privateKernelResetDimensionsConfig, isInner, allowRemainder);
95
+ const previousVkMembershipWitness = await oracle.getVkMembershipWitness(this.previousKernelOutput.verificationKey.keyAsFields);
96
+ const vkData = new VkData(this.previousKernelOutput.verificationKey, Number(previousVkMembershipWitness.leafIndex), previousVkMembershipWitness.siblingPath);
97
+ const previousKernelData = new PrivateKernelData(this.previousKernelOutput.publicInputs, vkData);
98
+ this.reduceReadRequestActions(this.noteHashResetActions, dimensions.NOTE_HASH_PENDING_READ, dimensions.NOTE_HASH_SETTLED_READ);
99
+ this.reduceReadRequestActions(this.nullifierResetActions, dimensions.NULLIFIER_PENDING_READ, dimensions.NULLIFIER_SETTLED_READ);
100
+ // TODO: Enable padding when we have a better idea what are the final amounts we should pad to.
101
+ const paddedSideEffects = PaddedSideEffects.empty();
102
+ return new PrivateKernelResetCircuitPrivateInputs(previousKernelData, paddedSideEffects, new PrivateKernelResetHints(await buildNoteHashReadRequestHintsFromResetActions(oracle, this.previousKernel.validationRequests.noteHashReadRequests, this.previousKernel.end.noteHashes, this.noteHashResetActions, noteHashLeafIndexMap), await buildNullifierReadRequestHintsFromResetActions({
103
+ getNullifierMembershipWitness: getNullifierMembershipWitnessResolver(oracle)
104
+ }, this.previousKernel.validationRequests.nullifierReadRequests, this.nullifierResetActions), await getMasterSecretKeysAndAppKeyGenerators(this.previousKernel.validationRequests.scopedKeyValidationRequestsAndGenerators, dimensions.KEY_VALIDATION, oracle), this.transientDataSquashingHints), dimensions);
105
+ }
106
+ reduceReadRequestActions(resetActions, maxPending, maxSettled) {
107
+ let numPending = 0;
108
+ let numSettled = 0;
109
+ for(let i = 0; i < resetActions.actions.length; i++){
110
+ const action = resetActions.actions[i];
111
+ if (action === ReadRequestActionEnum.READ_AS_PENDING) {
112
+ if (numPending < maxPending) {
113
+ numPending++;
114
+ } else {
115
+ resetActions.actions[i] = ReadRequestActionEnum.SKIP;
116
+ }
117
+ } else if (action === ReadRequestActionEnum.READ_AS_SETTLED) {
118
+ if (numSettled < maxSettled) {
119
+ numSettled++;
120
+ } else {
121
+ resetActions.actions[i] = ReadRequestActionEnum.SKIP;
122
+ }
123
+ }
124
+ }
125
+ resetActions.pendingReadHints = resetActions.pendingReadHints.slice(0, maxPending);
126
+ }
127
+ needsResetNoteHashReadRequests(forceResetAll = false) {
128
+ const numCurr = this.previousKernel.validationRequests.noteHashReadRequests.claimedLength;
129
+ const numNext = this.nextIteration ? this.nextIteration.noteHashReadRequests.claimedLength : 0;
130
+ const maxAmountToKeep = !this.nextIteration || forceResetAll ? 0 : MAX_NOTE_HASH_READ_REQUESTS_PER_TX;
131
+ if (numCurr + numNext <= maxAmountToKeep) {
132
+ return false;
133
+ }
134
+ const futureNoteHashes = collectNested(this.executionStack, (executionResult)=>{
135
+ return executionResult.publicInputs.noteHashes.getActiveItems().map((noteHash)=>new ScopedNoteHash(noteHash, executionResult.publicInputs.callContext.contractAddress));
136
+ });
137
+ const resetActions = getNoteHashReadRequestResetActions(this.previousKernel.validationRequests.noteHashReadRequests, this.previousKernel.end.noteHashes, futureNoteHashes);
138
+ const numPendingReads = resetActions.pendingReadHints.length;
139
+ const numSettledReads = resetActions.actions.reduce((accum, action)=>accum + (action === ReadRequestActionEnum.READ_AS_SETTLED ? 1 : 0), 0);
140
+ if (!this.nextIteration) {
141
+ this.noteHashResetActions = resetActions;
142
+ this.requestedDimensions.NOTE_HASH_PENDING_READ = numPendingReads;
143
+ this.requestedDimensions.NOTE_HASH_SETTLED_READ = numSettledReads;
144
+ } else {
145
+ // Pick only one dimension to reset if next iteration is not empty.
146
+ if (numPendingReads > numSettledReads) {
147
+ this.requestedDimensions.NOTE_HASH_PENDING_READ = numPendingReads;
148
+ this.noteHashResetActions.actions = assertLength(resetActions.actions.map((action)=>action === ReadRequestActionEnum.READ_AS_PENDING ? action : ReadRequestActionEnum.SKIP), MAX_NOTE_HASH_READ_REQUESTS_PER_TX);
149
+ this.noteHashResetActions.pendingReadHints = resetActions.pendingReadHints;
150
+ } else {
151
+ this.requestedDimensions.NOTE_HASH_SETTLED_READ = numSettledReads;
152
+ this.noteHashResetActions.actions = assertLength(resetActions.actions.map((action)=>action === ReadRequestActionEnum.READ_AS_SETTLED ? action : ReadRequestActionEnum.SKIP), MAX_NOTE_HASH_READ_REQUESTS_PER_TX);
153
+ }
154
+ }
155
+ return true;
156
+ }
157
+ needsResetNullifierReadRequests(forceResetAll = false) {
158
+ const numCurr = this.previousKernel.validationRequests.nullifierReadRequests.claimedLength;
159
+ const numNext = this.nextIteration ? this.nextIteration.nullifierReadRequests.claimedLength : 0;
160
+ const maxAmountToKeep = !this.nextIteration || forceResetAll ? 0 : MAX_NULLIFIER_READ_REQUESTS_PER_TX;
161
+ if (numCurr + numNext <= maxAmountToKeep) {
162
+ return false;
163
+ }
164
+ const futureNullifiers = collectNested(this.executionStack, (executionResult)=>{
165
+ return executionResult.publicInputs.nullifiers.getActiveItems().map((nullifier)=>new ScopedNullifier(nullifier, executionResult.publicInputs.callContext.contractAddress));
166
+ });
167
+ const resetActions = getNullifierReadRequestResetActions(this.previousKernel.validationRequests.nullifierReadRequests, this.previousKernel.end.nullifiers, futureNullifiers);
168
+ const numPendingReads = resetActions.pendingReadHints.length;
169
+ const numSettledReads = resetActions.actions.reduce((accum, action)=>accum + (action === ReadRequestActionEnum.READ_AS_SETTLED ? 1 : 0), 0);
170
+ if (!this.nextIteration) {
171
+ this.nullifierResetActions = resetActions;
172
+ this.requestedDimensions.NULLIFIER_PENDING_READ = numPendingReads;
173
+ this.requestedDimensions.NULLIFIER_SETTLED_READ = numSettledReads;
174
+ } else {
175
+ // Pick only one dimension to reset if next iteration is not empty.
176
+ if (numPendingReads > numSettledReads) {
177
+ this.requestedDimensions.NULLIFIER_PENDING_READ = numPendingReads;
178
+ this.nullifierResetActions.actions = assertLength(resetActions.actions.map((action)=>action === ReadRequestActionEnum.READ_AS_PENDING ? action : ReadRequestActionEnum.SKIP), MAX_NULLIFIER_READ_REQUESTS_PER_TX);
179
+ this.nullifierResetActions.pendingReadHints = resetActions.pendingReadHints;
180
+ } else {
181
+ this.requestedDimensions.NULLIFIER_SETTLED_READ = numSettledReads;
182
+ this.nullifierResetActions.actions = assertLength(resetActions.actions.map((action)=>action === ReadRequestActionEnum.READ_AS_SETTLED ? action : ReadRequestActionEnum.SKIP), MAX_NULLIFIER_READ_REQUESTS_PER_TX);
183
+ }
184
+ }
185
+ return true;
186
+ }
187
+ needsResetNullifierKeys() {
188
+ const numCurr = this.previousKernel.validationRequests.scopedKeyValidationRequestsAndGenerators.claimedLength;
189
+ const numNext = this.nextIteration ? this.nextIteration.keyValidationRequestsAndGenerators.claimedLength : 0;
190
+ const maxAmountToKeep = !this.nextIteration ? 0 : MAX_KEY_VALIDATION_REQUESTS_PER_TX;
191
+ if (numCurr + numNext <= maxAmountToKeep) {
192
+ return false;
193
+ }
194
+ this.requestedDimensions.KEY_VALIDATION = numCurr;
195
+ return true;
196
+ }
197
+ needsResetTransientData() {
198
+ // Initialize this to 0 so that needsSilo can be run.
199
+ this.numTransientData = 0;
200
+ const nextAccumNoteHashes = this.previousKernel.end.noteHashes.claimedLength + (this.nextIteration?.noteHashes.claimedLength ?? 0);
201
+ const noteHashWillOverflow = nextAccumNoteHashes > MAX_NOTE_HASHES_PER_TX;
202
+ const nextAccumNullifiers = this.previousKernel.end.nullifiers.claimedLength + (this.nextIteration?.nullifiers.claimedLength ?? 0);
203
+ const nullifierWillOverflow = nextAccumNullifiers > MAX_NULLIFIERS_PER_TX;
204
+ const nextAccumLogs = this.previousKernel.end.privateLogs.claimedLength + (this.nextIteration?.privateLogs.claimedLength ?? 0);
205
+ const logsWillOverflow = nextAccumLogs > MAX_PRIVATE_LOGS_PER_TX;
206
+ if (this.nextIteration && !noteHashWillOverflow && !nullifierWillOverflow && !logsWillOverflow) {
207
+ return false;
208
+ }
209
+ const futureNoteHashReads = collectNestedReadRequests(this.executionStack, (executionResult)=>executionResult.publicInputs.noteHashReadRequests);
210
+ const futureNullifierReads = collectNestedReadRequests(this.executionStack, (executionResult)=>executionResult.publicInputs.nullifierReadRequests);
211
+ // TODO(#15902): Collect future logs and only allow squashing a note hash when all its logs have been emitted
212
+ // (i.e. none of the future logs are linked to the to-be-squashed note hashes).
213
+ if (this.nextIteration) {
214
+ // If it's not the final reset, only one dimension will be reset at a time.
215
+ // The note hashes and nullifiers for the remaining read requests can't be squashed.
216
+ futureNoteHashReads.push(...this.previousKernel.validationRequests.noteHashReadRequests.getActiveItems());
217
+ futureNullifierReads.push(...this.previousKernel.validationRequests.nullifierReadRequests.getActiveItems());
218
+ }
219
+ const { numTransientData, hints: transientDataSquashingHints } = buildTransientDataHints(this.previousKernel.end.noteHashes, this.previousKernel.end.nullifiers, futureNoteHashReads, futureNullifierReads, this.noteHashNullifierCounterMap, this.splitCounter);
220
+ if (this.nextIteration && !numTransientData) {
221
+ const forceResetAll = true;
222
+ const canClearReadRequests = noteHashWillOverflow && this.needsResetNoteHashReadRequests(forceResetAll) || nullifierWillOverflow && this.needsResetNullifierReadRequests(forceResetAll) || logsWillOverflow && this.needsResetNoteHashReadRequests(forceResetAll);
223
+ if (!canClearReadRequests) {
224
+ const overflownData = noteHashWillOverflow ? 'note hashes' : nullifierWillOverflow ? 'nullifiers' : 'private logs';
225
+ throw new Error(`Number of ${overflownData} exceeds the limit.`);
226
+ }
227
+ // Clearing the read requests might not be enough to squash the overflown data.
228
+ // In this case, the next iteration will fail at the above check.
229
+ return true;
230
+ }
231
+ this.numTransientData = numTransientData;
232
+ this.transientDataSquashingHints = transientDataSquashingHints;
233
+ this.requestedDimensions.TRANSIENT_DATA_SQUASHING = numTransientData;
234
+ return numTransientData > 0;
235
+ }
236
+ needsSiloNoteHashes() {
237
+ if (this.numTransientData === undefined) {
238
+ throw new Error('`needsResetTransientData` must be run before `needsSiloNoteHashes`.');
239
+ }
240
+ const numNoteHashes = this.previousKernel.end.noteHashes.getActiveItems().filter((n)=>!n.contractAddress.isZero()).length;
241
+ const numToSilo = Math.max(0, numNoteHashes - this.numTransientData);
242
+ this.requestedDimensions.NOTE_HASH_SILOING = numToSilo;
243
+ return numToSilo > 0;
244
+ }
245
+ needsSiloNullifiers() {
246
+ if (this.numTransientData === undefined) {
247
+ throw new Error('`needsResetTransientData` must be run before `needsSiloNullifiers`.');
248
+ }
249
+ const numNullifiers = this.previousKernel.end.nullifiers.getActiveItems().filter((n)=>!n.contractAddress.isZero()).length;
250
+ const numToSilo = Math.max(0, numNullifiers - this.numTransientData);
251
+ // Include the first nullifier if there's something to silo.
252
+ // The reset circuit checks that capped_size must be greater than or equal to all non-empty nullifiers.
253
+ // Which includes the first nullifier, even though its contract address is always zero and doesn't need siloing.
254
+ const cappedSize = numToSilo ? numToSilo + 1 : 0;
255
+ this.requestedDimensions.NULLIFIER_SILOING = cappedSize;
256
+ return numToSilo > 0;
257
+ }
258
+ needsSiloPrivateLogs() {
259
+ if (this.numTransientData === undefined) {
260
+ throw new Error('`needsResetTransientData` must be run before `needsSiloPrivateLogs`.');
261
+ }
262
+ const privateLogs = this.previousKernel.end.privateLogs;
263
+ const numLogs = privateLogs.getActiveItems().filter((l)=>!l.contractAddress.isZero()).length;
264
+ const noteHashes = this.previousKernel.end.noteHashes;
265
+ const squashedNoteHashCounters = this.transientDataSquashingHints.filter((h)=>h.noteHashIndex < noteHashes.claimedLength).map((h)=>noteHashes.array[h.noteHashIndex].counter);
266
+ const numSquashedLogs = privateLogs.getActiveItems().filter((l)=>squashedNoteHashCounters.includes(l.inner.noteHashCounter)).length;
267
+ const numToSilo = numLogs - numSquashedLogs;
268
+ this.requestedDimensions.PRIVATE_LOG_SILOING = numToSilo;
269
+ return numToSilo > 0;
270
+ }
271
+ }
@@ -0,0 +1,3 @@
1
+ import { type PrivateCircuitPublicInputs, SideEffectUniquenessHints } from '@aztec/stdlib/kernel';
2
+ export declare function computeSideEffectUniquenessHints(publicInputs: PrivateCircuitPublicInputs): SideEffectUniquenessHints;
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tcHV0ZV9zaWRlX2VmZmVjdF91bmlxdWVuZXNzX2hpbnRzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvcHJpdmF0ZV9rZXJuZWwvaGludHMvY29tcHV0ZV9zaWRlX2VmZmVjdF91bmlxdWVuZXNzX2hpbnRzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQXdCQSxPQUFPLEVBR0wsS0FBSywwQkFBMEIsRUFFL0IseUJBQXlCLEVBQzFCLE1BQU0sc0JBQXNCLENBQUM7QUFFOUIsd0JBQWdCLGdDQUFnQyxDQUFDLFlBQVksRUFBRSwwQkFBMEIsR0FBRyx5QkFBeUIsQ0F3SHBIIn0=
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compute_side_effect_uniqueness_hints.d.ts","sourceRoot":"","sources":["../../../src/private_kernel/hints/compute_side_effect_uniqueness_hints.ts"],"names":[],"mappings":"AAwBA,OAAO,EAGL,KAAK,0BAA0B,EAE/B,yBAAyB,EAC1B,MAAM,sBAAsB,CAAC;AAE9B,wBAAgB,gCAAgC,CAAC,YAAY,EAAE,0BAA0B,GAAG,yBAAyB,CAwHpH"}
@@ -0,0 +1,48 @@
1
+ import { GLOBAL_INDEX_CONTRACT_CLASS_LOG_HASH_OFFSET, GLOBAL_INDEX_L2_TO_L1_MSG_OFFSET, GLOBAL_INDEX_NOTE_HASH_OFFSET, GLOBAL_INDEX_NOTE_HASH_READ_REQUEST_OFFSET, GLOBAL_INDEX_NULLIFIER_OFFSET, GLOBAL_INDEX_NULLIFIER_READ_REQUEST_OFFSET, GLOBAL_INDEX_PRIVATE_CALL_REQUEST_OFFSET, GLOBAL_INDEX_PRIVATE_LOG_OFFSET, GLOBAL_INDEX_PUBLIC_CALL_REQUEST_OFFSET, MAX_CONTRACT_CLASS_LOGS_PER_CALL, MAX_ENQUEUED_CALLS_PER_CALL, MAX_L2_TO_L1_MSGS_PER_CALL, MAX_NOTE_HASHES_PER_CALL, MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, MAX_NULLIFIERS_PER_CALL, MAX_NULLIFIER_READ_REQUESTS_PER_CALL, MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL, MAX_PRIVATE_LOGS_PER_CALL, TOTAL_COUNTED_SIDE_EFFECTS_PER_CALL } from '@aztec/constants';
2
+ import { makeTuple } from '@aztec/foundation/array';
3
+ import { padArrayEnd } from '@aztec/foundation/collection';
4
+ import { SideEffectCounterRange, SideEffectUniquenessHints } from '@aztec/stdlib/kernel';
5
+ export function computeSideEffectUniquenessHints(publicInputs) {
6
+ let sideEffectRanges = [];
7
+ sideEffectRanges = sideEffectRanges.concat(createRangesFromClaimedLengthArray(publicInputs.noteHashReadRequests, GLOBAL_INDEX_NOTE_HASH_READ_REQUEST_OFFSET, createRangeFromCountedItem));
8
+ sideEffectRanges = sideEffectRanges.concat(createRangesFromClaimedLengthArray(publicInputs.nullifierReadRequests, GLOBAL_INDEX_NULLIFIER_READ_REQUEST_OFFSET, createRangeFromCountedItem));
9
+ sideEffectRanges = sideEffectRanges.concat(createRangesFromClaimedLengthArray(publicInputs.noteHashes, GLOBAL_INDEX_NOTE_HASH_OFFSET, createRangeFromCountedItem));
10
+ sideEffectRanges = sideEffectRanges.concat(createRangesFromClaimedLengthArray(publicInputs.nullifiers, GLOBAL_INDEX_NULLIFIER_OFFSET, createRangeFromCountedItem));
11
+ sideEffectRanges = sideEffectRanges.concat(createRangesFromClaimedLengthArray(publicInputs.privateCallRequests, GLOBAL_INDEX_PRIVATE_CALL_REQUEST_OFFSET, createRangeFromPrivateCallRequest));
12
+ sideEffectRanges = sideEffectRanges.concat(createRangesFromClaimedLengthArray(publicInputs.publicCallRequests, GLOBAL_INDEX_PUBLIC_CALL_REQUEST_OFFSET, createRangeFromCountedItem));
13
+ sideEffectRanges = sideEffectRanges.concat(createRangesFromClaimedLengthArray(publicInputs.l2ToL1Msgs, GLOBAL_INDEX_L2_TO_L1_MSG_OFFSET, createRangeFromCountedItem));
14
+ sideEffectRanges = sideEffectRanges.concat(createRangesFromClaimedLengthArray(publicInputs.privateLogs, GLOBAL_INDEX_PRIVATE_LOG_OFFSET, createRangeFromCountedItem));
15
+ sideEffectRanges = sideEffectRanges.concat(createRangesFromClaimedLengthArray(publicInputs.contractClassLogsHashes, GLOBAL_INDEX_CONTRACT_CLASS_LOG_HASH_OFFSET, createRangeFromCountedItem));
16
+ sideEffectRanges.sort((a, b)=>a.start - b.start);
17
+ const sideEffectRangeIndices = makeTuple(TOTAL_COUNTED_SIDE_EFFECTS_PER_CALL, ()=>0);
18
+ for(let i = 0; i < sideEffectRanges.length; i++){
19
+ const range = sideEffectRanges[i];
20
+ sideEffectRangeIndices[range.sideEffectGlobalIndex] = i;
21
+ }
22
+ const hints = SideEffectUniquenessHints.from({
23
+ sideEffectRanges: padArrayEnd(sideEffectRanges, SideEffectCounterRange.empty(), TOTAL_COUNTED_SIDE_EFFECTS_PER_CALL),
24
+ noteHashReadRequestIndices: makeTuple(MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, (i)=>sideEffectRangeIndices[i + GLOBAL_INDEX_NOTE_HASH_READ_REQUEST_OFFSET]),
25
+ nullifierReadRequestIndices: makeTuple(MAX_NULLIFIER_READ_REQUESTS_PER_CALL, (i)=>sideEffectRangeIndices[i + GLOBAL_INDEX_NULLIFIER_READ_REQUEST_OFFSET]),
26
+ noteHashesIndices: makeTuple(MAX_NOTE_HASHES_PER_CALL, (i)=>sideEffectRangeIndices[i + GLOBAL_INDEX_NOTE_HASH_OFFSET]),
27
+ nullifiersIndices: makeTuple(MAX_NULLIFIERS_PER_CALL, (i)=>sideEffectRangeIndices[i + GLOBAL_INDEX_NULLIFIER_OFFSET]),
28
+ privateCallRequestsIndices: makeTuple(MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL, (i)=>sideEffectRangeIndices[i + GLOBAL_INDEX_PRIVATE_CALL_REQUEST_OFFSET]),
29
+ publicCallRequestsIndices: makeTuple(MAX_ENQUEUED_CALLS_PER_CALL, (i)=>sideEffectRangeIndices[i + GLOBAL_INDEX_PUBLIC_CALL_REQUEST_OFFSET]),
30
+ l2ToL1MsgsIndices: makeTuple(MAX_L2_TO_L1_MSGS_PER_CALL, (i)=>sideEffectRangeIndices[i + GLOBAL_INDEX_L2_TO_L1_MSG_OFFSET]),
31
+ privateLogsIndices: makeTuple(MAX_PRIVATE_LOGS_PER_CALL, (i)=>sideEffectRangeIndices[i + GLOBAL_INDEX_PRIVATE_LOG_OFFSET]),
32
+ contractClassLogsHashesIndices: makeTuple(MAX_CONTRACT_CLASS_LOGS_PER_CALL, (i)=>sideEffectRangeIndices[i + GLOBAL_INDEX_CONTRACT_CLASS_LOG_HASH_OFFSET])
33
+ });
34
+ return hints;
35
+ }
36
+ function createRangesFromClaimedLengthArray(array, globalIndexOffset, rangeConstructor) {
37
+ const ranges = [];
38
+ for(let i = 0; i < array.claimedLength; i++){
39
+ ranges.push(rangeConstructor(array.array[i], globalIndexOffset + i));
40
+ }
41
+ return ranges;
42
+ }
43
+ function createRangeFromCountedItem(item, globalIndex) {
44
+ return new SideEffectCounterRange(item.counter, item.counter, globalIndex);
45
+ }
46
+ function createRangeFromPrivateCallRequest(item, globalIndex) {
47
+ return new SideEffectCounterRange(item.startSideEffectCounter, item.endSideEffectCounter, globalIndex);
48
+ }
@@ -0,0 +1,4 @@
1
+ import type { PrivateKernelCircuitPublicInputs } from '@aztec/stdlib/kernel';
2
+ import type { UInt64 } from '@aztec/stdlib/types';
3
+ export declare function computeTxIncludeByTimestamp(previousKernel: PrivateKernelCircuitPublicInputs, maxDuration?: number): UInt64;
4
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tcHV0ZV90eF9pbmNsdWRlX2J5X3RpbWVzdGFtcC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3ByaXZhdGVfa2VybmVsL2hpbnRzL2NvbXB1dGVfdHhfaW5jbHVkZV9ieV90aW1lc3RhbXAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxLQUFLLEVBQUUsZ0NBQWdDLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUM3RSxPQUFPLEtBQUssRUFBRSxNQUFNLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQXFCbEQsd0JBQWdCLDJCQUEyQixDQUN6QyxjQUFjLEVBQUUsZ0NBQWdDLEVBQ2hELFdBQVcsU0FBb0MsR0FDOUMsTUFBTSxDQStCUiJ9
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compute_tx_include_by_timestamp.d.ts","sourceRoot":"","sources":["../../../src/private_kernel/hints/compute_tx_include_by_timestamp.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAqBlD,wBAAgB,2BAA2B,CACzC,cAAc,EAAE,gCAAgC,EAChD,WAAW,SAAoC,GAC9C,MAAM,CA+BR"}
@@ -0,0 +1,41 @@
1
+ import { MAX_INCLUDE_BY_TIMESTAMP_DURATION } from '@aztec/constants';
2
+ const ROUNDED_DURATIONS = [
3
+ 3600,
4
+ 1800,
5
+ 1
6
+ ];
7
+ function roundTimestamp(blockTimestamp, includeByTimestamp) {
8
+ return ROUNDED_DURATIONS.reduce((timestamp, duration)=>{
9
+ if (timestamp <= blockTimestamp) {
10
+ // The timestamp must be greater than the block timestamp.
11
+ // If it is too small, round it down again using a smaller duration.
12
+ const totalDuration = includeByTimestamp - blockTimestamp;
13
+ const roundedDuration = totalDuration - totalDuration % BigInt(duration);
14
+ return blockTimestamp + roundedDuration;
15
+ }
16
+ return timestamp;
17
+ }, 0n);
18
+ }
19
+ export function computeTxIncludeByTimestamp(previousKernel, maxDuration = MAX_INCLUDE_BY_TIMESTAMP_DURATION) {
20
+ if (maxDuration > MAX_INCLUDE_BY_TIMESTAMP_DURATION) {
21
+ throw new Error(`Custom max duration cannot be greater than the max allowed. Max allowed: ${MAX_INCLUDE_BY_TIMESTAMP_DURATION}. Custom value: ${maxDuration}.`);
22
+ }
23
+ const anchorBlockTimestamp = previousKernel.constants.anchorBlockHeader.globalVariables.timestamp;
24
+ const maxTimestamp = anchorBlockTimestamp + BigInt(maxDuration);
25
+ const includeByTimestamp = previousKernel.includeByTimestamp;
26
+ // If the includeByTimestamp set during the tx execution is greater than or equal to the max allowed duration,
27
+ // use the maximum allowed timestamp.
28
+ // Note: It shouldn't be larger than the max allowed duration, but we check for it anyway.
29
+ if (includeByTimestamp >= maxTimestamp) {
30
+ return maxTimestamp;
31
+ }
32
+ // Round it down to the nearest hour/min/second to reduce precision and avoid revealing the exact value.
33
+ // This makes it harder for others to infer what function calls may have been used to produce a specific timestamp.
34
+ const roundedTimestamp = roundTimestamp(anchorBlockTimestamp, includeByTimestamp);
35
+ // The tx can't be published if the timestamp is the same or less than the anchor block's timestamp.
36
+ // Future blocks will have a greater timestamp, so the tx would never be included.
37
+ if (roundedTimestamp <= anchorBlockTimestamp) {
38
+ throw new Error(`Include-by timestamp must be greater than the anchor block timestamp. Anchor block timestamp: ${anchorBlockTimestamp}. Include-by timestamp: ${includeByTimestamp}.`);
39
+ }
40
+ return roundedTimestamp;
41
+ }
@@ -0,0 +1,3 @@
1
+ export * from './build_private_kernel_reset_private_inputs.js';
2
+ export * from './compute_tx_include_by_timestamp.js';
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9wcml2YXRlX2tlcm5lbC9oaW50cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLGdEQUFnRCxDQUFDO0FBQy9ELGNBQWMsc0NBQXNDLENBQUMifQ==
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/private_kernel/hints/index.ts"],"names":[],"mappings":"AAAA,cAAc,gDAAgD,CAAC;AAC/D,cAAc,sCAAsC,CAAC"}
@@ -1 +1,2 @@
1
1
  export * from './build_private_kernel_reset_private_inputs.js';
2
+ export * from './compute_tx_include_by_timestamp.js';
@@ -0,0 +1,3 @@
1
+ export * from './private_kernel_execution_prover.js';
2
+ export * from './private_kernel_oracle.js';
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wcml2YXRlX2tlcm5lbC9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLHNDQUFzQyxDQUFDO0FBQ3JELGNBQWMsNEJBQTRCLENBQUMifQ==
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/private_kernel/index.ts"],"names":[],"mappings":"AAAA,cAAc,sCAAsC,CAAC;AACrD,cAAc,4BAA4B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './private_kernel_execution_prover.js';
2
+ export * from './private_kernel_oracle.js';
@@ -0,0 +1,44 @@
1
+ import type { PrivateKernelProver } from '@aztec/stdlib/interfaces/client';
2
+ import { type PrivateKernelExecutionProofOutput, type PrivateKernelTailCircuitPublicInputs } from '@aztec/stdlib/kernel';
3
+ import { type PrivateExecutionResult, TxRequest } from '@aztec/stdlib/tx';
4
+ import type { PrivateKernelOracle } from './private_kernel_oracle.js';
5
+ export interface PrivateKernelExecutionProverConfig {
6
+ simulate: boolean;
7
+ skipFeeEnforcement: boolean;
8
+ profileMode: 'gates' | 'execution-steps' | 'full' | 'none';
9
+ }
10
+ /**
11
+ * The PrivateKernelExecutionProver class is responsible for taking a transaction request and sequencing the
12
+ * the execution of the private functions within, sequenced with private kernel "glue" to check protocol rules.
13
+ * The result can be a chonk proof of the private transaction portion, or just a simulation that can e.g.
14
+ * inform state tree updates.
15
+ */
16
+ export declare class PrivateKernelExecutionProver {
17
+ private oracle;
18
+ private proofCreator;
19
+ private fakeProofs;
20
+ private log;
21
+ constructor(oracle: PrivateKernelOracle, proofCreator: PrivateKernelProver, fakeProofs?: boolean);
22
+ /**
23
+ * Generate a proof for a given transaction request and execution result.
24
+ * The function iterates through the nested executions in the execution result, creates private call data,
25
+ * and generates a proof using the provided ProofCreator instance. It also maintains an index of new notes
26
+ * created during the execution and returns them as a part of the KernelProverOutput.
27
+ *
28
+ * @param txRequest - The authenticated transaction request object.
29
+ * @param executionResult - The execution result object containing nested executions and preimages.
30
+ * @param profile - Set true to profile the gate count for each circuit
31
+ * @returns A Promise that resolves to a KernelProverOutput object containing proof, public inputs, and output notes.
32
+ */
33
+ proveWithKernels(txRequest: TxRequest, executionResult: PrivateExecutionResult, { simulate, skipFeeEnforcement, profileMode }?: PrivateKernelExecutionProverConfig): Promise<PrivateKernelExecutionProofOutput<PrivateKernelTailCircuitPublicInputs>>;
34
+ /**
35
+ * Checks that the public inputs of the chonk proof match the public inputs of the tail circuit.
36
+ * This can only mismatch if there is a circuit / noir / bb bug.
37
+ * @param chonkProof - The chonk proof with public inputs.
38
+ * @param tailPublicInputs - The public inputs resulting from witness generation of the tail circuit.
39
+ */
40
+ private ensurePublicInputsMatch;
41
+ private getVkData;
42
+ private createPrivateCallData;
43
+ }
44
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJpdmF0ZV9rZXJuZWxfZXhlY3V0aW9uX3Byb3Zlci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3ByaXZhdGVfa2VybmVsL3ByaXZhdGVfa2VybmVsX2V4ZWN1dGlvbl9wcm92ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBUUEsT0FBTyxLQUFLLEVBQUUsbUJBQW1CLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUMzRSxPQUFPLEVBUUwsS0FBSyxpQ0FBaUMsRUFLdEMsS0FBSyxvQ0FBb0MsRUFFMUMsTUFBTSxzQkFBc0IsQ0FBQztBQUU5QixPQUFPLEVBRUwsS0FBSyxzQkFBc0IsRUFDM0IsU0FBUyxFQUlWLE1BQU0sa0JBQWtCLENBQUM7QUFLMUIsT0FBTyxLQUFLLEVBQUUsbUJBQW1CLEVBQUUsTUFBTSw0QkFBNEIsQ0FBQztBQVN0RSxNQUFNLFdBQVcsa0NBQWtDO0lBQ2pELFFBQVEsRUFBRSxPQUFPLENBQUM7SUFDbEIsa0JBQWtCLEVBQUUsT0FBTyxDQUFDO0lBQzVCLFdBQVcsRUFBRSxPQUFPLEdBQUcsaUJBQWlCLEdBQUcsTUFBTSxHQUFHLE1BQU0sQ0FBQztDQUM1RDtBQUVEOzs7OztHQUtHO0FBQ0gscUJBQWEsNEJBQTRCO0lBSXJDLE9BQU8sQ0FBQyxNQUFNO0lBQ2QsT0FBTyxDQUFDLFlBQVk7SUFDcEIsT0FBTyxDQUFDLFVBQVU7SUFMcEIsT0FBTyxDQUFDLEdBQUcsQ0FBdUQ7SUFFbEUsWUFDVSxNQUFNLEVBQUUsbUJBQW1CLEVBQzNCLFlBQVksRUFBRSxtQkFBbUIsRUFDakMsVUFBVSxVQUFRLEVBQ3hCO0lBRUo7Ozs7Ozs7Ozs7T0FVRztJQUNHLGdCQUFnQixDQUNwQixTQUFTLEVBQUUsU0FBUyxFQUNwQixlQUFlLEVBQUUsc0JBQXNCLEVBQ3ZDLEVBQUUsUUFBUSxFQUFFLGtCQUFrQixFQUFFLFdBQVcsRUFBRSxHQUFFLGtDQUk5QyxHQUNBLE9BQU8sQ0FBQyxpQ0FBaUMsQ0FBQyxvQ0FBb0MsQ0FBQyxDQUFDLENBcVJsRjtJQUVEOzs7OztPQUtHO0lBQ0gsT0FBTyxDQUFDLHVCQUF1QjtZQW9CakIsU0FBUztZQVNULHFCQUFxQjtDQWtDcEMifQ==
@@ -0,0 +1 @@
1
+ {"version":3,"file":"private_kernel_execution_prover.d.ts","sourceRoot":"","sources":["../../src/private_kernel/private_kernel_execution_prover.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAQL,KAAK,iCAAiC,EAKtC,KAAK,oCAAoC,EAE1C,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAEL,KAAK,sBAAsB,EAC3B,SAAS,EAIV,MAAM,kBAAkB,CAAC;AAK1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAStE,MAAM,WAAW,kCAAkC;IACjD,QAAQ,EAAE,OAAO,CAAC;IAClB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,WAAW,EAAE,OAAO,GAAG,iBAAiB,GAAG,MAAM,GAAG,MAAM,CAAC;CAC5D;AAED;;;;;GAKG;AACH,qBAAa,4BAA4B;IAIrC,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,UAAU;IALpB,OAAO,CAAC,GAAG,CAAuD;IAElE,YACU,MAAM,EAAE,mBAAmB,EAC3B,YAAY,EAAE,mBAAmB,EACjC,UAAU,UAAQ,EACxB;IAEJ;;;;;;;;;;OAUG;IACG,gBAAgB,CACpB,SAAS,EAAE,SAAS,EACpB,eAAe,EAAE,sBAAsB,EACvC,EAAE,QAAQ,EAAE,kBAAkB,EAAE,WAAW,EAAE,GAAE,kCAI9C,GACA,OAAO,CAAC,iCAAiC,CAAC,oCAAoC,CAAC,CAAC,CAqRlF;IAED;;;;;OAKG;IACH,OAAO,CAAC,uBAAuB;YAoBjB,SAAS;YAST,qBAAqB;CAkCpC"}