@aztec/pxe 3.0.0-canary.a9708bd → 3.0.0-devnet.2-patch.1

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 (264) hide show
  1. package/README.md +5 -5
  2. package/dest/bin/check_oracle_version.d.ts +1 -1
  3. package/dest/bin/check_oracle_version.js +110 -10
  4. package/dest/config/index.d.ts +9 -17
  5. package/dest/config/index.d.ts.map +1 -1
  6. package/dest/config/index.js +10 -16
  7. package/dest/config/package_info.d.ts +1 -1
  8. package/dest/config/package_info.js +1 -1
  9. package/dest/contract_function_simulator/contract_function_simulator.d.ts +6 -6
  10. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  11. package/dest/contract_function_simulator/contract_function_simulator.js +97 -42
  12. package/dest/contract_function_simulator/execution_data_provider.d.ts +40 -57
  13. package/dest/contract_function_simulator/execution_data_provider.d.ts.map +1 -1
  14. package/dest/contract_function_simulator/execution_note_cache.d.ts +11 -9
  15. package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
  16. package/dest/contract_function_simulator/execution_note_cache.js +28 -17
  17. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +16 -0
  18. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -0
  19. package/dest/contract_function_simulator/execution_tagging_index_cache.js +26 -0
  20. package/dest/contract_function_simulator/hashed_values_cache.d.ts +2 -2
  21. package/dest/contract_function_simulator/hashed_values_cache.d.ts.map +1 -1
  22. package/dest/contract_function_simulator/index.d.ts +4 -2
  23. package/dest/contract_function_simulator/index.d.ts.map +1 -1
  24. package/dest/contract_function_simulator/index.js +2 -1
  25. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +2 -2
  26. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
  27. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +2 -2
  28. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts.map +1 -1
  29. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +3 -3
  30. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
  31. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +8 -4
  32. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +6 -3
  33. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
  34. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +12 -3
  35. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +22 -0
  36. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -0
  37. package/dest/contract_function_simulator/noir-structs/utility_context.js +33 -0
  38. package/dest/contract_function_simulator/oracle/index.d.ts +2 -2
  39. package/dest/contract_function_simulator/oracle/index.d.ts.map +1 -1
  40. package/dest/contract_function_simulator/oracle/index.js +1 -1
  41. package/dest/contract_function_simulator/oracle/interfaces.d.ts +104 -0
  42. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -0
  43. package/dest/contract_function_simulator/oracle/interfaces.js +4 -0
  44. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +2 -4
  45. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
  46. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.js +1 -1
  47. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +10 -4
  48. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
  49. package/dest/contract_function_simulator/oracle/note_packing_utils.js +10 -5
  50. package/dest/contract_function_simulator/oracle/oracle.d.ts +17 -15
  51. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
  52. package/dest/contract_function_simulator/oracle/oracle.js +101 -81
  53. package/dest/contract_function_simulator/oracle/private_execution.d.ts +6 -5
  54. package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
  55. package/dest/contract_function_simulator/oracle/private_execution.js +7 -16
  56. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +34 -22
  57. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  58. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +89 -25
  59. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +23 -33
  60. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  61. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +38 -42
  62. package/dest/contract_function_simulator/pick_notes.d.ts +2 -2
  63. package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -1
  64. package/dest/contract_function_simulator/pick_notes.js +1 -1
  65. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +1 -1
  66. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -1
  67. package/dest/contract_function_simulator/proxied_node.d.ts +1 -1
  68. package/dest/contract_function_simulator/proxied_node.d.ts.map +1 -1
  69. package/dest/contract_function_simulator/pxe_oracle_interface.d.ts +34 -68
  70. package/dest/contract_function_simulator/pxe_oracle_interface.d.ts.map +1 -1
  71. package/dest/contract_function_simulator/pxe_oracle_interface.js +220 -208
  72. package/dest/entrypoints/client/bundle/index.d.ts +4 -2
  73. package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
  74. package/dest/entrypoints/client/bundle/index.js +2 -1
  75. package/dest/entrypoints/client/bundle/utils.d.ts +9 -9
  76. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  77. package/dest/entrypoints/client/bundle/utils.js +21 -12
  78. package/dest/entrypoints/client/lazy/index.d.ts +4 -2
  79. package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
  80. package/dest/entrypoints/client/lazy/index.js +2 -1
  81. package/dest/entrypoints/client/lazy/utils.d.ts +8 -8
  82. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  83. package/dest/entrypoints/client/lazy/utils.js +20 -11
  84. package/dest/entrypoints/pxe_creation_options.d.ts +5 -2
  85. package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
  86. package/dest/entrypoints/server/index.d.ts +4 -2
  87. package/dest/entrypoints/server/index.d.ts.map +1 -1
  88. package/dest/entrypoints/server/index.js +2 -1
  89. package/dest/entrypoints/server/utils.d.ts +5 -24
  90. package/dest/entrypoints/server/utils.d.ts.map +1 -1
  91. package/dest/entrypoints/server/utils.js +17 -45
  92. package/dest/error_enriching.d.ts +11 -0
  93. package/dest/error_enriching.d.ts.map +1 -0
  94. package/dest/{pxe_service/error_enriching.js → error_enriching.js} +3 -0
  95. package/dest/events/index.d.ts +2 -0
  96. package/dest/events/index.d.ts.map +1 -0
  97. package/dest/events/index.js +1 -0
  98. package/dest/events/private_event_filter_validator.d.ts +8 -0
  99. package/dest/events/private_event_filter_validator.d.ts.map +1 -0
  100. package/dest/events/private_event_filter_validator.js +39 -0
  101. package/dest/oracle_version.d.ts +3 -3
  102. package/dest/oracle_version.js +2 -2
  103. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +3 -3
  104. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +1 -1
  105. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.js +7 -7
  106. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +1 -1
  107. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.js +6 -6
  108. package/dest/private_kernel/hints/index.d.ts +1 -1
  109. package/dest/private_kernel/index.d.ts +1 -1
  110. package/dest/private_kernel/private_kernel_execution_prover.d.ts +9 -2
  111. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
  112. package/dest/private_kernel/private_kernel_execution_prover.js +38 -32
  113. package/dest/private_kernel/private_kernel_oracle.d.ts +3 -2
  114. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
  115. package/dest/private_kernel/private_kernel_oracle_impl.d.ts +8 -7
  116. package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +1 -1
  117. package/dest/pxe.d.ts +240 -0
  118. package/dest/pxe.d.ts.map +1 -0
  119. package/dest/{pxe_service/pxe_service.js → pxe.js} +227 -241
  120. package/dest/storage/address_data_provider/address_data_provider.d.ts +2 -4
  121. package/dest/storage/address_data_provider/address_data_provider.d.ts.map +1 -1
  122. package/dest/storage/address_data_provider/address_data_provider.js +0 -3
  123. package/dest/storage/address_data_provider/index.d.ts +1 -1
  124. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts +3 -5
  125. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +1 -1
  126. package/dest/storage/capsule_data_provider/capsule_data_provider.js +1 -5
  127. package/dest/storage/capsule_data_provider/index.d.ts +1 -1
  128. package/dest/storage/contract_data_provider/contract_data_provider.d.ts +6 -17
  129. package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +1 -1
  130. package/dest/storage/contract_data_provider/contract_data_provider.js +0 -15
  131. package/dest/storage/contract_data_provider/index.d.ts +1 -1
  132. package/dest/storage/contract_data_provider/private_functions_tree.d.ts +1 -1
  133. package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +1 -1
  134. package/dest/storage/contract_data_provider/private_functions_tree.js +1 -1
  135. package/dest/storage/index.d.ts +1 -2
  136. package/dest/storage/index.d.ts.map +1 -1
  137. package/dest/storage/index.js +0 -1
  138. package/dest/storage/metadata.d.ts +1 -1
  139. package/dest/storage/note_data_provider/index.d.ts +2 -2
  140. package/dest/storage/note_data_provider/index.d.ts.map +1 -1
  141. package/dest/storage/note_data_provider/index.js +1 -1
  142. package/dest/storage/note_data_provider/note_data_provider.d.ts +75 -11
  143. package/dest/storage/note_data_provider/note_data_provider.d.ts.map +1 -1
  144. package/dest/storage/note_data_provider/note_data_provider.js +143 -81
  145. package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +31 -17
  146. package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts.map +1 -1
  147. package/dest/storage/private_event_data_provider/private_event_data_provider.js +47 -28
  148. package/dest/storage/sync_data_provider/index.d.ts +1 -1
  149. package/dest/storage/sync_data_provider/sync_data_provider.d.ts +4 -5
  150. package/dest/storage/sync_data_provider/sync_data_provider.d.ts.map +1 -1
  151. package/dest/storage/sync_data_provider/sync_data_provider.js +0 -3
  152. package/dest/storage/tagging_data_provider/index.d.ts +1 -1
  153. package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts +29 -7
  154. package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts.map +1 -1
  155. package/dest/storage/tagging_data_provider/tagging_data_provider.js +46 -39
  156. package/dest/synchronizer/index.d.ts +1 -1
  157. package/dest/synchronizer/synchronizer.d.ts +3 -2
  158. package/dest/synchronizer/synchronizer.d.ts.map +1 -1
  159. package/dest/synchronizer/synchronizer.js +4 -4
  160. package/dest/tagging/constants.d.ts +2 -0
  161. package/dest/tagging/constants.d.ts.map +1 -0
  162. package/dest/tagging/constants.js +2 -0
  163. package/dest/tagging/index.d.ts +7 -0
  164. package/dest/tagging/index.d.ts.map +1 -0
  165. package/dest/tagging/index.js +5 -0
  166. package/dest/tagging/siloed_tag.d.ts +14 -0
  167. package/dest/tagging/siloed_tag.d.ts.map +1 -0
  168. package/dest/tagging/siloed_tag.js +20 -0
  169. package/dest/tagging/tag.d.ts +12 -0
  170. package/dest/tagging/tag.d.ts.map +1 -0
  171. package/dest/tagging/tag.js +17 -0
  172. package/dest/tagging/utils.d.ts +18 -0
  173. package/dest/tagging/utils.d.ts.map +1 -0
  174. package/dest/tagging/utils.js +24 -0
  175. package/package.json +22 -24
  176. package/src/bin/check_oracle_version.ts +134 -10
  177. package/src/config/index.ts +18 -32
  178. package/src/config/package_info.ts +1 -1
  179. package/src/contract_function_simulator/contract_function_simulator.ts +151 -62
  180. package/src/contract_function_simulator/execution_data_provider.ts +47 -65
  181. package/src/contract_function_simulator/execution_note_cache.ts +33 -17
  182. package/src/contract_function_simulator/execution_tagging_index_cache.ts +32 -0
  183. package/src/contract_function_simulator/hashed_values_cache.ts +1 -1
  184. package/src/contract_function_simulator/index.ts +3 -1
  185. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +1 -1
  186. package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +1 -1
  187. package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +10 -5
  188. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +14 -2
  189. package/src/contract_function_simulator/noir-structs/utility_context.ts +42 -0
  190. package/src/contract_function_simulator/oracle/index.ts +1 -1
  191. package/src/contract_function_simulator/oracle/interfaces.ts +176 -0
  192. package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +1 -1
  193. package/src/contract_function_simulator/oracle/note_packing_utils.ts +21 -5
  194. package/src/contract_function_simulator/oracle/oracle.ts +135 -80
  195. package/src/contract_function_simulator/oracle/private_execution.ts +10 -17
  196. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +123 -49
  197. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +68 -80
  198. package/src/contract_function_simulator/pick_notes.ts +1 -1
  199. package/src/contract_function_simulator/pxe_oracle_interface.ts +291 -271
  200. package/src/entrypoints/client/bundle/index.ts +3 -1
  201. package/src/entrypoints/client/bundle/utils.ts +21 -23
  202. package/src/entrypoints/client/lazy/index.ts +3 -1
  203. package/src/entrypoints/client/lazy/utils.ts +20 -23
  204. package/src/entrypoints/pxe_creation_options.ts +4 -1
  205. package/src/entrypoints/server/index.ts +3 -1
  206. package/src/entrypoints/server/utils.ts +20 -68
  207. package/src/{pxe_service/error_enriching.ts → error_enriching.ts} +5 -1
  208. package/src/events/index.ts +1 -0
  209. package/src/events/private_event_filter_validator.ts +47 -0
  210. package/src/oracle_version.ts +2 -2
  211. package/src/private_kernel/hints/build_private_kernel_reset_private_inputs.ts +5 -9
  212. package/src/private_kernel/hints/compute_tx_include_by_timestamp.ts +6 -6
  213. package/src/private_kernel/private_kernel_execution_prover.ts +51 -43
  214. package/src/private_kernel/private_kernel_oracle.ts +2 -1
  215. package/src/private_kernel/private_kernel_oracle_impl.ts +4 -3
  216. package/src/{pxe_service/pxe_service.ts → pxe.ts} +256 -308
  217. package/src/storage/address_data_provider/address_data_provider.ts +1 -7
  218. package/src/storage/capsule_data_provider/capsule_data_provider.ts +2 -12
  219. package/src/storage/contract_data_provider/contract_data_provider.ts +4 -27
  220. package/src/storage/contract_data_provider/private_functions_tree.ts +1 -1
  221. package/src/storage/index.ts +0 -1
  222. package/src/storage/note_data_provider/index.ts +1 -1
  223. package/src/storage/note_data_provider/note_data_provider.ts +171 -109
  224. package/src/storage/private_event_data_provider/private_event_data_provider.ts +69 -41
  225. package/src/storage/sync_data_provider/sync_data_provider.ts +3 -8
  226. package/src/storage/tagging_data_provider/tagging_data_provider.ts +52 -55
  227. package/src/synchronizer/synchronizer.ts +4 -4
  228. package/src/tagging/constants.ts +2 -0
  229. package/src/tagging/index.ts +6 -0
  230. package/src/tagging/siloed_tag.ts +22 -0
  231. package/src/tagging/tag.ts +16 -0
  232. package/src/tagging/utils.ts +31 -0
  233. package/dest/bin/index.d.ts +0 -3
  234. package/dest/bin/index.d.ts.map +0 -1
  235. package/dest/bin/index.js +0 -48
  236. package/dest/contract_function_simulator/oracle/typed_oracle.d.ts +0 -87
  237. package/dest/contract_function_simulator/oracle/typed_oracle.d.ts.map +0 -1
  238. package/dest/contract_function_simulator/oracle/typed_oracle.js +0 -146
  239. package/dest/contract_function_simulator/tagging_utils.d.ts +0 -17
  240. package/dest/contract_function_simulator/tagging_utils.d.ts.map +0 -1
  241. package/dest/contract_function_simulator/tagging_utils.js +0 -23
  242. package/dest/pxe_service/error_enriching.d.ts +0 -11
  243. package/dest/pxe_service/error_enriching.d.ts.map +0 -1
  244. package/dest/pxe_service/index.d.ts +0 -3
  245. package/dest/pxe_service/index.d.ts.map +0 -1
  246. package/dest/pxe_service/index.js +0 -2
  247. package/dest/pxe_service/pxe_service.d.ts +0 -100
  248. package/dest/pxe_service/pxe_service.d.ts.map +0 -1
  249. package/dest/storage/data_provider.d.ts +0 -4
  250. package/dest/storage/data_provider.d.ts.map +0 -1
  251. package/dest/storage/data_provider.js +0 -1
  252. package/dest/storage/note_data_provider/note_dao.d.ts +0 -100
  253. package/dest/storage/note_data_provider/note_dao.d.ts.map +0 -1
  254. package/dest/storage/note_data_provider/note_dao.js +0 -102
  255. package/dest/test/pxe_test_suite.d.ts +0 -3
  256. package/dest/test/pxe_test_suite.d.ts.map +0 -1
  257. package/dest/test/pxe_test_suite.js +0 -97
  258. package/src/bin/index.ts +0 -62
  259. package/src/contract_function_simulator/oracle/typed_oracle.ts +0 -289
  260. package/src/contract_function_simulator/tagging_utils.ts +0 -32
  261. package/src/pxe_service/index.ts +0 -2
  262. package/src/storage/data_provider.ts +0 -3
  263. package/src/storage/note_data_provider/note_dao.ts +0 -154
  264. package/src/test/pxe_test_suite.ts +0 -113
