@aztec/simulator 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 (342) hide show
  1. package/dest/client.d.ts +1 -1
  2. package/dest/common/errors.d.ts +2 -8
  3. package/dest/common/errors.d.ts.map +1 -1
  4. package/dest/common/index.d.ts +1 -1
  5. package/dest/common/stats/index.d.ts +1 -1
  6. package/dest/common/stats/stats.d.ts +1 -1
  7. package/dest/private/acvm/acvm.d.ts +1 -1
  8. package/dest/private/acvm/acvm_types.d.ts +1 -1
  9. package/dest/private/acvm/deserialize.d.ts +2 -2
  10. package/dest/private/acvm/deserialize.d.ts.map +1 -1
  11. package/dest/private/acvm/deserialize.js +1 -1
  12. package/dest/private/acvm/index.d.ts +1 -1
  13. package/dest/private/acvm/serialize.d.ts +2 -2
  14. package/dest/private/acvm/serialize.d.ts.map +1 -1
  15. package/dest/private/acvm/serialize.js +1 -1
  16. package/dest/private/acvm_native.d.ts +2 -3
  17. package/dest/private/acvm_native.d.ts.map +1 -1
  18. package/dest/private/acvm_native.js +15 -13
  19. package/dest/private/acvm_wasm.d.ts +1 -1
  20. package/dest/private/acvm_wasm.d.ts.map +1 -1
  21. package/dest/private/acvm_wasm_with_blobs.d.ts +1 -1
  22. package/dest/private/acvm_wasm_with_blobs.d.ts.map +1 -1
  23. package/dest/private/circuit_recording/circuit_recorder.d.ts +1 -1
  24. package/dest/private/circuit_recording/circuit_recorder.d.ts.map +1 -1
  25. package/dest/private/circuit_recording/circuit_recorder.js +1 -1
  26. package/dest/private/circuit_recording/file_circuit_recorder.d.ts +1 -1
  27. package/dest/private/circuit_recording/file_circuit_recorder.d.ts.map +1 -1
  28. package/dest/private/circuit_recording/memory_circuit_recorder.d.ts +1 -1
  29. package/dest/private/circuit_recording/memory_circuit_recorder.d.ts.map +1 -1
  30. package/dest/private/circuit_recording/simulator_recorder_wrapper.d.ts +2 -2
  31. package/dest/private/circuit_recording/simulator_recorder_wrapper.d.ts.map +1 -1
  32. package/dest/private/circuit_simulator.d.ts +1 -1
  33. package/dest/private/factory.d.ts +1 -1
  34. package/dest/public/avm/avm_context.d.ts +2 -2
  35. package/dest/public/avm/avm_context.d.ts.map +1 -1
  36. package/dest/public/avm/avm_contract_call_result.d.ts +2 -2
  37. package/dest/public/avm/avm_contract_call_result.d.ts.map +1 -1
  38. package/dest/public/avm/avm_execution_environment.d.ts +5 -4
  39. package/dest/public/avm/avm_execution_environment.d.ts.map +1 -1
  40. package/dest/public/avm/avm_execution_environment.js +5 -5
  41. package/dest/public/avm/avm_gas.d.ts +2 -2
  42. package/dest/public/avm/avm_gas.d.ts.map +1 -1
  43. package/dest/public/avm/avm_gas.js +2 -2
  44. package/dest/public/avm/avm_machine_state.d.ts +2 -2
  45. package/dest/public/avm/avm_machine_state.d.ts.map +1 -1
  46. package/dest/public/avm/avm_memory_types.d.ts +20 -14
  47. package/dest/public/avm/avm_memory_types.d.ts.map +1 -1
  48. package/dest/public/avm/avm_memory_types.js +10 -3
  49. package/dest/public/avm/avm_simulator.d.ts +4 -3
  50. package/dest/public/avm/avm_simulator.d.ts.map +1 -1
  51. package/dest/public/avm/avm_simulator.js +19 -25
  52. package/dest/public/avm/avm_simulator_interface.d.ts +1 -1
  53. package/dest/public/avm/errors.d.ts +13 -16
  54. package/dest/public/avm/errors.d.ts.map +1 -1
  55. package/dest/public/avm/errors.js +21 -22
  56. package/dest/public/avm/fixtures/avm_simulation_tester.d.ts +3 -2
  57. package/dest/public/avm/fixtures/avm_simulation_tester.d.ts.map +1 -1
  58. package/dest/public/avm/fixtures/avm_simulation_tester.js +14 -6
  59. package/dest/public/avm/fixtures/base_avm_simulation_tester.d.ts +4 -2
  60. package/dest/public/avm/fixtures/base_avm_simulation_tester.d.ts.map +1 -1
  61. package/dest/public/avm/fixtures/base_avm_simulation_tester.js +23 -1
  62. package/dest/public/avm/fixtures/initializers.d.ts +2 -3
  63. package/dest/public/avm/fixtures/initializers.d.ts.map +1 -1
  64. package/dest/public/avm/fixtures/initializers.js +6 -4
  65. package/dest/public/avm/fixtures/utils.d.ts +4 -3
  66. package/dest/public/avm/fixtures/utils.d.ts.map +1 -1
  67. package/dest/public/avm/fixtures/utils.js +3 -2
  68. package/dest/public/avm/index.d.ts +1 -1
  69. package/dest/public/avm/opcodes/accrued_substate.d.ts +3 -3
  70. package/dest/public/avm/opcodes/accrued_substate.d.ts.map +1 -1
  71. package/dest/public/avm/opcodes/accrued_substate.js +7 -7
  72. package/dest/public/avm/opcodes/addressing_mode.d.ts +1 -1
  73. package/dest/public/avm/opcodes/addressing_mode.d.ts.map +1 -1
  74. package/dest/public/avm/opcodes/addressing_mode.js +4 -5
  75. package/dest/public/avm/opcodes/arithmetic.d.ts +10 -8
  76. package/dest/public/avm/opcodes/arithmetic.d.ts.map +1 -1
  77. package/dest/public/avm/opcodes/arithmetic.js +11 -1
  78. package/dest/public/avm/opcodes/bitwise.d.ts +5 -5
  79. package/dest/public/avm/opcodes/bitwise.d.ts.map +1 -1
  80. package/dest/public/avm/opcodes/comparators.d.ts +4 -4
  81. package/dest/public/avm/opcodes/comparators.d.ts.map +1 -1
  82. package/dest/public/avm/opcodes/contract.d.ts +1 -1
  83. package/dest/public/avm/opcodes/contract.d.ts.map +1 -1
  84. package/dest/public/avm/opcodes/control_flow.d.ts +1 -1
  85. package/dest/public/avm/opcodes/control_flow.d.ts.map +1 -1
  86. package/dest/public/avm/opcodes/conversion.d.ts +1 -1
  87. package/dest/public/avm/opcodes/conversion.d.ts.map +1 -1
  88. package/dest/public/avm/opcodes/conversion.js +3 -0
  89. package/dest/public/avm/opcodes/ec_add.d.ts +2 -2
  90. package/dest/public/avm/opcodes/ec_add.d.ts.map +1 -1
  91. package/dest/public/avm/opcodes/ec_add.js +6 -6
  92. package/dest/public/avm/opcodes/environment_getters.d.ts +1 -1
  93. package/dest/public/avm/opcodes/environment_getters.d.ts.map +1 -1
  94. package/dest/public/avm/opcodes/environment_getters.js +5 -7
  95. package/dest/public/avm/opcodes/external_calls.d.ts +1 -1
  96. package/dest/public/avm/opcodes/external_calls.d.ts.map +1 -1
  97. package/dest/public/avm/opcodes/external_calls.js +0 -1
  98. package/dest/public/avm/opcodes/hashing.d.ts +2 -2
  99. package/dest/public/avm/opcodes/hashing.d.ts.map +1 -1
  100. package/dest/public/avm/opcodes/hashing.js +3 -1
  101. package/dest/public/avm/opcodes/index.d.ts +1 -1
  102. package/dest/public/avm/opcodes/instruction.d.ts +2 -2
  103. package/dest/public/avm/opcodes/instruction.d.ts.map +1 -1
  104. package/dest/public/avm/opcodes/instruction.js +5 -6
  105. package/dest/public/avm/opcodes/instruction_impl.d.ts +1 -1
  106. package/dest/public/avm/opcodes/instruction_impl.d.ts.map +1 -1
  107. package/dest/public/avm/opcodes/memory.d.ts +2 -2
  108. package/dest/public/avm/opcodes/memory.d.ts.map +1 -1
  109. package/dest/public/avm/opcodes/memory.js +1 -1
  110. package/dest/public/avm/opcodes/misc.d.ts +3 -2
  111. package/dest/public/avm/opcodes/misc.d.ts.map +1 -1
  112. package/dest/public/avm/opcodes/misc.js +28 -8
  113. package/dest/public/avm/opcodes/storage.d.ts +3 -3
  114. package/dest/public/avm/opcodes/storage.d.ts.map +1 -1
  115. package/dest/public/avm/revert_reason.d.ts +2 -2
  116. package/dest/public/avm/revert_reason.d.ts.map +1 -1
  117. package/dest/public/avm/revert_reason.js +3 -2
  118. package/dest/public/avm/serialization/buffer_cursor.d.ts +1 -1
  119. package/dest/public/avm/serialization/buffer_cursor.d.ts.map +1 -1
  120. package/dest/public/avm/serialization/bytecode_serialization.d.ts +1 -1
  121. package/dest/public/avm/serialization/bytecode_serialization.d.ts.map +1 -1
  122. package/dest/public/avm/serialization/bytecode_serialization.js +9 -6
  123. package/dest/public/avm/serialization/instruction_serialization.d.ts +9 -1
  124. package/dest/public/avm/serialization/instruction_serialization.d.ts.map +1 -1
  125. package/dest/public/avm/serialization/instruction_serialization.js +11 -1
  126. package/dest/public/avm/test_utils.d.ts +4 -4
  127. package/dest/public/avm/test_utils.d.ts.map +1 -1
  128. package/dest/public/avm/test_utils.js +7 -10
  129. package/dest/public/contracts_db_checkpoint.d.ts +16 -0
  130. package/dest/public/contracts_db_checkpoint.d.ts.map +1 -0
  131. package/dest/public/contracts_db_checkpoint.js +30 -0
  132. package/dest/public/db_interfaces.d.ts +14 -2
  133. package/dest/public/db_interfaces.d.ts.map +1 -1
  134. package/dest/public/debug_fn_name.d.ts +15 -2
  135. package/dest/public/debug_fn_name.d.ts.map +1 -1
  136. package/dest/public/debug_fn_name.js +19 -0
  137. package/dest/public/executor_metrics.d.ts +3 -2
  138. package/dest/public/executor_metrics.d.ts.map +1 -1
  139. package/dest/public/executor_metrics.js +1 -1
  140. package/dest/public/executor_metrics_interface.d.ts +3 -2
  141. package/dest/public/executor_metrics_interface.d.ts.map +1 -1
  142. package/dest/public/fixtures/amm_test.d.ts +1 -1
  143. package/dest/public/fixtures/amm_test.js +2 -2
  144. package/dest/public/fixtures/bulk_test.d.ts +1 -1
  145. package/dest/public/fixtures/bulk_test.d.ts.map +1 -1
  146. package/dest/public/fixtures/bulk_test.js +64 -131
  147. package/dest/public/fixtures/custom_bytecode_tester.d.ts +12 -0
  148. package/dest/public/fixtures/custom_bytecode_tester.d.ts.map +1 -0
  149. package/dest/public/fixtures/custom_bytecode_tester.js +29 -0
  150. package/dest/public/fixtures/custom_bytecode_tests.d.ts +10 -0
  151. package/dest/public/fixtures/custom_bytecode_tests.d.ts.map +1 -0
  152. package/dest/public/fixtures/custom_bytecode_tests.js +130 -0
  153. package/dest/public/fixtures/index.d.ts +3 -2
  154. package/dest/public/fixtures/index.d.ts.map +1 -1
  155. package/dest/public/fixtures/index.js +2 -1
  156. package/dest/public/fixtures/minimal_public_tx.d.ts +4 -4
  157. package/dest/public/fixtures/minimal_public_tx.d.ts.map +1 -1
  158. package/dest/public/fixtures/minimal_public_tx.js +8 -22
  159. package/dest/public/fixtures/public_tx_simulation_tester.d.ts +11 -4
  160. package/dest/public/fixtures/public_tx_simulation_tester.d.ts.map +1 -1
  161. package/dest/public/fixtures/public_tx_simulation_tester.js +29 -10
  162. package/dest/public/fixtures/simple_contract_data_source.d.ts +5 -4
  163. package/dest/public/fixtures/simple_contract_data_source.d.ts.map +1 -1
  164. package/dest/public/fixtures/simple_contract_data_source.js +4 -4
  165. package/dest/public/fixtures/token_test.d.ts +6 -2
  166. package/dest/public/fixtures/token_test.d.ts.map +1 -1
  167. package/dest/public/fixtures/token_test.js +13 -12
  168. package/dest/public/fixtures/utils.d.ts +2 -2
  169. package/dest/public/fixtures/utils.d.ts.map +1 -1
  170. package/dest/public/fixtures/utils.js +4 -4
  171. package/dest/public/fuzzing/avm_fuzzer_simulator.d.ts +46 -0
  172. package/dest/public/fuzzing/avm_fuzzer_simulator.d.ts.map +1 -0
  173. package/dest/public/fuzzing/avm_fuzzer_simulator.js +136 -0
  174. package/dest/public/fuzzing/avm_simulator_bin.d.ts +2 -0
  175. package/dest/public/fuzzing/avm_simulator_bin.d.ts.map +1 -0
  176. package/dest/public/fuzzing/avm_simulator_bin.js +84 -0
  177. package/dest/public/hinting_db_sources.d.ts +15 -4
  178. package/dest/public/hinting_db_sources.d.ts.map +1 -1
  179. package/dest/public/hinting_db_sources.js +69 -13
  180. package/dest/public/index.d.ts +3 -2
  181. package/dest/public/index.d.ts.map +1 -1
  182. package/dest/public/index.js +1 -1
  183. package/dest/public/public_db_sources.d.ts +24 -65
  184. package/dest/public/public_db_sources.d.ts.map +1 -1
  185. package/dest/public/public_db_sources.js +85 -132
  186. package/dest/public/public_errors.d.ts +12 -0
  187. package/dest/public/public_errors.d.ts.map +1 -0
  188. package/dest/public/public_errors.js +13 -0
  189. package/dest/public/public_processor/guarded_merkle_tree.d.ts +5 -2
  190. package/dest/public/public_processor/guarded_merkle_tree.d.ts.map +1 -1
  191. package/dest/public/public_processor/guarded_merkle_tree.js +3 -0
  192. package/dest/public/public_processor/public_processor.d.ts +11 -13
  193. package/dest/public/public_processor/public_processor.d.ts.map +1 -1
  194. package/dest/public/public_processor/public_processor.js +61 -43
  195. package/dest/public/public_processor/public_processor_metrics.d.ts +1 -1
  196. package/dest/public/public_processor/public_processor_metrics.d.ts.map +1 -1
  197. package/dest/public/public_tx_simulator/contract_provider_for_cpp.d.ts +18 -0
  198. package/dest/public/public_tx_simulator/contract_provider_for_cpp.d.ts.map +1 -0
  199. package/dest/public/public_tx_simulator/contract_provider_for_cpp.js +94 -0
  200. package/dest/public/public_tx_simulator/cpp_public_tx_simulator.d.ts +38 -0
  201. package/dest/public/public_tx_simulator/cpp_public_tx_simulator.d.ts.map +1 -0
  202. package/dest/public/public_tx_simulator/cpp_public_tx_simulator.js +93 -0
  203. package/dest/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.d.ts +42 -0
  204. package/dest/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.d.ts.map +1 -0
  205. package/dest/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.js +86 -0
  206. package/dest/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.d.ts +30 -0
  207. package/dest/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.d.ts.map +1 -0
  208. package/dest/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.js +170 -0
  209. package/dest/public/public_tx_simulator/dumping_cpp_public_tx_simulator.d.ts +22 -0
  210. package/dest/public/public_tx_simulator/dumping_cpp_public_tx_simulator.d.ts.map +1 -0
  211. package/dest/public/public_tx_simulator/dumping_cpp_public_tx_simulator.js +52 -0
  212. package/dest/public/public_tx_simulator/factories.d.ts +13 -0
  213. package/dest/public/public_tx_simulator/factories.d.ts.map +1 -0
  214. package/dest/public/public_tx_simulator/factories.js +28 -0
  215. package/dest/public/public_tx_simulator/index.d.ts +6 -1
  216. package/dest/public/public_tx_simulator/index.d.ts.map +1 -1
  217. package/dest/public/public_tx_simulator/index.js +3 -0
  218. package/dest/public/public_tx_simulator/measured_public_tx_simulator.d.ts +16 -8
  219. package/dest/public/public_tx_simulator/measured_public_tx_simulator.d.ts.map +1 -1
  220. package/dest/public/public_tx_simulator/measured_public_tx_simulator.js +7 -8
  221. package/dest/public/public_tx_simulator/public_tx_context.d.ts +9 -4
  222. package/dest/public/public_tx_simulator/public_tx_context.d.ts.map +1 -1
  223. package/dest/public/public_tx_simulator/public_tx_context.js +22 -10
  224. package/dest/public/public_tx_simulator/public_tx_simulator.d.ts +22 -29
  225. package/dest/public/public_tx_simulator/public_tx_simulator.d.ts.map +1 -1
  226. package/dest/public/public_tx_simulator/public_tx_simulator.js +178 -127
  227. package/dest/public/public_tx_simulator/public_tx_simulator_interface.d.ts +9 -0
  228. package/dest/public/public_tx_simulator/public_tx_simulator_interface.d.ts.map +1 -0
  229. package/dest/public/public_tx_simulator/public_tx_simulator_interface.js +1 -0
  230. package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.d.ts +4 -3
  231. package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.d.ts.map +1 -1
  232. package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.js +2 -2
  233. package/dest/public/side_effect_errors.d.ts +42 -2
  234. package/dest/public/side_effect_errors.d.ts.map +1 -1
  235. package/dest/public/side_effect_errors.js +70 -1
  236. package/dest/public/side_effect_trace.d.ts +13 -7
  237. package/dest/public/side_effect_trace.d.ts.map +1 -1
  238. package/dest/public/side_effect_trace.js +36 -21
  239. package/dest/public/side_effect_trace_interface.d.ts +9 -4
  240. package/dest/public/side_effect_trace_interface.d.ts.map +1 -1
  241. package/dest/public/state_manager/index.d.ts +1 -1
  242. package/dest/public/state_manager/nullifiers.d.ts +2 -5
  243. package/dest/public/state_manager/nullifiers.d.ts.map +1 -1
  244. package/dest/public/state_manager/nullifiers.js +1 -6
  245. package/dest/public/state_manager/public_storage.d.ts +2 -2
  246. package/dest/public/state_manager/public_storage.d.ts.map +1 -1
  247. package/dest/public/state_manager/public_storage.js +1 -1
  248. package/dest/public/state_manager/state_manager.d.ts +16 -13
  249. package/dest/public/state_manager/state_manager.d.ts.map +1 -1
  250. package/dest/public/state_manager/state_manager.js +64 -21
  251. package/dest/public/test_executor_metrics.d.ts +4 -3
  252. package/dest/public/test_executor_metrics.d.ts.map +1 -1
  253. package/dest/public/test_executor_metrics.js +5 -4
  254. package/dest/public/unique_class_ids.d.ts +1 -1
  255. package/dest/public/unique_class_ids.d.ts.map +1 -1
  256. package/dest/public/utils.d.ts +1 -1
  257. package/dest/server.d.ts +1 -1
  258. package/dest/testing.d.ts +1 -1
  259. package/package.json +24 -19
  260. package/src/common/errors.ts +1 -1
  261. package/src/private/acvm/deserialize.ts +1 -1
  262. package/src/private/acvm/serialize.ts +1 -1
  263. package/src/private/acvm_native.ts +18 -11
  264. package/src/private/circuit_recording/circuit_recorder.ts +1 -1
  265. package/src/private/circuit_recording/simulator_recorder_wrapper.ts +1 -1
  266. package/src/public/avm/avm_context.ts +1 -1
  267. package/src/public/avm/avm_contract_call_result.ts +1 -1
  268. package/src/public/avm/avm_execution_environment.ts +4 -3
  269. package/src/public/avm/avm_gas.ts +5 -5
  270. package/src/public/avm/avm_machine_state.ts +1 -1
  271. package/src/public/avm/avm_memory_types.ts +12 -3
  272. package/src/public/avm/avm_simulator.ts +24 -33
  273. package/src/public/avm/errors.ts +24 -27
  274. package/src/public/avm/fixtures/avm_simulation_tester.ts +14 -4
  275. package/src/public/avm/fixtures/base_avm_simulation_tester.ts +33 -1
  276. package/src/public/avm/fixtures/initializers.ts +7 -8
  277. package/src/public/avm/fixtures/utils.ts +3 -2
  278. package/src/public/avm/opcodes/accrued_substate.ts +4 -4
  279. package/src/public/avm/opcodes/addressing_mode.ts +5 -5
  280. package/src/public/avm/opcodes/arithmetic.ts +13 -1
  281. package/src/public/avm/opcodes/conversion.ts +4 -0
  282. package/src/public/avm/opcodes/ec_add.ts +6 -6
  283. package/src/public/avm/opcodes/environment_getters.ts +6 -8
  284. package/src/public/avm/opcodes/external_calls.ts +0 -1
  285. package/src/public/avm/opcodes/hashing.ts +3 -1
  286. package/src/public/avm/opcodes/instruction.ts +8 -6
  287. package/src/public/avm/opcodes/memory.ts +1 -1
  288. package/src/public/avm/opcodes/misc.ts +41 -7
  289. package/src/public/avm/revert_reason.ts +6 -3
  290. package/src/public/avm/serialization/bytecode_serialization.ts +17 -6
  291. package/src/public/avm/serialization/instruction_serialization.ts +13 -1
  292. package/src/public/avm/test_utils.ts +7 -15
  293. package/src/public/contracts_db_checkpoint.ts +41 -0
  294. package/src/public/db_interfaces.ts +16 -1
  295. package/src/public/debug_fn_name.ts +26 -1
  296. package/src/public/executor_metrics.ts +2 -1
  297. package/src/public/executor_metrics_interface.ts +2 -1
  298. package/src/public/fixtures/amm_test.ts +2 -2
  299. package/src/public/fixtures/bulk_test.ts +42 -24
  300. package/src/public/fixtures/custom_bytecode_tester.ts +49 -0
  301. package/src/public/fixtures/custom_bytecode_tests.ts +159 -0
  302. package/src/public/fixtures/index.ts +2 -1
  303. package/src/public/fixtures/minimal_public_tx.ts +9 -33
  304. package/src/public/fixtures/public_tx_simulation_tester.ts +52 -17
  305. package/src/public/fixtures/simple_contract_data_source.ts +8 -9
  306. package/src/public/fixtures/token_test.ts +18 -10
  307. package/src/public/fixtures/utils.ts +4 -4
  308. package/src/public/fuzzing/avm_fuzzer_simulator.ts +233 -0
  309. package/src/public/fuzzing/avm_simulator_bin.ts +121 -0
  310. package/src/public/hinting_db_sources.ts +113 -10
  311. package/src/public/index.ts +8 -1
  312. package/src/public/public_db_sources.ts +112 -175
  313. package/src/public/public_errors.ts +14 -0
  314. package/src/public/public_processor/guarded_merkle_tree.ts +6 -1
  315. package/src/public/public_processor/public_processor.ts +92 -70
  316. package/src/public/public_tx_simulator/contract_provider_for_cpp.ts +116 -0
  317. package/src/public/public_tx_simulator/cpp_public_tx_simulator.ts +155 -0
  318. package/src/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.ts +132 -0
  319. package/src/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.ts +236 -0
  320. package/src/public/public_tx_simulator/dumping_cpp_public_tx_simulator.ts +81 -0
  321. package/src/public/public_tx_simulator/factories.ts +41 -0
  322. package/src/public/public_tx_simulator/index.ts +5 -0
  323. package/src/public/public_tx_simulator/measured_public_tx_simulator.ts +13 -14
  324. package/src/public/public_tx_simulator/public_tx_context.ts +20 -7
  325. package/src/public/public_tx_simulator/public_tx_simulator.ts +265 -179
  326. package/src/public/public_tx_simulator/public_tx_simulator_interface.ts +10 -0
  327. package/src/public/public_tx_simulator/telemetry_public_tx_simulator.ts +4 -13
  328. package/src/public/side_effect_errors.ts +91 -1
  329. package/src/public/side_effect_trace.ts +49 -24
  330. package/src/public/side_effect_trace_interface.ts +7 -1
  331. package/src/public/state_manager/nullifiers.ts +2 -8
  332. package/src/public/state_manager/public_storage.ts +1 -1
  333. package/src/public/state_manager/state_manager.ts +87 -39
  334. package/src/public/test_executor_metrics.ts +7 -5
  335. package/dest/public/bytecode_errors.d.ts +0 -4
  336. package/dest/public/bytecode_errors.d.ts.map +0 -1
  337. package/dest/public/bytecode_errors.js +0 -6
  338. package/dest/public/tx_contract_cache.d.ts +0 -41
  339. package/dest/public/tx_contract_cache.d.ts.map +0 -1
  340. package/dest/public/tx_contract_cache.js +0 -49
  341. package/src/public/bytecode_errors.ts +0 -6
  342. package/src/public/tx_contract_cache.ts +0 -69