package/README.md CHANGED
@@ -1,13 +1,13 @@
1
- # PXE Service & PXE
1
+ # PXE & PXE
2
2
 
3
- `PXE Service` (pronounced "pixie service") is a server-side software that provides a set of apis for interacting with the Aztec network. It acts as a bridge between the network and client applications by exposing methods to manage accounts, deploy contracts, create transactions, and retrieve public and account-specific information. It provides a secure environment for the execution of sensitive operations, ensuring private information and decrypted data are not accessible to unauthorized applications. The PXE Service is a critical component of the Aztec network, and its security and reliability are essential to the overall trustworthiness of user's data.
3
+ `PXE` (pronounced "pixie service") is a server-side software that provides a set of apis for interacting with the Aztec network. It acts as a bridge between the network and client applications by exposing methods to manage accounts, deploy contracts, create transactions, and retrieve public and account-specific information. It provides a secure environment for the execution of sensitive operations, ensuring private information and decrypted data are not accessible to unauthorized applications. The PXE is a critical component of the Aztec network, and its security and reliability are essential to the overall trustworthiness of user's data.
4
4
 
5
- `PXE` is the interface the PXE Service and every client-side instance implement. Various implementations of the client-side can exist, including those for different platforms such as mobile apps and web browsers. It is a relay between the dApps and the actual PXE Service.
5
+ `PXE` is the interface the PXE and every client-side instance implement. Various implementations of the client-side can exist, including those for different platforms such as mobile apps and web browsers. It is a relay between the dApps and the actual PXE.
6
6
 
7
- ### Main Components in an PXE Service
7
+ ### Main Components in an PXE
8
8
 
9
9
  - [Simulator](../simulator/)
10
10
  - [Key Store](../key-store/)
11
11
  - [Account State](./src/account_state/account_state.ts): It coordinates other components to synchronize and decrypt data, simulate transactions, and generate kernel proofs, for a specific account.
12
12
 
13
- ![Pixie](./pixie.png)
13
+ ![Pixie](./pixie.png)
@@ -1,2 +1,2 @@
1
1
  export {};
2
- //# sourceMappingURL=check_oracle_version.d.ts.map
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hlY2tfb3JhY2xlX3ZlcnNpb24uZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9iaW4vY2hlY2tfb3JhY2xlX3ZlcnNpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
@@ -1,11 +1,9 @@
1
- import { keccak256String } from '@aztec/foundation/crypto';
2
- import deterministicStringify from 'json-stringify-deterministic';
3
- import { Oracle } from '../contract_function_simulator/oracle/oracle.js';
4
- import { TypedOracle } from '../contract_function_simulator/oracle/typed_oracle.js';
1
+ import { keccak256String } from '@aztec/foundation/crypto/keccak';
2
+ import { readFileSync } from 'fs';
3
+ import { dirname, join } from 'path';
4
+ import ts from 'typescript';
5
+ import { fileURLToPath } from 'url';
5
6
  import { ORACLE_INTERFACE_HASH } from '../oracle_version.js';