@@ -1 +1 @@
1
- {"version":3,"file":"state_manager.d.ts","sourceRoot":"","sources":["../../../src/public/state_manager/state_manager.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAI9C,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAE,iCAAiC,EAA+B,MAAM,wBAAwB,CAAC;AAC7G,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAGtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,YAA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C,EAAE,MAAM,CAAA;KAAE,CAAC,CAEzE;IAEY,OAAO,CAAC,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEhF;IAEY,gBAAgB,IAAI,OAAO,CAAC,aAAa,CAAC,CAEtD;CACF"}
@@ -1,5 +1,5 @@
1
1
  import { CANONICAL_AUTH_REGISTRY_ADDRESS, CONTRACT_CLASS_REGISTRY_CONTRACT_ADDRESS, CONTRACT_INSTANCE_REGISTRY_CONTRACT_ADDRESS, FEE_JUICE_ADDRESS, MULTI_CALL_ENTRYPOINT_ADDRESS, ROUTER_ADDRESS } from '@aztec/constants';
2
- import { poseidon2Hash } from '@aztec/foundation/crypto';
2
+ import { poseidon2Hash } from '@aztec/foundation/crypto/poseidon';
3
3
  import { jsonStringify } from '@aztec/foundation/json-rpc';
4
4
  import { createLogger } from '@aztec/foundation/log';
5
5
  import { ProtocolContractAddress } from '@aztec/protocol-contracts';
@@ -8,8 +8,9 @@ import { SerializableContractInstance } from '@aztec/stdlib/contract';
8
8
  import { DelayedPublicMutableValues, DelayedPublicMutableValuesWithHash } from '@aztec/stdlib/delayed-public-mutable';
9
9
  import { computeNoteHashNonce, computeUniqueNoteHash, siloNoteHash, siloNullifier } from '@aztec/stdlib/hash';
10
10
  import { strict as assert } from 'assert';
11
- import { getPublicFunctionDebugName } from '../debug_fn_name.js';
12
- import { NullifierCollisionError, NullifierManager } from './nullifiers.js';
11
+ import { getPublicFunctionDebugName, getPublicFunctionSelectorAndName } from '../debug_fn_name.js';
12
+ import { L1ToL2MessageIndexOutOfRangeError, MaxCallsToUniqueContractClassIdsError, NoteHashIndexOutOfRangeError, NullifierCollisionError } from '../side_effect_errors.js';
13
+ import { NullifierManager } from './nullifiers.js';
13
14
  import { PublicStorage } from './public_storage.js';
14
15
  /**
15
16
  * A class to manage persistable AVM state for contract calls.
@@ -30,7 +31,7 @@ import { PublicStorage } from './public_storage.js';
30
31
  nullifiers;
31
32
  log;
32
33
  /** Make sure a forked state is never merged twice. */ alreadyMergedIntoParent;
33
- constructor(treesDB, contractsDB, trace, firstNullifier, timestamp, doMerkleOperations = false, publicStorage = new PublicStorage(treesDB), nullifiers = new NullifierManager(treesDB)){
34
+ constructor(treesDB, contractsDB, trace, firstNullifier, timestamp, doMerkleOperations = true, publicStorage = new PublicStorage(treesDB), nullifiers = new NullifierManager(treesDB)){
34
35
  this.treesDB = treesDB;
35
36
  this.contractsDB = contractsDB;
36
37
  this.trace = trace;
@@ -44,8 +45,8 @@ import { PublicStorage } from './public_storage.js';
44
45
  }
45
46
  /**
46
47
  * Create a new state manager
47
- */ static create(treesDB, contractsDB, trace, doMerkleOperations = false, firstNullifier, timestamp) {
48
- return new PublicPersistableStateManager(treesDB, contractsDB, trace, firstNullifier, timestamp, doMerkleOperations);
48
+ */ static create(treesDB, contractsDB, trace, firstNullifier, timestamp) {
49
+ return new PublicPersistableStateManager(treesDB, contractsDB, trace, firstNullifier, timestamp);
49
50
  }
50
51
  /**
51
52
  * Create a new state manager forked from this one
@@ -108,7 +109,6 @@ import { PublicStorage } from './public_storage.js';
108
109
  if (this.doMerkleOperations) {
109
110
  return await this.treesDB.storageRead(contractAddress, slot);
110
111
  } else {
111
- // TODO(fcarreiro): I don't get this. PublicStorage CAN end up reading the tree. Why is it in the "dont do merkle operations" branch?
112
112
  const read = await this.publicStorage.read(contractAddress, slot);
113
113
  this.log.trace(`Storage read results (address=${contractAddress}, slot=${slot}): value=${read.value}, cached=${read.cached}`);
114
114
  return read.value;
@@ -123,10 +123,19 @@ import { PublicStorage } from './public_storage.js';
123
123
  * @param leafIndex - the leaf index being checked
124
124
  * @returns true if the note hash exists at the given leaf index, false otherwise
125
125
  */ async checkNoteHashExists(contractAddress, noteHash, leafIndex) {
126
- const gotLeafValue = await this.treesDB.getNoteHash(leafIndex);
127
- const exists = gotLeafValue !== undefined && gotLeafValue.equals(noteHash);
128
- this.log.trace(`noteHashes(${contractAddress})@${noteHash} ?? leafIndex: ${leafIndex} | gotLeafValue: ${gotLeafValue}, exists: ${exists}.`);
129
- return Promise.resolve(exists);
126
+ try {
127
+ const gotLeafValue = await this.treesDB.getNoteHash(leafIndex);
128
+ const exists = gotLeafValue.equals(noteHash);
129
+ this.log.trace(`noteHashes(${contractAddress})@${noteHash} ?? leafIndex: ${leafIndex} | gotLeafValue: ${gotLeafValue}, exists: ${exists}.`);
130
+ return Promise.resolve(exists);
131
+ } catch (error) {
132
+ // If the index is out of range, note_hash_leaf_in_range = 0 and the circuit returns false:
133
+ if (error instanceof NoteHashIndexOutOfRangeError) {
134
+ return Promise.resolve(false);
135
+ }
136
+ // Otherwise, unknown error. This is a bug.
137
+ throw error;
138
+ }
130
139
  }
131
140
  /**
132
141
  * Write a raw note hash, silo it and make it unique, then trace the write.
@@ -206,10 +215,19 @@ import { PublicStorage } from './public_storage.js';
206
215
  * @param msgLeafIndex - the message leaf index to use in the check
207
216
  * @returns exists - whether the message exists in the L1 to L2 Messages tree
208
217
  */ async checkL1ToL2MessageExists(msgHash, msgLeafIndex) {
209
- const valueAtIndex = await this.treesDB.getL1ToL2LeafValue(msgLeafIndex.toBigInt());
210
- const exists = valueAtIndex !== undefined && valueAtIndex.equals(msgHash);
211
- this.log.trace(`l1ToL2Messages(@${msgLeafIndex}) ?? exists: ${exists}, expected: ${msgHash}, found: ${valueAtIndex}.`);
212
- return Promise.resolve(exists);
218
+ try {
219
+ const valueAtIndex = await this.treesDB.getL1ToL2LeafValue(msgLeafIndex.toBigInt());
220
+ const exists = valueAtIndex.equals(msgHash);
221
+ this.log.trace(`l1ToL2Messages(@${msgLeafIndex}) ?? exists: ${exists}, expected: ${msgHash}, found: ${valueAtIndex}.`);
222
+ return Promise.resolve(exists);
223
+ } catch (error) {
224
+ // If the index is out of range, l1_to_l2_msg_leaf_in_range = 0 and the circuit returns false:
225
+ if (error instanceof L1ToL2MessageIndexOutOfRangeError) {
226
+ return Promise.resolve(false);
227
+ }
228
+ // Otherwise, unknown error. This is a bug.
229
+ throw error;
230
+ }
213
231
  }
214
232
  /**
215
233
  * Write an L2 to L1 message.
@@ -226,6 +244,18 @@ import { PublicStorage } from './public_storage.js';
226
244
  */ writeScopedL2ToL1Message(l2ToL1Message) {
227
245
  this.writeL2ToL1Message(l2ToL1Message.contractAddress, l2ToL1Message.message.recipient.toField(), l2ToL1Message.message.content);
228
246
  }
247
+ writeDebugLog(contractAddress, level, message, fields) {
248
+ this.trace.traceDebugLog(contractAddress, level, message, fields);
249
+ }
250
+ writeDebugLogMemoryReads(memoryReads) {
251
+ this.trace.traceDebugLogMemoryReads(memoryReads);
252
+ }
253
+ getDebugLogMemoryReads() {
254
+ return this.trace.getDebugLogMemoryReads();
255
+ }
256
+ getLogs() {
257
+ return this.trace.getDebugLogs();
258
+ }
229
259
  /**
230
260
  * Write a public log
231
261
  * @param contractAddress - address of the contract that emitted the log
@@ -257,7 +287,7 @@ import { PublicStorage } from './public_storage.js';
257
287
  return undefined;
258
288
  }
259
289
  this.log.trace(`Got contract instance (address=${contractAddress}): instance=${jsonStringify(instance)}`);
260
- // All that is left is tocheck that the contract updatability information is correct.
290
+ // All that is left is to check that the contract updatability information is correct.
261
291
  // That is, that the current and original contract class ids are correct.
262
292
  await this.checkContractUpdateInformation(instanceWithAddress);
263
293
  return instance;
@@ -276,10 +306,12 @@ import { PublicStorage } from './public_storage.js';
276
306
  //
277
307
  // However, we will also be checking the hash of the delayed public mutable values.
278
308
  // This is a bit of a leak of information, since the circuit will use it to prove
279
- // one public read insted of N of the delayed public mutable values.
309
+ // one public read instead of N of the delayed public mutable values.
280
310
  const { delayedPublicMutableSlot, delayedPublicMutableHashSlot } = await DelayedPublicMutableValuesWithHash.getContractUpdateSlots(instance.address);
281
311
  const readDeployerStorage = async (storageSlot)=>await this.readStorage(ProtocolContractAddress.ContractInstanceRegistry, storageSlot);
282
312
  const hash = await readDeployerStorage(delayedPublicMutableHashSlot);
313
+ // NOTE: The below reads are either not performed (if hash.isZero()) or only performed in unconstrained in c++ simulation.
314
+ // See UpdateCheck::check_current_class_id documentation - this means if we generate hints from the merkle db, they are unused:
283
315
  const delayedPublicMutableValues = await DelayedPublicMutableValues.readFromTree(delayedPublicMutableSlot, readDeployerStorage);
284
316
  const preImage = delayedPublicMutableValues.toFields();
285
317
  // 1) update never scheduled: hash == 0 and preimage should be empty (but poseidon2hash(preimage) will not be 0s)
@@ -319,7 +351,7 @@ import { PublicStorage } from './public_storage.js';
319
351
  publicBytecodeCommitment: bytecodeCommitment
320
352
  };
321
353
  } else {
322
- this.log.debug(`Contract instance NOT FOUND (id=${classId})`);
354
+ this.log.debug(`Contract class NOT FOUND (id=${classId})`);
323
355
  }
324
356
  // TODO(dbanks12): does this need to be moved to before the DB accesses as was done with writeNullifier?
325
357
  this.trace.traceGetContractClass(classId, exists);
@@ -333,13 +365,24 @@ import { PublicStorage } from './public_storage.js';
333
365
  if (!contractInstance) {
334
366
  return undefined;
335
367
  }
336
- const contractClass = await this.getContractClass(contractInstance.currentContractClassId);
337
- assert(contractClass, `Contract class not found in DB, but a contract instance was found with this class ID (${contractInstance.currentContractClassId}). This should not happen!`);
338
- return contractClass.packedBytecode;
368
+ try {
369
+ const contractClass = await this.getContractClass(contractInstance.currentContractClassId);
370
+ assert(contractClass, `Contract class not found in DB, but a contract instance was found with this class ID (${contractInstance.currentContractClassId}). This should not happen!`);
371
+ return contractClass.packedBytecode;
372
+ } catch (error) {
373
+ if (error instanceof MaxCallsToUniqueContractClassIdsError) {
374
+ return undefined;
375
+ }
376
+ // Otherwise, unknown error. This is a bug.
377
+ throw error;
378
+ }
339
379
  }
340
380
  async getPublicFunctionDebugName(avmEnvironment) {
341
381
  return await getPublicFunctionDebugName(this.contractsDB, avmEnvironment.address, avmEnvironment.calldata);
342
382
  }
383
+ async getPublicFunctionSelectorAndName(avmEnvironment) {
384
+ return await getPublicFunctionSelectorAndName(this.contractsDB, avmEnvironment.address, avmEnvironment.calldata);
385
+ }
343
386
  async padTree(treeId, leavesToInsert) {
344
387
  await this.treesDB.padTree(treeId, leavesToInsert);
345
388
  }
@@ -1,4 +1,5 @@
1
1
  import type { RevertCode } from '@aztec/stdlib/avm';
2
+ import type { GasUsed } from '@aztec/stdlib/gas';
2
3
  import type { ExecutorMetricsInterface } from './executor_metrics_interface.js';
3
4
  export interface PublicEnqueuedCallMetrics {
4
5
  fnName: string;
@@ -9,7 +10,7 @@ export interface PublicEnqueuedCallMetrics {
9
10
  }
10
11
  export interface PublicTxMetrics {
11
12
  totalDurationMs: number;
12
- manaUsed: number;
13
+ manaUsed: number | undefined;
13
14
  totalInstructionsExecuted: number;
14
15
  nonRevertiblePrivateInsertionsUs: number | undefined;
15
16
  revertiblePrivateInsertionsUs: number | undefined;
@@ -41,7 +42,7 @@ export declare class TestExecutorMetrics implements ExecutorMetricsInterface {
41
42
  private txTimer;
42
43
  constructor();
43
44
  startRecordingTxSimulation(txLabel: string): void;
44
- stopRecordingTxSimulation(txLabel: string, revertedCode?: RevertCode): void;
45
+ stopRecordingTxSimulation(txLabel: string, gasUsed?: GasUsed, revertedCode?: RevertCode): void;
45
46
  recordEnqueuedCallSimulation(fnName: string, durationMs: number, manaUsed: number, totalInstructionsExecuted: number): void;
46
47
  recordEnqueuedCallSimulationFailure(fnName: string, durationMs: number, manaUsed: number, totalInstructionsExecuted: number): void;
47
48
  recordPrivateEffectsInsertion(durationUs: number, type: 'revertible' | 'non-revertible'): void;
@@ -51,4 +52,4 @@ export declare class TestExecutorMetrics implements ExecutorMetricsInterface {
51
52
  toJSON(indent?: number): string;
52
53
  toGithubActionBenchmarkJSON(indent?: number): string;
53
54
  }
54
- //# sourceMappingURL=test_executor_metrics.d.ts.map
55
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdF9leGVjdXRvcl9tZXRyaWNzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvcHVibGljL3Rlc3RfZXhlY3V0b3JfbWV0cmljc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;IAC7D,wBAAwB,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9C;AAWD,oBAAY,qBAAqB;IAC/B,GAAG,IAAA;IACH,MAAM,IAAA;IACN,SAAS,IAAA;IACT,YAAY,IAAA;IACZ,OAAO,IAAA;CACR;AA2BD,qBAAa,mBAAoB,YAAW,wBAAwB;;IAClE,OAAO,CAAC,MAAM,CAAS;IAEvB,OAAO,CAAC,SAAS,CAA2C;IAC5D,OAAO,CAAC,cAAc,CAAqB;IAC3C,OAAO,CAAC,OAAO,CAAoB;IAEnC,cAEC;IAED,0BAA0B,CAAC,OAAO,EAAE,MAAM,QAMzC;IAED,yBAAyB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,YAAY,CAAC,EAAE,UAAU,QAgBtF;IAED,4BAA4B,CAC1B,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,yBAAyB,EAAE,MAAM,QAGlC;IAED,mCAAmC,CACjC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,yBAAyB,EAAE,MAAM,QAGlC;IAoBD,6BAA6B,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,GAAG,gBAAgB,QAgBtF;IAED,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,eAAe,CAAC,QAUrE;IAED,WAAW,CAAC,MAAM,GAAE,qBAAiD,QAEpE;IAED,cAAc,CAAC,MAAM,GAAE,qBAAiD,UA+EvE;IA0BD,MAAM,CAAC,MAAM,SAAI,UAEhB;IAED,2BAA2B,CAAC,MAAM,SAAI,UA4FrC;CACF"}
@@ -58,14 +58,14 @@ export class TestExecutorMetrics {
58
58
  this.currentTxLabel = txLabel;
59
59
  this.txTimer = new Timer();
60
60
  }
61
- stopRecordingTxSimulation(txLabel, revertedCode) {
61
+ stopRecordingTxSimulation(txLabel, gasUsed, revertedCode) {
62
62
  assert(this.currentTxLabel === txLabel, 'Cannot stop recording metrics for tx when another is live');
63
63
  const txMetrics = this.txMetrics.get(txLabel);
64
64
  // total duration of tx
65
65
  txMetrics.totalDurationMs = this.txTimer.ms();
66
66
  this.logger.debug(`Public TX simulation of ${txLabel} took ${txMetrics.totalDurationMs}ms`);
67
67
  // add manaUsed across all enqueued calls
68
- txMetrics.manaUsed = sum(txMetrics.enqueuedCalls.map((call)=>call.manaUsed));
68
+ txMetrics.manaUsed = gasUsed?.publicGas.l2Gas;
69
69
  // add totalInstructionsExecuted across all enqueued calls
70
70
  txMetrics.totalInstructionsExecuted = sum(txMetrics.enqueuedCalls.map((call)=>call.totalInstructionsExecuted));
71
71
  txMetrics.revertedCode = revertedCode;
@@ -124,8 +124,9 @@ export class TestExecutorMetrics {
124
124
  pretty += `${INDENT0}Total duration: ${fmtNum(txMetrics.totalDurationMs, 'ms')}\n`;
125
125
  }
126
126
  if (filter === 1 || filter === 0) {
127
- pretty += `${INDENT0}Total mana used: ${fmtNum(txMetrics.manaUsed)}\n`;
128
- const manaPerSecond = Math.round(txMetrics.manaUsed * 1000 / txMetrics.totalDurationMs);
127
+ const manaUsed = txMetrics.manaUsed || 0;
128
+ pretty += `${INDENT0}Total mana used: ${fmtNum(manaUsed)}\n`;
129
+ const manaPerSecond = Math.round(manaUsed * 1000 / txMetrics.totalDurationMs);
129
130
  pretty += `${INDENT0}Mana per second: ${fmtNum(manaPerSecond)}\n`;
130
131
  }
131
132
  if (filter === 3 || filter === 1 || filter === 0) {
@@ -34,4 +34,4 @@ export declare class UniqueClassIds {
34
34
  */
35
35
  acceptAndMerge(incoming: UniqueClassIds): void;
36
36
  }
37
- //# sourceMappingURL=unique_class_ids.d.ts.map
37
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidW5pcXVlX2NsYXNzX2lkcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3B1YmxpYy91bmlxdWVfY2xhc3NfaWRzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUlBOzs7R0FHRztBQUNILHFCQUFhLGNBQWM7SUFHYixPQUFPLENBQUMsUUFBUSxDQUFDLE1BQU0sQ0FBQztJQUZwQyxPQUFPLENBQUMsUUFBUSxDQUFDLFFBQVEsQ0FBMEI7SUFFbkQsWUFBNkIsTUFBTSxDQUFDLDRCQUFnQixFQUFJO0lBRXhEOztPQUVHO0lBQ0ksSUFBSSxtQkFFVjtJQUVEOzs7OztPQUtHO0lBQ0ksR0FBRyxDQUFDLE9BQU8sRUFBRSxNQUFNLEdBQUcsT0FBTyxDQVNuQztJQUVEOztPQUVHO0lBQ0ksSUFBSSxJQUFJLE1BQU0sQ0FFcEI7SUFFRDs7OztPQUlHO0lBQ0ksR0FBRyxDQUFDLE9BQU8sRUFBRSxNQUFNLFFBU3pCO0lBRUQ7Ozs7T0FJRztJQUNJLGNBQWMsQ0FBQyxRQUFRLEVBQUUsY0FBYyxRQWE3QztDQUNGIn0=
@@ -1 +1 @@
1
- {"version":3,"file":"unique_class_ids.d.ts","sourceRoot":"","sources":["../../src/public/unique_class_ids.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,qBAAa,cAAc;IAGb,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC;IAFpC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA0B;gBAEtB,MAAM,CAAC,EAAE,cAAc,YAAA;IAEpD;;OAEG;IACI,IAAI;IAIX;;;;;OAKG;IACI,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAWpC;;OAEG;IACI,IAAI,IAAI,MAAM;IAIrB;;;;OAIG;IACI,GAAG,CAAC,OAAO,EAAE,MAAM;IAW1B;;;;OAIG;IACI,cAAc,CAAC,QAAQ,EAAE,cAAc;CAc/C"}
1
+ {"version":3,"file":"unique_class_ids.d.ts","sourceRoot":"","sources":["../../src/public/unique_class_ids.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,qBAAa,cAAc;IAGb,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC;IAFpC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA0B;IAEnD,YAA6B,MAAM,CAAC,4BAAgB,EAAI;IAExD;;OAEG;IACI,IAAI,mBAEV;IAED;;;;;OAKG;IACI,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CASnC;IAED;;OAEG;IACI,IAAI,IAAI,MAAM,CAEpB;IAED;;;;OAIG;IACI,GAAG,CAAC,OAAO,EAAE,MAAM,QASzB;IAED;;;;OAIG;IACI,cAAc,CAAC,QAAQ,EAAE,cAAc,QAa7C;CACF"}
@@ -1,3 +1,3 @@
1
1
  import { PublicCallRequestWithCalldata, type Tx, TxExecutionPhase } from '@aztec/stdlib/tx';
2
2
  export declare function getCallRequestsWithCalldataByPhase(tx: Tx, phase: TxExecutionPhase): PublicCallRequestWithCalldata[];
3
- //# sourceMappingURL=utils.d.ts.map
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wdWJsaWMvdXRpbHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLDZCQUE2QixFQUFFLEtBQUssRUFBRSxFQUFFLGdCQUFnQixFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFFNUYsd0JBQWdCLGtDQUFrQyxDQUFDLEVBQUUsRUFBRSxFQUFFLEVBQUUsS0FBSyxFQUFFLGdCQUFnQixHQUFHLDZCQUE2QixFQUFFLENBYW5IIn0=
package/dest/server.d.ts CHANGED
@@ -6,4 +6,4 @@ export { SimulatorRecorderWrapper } from './private/circuit_recording/simulator_
6
6
  export { MemoryCircuitRecorder } from './private/circuit_recording/memory_circuit_recorder.js';
7
7
  export { type CircuitSimulator, type DecodedError } from './private/circuit_simulator.js';
8
8
  export * from './common/index.js';
9
- //# sourceMappingURL=server.d.ts.map
9
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VydmVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvc2VydmVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsbUJBQW1CLENBQUM7QUFDbEMsY0FBYyx5QkFBeUIsQ0FBQztBQUN4QyxPQUFPLEVBQUUsc0JBQXNCLEVBQUUsTUFBTSxtQ0FBbUMsQ0FBQztBQUMzRSxPQUFPLEVBQUUsbUJBQW1CLEVBQUUsTUFBTSwwQkFBMEIsQ0FBQztBQUMvRCxPQUFPLEVBQUUsd0JBQXdCLEVBQUUsTUFBTSwyREFBMkQsQ0FBQztBQUNyRyxPQUFPLEVBQUUscUJBQXFCLEVBQUUsTUFBTSx3REFBd0QsQ0FBQztBQUMvRixPQUFPLEVBQUUsS0FBSyxnQkFBZ0IsRUFBRSxLQUFLLFlBQVksRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQzFGLGNBQWMsbUJBQW1CLENBQUMifQ==
package/dest/testing.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export { FileCircuitRecorder } from './private/circuit_recording/file_circuit_recorder.js';
2
- //# sourceMappingURL=testing.d.ts.map
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdGluZy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL3Rlc3RpbmcudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLG1CQUFtQixFQUFFLE1BQU0sc0RBQXNELENBQUMifQ==
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/simulator",
3
- "version": "3.0.0-canary.a9708bd",
3
+ "version": "3.0.0-devnet.2-patch.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./server": "./dest/server.js",
@@ -17,10 +17,11 @@
17
17
  "tsconfig": "./tsconfig.json"
18
18
  },
19
19
  "scripts": {
20
- "build": "yarn clean && tsc -b",
21
- "build:dev": "tsc -b --watch",
20
+ "build": "yarn clean && ../scripts/tsc.sh",
21
+ "build:dev": "../scripts/tsc.sh --watch",
22
22
  "clean": "rm -rf ./dest .tsbuildinfo",
23
- "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}"
23
+ "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}",
24
+ "build:fuzzer": "yarn clean && ../scripts/tsc.sh"
24
25
  },
25
26
  "inherits": [
26
27
  "../package.common.json"
@@ -63,35 +64,39 @@
63
64
  ]
64
65
  },
65
66
  "dependencies": {
66
- "@aztec/constants": "3.0.0-canary.a9708bd",
67
- "@aztec/foundation": "3.0.0-canary.a9708bd",
68
- "@aztec/noir-acvm_js": "3.0.0-canary.a9708bd",
69
- "@aztec/noir-noirc_abi": "3.0.0-canary.a9708bd",
70
- "@aztec/noir-protocol-circuits-types": "3.0.0-canary.a9708bd",
71
- "@aztec/noir-types": "3.0.0-canary.a9708bd",
72
- "@aztec/protocol-contracts": "3.0.0-canary.a9708bd",
73
- "@aztec/stdlib": "3.0.0-canary.a9708bd",
74
- "@aztec/telemetry-client": "3.0.0-canary.a9708bd",
75
- "@aztec/world-state": "3.0.0-canary.a9708bd",
67
+ "@aztec/constants": "3.0.0-devnet.2-patch.1",
68
+ "@aztec/foundation": "3.0.0-devnet.2-patch.1",
69
+ "@aztec/native": "3.0.0-devnet.2-patch.1",
70
+ "@aztec/noir-acvm_js": "3.0.0-devnet.2-patch.1",
71
+ "@aztec/noir-noirc_abi": "3.0.0-devnet.2-patch.1",
72
+ "@aztec/noir-protocol-circuits-types": "3.0.0-devnet.2-patch.1",
73
+ "@aztec/noir-types": "3.0.0-devnet.2-patch.1",
74
+ "@aztec/protocol-contracts": "3.0.0-devnet.2-patch.1",
75
+ "@aztec/stdlib": "3.0.0-devnet.2-patch.1",
76
+ "@aztec/telemetry-client": "3.0.0-devnet.2-patch.1",
77
+ "@aztec/world-state": "3.0.0-devnet.2-patch.1",
76
78
  "lodash.clonedeep": "^4.5.0",
77
79
  "lodash.merge": "^4.6.2",
78
80
  "tslib": "^2.4.0"
79
81
  },
80
82
  "devDependencies": {
81
- "@aztec/kv-store": "3.0.0-canary.a9708bd",
82
- "@aztec/merkle-tree": "3.0.0-canary.a9708bd",
83
- "@aztec/noir-contracts.js": "3.0.0-canary.a9708bd",
84
- "@aztec/noir-test-contracts.js": "3.0.0-canary.a9708bd",
83
+ "@aztec/kv-store": "3.0.0-devnet.2-patch.1",
84
+ "@aztec/merkle-tree": "3.0.0-devnet.2-patch.1",
85
+ "@aztec/noir-contracts.js": "3.0.0-devnet.2-patch.1",
86
+ "@aztec/noir-test-contracts.js": "3.0.0-devnet.2-patch.1",
85
87
  "@jest/globals": "^30.0.0",
86
88
  "@types/jest": "^30.0.0",
87
89
  "@types/lodash.clonedeep": "^4.5.7",
88
90
  "@types/lodash.merge": "^4.6.9",
89
91
  "@types/node": "^22.15.17",
92
+ "@typescript/native-preview": "7.0.0-dev.20251126.1",
93
+ "istanbul-lib-hook": "^3.0.0",
94
+ "istanbul-lib-instrument": "^6.0.3",
90
95
  "jest": "^30.0.0",
91
96
  "jest-mock-extended": "^4.0.0",
92
97
  "ts-node": "^10.9.1",
93
98
  "typescript": "^5.3.3",
94
- "viem": "2.23.7"
99
+ "viem": "npm:@aztec/viem@2.38.2"
95
100
  },
96
101
  "files": [
97
102
  "dest",
@@ -1,4 +1,4 @@
1
- import type { Fr } from '@aztec/foundation/fields';
1
+ import type { Fr } from '@aztec/foundation/curves/bn254';
2
2
  import { jsonStringify } from '@aztec/foundation/json-rpc';
3
3
  import type { RawAssertionPayload } from '@aztec/noir-acvm_js';
4
4
  import { abiDecodeError } from '@aztec/noir-noirc_abi';
@@ -1,4 +1,4 @@
1
- import { Fr } from '@aztec/foundation/fields';
1
+ import { Fr } from '@aztec/foundation/curves/bn254';
2
2
  import { hexToBuffer } from '@aztec/foundation/string';
3
3
 
4
4
  import type { ACVMField, ACVMWitness } from './acvm_types.js';
@@ -1,5 +1,5 @@
1
+ import { Fr } from '@aztec/foundation/curves/bn254';
1
2
  import type { EthAddress } from '@aztec/foundation/eth-address';
2
- import { Fr } from '@aztec/foundation/fields';
3
3
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
4
4
 
5
5
  import type { ACVMField } from './acvm_types.js';
@@ -1,8 +1,7 @@
1
1
  import { runInDirectory } from '@aztec/foundation/fs';
2
2
  import { createLogger } from '@aztec/foundation/log';
3
3
  import { Timer } from '@aztec/foundation/timer';
4
- import type { WitnessMap } from '@aztec/noir-acvm_js';
5
- import type { ForeignCallHandler } from '@aztec/noir-protocol-circuits-types/types';
4
+ import type { ForeignCallHandler, WitnessMap } from '@aztec/noir-acvm_js';
6
5
  import type { FunctionArtifactWithContractName } from '@aztec/stdlib/abi';
7
6
  import type { NoirCompiledCircuitWithName } from '@aztec/stdlib/noir';
8
7
 
@@ -104,21 +103,26 @@ export async function executeNativeCircuit(
104
103
  logger.debug(`Calling ACVM with ${args.join(' ')}`);
105
104
 
106
105
  const processPromise = new Promise<string>((resolve, reject) => {
107
- let outputWitness = Buffer.alloc(0);
108
- let errorBuffer = Buffer.alloc(0);
106
+ const outChunks: Buffer[] = [];
107
+ const errChunks: Buffer[] = [];
108
+ let outLen = 0;
109
+ let errLen = 0;
109
110
  const acvm = proc.spawn(pathToAcvm, args);
110
- acvm.stdout.on('data', data => {
111
- outputWitness = Buffer.concat([outputWitness, data]);
111
+ acvm.stdout.on('data', (data: Buffer) => {
112
+ outChunks.push(data);
113
+ outLen += data.length;
112
114
  });
113
- acvm.stderr.on('data', data => {
114
- errorBuffer = Buffer.concat([errorBuffer, data]);
115
+ acvm.stderr.on('data', (data: Buffer) => {
116
+ errChunks.push(data);
117
+ errLen += data.length;
115
118
  });
116
119
  acvm.on('close', code => {
117
120
  if (code === 0) {
118
- resolve(outputWitness.toString('utf-8'));
121
+ resolve(Buffer.concat(outChunks, outLen).toString('utf-8'));
119
122
  } else {
120
- logger.error(`From ACVM: ${errorBuffer.toString('utf-8')}`);
121
- reject(errorBuffer.toString('utf-8'));
123
+ const stderr = Buffer.concat(errChunks, errLen);
124
+ logger.error(`From ACVM: ${stderr.toString('utf-8')}`);
125
+ reject(stderr.toString('utf-8'));
122
126
  }
123
127
  });
124
128
  });
@@ -130,6 +134,9 @@ export async function executeNativeCircuit(
130
134
  const outputWitnessFileName = `${workingDirectory}/output-witness.gz`;
131
135
  await fs.copyFile(outputWitnessFileName, outputFilename);
132
136
  }
137
+ // TODO: We shouldn't be parsing the witness from stdout, it's not very performant, and we end up with two ways of fetching the witness.
138
+ // We probably should implement the WitnessStack type, run the ACVM with msgpack serialization mode (env variable), and ungzip and parse the witness from
139
+ // the outputted gz witness file.
133
140
  const witness = parseIntoWitnessMap(output);
134
141
  return { status: ACVM_RESULT.SUCCESS, witness, duration };
135
142
  } catch (error) {
@@ -1,4 +1,4 @@
1
- import { sha512 } from '@aztec/foundation/crypto';
1
+ import { sha512 } from '@aztec/foundation/crypto/sha512';
2
2
  import { createLogger } from '@aztec/foundation/log';
3
3
  import { Timer } from '@aztec/foundation/timer';
4
4
  import type { ForeignCallHandler, ForeignCallInput, ForeignCallOutput } from '@aztec/noir-acvm_js';
@@ -1,4 +1,4 @@
1
- import type { ForeignCallHandler } from '@aztec/noir-protocol-circuits-types/types';
1
+ import type { ForeignCallHandler } from '@aztec/noir-acvm_js';
2
2
  import type { FunctionArtifactWithContractName } from '@aztec/stdlib/abi';
3
3
  import type { NoirCompiledCircuitWithName } from '@aztec/stdlib/noir';
4
4
 
@@ -1,4 +1,4 @@
1
- import type { Fr } from '@aztec/foundation/fields';
1
+ import type { Fr } from '@aztec/foundation/curves/bn254';
2
2
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
3
3
 
4
4
  import type { PublicPersistableStateManager } from '../state_manager/state_manager.js';
@@ -1,4 +1,4 @@
1
- import type { Fr } from '@aztec/foundation/fields';
1
+ import type { Fr } from '@aztec/foundation/curves/bn254';
2
2
  import type { SimulationError } from '@aztec/stdlib/errors';
3
3
  import { Gas } from '@aztec/stdlib/gas';
4
4
 
@@ -1,4 +1,5 @@
1
- import { Fr } from '@aztec/foundation/fields';
1
+ import { Fr } from '@aztec/foundation/curves/bn254';
2
+ import type { PublicSimulatorConfig } from '@aztec/stdlib/avm';
2
3
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
3
4
  import type { GlobalVariables } from '@aztec/stdlib/tx';
4
5
 
@@ -15,7 +16,7 @@ export class AvmExecutionEnvironment {
15
16
  public readonly globals: GlobalVariables,
16
17
  public readonly isStaticCall: boolean,
17
18
  public readonly calldata: Fr[],
18
- public readonly clientInitiatedSimulation: boolean = false,
19
+ public readonly config: PublicSimulatorConfig,
19
20
  ) {}
20
21
 
21
22
  private deriveEnvironmentForNestedCallInternal(
@@ -31,7 +32,7 @@ export class AvmExecutionEnvironment {
31
32
  this.globals,
32
33
  isStaticCall,
33
34
  calldata,
34
- /*clientInitiatedSimulation=*/ this.clientInitiatedSimulation,
35
+ this.config,
35
36
  );
36
37
  }
37
38
 
@@ -26,9 +26,9 @@ export function makeGas(gasCost: Partial<Gas>) {
26
26
  }
27
27
 
28
28
  /** Sums together multiple instances of Gas. */
29
- export function sumGas(...gases: Partial<Gas>[]) {
30
- return gases.reduce(
31
- (acc: Gas, gas) => ({
29
+ export function sumGas(...gases: Partial<Gas>[]): Gas {
30
+ return gases.reduce<Gas>(
31
+ (acc, gas) => ({
32
32
  l2Gas: acc.l2Gas + (gas.l2Gas ?? 0),
33
33
  daGas: acc.daGas + (gas.daGas ?? 0),
34
34
  }),
@@ -110,7 +110,7 @@ const BASE_GAS_COSTS: Record<Opcode, Gas> = {
110
110
  [Opcode.NULLIFIEREXISTS]: makeCost(c.AVM_NULLIFIEREXISTS_BASE_L2_GAS, 0),
111
111
  [Opcode.EMITNULLIFIER]: makeCost(c.AVM_EMITNULLIFIER_BASE_L2_GAS, c.AVM_EMITNULLIFIER_BASE_DA_GAS),
112
112
  [Opcode.L1TOL2MSGEXISTS]: makeCost(c.AVM_L1TOL2MSGEXISTS_BASE_L2_GAS, 0),
113
- [Opcode.EMITUNENCRYPTEDLOG]: makeCost(c.AVM_EMITUNENCRYPTEDLOG_BASE_L2_GAS, 0),
113
+ [Opcode.EMITUNENCRYPTEDLOG]: makeCost(c.AVM_EMITUNENCRYPTEDLOG_BASE_L2_GAS, c.AVM_EMITUNENCRYPTEDLOG_BASE_DA_GAS),
114
114
  [Opcode.SENDL2TOL1MSG]: makeCost(c.AVM_SENDL2TOL1MSG_BASE_L2_GAS, c.AVM_SENDL2TOL1MSG_BASE_DA_GAS),
115
115
  [Opcode.GETCONTRACTINSTANCE]: makeCost(c.AVM_GETCONTRACTINSTANCE_BASE_L2_GAS, 0),
116
116
  [Opcode.CALL]: makeCost(c.AVM_CALL_BASE_L2_GAS, 0),
@@ -130,7 +130,7 @@ const DYNAMIC_GAS_COSTS = new Map<Opcode, Gas>([
130
130
  [Opcode.CALLDATACOPY, makeCost(c.AVM_CALLDATACOPY_DYN_L2_GAS, 0)],
131
131
  [Opcode.RETURNDATACOPY, makeCost(c.AVM_RETURNDATACOPY_DYN_L2_GAS, 0)],
132
132
  // TODO: Call and static call based on bytecode length
133
- [Opcode.EMITUNENCRYPTEDLOG, makeCost(0, c.AVM_EMITUNENCRYPTEDLOG_DYN_DA_GAS)],
133
+ [Opcode.EMITUNENCRYPTEDLOG, makeCost(c.AVM_EMITUNENCRYPTEDLOG_DYN_L2_GAS, c.AVM_EMITUNENCRYPTEDLOG_DYN_DA_GAS)],
134
134
  [Opcode.TORADIXBE, makeCost(c.AVM_TORADIXBE_DYN_L2_GAS, 0)],
135
135
  [Opcode.AND_8, makeCost(c.AVM_BITWISE_DYN_L2_GAS, 0)],
136
136
  [Opcode.AND_16, makeCost(c.AVM_BITWISE_DYN_L2_GAS, 0)],
@@ -1,4 +1,4 @@
1
- import type { Fr } from '@aztec/foundation/fields';
1
+ import type { Fr } from '@aztec/foundation/curves/bn254';
2
2
 
3
3
  import type { Gas } from './avm_gas.js';
4
4
  import { TaggedMemory } from './avm_memory_types.js';
@@ -8,7 +8,7 @@ import {
8
8
  MEM_TAG_U128,
9
9
  } from '@aztec/constants';
10
10
  import { toBufferBE } from '@aztec/foundation/bigint-buffer';
11
- import { Fr } from '@aztec/foundation/fields';
11
+ import { Fr } from '@aztec/foundation/curves/bn254';
12
12
  import { type Logger, createLogger } from '@aztec/foundation/log';
13
13
  import type { FunctionsOf } from '@aztec/foundation/types';
14
14
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
@@ -74,6 +74,7 @@ export abstract class IntegralValue extends MemoryValue {
74
74
  **/
75
75
  function UnsignedIntegerClassFactory(bits: number) {
76
76
  return class NewUintClass extends IntegralValue {
77
+ static readonly bits: number = bits;
77
78
  static readonly mod: bigint = 1n << BigInt(bits);
78
79
  static readonly bitmask: bigint = this.mod - 1n;
79
80
  public readonly n: bigint; // Cannot be private due to TS limitations.
@@ -108,12 +109,20 @@ function UnsignedIntegerClassFactory(bits: number) {
108
109
 
109
110
  // No sign extension.
110
111
  public shr(rhs: NewUintClass): NewUintClass {
111
- // Note that this.n is > 0 by class invariant.
112
+ // Note that this.n is >= 0 by class invariant.
112
113
  return this.build(this.n >> rhs.n);
113
114
  }
114
115
 
115
116
  public shl(rhs: NewUintClass): NewUintClass {
116
- return this.build((this.n << rhs.n) & NewUintClass.bitmask);
117
+ const shiftAmount = rhs.n;
118
+ const bitSize = BigInt(NewUintClass.bits);
119
+
120
+ // Shifting by more than the bit size always results in 0
121
+ if (shiftAmount >= bitSize) {
122
+ return this.build(0n);
123
+ }
124
+
125
+ return this.build((this.n << shiftAmount) & NewUintClass.bitmask);
117
126
  }
118
127
 
119
128
  public and(rhs: NewUintClass): NewUintClass {