6
- // Create a minimal mock implementation of TypedOracle to instantiate the Oracle class for interface verification.
7
- class OracleMock extends TypedOracle {
8
- }
9
7
  /**
10
8
  * Verifies that the Oracle interface matches the expected interface hash.
11
9
  *
@@ -18,12 +16,114 @@ class OracleMock extends TypedOracle {
18
16
  * oracles. Ensure this checks TXE oracles as well. This hasn't been implemented yet since we don't have a clean TXE
19
17
  * oracle interface like we do in PXE (i.e., there is no single Oracle class that contains only the oracles).
20
18
  */ function assertOracleInterfaceMatches() {
21
- const oracle = new Oracle(new OracleMock());
19
+ const oracleInterfaceSignature = getOracleInterfaceSignature();
22
20
  // We use keccak256 here just because we already have it in the dependencies.
23
- const oracleInterfaceHash = keccak256String(deterministicStringify(oracle.toACIRCallback()));
21
+ const oracleInterfaceHash = keccak256String(oracleInterfaceSignature);
24
22
  if (oracleInterfaceHash !== ORACLE_INTERFACE_HASH) {
25
23
  // This check exists only to notify you when you need to update the ORACLE_VERSION constant.
26
- throw new Error(`The TypedOracle interface has changed, which implies a breaking change in the aztec.nr/PXE oracle interface. Update ORACLE_INTERFACE_HASH to ${oracleInterfaceHash} and bump ORACLE_VERSION in pxe/src/oracle_version.ts.`);
24
+ throw new Error(`The Oracle interface has changed, which implies a breaking change in the aztec.nr/PXE oracle interface. Update ORACLE_INTERFACE_HASH to ${oracleInterfaceHash} and bump ORACLE_VERSION in pxe/src/oracle_version.ts.`);
25
+ }
26
+ }
27
+ /**
28
+ * Constructs a signature of the Oracle interface while ignoring methods that are not foreign call handlers.
29
+ */ function getOracleInterfaceSignature() {
30
+ const excludedProps = [
31
+ 'handler',
32
+ 'constructor',
33
+ 'toACIRCallback',
34
+ 'handlerAsMisc',
35
+ 'handlerAsUtility',
36
+ 'handlerAsPrivate'
37
+ ];
38
+ // Get the path to Oracle.ts source file
39
+ // The script runs from dest/bin/ after compilation, so we need to go up to the package root
40
+ // then into src/ to find the source file
41
+ const currentDir = dirname(fileURLToPath(import.meta.url));
42
+ // Go up from dest/bin/ or src/bin/ to the package root (pxe/), then into src/
43
+ const packageRoot = dirname(dirname(currentDir)); // Go up from bin/ to pxe/
44
+ const oracleSourcePath = join(packageRoot, 'src/contract_function_simulator/oracle/oracle.ts');
45
+ // Read and parse the TypeScript source file
46
+ const sourceCode = readFileSync(oracleSourcePath, 'utf-8');
47
+ const sourceFile = ts.createSourceFile('oracle.ts', sourceCode, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
48
+ // Extract method signatures from the Oracle class
49
+ const methodSignatures = [];
50
+ function visit(node) {
51
+ // Look for class declaration named "Oracle"
52
+ if (ts.isClassDeclaration(node) && node.name?.text === 'Oracle') {
53
+ // Visit all members of the class
54
+ node.members.forEach((member)=>{
55
+ if (ts.isMethodDeclaration(member) && member.name && ts.isIdentifier(member.name)) {
56
+ const methodName = member.name.text;
57
+ // Skip excluded methods
58
+ if (excludedProps.includes(methodName)) {
59
+ return;
60
+ }
61
+ // Extract parameter signatures
62
+ const paramSignatures = [];
63
+ member.parameters.forEach((param)=>{
64
+ const paramName = extractParameterName(param, sourceFile);
65
+ const paramType = extractTypeString(param.type, sourceFile);
66
+ paramSignatures.push(`${paramName}: ${paramType}`);
67
+ });
68
+ // Extract return type
69
+ const returnType = extractTypeString(member.type, sourceFile);
70
+ // Build full signature: methodName(param1: Type1, param2: Type2): ReturnType
71
+ const signature = `${methodName}(${paramSignatures.join(', ')}): ${returnType}`;
72
+ methodSignatures.push(signature);
73
+ }
74
+ });
75
+ }
76
+ ts.forEachChild(node, visit);
77
+ }
78
+ visit(sourceFile);
79
+ // Sort signatures alphabetically for consistent hashing
80
+ methodSignatures.sort();
81
+ // Create a hashable representation by concatenating all signatures
82
+ return methodSignatures.join('');
83
+ }
84
+ /**
85
+ * Extracts the parameter name from a parameter node, handling destructured parameters.
86
+ */ function extractParameterName(param, sourceFile) {
87
+ const name = param.name;
88
+ if (ts.isIdentifier(name)) {
89
+ return name.text;
90
+ }
91
+ if (ts.isArrayBindingPattern(name)) {
92
+ // Handle destructured parameters like [blockNumber]: ACVMField[]
93
+ // Extract the first element name
94
+ if (name.elements.length > 0) {
95
+ const element = name.elements[0];
96
+ if (ts.isBindingElement(element)) {
97
+ const elementName = element.name;
98
+ if (ts.isIdentifier(elementName)) {
99
+ return elementName.text;
100
+ }
101
+ // Nested destructuring - use text representation
102
+ if (ts.isArrayBindingPattern(elementName) || ts.isObjectBindingPattern(elementName)) {
103
+ return elementName.getText(sourceFile);
104
+ }
105
+ }
106
+ }
107
+ // Fallback: return the text representation
108
+ return name.getText(sourceFile);
109
+ }
110
+ if (ts.isObjectBindingPattern(name)) {
111
+ // Handle object destructuring
112
+ return name.getText(sourceFile);
113
+ }
114
+ // Fallback for any other case - this should never happen but TypeScript needs it
115
+ return name.getText(sourceFile);
116
+ }
117
+ /**
118
+ * Extracts the type string from a type node, normalizing whitespace.
119
+ */ function extractTypeString(typeNode, sourceFile) {
120
+ if (!typeNode) {
121
+ return 'void';
27
122
  }
123
+ // Get the type text and normalize whitespace
124
+ let typeText = typeNode.getText(sourceFile);
125
+ // Normalize whitespace: remove extra spaces, newlines, and tabs
126
+ typeText = typeText.replace(/\s+/g, ' ').trim();
127
+ return typeText;
28
128
  }
29
129
  assertOracleInterfaceMatches();
@@ -2,14 +2,6 @@ import { type ConfigMappingsType } from '@aztec/foundation/config';
2
2
  import { type DataStoreConfig } from '@aztec/kv-store/config';
3
3
  import { type ChainConfig } from '@aztec/stdlib/config';
4
4
  export { getPackageInfo } from './package_info.js';
5
- /**
6
- * Temporary configuration until WASM can be used instead of native
7
- */
8
- export interface BBProverConfig {
9
- bbWorkingDirectory?: string;
10
- bbBinaryPath?: string;
11
- bbSkipCleanup?: boolean;
12
- }
13
5
  /**
14
6
  * Configuration settings for the prover factory
15
7
  */
@@ -18,26 +10,26 @@ export interface KernelProverConfig {
18
10
  proverEnabled?: boolean;
19
11
  }
20
12
  /**
21
- * Configuration settings for the PXE.
13
+ * Configuration settings for the synchronizer.
22
14
  */
23
- export interface PXEConfig {
15
+ export interface SynchronizerConfig {
24
16
  /** Maximum amount of blocks to pull from the stream in one request when synchronizing */
25
17
  l2BlockBatchSize: number;
26
18
  }
27
- export type PXEServiceConfig = PXEConfig & KernelProverConfig & BBProverConfig & DataStoreConfig & ChainConfig;
19
+ export type PXEConfig = KernelProverConfig & DataStoreConfig & ChainConfig & SynchronizerConfig;
28
20
  export type CliPXEOptions = {
29
21
  /** Custom Aztec Node URL to connect to */
30
22
  nodeUrl?: string;
31
23
  };
32
- export declare const pxeConfigMappings: ConfigMappingsType<PXEServiceConfig>;
24
+ export declare const pxeConfigMappings: ConfigMappingsType<PXEConfig>;
33
25
  /**
34
- * Creates an instance of PXEServiceConfig out of environment variables using sensible defaults for integration testing if not set.
26
+ * Creates an instance of PXEConfig out of environment variables using sensible defaults for integration testing if not set.
35
27
  */
36
- export declare function getPXEServiceConfig(): PXEServiceConfig;
28
+ export declare function getPXEConfig(): PXEConfig;
37
29
  export declare const pxeCliConfigMappings: ConfigMappingsType<CliPXEOptions>;
38
- export declare const allPxeConfigMappings: ConfigMappingsType<CliPXEOptions & PXEServiceConfig>;
30
+ export declare const allPxeConfigMappings: ConfigMappingsType<CliPXEOptions & PXEConfig>;
39
31
  /**
40
32
  * Creates an instance of CliPxeOptions out of environment variables
41
33
  */
42
- export declare function getCliPXEOptions(): CliPXEOptions & PXEServiceConfig;
43
- //# sourceMappingURL=index.d.ts.map
34
+ export declare function getCliPXEOptions(): CliPXEOptions & PXEConfig;
35
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb25maWcvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUNMLEtBQUssa0JBQWtCLEVBS3hCLE1BQU0sMEJBQTBCLENBQUM7QUFDbEMsT0FBTyxFQUFFLEtBQUssZUFBZSxFQUFzQixNQUFNLHdCQUF3QixDQUFDO0FBQ2xGLE9BQU8sRUFBRSxLQUFLLFdBQVcsRUFBdUIsTUFBTSxzQkFBc0IsQ0FBQztBQUU3RSxPQUFPLEVBQUUsY0FBYyxFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFFbkQ7O0dBRUc7QUFDSCxNQUFNLFdBQVcsa0JBQWtCO0lBQ2pDLDhDQUE4QztJQUM5QyxhQUFhLENBQUMsRUFBRSxPQUFPLENBQUM7Q0FDekI7QUFFRDs7R0FFRztBQUNILE1BQU0sV0FBVyxrQkFBa0I7SUFDakMseUZBQXlGO0lBQ3pG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CAAC;AAEhG,MAAM,MAAM,aAAa,GAAG;IAC1B,2CAA2C;IAC3C,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,kBAAkB,CAAC,SAAS,CAoB3D,CAAC;AAEF;;GAEG;AACH,wBAAgB,YAAY,IAAI,SAAS,CAExC;AAED,eAAO,MAAM,oBAAoB,EAAE,kBAAkB,CAAC,aAAa,CAKlE,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,kBAAkB,CAAC,aAAa,GAAG,SAAS,CAW9E,CAAC;AAEF;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,aAAa,GAAG,SAAS,CAQ5D"}
@@ -10,19 +10,13 @@ export const pxeConfigMappings = {
10
10
  ...numberConfigHelper(50),
11
11
  description: 'Maximum amount of blocks to pull from the stream in one request when synchronizing'
12
12
  },
13
- bbBinaryPath: {
14
- env: 'BB_BINARY_PATH',
15
- description: 'Path to the BB binary'
16
- },
17
- bbWorkingDirectory: {
18
- env: 'BB_WORKING_DIRECTORY',
19
- description: 'Working directory for the BB binary'
20
- },
21
- bbSkipCleanup: {
22
- env: 'BB_SKIP_CLEANUP',
23
- description: 'True to skip cleanup of temporary files for debugging purposes',
24
- ...booleanConfigHelper()
25
- },
13
+ // TODO: We're losing this feature in moving to bb.js api.
14
+ // Reimplement it as a setting that dumps the msgpack data on the bb.js backend if needed.
15
+ // bbSkipCleanup: {
16
+ // env: 'BB_SKIP_CLEANUP',
17
+ // description: 'True to skip cleanup of temporary files for debugging purposes',
18
+ // ...booleanConfigHelper(),
19
+ // },
26
20
  proverEnabled: {
27
21
  env: 'PXE_PROVER_ENABLED',
28
22
  description: 'Enable real proofs',
@@ -30,8 +24,8 @@ export const pxeConfigMappings = {
30
24
  }
31
25
  };
32
26
  /**
33
- * Creates an instance of PXEServiceConfig out of environment variables using sensible defaults for integration testing if not set.
34
- */ export function getPXEServiceConfig() {
27
+ * Creates an instance of PXEConfig out of environment variables using sensible defaults for integration testing if not set.
28
+ */ export function getPXEConfig() {
35
29
  return getConfigFromMappings(pxeConfigMappings);
36
30
  }
37
31
  export const pxeCliConfigMappings = {
@@ -55,7 +49,7 @@ export const allPxeConfigMappings = {
55
49
  /**
56
50
  * Creates an instance of CliPxeOptions out of environment variables
57
51
  */ export function getCliPXEOptions() {
58
- const pxeConfig = getPXEServiceConfig();
52
+ const pxeConfig = getPXEConfig();
59
53
  const cliOptions = getConfigFromMappings(pxeCliConfigMappings);
60
54
  return {
61
55
  ...pxeConfig,
@@ -2,4 +2,4 @@ export declare function getPackageInfo(): {
2
2
  version: string;
3
3
  name: string;
4
4
  };
5
- //# sourceMappingURL=package_info.d.ts.map
5
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGFja2FnZV9pbmZvLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY29uZmlnL3BhY2thZ2VfaW5mby50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSx3QkFBZ0IsY0FBYzs7O0VBRTdCIn0=
@@ -1,6 +1,6 @@
1
1
  export function getPackageInfo() {
2
2
  return {
3
- version: '2.0.0',
3
+ version: '3.0.0',
4
4
  name: '@aztec/pxe'
5
5
  };
6
6
  }
@@ -1,6 +1,6 @@
1
- import { Fr } from '@aztec/foundation/fields';
1
+ import { Fr } from '@aztec/foundation/curves/bn254';
2
2
  import { type CircuitSimulator } from '@aztec/simulator/client';
3
- import type { AbiDecoded, FunctionCall } from '@aztec/stdlib/abi';
3
+ import type { FunctionCall } from '@aztec/stdlib/abi';
4
4
  import { FunctionSelector } from '@aztec/stdlib/abi';
5
5
  import type { AuthWitness } from '@aztec/stdlib/auth-witness';
6
6
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
@@ -35,13 +35,13 @@ export declare class ContractFunctionSimulator {
35
35
  * @param authwits - Authentication witnesses required for the function call.
36
36
  * @param scopes - Optional array of account addresses whose notes can be accessed in this call. Defaults to all
37
37
  * accounts if not specified.
38
- * @returns A decoded ABI value containing the function's return data.
38
+ * @returns A return value of the utility function in a form as returned by the simulator (Noir fields)
39
39
  */
40
- runUtility(call: FunctionCall, authwits: AuthWitness[], scopes?: AztecAddress[]): Promise<AbiDecoded>;
40
+ runUtility(call: FunctionCall, authwits: AuthWitness[], scopes?: AztecAddress[]): Promise<Fr[]>;
41
41
  getStats(): import("./execution_data_provider.js").ExecutionStats;
42
42
  }
43
43
  /**
44
- * Generates the final public inputs of the tail kernel circuit, an empty ClientIVC proof
44
+ * Generates the final public inputs of the tail kernel circuit, an empty Chonk proof
45
45
  * and the execution steps for a `PrivateExecutionResult` as if it had been
46
46
  * processed by the private kernel prover. This skips many of the checks performed by the kernels
47
47
  * (allowing state overrides) and is much faster, while still generating a valid
@@ -53,4 +53,4 @@ export declare class ContractFunctionSimulator {
53
53
  * @returns The simulated proving result.
54
54
  */
55
55
  export declare function generateSimulatedProvingResult(privateExecutionResult: PrivateExecutionResult, nonceGenerator: Fr, contractDataProvider: ContractDataProvider): Promise<PrivateKernelExecutionProofOutput<PrivateKernelTailCircuitPublicInputs>>;
56
- //# sourceMappingURL=contract_function_simulator.d.ts.map
56
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udHJhY3RfZnVuY3Rpb25fc2ltdWxhdG9yLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY29udHJhY3RfZnVuY3Rpb25fc2ltdWxhdG9yL2NvbnRyYWN0X2Z1bmN0aW9uX3NpbXVsYXRvci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFvQkEsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBS3BELE9BQU8sRUFDTCxLQUFLLGdCQUFnQixFQU90QixNQUFNLHlCQUF5QixDQUFDO0FBQ2pDLE9BQU8sS0FBSyxFQ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FVLENBQUMsSUFBSSxFQUFFLFlBQVksRUFBRSxRQUFRLEVBQUUsV0FBVyxFQUFFLEVBQUUsTUFBTSxDQUFDLEVBQUUsWUFBWSxFQUFFLEdBQUcsT0FBTyxDQUFDLEVBQUUsRUFBRSxDQUFDLENBc0MzRztJQUdELFFBQVEsMERBRVA7Q0FDRjtBQVlEOzs7Ozs7Ozs7OztHQVdHO0FBQ0gsd0JBQXNCLDhCQUE4QixDQUNsRCxzQkFBc0IsRUFBRSxzQkFBc0IsRUFDOUMsY0FBYyxFQUFFLEVBQUUsRUFDbEIsb0JBQW9CLEVBQUUsb0JBQW9CLEdBQ3pDLE9BQU8sQ0FBQyxpQ0FBaUMsQ0FBQyxvQ0FBb0MsQ0FBQyxDQUFDLENBZ05sRiJ9
@@ -1 +1 @@
1
- {"version":3,"file":"contract_function_simulator.d.ts","sourceRoot":"","sources":["../../src/contract_function_simulator/contract_function_simulator.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAK9C,OAAO,EACL,KAAK,gBAAgB,EAOtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAA+B,MAAM,mBAAmB,CAAC;AAClF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAG3D,OAAO,EAIL,KAAK,iCAAiC,EACtC,oCAAoC,EAKrC,MAAM,sBAAsB,CAAC;AAI9B,OAAO,EAGL,sBAAsB,EAEtB,kBAAkB,EAEnB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAQ1E;;GAEG;AACH,qBAAa,yBAAyB;IAIlC,OAAO,CAAC,qBAAqB;IAC7B,OAAO,CAAC,SAAS;IAJnB,OAAO,CAAC,GAAG,CAAS;gBAGV,qBAAqB,EAAE,qBAAqB,EAC5C,SAAS,EAAE,gBAAgB;IAKrC;;;;;;;;;;;OAWG;IACU,GAAG,CACd,OAAO,EAAE,kBAAkB,EAC3B,eAAe,EAAE,YAAY,EAC7B,QAAQ,EAAE,gBAAgB,EAC1B,SAAS,eAA6C,EACtD,aAAa,CAAC,EAAE,YAAY,EAC5B,MAAM,CAAC,EAAE,YAAY,EAAE,GACtB,OAAO,CAAC,sBAAsB,CAAC;IAiGlC;;;;;;;OAOG;IACU,UAAU,CAAC,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,EAAE,MAAM,CAAC,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;IA0ClH,QAAQ;CAGT;AAYD;;;;;;;;;;;GAWG;AACH,wBAAsB,8BAA8B,CAClD,sBAAsB,EAAE,sBAAsB,EAC9C,cAAc,EAAE,EAAE,EAClB,oBAAoB,EAAE,oBAAoB,GACzC,OAAO,CAAC,iCAAiC,CAAC,oCAAoC,CAAC,CAAC,CA+LlF"}
1
+ {"version":3,"file":"contract_function_simulator.d.ts","sourceRoot":"","sources":["../../src/contract_function_simulator/contract_function_simulator.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAKpD,OAAO,EACL,KAAK,gBAAgB,EAOtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAgB,MAAM,mBAAmB,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAS3D,OAAO,EAIL,KAAK,iCAAiC,EACtC,oCAAoC,EAKrC,MAAM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End } from '@aztec/foundation/collection';
3
- import { poseidon2Hash } from '@aztec/foundation/crypto';
4
- import { Fr } from '@aztec/foundation/fields';
1
+ import { AVM_EMITNOTEHASH_BASE_L2_GAS, AVM_EMITNULLIFIER_BASE_L2_GAS, AVM_SENDL2TOL1MSG_BASE_L2_GAS, DA_BYTES_PER_FIELD, DA_GAS_PER_BYTE, FIXED_AVM_STARTUP_L2_GAS, FIXED_DA_GAS, FIXED_L2_GAS, L2_GAS_PER_CONTRACT_CLASS_LOG, L2_GAS_PER_PRIVATE_LOG, MAX_CONTRACT_CLASS_LOGS_PER_TX, MAX_ENQUEUED_CALLS_PER_TX, MAX_L2_TO_L1_MSGS_PER_TX, MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX, MAX_PRIVATE_LOGS_PER_TX } from '@aztec/constants';
2
+ import { arrayNonEmptyLength, padArrayEnd } from '@aztec/foundation/collection';
3
+ import { poseidon2Hash } from '@aztec/foundation/crypto/poseidon';
4
+ import { Fr } from '@aztec/foundation/curves/bn254';
5
5
  import { createLogger } from '@aztec/foundation/log';
6
6
  import { Timer } from '@aztec/foundation/timer';
7
7
  import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
8
- import { protocolContractTreeRoot } from '@aztec/protocol-contracts';
8
+ import { protocolContractsHash } from '@aztec/protocol-contracts';
9
9
  import { ExecutionError, createSimulationError, extractCallStack, resolveAssertionMessageFromError, toACVMWitness, witnessMapToFields } from '@aztec/simulator/client';
10
- import { FunctionSelector, FunctionType, decodeFromAbi } from '@aztec/stdlib/abi';
10
+ import { FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
11
11
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
12
12
  import { Gas } from '@aztec/stdlib/gas';
13
- import { computeNoteHashNonce, computeUniqueNoteHash, siloNoteHash, siloNullifier } from '@aztec/stdlib/hash';
13
+ import { computeNoteHashNonce, computeProtocolNullifier, computeUniqueNoteHash, siloNoteHash, siloNullifier } from '@aztec/stdlib/hash';
14
14
  import { PartialPrivateTailPublicInputsForPublic, PartialPrivateTailPublicInputsForRollup, PrivateKernelTailCircuitPublicInputs, PrivateToPublicAccumulatedData, PrivateToRollupAccumulatedData, PublicCallRequest, ScopedLogHash } from '@aztec/stdlib/kernel';
15
15
  import { PrivateLog } from '@aztec/stdlib/logs';
16
16
  import { ScopedL2ToL1Message } from '@aztec/stdlib/messaging';
17
- import { ClientIvcProof } from '@aztec/stdlib/proofs';
18
- import { CallContext, HashedValues, PrivateExecutionResult, TxConstantData, collectNested } from '@aztec/stdlib/tx';
17
+ import { ChonkProof } from '@aztec/stdlib/proofs';
18
+ import { CallContext, HashedValues, PrivateExecutionResult, TxConstantData, collectNested, getFinalMinRevertibleSideEffectCounter } from '@aztec/stdlib/tx';
19
19
  import { ExecutionNoteCache } from './execution_note_cache.js';
20
+ import { ExecutionTaggingIndexCache } from './execution_tagging_index_cache.js';
20
21
  import { HashedValuesCache } from './hashed_values_cache.js';
21
22
  import { Oracle } from './oracle/oracle.js';
22
23
  import { executePrivateFunction, verifyCurrentClassId } from './oracle/private_execution.js';
@@ -46,7 +47,7 @@ import { UtilityExecutionOracle } from './oracle/utility_execution_oracle.js';
46
47
  * @returns The result of the execution.
47
48
  */ async run(request, contractAddress, selector, msgSender = AztecAddress.fromField(Fr.MAX_FIELD_VALUE), senderForTags, scopes) {
48
49
  const simulatorSetupTimer = new Timer();
49
- const header = await this.executionDataProvider.getBlockHeader();
50
+ const anchorBlockHeader = await this.executionDataProvider.getAnchorBlockHeader();
50
51
  await verifyCurrentClassId(contractAddress, this.executionDataProvider);
51
52
  const entryPointArtifact = await this.executionDataProvider.getFunctionArtifact(contractAddress, selector);
52
53
  if (entryPointArtifact.functionType !== FunctionType.PRIVATE) {
@@ -56,11 +57,12 @@ import { UtilityExecutionOracle } from './oracle/utility_execution_oracle.js';
56
57
  this.log.warn(`Request origin does not match contract address in simulation. Request origin: ${request.origin}, contract address: ${contractAddress}`);
57
58
  }
58
59
  // reserve the first side effect for the tx hash (inserted by the private kernel)
59
- const startSideEffectCounter = 1;
60
+ const startSideEffectCounter = 2;
60
61
  const callContext = new CallContext(msgSender, contractAddress, await FunctionSelector.fromNameAndParameters(entryPointArtifact.name, entryPointArtifact.parameters), entryPointArtifact.isStatic);
61
- const txRequestHash = await request.toTxRequest().hash();
62
- const noteCache = new ExecutionNoteCache(txRequestHash);
63
- const privateExecutionOracle = new PrivateExecutionOracle(request.firstCallArgsHash, request.txContext, callContext, header, request.authWitnesses, request.capsules, HashedValuesCache.create(request.argsOfCalls), noteCache, this.executionDataProvider, this.simulator, 0, startSideEffectCounter, undefined, scopes, senderForTags);
62
+ const protocolNullifier = await computeProtocolNullifier(await request.toTxRequest().hash());
63
+ const noteCache = new ExecutionNoteCache(protocolNullifier);
64
+ const taggingIndexCache = new ExecutionTaggingIndexCache();
65
+ const privateExecutionOracle = new PrivateExecutionOracle(request.firstCallArgsHash, request.txContext, callContext, anchorBlockHeader, request.authWitnesses, request.capsules, HashedValuesCache.create(request.argsOfCalls), noteCache, taggingIndexCache, this.executionDataProvider, 0, startSideEffectCounter, undefined, scopes, senderForTags, this.simulator);
64
66
  const setupTime = simulatorSetupTimer.ms();
65
67
  try {
66
68
  // Note: any nested private function calls are made recursively within this
@@ -69,8 +71,8 @@ import { UtilityExecutionOracle } from './oracle/utility_execution_oracle.js';
69
71
  // within executionResult.nestedExecutionResults).
70
72
  const executionResult = await executePrivateFunction(this.simulator, privateExecutionOracle, entryPointArtifact, contractAddress, request.functionSelector);
71
73
  const simulatorTeardownTimer = new Timer();
72
- const { usedTxRequestHashForNonces } = noteCache.finish();
73
- const firstNullifierHint = usedTxRequestHashForNonces ? Fr.ZERO : noteCache.getAllNullifiers()[0];
74
+ const { usedProtocolNullifierForNonces } = noteCache.finish();
75
+ const firstNullifierHint = usedProtocolNullifierForNonces ? Fr.ZERO : noteCache.getAllNullifiers()[0];
74
76
  const publicCallRequests = collectNested([
75
77
  executionResult
76
78
  ], (r)=>r.publicInputs.publicCallRequests.getActiveItems().map((r)=>r.inner).concat(r.publicInputs.publicTeardownCallRequest.isEmpty() ? [] : [
@@ -100,7 +102,7 @@ import { UtilityExecutionOracle } from './oracle/utility_execution_oracle.js';
100
102
  * @param authwits - Authentication witnesses required for the function call.
101
103
  * @param scopes - Optional array of account addresses whose notes can be accessed in this call. Defaults to all
102
104
  * accounts if not specified.
103
- * @returns A decoded ABI value containing the function's return data.
105
+ * @returns A return value of the utility function in a form as returned by the simulator (Noir fields)
104
106
  */ async runUtility(call, authwits, scopes) {
105
107
  await verifyCurrentClassId(call.to, this.executionDataProvider);
106
108
  const entryPointArtifact = await this.executionDataProvider.getFunctionArtifact(call.to, call.selector);
@@ -123,9 +125,8 @@ import { UtilityExecutionOracle } from './oracle/utility_execution_oracle.js';
123
125
  cause: err
124
126
  });
125
127
  });
126
- const returnWitness = witnessMapToFields(acirExecutionResult.returnWitness);
127
128
  this.log.verbose(`Utility simulation for ${call.to}.${call.selector} completed`);
128
- return decodeFromAbi(entryPointArtifact.returnTypes, returnWitness);
129
+ return witnessMapToFields(acirExecutionResult.returnWitness);
129
130
  } catch (err) {
130
131
  throw createSimulationError(err instanceof Error ? err : new Error('Unknown error during private execution'));
131
132
  }
@@ -144,7 +145,7 @@ class OrderedSideEffect {
144
145
  }
145
146
  }
146
147
  /**
147
- * Generates the final public inputs of the tail kernel circuit, an empty ClientIVC proof
148
+ * Generates the final public inputs of the tail kernel circuit, an empty Chonk proof
148
149
  * and the execution steps for a `PrivateExecutionResult` as if it had been
149
150
  * processed by the private kernel prover. This skips many of the checks performed by the kernels
150
151
  * (allowing state overrides) and is much faster, while still generating a valid
@@ -200,21 +201,23 @@ class OrderedSideEffect {
200
201
  witness: execution.partialWitness
201
202
  });
202
203
  }
203
- const constantData = new TxConstantData(privateExecutionResult.entrypoint.publicInputs.historicalHeader, privateExecutionResult.entrypoint.publicInputs.txContext, getVKTreeRoot(), protocolContractTreeRoot);
204
+ const constantData = new TxConstantData(privateExecutionResult.entrypoint.publicInputs.anchorBlockHeader, privateExecutionResult.entrypoint.publicInputs.txContext, getVKTreeRoot(), protocolContractsHash);
204
205
  const hasPublicCalls = privateExecutionResult.publicFunctionCalldata.length !== 0;
205
206
  let inputsForRollup;
206
207
  let inputsForPublic;
208
+ let gasUsed;
207
209
  const sortByCounter = (a, b)=>a.counter - b.counter;
208
210
  const getEffect = (orderedSideEffect)=>orderedSideEffect.sideEffect;
209
- const sortedNullifiers = nullifiers.sort(sortByCounter).map(getEffect);
210
- // If the tx generated no nullifiers, the nonce generator (txRequest hash)
211
- // is injected as the first nullifier as per protocol rules.
212
- if (sortedNullifiers.length === 0) {
213
- sortedNullifiers.push(nonceGenerator);
211
+ const isPrivateOnlyTx = privateExecutionResult.publicFunctionCalldata.length === 0;
212
+ const minRevertibleSideEffectCounter = getFinalMinRevertibleSideEffectCounter(privateExecutionResult);
213
+ const [nonRevertibleNullifiers, revertibleNullifiers] = splitOrderedSideEffects(nullifiers.sort(sortByCounter), minRevertibleSideEffectCounter);
214
+ if (nonRevertibleNullifiers.length > 0 && !nonRevertibleNullifiers[0].equals(nonceGenerator)) {
215
+ throw new Error('The first non revertible nullifier should be equal to the nonce generator. This is a bug!');
216
+ } else {
217
+ nonRevertibleNullifiers.unshift(nonceGenerator);
214
218
  }
215
- // Private only
216
- if (privateExecutionResult.publicFunctionCalldata.length === 0) {
217
- // In case the tx only contains private functions, we must make the note hashes unique by using the
219
+ if (isPrivateOnlyTx) {
220
+ // We must make the note hashes unique by using the
218
221
  // nonce generator and their index in the tx.
219
222
  const uniqueNoteHashes = await Promise.all(siloedNoteHashes.sort(sortByCounter).map(async (orderedSideEffect, i)=>{
220
223
  const siloedNoteHash = orderedSideEffect.sideEffect;
@@ -222,24 +225,76 @@ class OrderedSideEffect {
222
225
  const uniqueNoteHash = await computeUniqueNoteHash(nonce, siloedNoteHash);
223
226
  return uniqueNoteHash;
224
227
  }));
225
- const accumulatedDataForRollup = new PrivateToRollupAccumulatedData(padArrayEnd(uniqueNoteHashes, Fr.ZERO, MAX_NOTE_HASHES_PER_TX), padArrayEnd(sortedNullifiers, Fr.ZERO, MAX_NULLIFIERS_PER_TX), padArrayEnd(l2ToL1Messages.sort(sortByCounter).map(getEffect), ScopedL2ToL1Message.empty(), MAX_L2_TO_L1_MSGS_PER_TX), padArrayEnd(taggedPrivateLogs.sort(sortByCounter).map(getEffect), PrivateLog.empty(), MAX_PRIVATE_LOGS_PER_TX), padArrayEnd(contractClassLogsHashes.sort(sortByCounter).map(getEffect), ScopedLogHash.empty(), MAX_CONTRACT_CLASS_LOGS_PER_TX));
228
+ const accumulatedDataForRollup = new PrivateToRollupAccumulatedData(padArrayEnd(uniqueNoteHashes, Fr.ZERO, MAX_NOTE_HASHES_PER_TX), padArrayEnd(nonRevertibleNullifiers.concat(revertibleNullifiers), Fr.ZERO, MAX_NULLIFIERS_PER_TX), padArrayEnd(l2ToL1Messages.sort(sortByCounter).map(getEffect), ScopedL2ToL1Message.empty(), MAX_L2_TO_L1_MSGS_PER_TX), padArrayEnd(taggedPrivateLogs.sort(sortByCounter).map(getEffect), PrivateLog.empty(), MAX_PRIVATE_LOGS_PER_TX), padArrayEnd(contractClassLogsHashes.sort(sortByCounter).map(getEffect), ScopedLogHash.empty(), MAX_CONTRACT_CLASS_LOGS_PER_TX));
229
+ gasUsed = meterGasUsed(accumulatedDataForRollup);
226
230
  inputsForRollup = new PartialPrivateTailPublicInputsForRollup(accumulatedDataForRollup);
227
231
  } else {
228
- const nonRevertibleData = PrivateToPublicAccumulatedData.empty();
229
- // The nullifier array contains the nonce generator in position 0
230
- // Here we remove it from the revertible data and
231
- // add it as the first non-revertible nullifier (we can't have dupes!)
232
- // This is because public processor will use that first non-revertible nullifier
233
- // as the nonce generator for the note hashes in the revertible part of the tx.
234
- const [firstNullifier] = sortedNullifiers.splice(0, 1);
235
- nonRevertibleData.nullifiers[0] = firstNullifier;
236
- const revertibleData = new PrivateToPublicAccumulatedData(padArrayEnd(siloedNoteHashes.sort(sortByCounter).map(getEffect), Fr.ZERO, MAX_NOTE_HASHES_PER_TX), padArrayEnd(sortedNullifiers, Fr.ZERO, MAX_NULLIFIERS_PER_TX), padArrayEnd(l2ToL1Messages.sort(sortByCounter).map(getEffect), ScopedL2ToL1Message.empty(), MAX_L2_TO_L1_MSGS_PER_TX), padArrayEnd(taggedPrivateLogs.sort(sortByCounter).map(getEffect), PrivateLog.empty(), MAX_PRIVATE_LOGS_PER_TX), padArrayEnd(contractClassLogsHashes.sort(sortByCounter).map(getEffect), ScopedLogHash.empty(), MAX_CONTRACT_CLASS_LOGS_PER_TX), padArrayEnd(publicCallRequests.sort(sortByCounter).map(getEffect), PublicCallRequest.empty(), MAX_ENQUEUED_CALLS_PER_TX));
232
+ const [nonRevertibleNoteHashes, revertibleNoteHashes] = splitOrderedSideEffects(siloedNoteHashes.sort(sortByCounter), minRevertibleSideEffectCounter);
233
+ const [nonRevertibleL2ToL1Messages, revertibleL2ToL1Messages] = splitOrderedSideEffects(l2ToL1Messages.sort(sortByCounter), minRevertibleSideEffectCounter);
234
+ const [nonRevertibleTaggedPrivateLogs, revertibleTaggedPrivateLogs] = splitOrderedSideEffects(taggedPrivateLogs, minRevertibleSideEffectCounter);
235
+ const [nonRevertibleContractClassLogHashes, revertibleContractClassLogHashes] = splitOrderedSideEffects(contractClassLogsHashes.sort(sortByCounter), minRevertibleSideEffectCounter);
236
+ const [nonRevertiblePublicCallRequests, revertiblePublicCallRequests] = splitOrderedSideEffects(publicCallRequests.sort(sortByCounter), minRevertibleSideEffectCounter);
237
+ const nonRevertibleData = new PrivateToPublicAccumulatedData(padArrayEnd(nonRevertibleNoteHashes, Fr.ZERO, MAX_NOTE_HASHES_PER_TX), padArrayEnd(nonRevertibleNullifiers, Fr.ZERO, MAX_NULLIFIERS_PER_TX), padArrayEnd(nonRevertibleL2ToL1Messages, ScopedL2ToL1Message.empty(), MAX_L2_TO_L1_MSGS_PER_TX), padArrayEnd(nonRevertibleTaggedPrivateLogs, PrivateLog.empty(), MAX_PRIVATE_LOGS_PER_TX), padArrayEnd(nonRevertibleContractClassLogHashes, ScopedLogHash.empty(), MAX_CONTRACT_CLASS_LOGS_PER_TX), padArrayEnd(nonRevertiblePublicCallRequests, PublicCallRequest.empty(), MAX_ENQUEUED_CALLS_PER_TX));
238
+ const revertibleData = new PrivateToPublicAccumulatedData(padArrayEnd(revertibleNoteHashes, Fr.ZERO, MAX_NOTE_HASHES_PER_TX), padArrayEnd(revertibleNullifiers, Fr.ZERO, MAX_NULLIFIERS_PER_TX), padArrayEnd(revertibleL2ToL1Messages, ScopedL2ToL1Message.empty(), MAX_L2_TO_L1_MSGS_PER_TX), padArrayEnd(revertibleTaggedPrivateLogs, PrivateLog.empty(), MAX_PRIVATE_LOGS_PER_TX), padArrayEnd(revertibleContractClassLogHashes, ScopedLogHash.empty(), MAX_CONTRACT_CLASS_LOGS_PER_TX), padArrayEnd(revertiblePublicCallRequests, PublicCallRequest.empty(), MAX_ENQUEUED_CALLS_PER_TX));
239
+ gasUsed = meterGasUsed(revertibleData).add(meterGasUsed(nonRevertibleData));
240
+ if (publicTeardownCallRequest) {
241
+ gasUsed.add(privateExecutionResult.entrypoint.publicInputs.txContext.gasSettings.teardownGasLimits);
242
+ }
237
243
  inputsForPublic = new PartialPrivateTailPublicInputsForPublic(nonRevertibleData, revertibleData, publicTeardownCallRequest ?? PublicCallRequest.empty());
238
244
  }
239
- const publicInputs = new PrivateKernelTailCircuitPublicInputs(constantData, /*gasUsed=*/ new Gas(0, 0), /*feePayer=*/ AztecAddress.zero(), /*includeByTimestamp=*/ 0n, hasPublicCalls ? inputsForPublic : undefined, !hasPublicCalls ? inputsForRollup : undefined);
245
+ const publicInputs = new PrivateKernelTailCircuitPublicInputs(constantData, /*gasUsed=*/ gasUsed.add(Gas.from({
246
+ l2Gas: FIXED_L2_GAS,
247
+ daGas: FIXED_DA_GAS
248
+ })), /*feePayer=*/ AztecAddress.zero(), /*includeByTimestamp=*/ 0n, hasPublicCalls ? inputsForPublic : undefined, !hasPublicCalls ? inputsForRollup : undefined);
240
249
  return {
241
250
  publicInputs,
242
- clientIvcProof: ClientIvcProof.empty(),
243
- executionSteps: executionSteps
251
+ chonkProof: ChonkProof.empty(),
252
+ executionSteps
244
253
  };
245
254
  }
255
+ function splitOrderedSideEffects(effects, minRevertibleSideEffectCounter) {
256
+ const revertibleSideEffects = [];
257
+ const nonRevertibleSideEffects = [];
258
+ effects.forEach((effect)=>{
259
+ if (effect.counter < minRevertibleSideEffectCounter) {
260
+ nonRevertibleSideEffects.push(effect.sideEffect);
261
+ } else {
262
+ revertibleSideEffects.push(effect.sideEffect);
263
+ }
264
+ });
265
+ return [
266
+ nonRevertibleSideEffects,
267
+ revertibleSideEffects
268
+ ];
269
+ }
270
+ function meterGasUsed(data) {
271
+ let meteredDAFields = 0;
272
+ let meteredL2Gas = 0;
273
+ const numNoteHashes = arrayNonEmptyLength(data.noteHashes, (hash)=>hash.isEmpty());
274
+ meteredDAFields += numNoteHashes;
275
+ meteredL2Gas += numNoteHashes * AVM_EMITNOTEHASH_BASE_L2_GAS;
276
+ const numNullifiers = arrayNonEmptyLength(data.nullifiers, (nullifier)=>nullifier.isEmpty());
277
+ meteredDAFields += numNullifiers;
278
+ meteredL2Gas += numNullifiers * AVM_EMITNULLIFIER_BASE_L2_GAS;
279
+ const numL2toL1Messages = arrayNonEmptyLength(data.l2ToL1Msgs, (msg)=>msg.isEmpty());
280
+ meteredDAFields += numL2toL1Messages;
281
+ meteredL2Gas += numL2toL1Messages * AVM_SENDL2TOL1MSG_BASE_L2_GAS;
282
+ const numPrivatelogs = arrayNonEmptyLength(data.privateLogs, (log)=>log.isEmpty());
283
+ // Every private log emits its length as an additional field
284
+ meteredDAFields += data.privateLogs.reduce((acc, log)=>!log.isEmpty() ? acc + log.emittedLength + 1 : acc, 0);
285
+ meteredL2Gas += numPrivatelogs * L2_GAS_PER_PRIVATE_LOG;
286
+ const numContractClassLogs = arrayNonEmptyLength(data.contractClassLogsHashes, (log)=>log.isEmpty());
287
+ // Every contract class log emits its length and contract address as additional fields
288
+ meteredDAFields += data.contractClassLogsHashes.reduce((acc, log)=>!log.isEmpty() ? acc + log.logHash.length + 2 : acc, 0);
289
+ meteredL2Gas += numContractClassLogs * L2_GAS_PER_CONTRACT_CLASS_LOG;
290
+ const meteredDAGas = meteredDAFields * DA_BYTES_PER_FIELD * DA_GAS_PER_BYTE;
291
+ if (data.publicCallRequests) {
292
+ const dataForPublic = data;
293
+ const numPublicCallRequests = arrayNonEmptyLength(dataForPublic.publicCallRequests, (req)=>req.isEmpty());
294
+ meteredL2Gas += numPublicCallRequests * FIXED_AVM_STARTUP_L2_GAS;
295
+ }
296
+ return Gas.from({
297
+ l2Gas: meteredL2Gas,
298
+ daGas: meteredDAGas
299
+ });
300
+ }