@aztec/simulator 4.0.0-nightly.20250907 → 4.0.0-nightly.20260107

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 (346) 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 +16 -15
  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 +8 -8
  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 +1 -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 +9 -4
  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 +28 -2
  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 +59 -161
  147. package/dest/public/fixtures/custom_bytecode_tester.d.ts +34 -0
  148. package/dest/public/fixtures/custom_bytecode_tester.d.ts.map +1 -0
  149. package/dest/public/fixtures/custom_bytecode_tester.js +53 -0
  150. package/dest/public/fixtures/custom_bytecode_tests.d.ts +12 -0
  151. package/dest/public/fixtures/custom_bytecode_tests.d.ts.map +1 -0
  152. package/dest/public/fixtures/custom_bytecode_tests.js +174 -0
  153. package/dest/public/fixtures/index.d.ts +5 -2
  154. package/dest/public/fixtures/index.d.ts.map +1 -1
  155. package/dest/public/fixtures/index.js +4 -1
  156. package/dest/public/fixtures/minimal_public_tx.d.ts +4 -9
  157. package/dest/public/fixtures/minimal_public_tx.d.ts.map +1 -1
  158. package/dest/public/fixtures/minimal_public_tx.js +8 -32
  159. package/dest/public/fixtures/opcode_spammer.d.ts +123 -0
  160. package/dest/public/fixtures/opcode_spammer.d.ts.map +1 -0
  161. package/dest/public/fixtures/opcode_spammer.js +1681 -0
  162. package/dest/public/fixtures/public_tx_simulation_tester.d.ts +25 -5
  163. package/dest/public/fixtures/public_tx_simulation_tester.d.ts.map +1 -1
  164. package/dest/public/fixtures/public_tx_simulation_tester.js +63 -17
  165. package/dest/public/fixtures/simple_contract_data_source.d.ts +5 -4
  166. package/dest/public/fixtures/simple_contract_data_source.d.ts.map +1 -1
  167. package/dest/public/fixtures/simple_contract_data_source.js +4 -4
  168. package/dest/public/fixtures/token_test.d.ts +6 -2
  169. package/dest/public/fixtures/token_test.d.ts.map +1 -1
  170. package/dest/public/fixtures/token_test.js +13 -12
  171. package/dest/public/fixtures/utils.d.ts +2 -2
  172. package/dest/public/fixtures/utils.d.ts.map +1 -1
  173. package/dest/public/fixtures/utils.js +7 -6
  174. package/dest/public/fuzzing/avm_fuzzer_simulator.d.ts +46 -0
  175. package/dest/public/fuzzing/avm_fuzzer_simulator.d.ts.map +1 -0
  176. package/dest/public/fuzzing/avm_fuzzer_simulator.js +139 -0
  177. package/dest/public/fuzzing/avm_simulator_bin.d.ts +2 -0
  178. package/dest/public/fuzzing/avm_simulator_bin.d.ts.map +1 -0
  179. package/dest/public/fuzzing/avm_simulator_bin.js +100 -0
  180. package/dest/public/hinting_db_sources.d.ts +16 -4
  181. package/dest/public/hinting_db_sources.d.ts.map +1 -1
  182. package/dest/public/hinting_db_sources.js +74 -13
  183. package/dest/public/index.d.ts +3 -2
  184. package/dest/public/index.d.ts.map +1 -1
  185. package/dest/public/index.js +1 -1
  186. package/dest/public/public_db_sources.d.ts +24 -65
  187. package/dest/public/public_db_sources.d.ts.map +1 -1
  188. package/dest/public/public_db_sources.js +85 -132
  189. package/dest/public/public_errors.d.ts +12 -0
  190. package/dest/public/public_errors.d.ts.map +1 -0
  191. package/dest/public/public_errors.js +13 -0
  192. package/dest/public/public_processor/guarded_merkle_tree.d.ts +6 -2
  193. package/dest/public/public_processor/guarded_merkle_tree.d.ts.map +1 -1
  194. package/dest/public/public_processor/guarded_merkle_tree.js +8 -0
  195. package/dest/public/public_processor/public_processor.d.ts +11 -13
  196. package/dest/public/public_processor/public_processor.d.ts.map +1 -1
  197. package/dest/public/public_processor/public_processor.js +477 -70
  198. package/dest/public/public_processor/public_processor_metrics.d.ts +1 -1
  199. package/dest/public/public_processor/public_processor_metrics.d.ts.map +1 -1
  200. package/dest/public/public_tx_simulator/contract_provider_for_cpp.d.ts +18 -0
  201. package/dest/public/public_tx_simulator/contract_provider_for_cpp.d.ts.map +1 -0
  202. package/dest/public/public_tx_simulator/contract_provider_for_cpp.js +98 -0
  203. package/dest/public/public_tx_simulator/cpp_public_tx_simulator.d.ts +53 -0
  204. package/dest/public/public_tx_simulator/cpp_public_tx_simulator.d.ts.map +1 -0
  205. package/dest/public/public_tx_simulator/cpp_public_tx_simulator.js +131 -0
  206. package/dest/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.d.ts +42 -0
  207. package/dest/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.d.ts.map +1 -0
  208. package/dest/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.js +86 -0
  209. package/dest/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.d.ts +30 -0
  210. package/dest/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.d.ts.map +1 -0
  211. package/dest/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.js +171 -0
  212. package/dest/public/public_tx_simulator/dumping_cpp_public_tx_simulator.d.ts +22 -0
  213. package/dest/public/public_tx_simulator/dumping_cpp_public_tx_simulator.d.ts.map +1 -0
  214. package/dest/public/public_tx_simulator/dumping_cpp_public_tx_simulator.js +52 -0
  215. package/dest/public/public_tx_simulator/factories.d.ts +13 -0
  216. package/dest/public/public_tx_simulator/factories.d.ts.map +1 -0
  217. package/dest/public/public_tx_simulator/factories.js +28 -0
  218. package/dest/public/public_tx_simulator/index.d.ts +6 -1
  219. package/dest/public/public_tx_simulator/index.d.ts.map +1 -1
  220. package/dest/public/public_tx_simulator/index.js +3 -0
  221. package/dest/public/public_tx_simulator/measured_public_tx_simulator.d.ts +16 -8
  222. package/dest/public/public_tx_simulator/measured_public_tx_simulator.d.ts.map +1 -1
  223. package/dest/public/public_tx_simulator/measured_public_tx_simulator.js +7 -8
  224. package/dest/public/public_tx_simulator/public_tx_context.d.ts +9 -4
  225. package/dest/public/public_tx_simulator/public_tx_context.d.ts.map +1 -1
  226. package/dest/public/public_tx_simulator/public_tx_context.js +22 -10
  227. package/dest/public/public_tx_simulator/public_tx_simulator.d.ts +22 -29
  228. package/dest/public/public_tx_simulator/public_tx_simulator.d.ts.map +1 -1
  229. package/dest/public/public_tx_simulator/public_tx_simulator.js +178 -127
  230. package/dest/public/public_tx_simulator/public_tx_simulator_interface.d.ts +32 -0
  231. package/dest/public/public_tx_simulator/public_tx_simulator_interface.d.ts.map +1 -0
  232. package/dest/public/public_tx_simulator/public_tx_simulator_interface.js +1 -0
  233. package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.d.ts +4 -3
  234. package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.d.ts.map +1 -1
  235. package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.js +396 -20
  236. package/dest/public/side_effect_errors.d.ts +42 -2
  237. package/dest/public/side_effect_errors.d.ts.map +1 -1
  238. package/dest/public/side_effect_errors.js +70 -1
  239. package/dest/public/side_effect_trace.d.ts +13 -7
  240. package/dest/public/side_effect_trace.d.ts.map +1 -1
  241. package/dest/public/side_effect_trace.js +36 -21
  242. package/dest/public/side_effect_trace_interface.d.ts +9 -4
  243. package/dest/public/side_effect_trace_interface.d.ts.map +1 -1
  244. package/dest/public/state_manager/index.d.ts +1 -1
  245. package/dest/public/state_manager/nullifiers.d.ts +2 -5
  246. package/dest/public/state_manager/nullifiers.d.ts.map +1 -1
  247. package/dest/public/state_manager/nullifiers.js +1 -6
  248. package/dest/public/state_manager/public_storage.d.ts +2 -2
  249. package/dest/public/state_manager/public_storage.d.ts.map +1 -1
  250. package/dest/public/state_manager/public_storage.js +1 -1
  251. package/dest/public/state_manager/state_manager.d.ts +16 -13
  252. package/dest/public/state_manager/state_manager.d.ts.map +1 -1
  253. package/dest/public/state_manager/state_manager.js +64 -21
  254. package/dest/public/test_executor_metrics.d.ts +4 -3
  255. package/dest/public/test_executor_metrics.d.ts.map +1 -1
  256. package/dest/public/test_executor_metrics.js +5 -4
  257. package/dest/public/unique_class_ids.d.ts +1 -1
  258. package/dest/public/unique_class_ids.d.ts.map +1 -1
  259. package/dest/public/utils.d.ts +1 -1
  260. package/dest/server.d.ts +1 -1
  261. package/dest/testing.d.ts +1 -1
  262. package/package.json +24 -19
  263. package/src/common/errors.ts +1 -1
  264. package/src/private/acvm/deserialize.ts +1 -1
  265. package/src/private/acvm/serialize.ts +1 -1
  266. package/src/private/acvm_native.ts +18 -11
  267. package/src/private/circuit_recording/circuit_recorder.ts +17 -16
  268. package/src/private/circuit_recording/simulator_recorder_wrapper.ts +1 -1
  269. package/src/public/avm/avm_context.ts +1 -1
  270. package/src/public/avm/avm_contract_call_result.ts +1 -1
  271. package/src/public/avm/avm_execution_environment.ts +4 -3
  272. package/src/public/avm/avm_gas.ts +5 -5
  273. package/src/public/avm/avm_machine_state.ts +1 -1
  274. package/src/public/avm/avm_memory_types.ts +12 -3
  275. package/src/public/avm/avm_simulator.ts +24 -33
  276. package/src/public/avm/errors.ts +24 -27
  277. package/src/public/avm/fixtures/avm_simulation_tester.ts +14 -4
  278. package/src/public/avm/fixtures/base_avm_simulation_tester.ts +33 -1
  279. package/src/public/avm/fixtures/initializers.ts +7 -8
  280. package/src/public/avm/fixtures/utils.ts +3 -2
  281. package/src/public/avm/opcodes/accrued_substate.ts +5 -5
  282. package/src/public/avm/opcodes/addressing_mode.ts +5 -5
  283. package/src/public/avm/opcodes/arithmetic.ts +13 -1
  284. package/src/public/avm/opcodes/conversion.ts +4 -0
  285. package/src/public/avm/opcodes/ec_add.ts +6 -6
  286. package/src/public/avm/opcodes/environment_getters.ts +6 -8
  287. package/src/public/avm/opcodes/external_calls.ts +1 -1
  288. package/src/public/avm/opcodes/hashing.ts +10 -4
  289. package/src/public/avm/opcodes/instruction.ts +8 -6
  290. package/src/public/avm/opcodes/memory.ts +1 -1
  291. package/src/public/avm/opcodes/misc.ts +41 -7
  292. package/src/public/avm/revert_reason.ts +6 -3
  293. package/src/public/avm/serialization/bytecode_serialization.ts +17 -6
  294. package/src/public/avm/serialization/instruction_serialization.ts +13 -1
  295. package/src/public/avm/test_utils.ts +7 -15
  296. package/src/public/contracts_db_checkpoint.ts +41 -0
  297. package/src/public/db_interfaces.ts +16 -1
  298. package/src/public/debug_fn_name.ts +35 -3
  299. package/src/public/executor_metrics.ts +2 -1
  300. package/src/public/executor_metrics_interface.ts +2 -1
  301. package/src/public/fixtures/amm_test.ts +2 -2
  302. package/src/public/fixtures/bulk_test.ts +38 -25
  303. package/src/public/fixtures/custom_bytecode_tester.ts +83 -0
  304. package/src/public/fixtures/custom_bytecode_tests.ts +219 -0
  305. package/src/public/fixtures/index.ts +8 -1
  306. package/src/public/fixtures/minimal_public_tx.ts +9 -42
  307. package/src/public/fixtures/opcode_spammer.ts +1638 -0
  308. package/src/public/fixtures/public_tx_simulation_tester.ts +90 -22
  309. package/src/public/fixtures/simple_contract_data_source.ts +8 -9
  310. package/src/public/fixtures/token_test.ts +18 -10
  311. package/src/public/fixtures/utils.ts +5 -6
  312. package/src/public/fuzzing/avm_fuzzer_simulator.ts +240 -0
  313. package/src/public/fuzzing/avm_simulator_bin.ts +140 -0
  314. package/src/public/hinting_db_sources.ts +117 -10
  315. package/src/public/index.ts +8 -1
  316. package/src/public/public_db_sources.ts +112 -175
  317. package/src/public/public_errors.ts +14 -0
  318. package/src/public/public_processor/guarded_merkle_tree.ts +10 -1
  319. package/src/public/public_processor/public_processor.ts +112 -79
  320. package/src/public/public_tx_simulator/contract_provider_for_cpp.ts +121 -0
  321. package/src/public/public_tx_simulator/cpp_public_tx_simulator.ts +200 -0
  322. package/src/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.ts +132 -0
  323. package/src/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.ts +237 -0
  324. package/src/public/public_tx_simulator/dumping_cpp_public_tx_simulator.ts +81 -0
  325. package/src/public/public_tx_simulator/factories.ts +41 -0
  326. package/src/public/public_tx_simulator/index.ts +5 -0
  327. package/src/public/public_tx_simulator/measured_public_tx_simulator.ts +13 -14
  328. package/src/public/public_tx_simulator/public_tx_context.ts +20 -7
  329. package/src/public/public_tx_simulator/public_tx_simulator.ts +265 -179
  330. package/src/public/public_tx_simulator/public_tx_simulator_interface.ts +33 -0
  331. package/src/public/public_tx_simulator/telemetry_public_tx_simulator.ts +4 -13
  332. package/src/public/side_effect_errors.ts +91 -1
  333. package/src/public/side_effect_trace.ts +49 -24
  334. package/src/public/side_effect_trace_interface.ts +7 -1
  335. package/src/public/state_manager/nullifiers.ts +2 -8
  336. package/src/public/state_manager/public_storage.ts +1 -1
  337. package/src/public/state_manager/state_manager.ts +87 -39
  338. package/src/public/test_executor_metrics.ts +7 -5
  339. package/dest/public/bytecode_errors.d.ts +0 -4
  340. package/dest/public/bytecode_errors.d.ts.map +0 -1
  341. package/dest/public/bytecode_errors.js +0 -6
  342. package/dest/public/tx_contract_cache.d.ts +0 -41
  343. package/dest/public/tx_contract_cache.d.ts.map +0 -1
  344. package/dest/public/tx_contract_cache.js +0 -49
  345. package/src/public/bytecode_errors.ts +0 -6
  346. package/src/public/tx_contract_cache.ts +0 -69
@@ -1,39 +1,30 @@
1
- import type { Fr } from '@aztec/foundation/fields';
1
+ import { Fr } from '@aztec/foundation/curves/bn254';
2
2
  import { type Logger } from '@aztec/foundation/log';
3
- import { type AvmProvingRequest, type RevertCode } from '@aztec/stdlib/avm';
3
+ import { PublicSimulatorConfig, PublicTxResult } from '@aztec/stdlib/avm';
4
4
  import { SimulationError } from '@aztec/stdlib/errors';
5
- import type { Gas, GasUsed } from '@aztec/stdlib/gas';
5
+ import { Gas } from '@aztec/stdlib/gas';
6
6
  import type { MerkleTreeWriteOperations } from '@aztec/stdlib/trees';
7
7
  import { type GlobalVariables, NestedProcessReturnValues, PublicCallRequestWithCalldata, Tx, TxExecutionPhase } from '@aztec/stdlib/tx';
8
8
  import type { AvmFinalizedCallResult } from '../avm/avm_contract_call_result.js';
9
9
  import { type PublicContractsDB } from '../public_db_sources.js';
10
10
  import type { PublicPersistableStateManager } from '../state_manager/state_manager.js';
11
11
  import { PublicTxContext } from './public_tx_context.js';
12
- export type ProcessedPhase = {
12
+ import type { PublicTxSimulatorInterface } from './public_tx_simulator_interface.js';
13
+ /** Only used internally. */
14
+ type ProcessedPhase = {
13
15
  phase: TxExecutionPhase;
14
16
  durationMs?: number;
15
17
  returnValues: NestedProcessReturnValues[];
16
18
  reverted: boolean;
17
19
  revertReason?: SimulationError;
18
20
  };
19
- export type PublicTxResult = {
20
- avmProvingRequest: AvmProvingRequest;
21
- /** Gas used during the execution of this tx */
22
- gasUsed: GasUsed;
23
- revertCode: RevertCode;
24
- /** Revert reason, if any */
25
- revertReason?: SimulationError;
26
- processedPhases: ProcessedPhase[];
27
- };
28
- export declare class PublicTxSimulator {
29
- private merkleTree;
30
- private contractsDB;
31
- private globalVariables;
32
- private doMerkleOperations;
33
- private skipFeeEnforcement;
34
- private clientInitiatedSimulation;
21
+ export declare class PublicTxSimulator implements PublicTxSimulatorInterface {
22
+ protected merkleTree: MerkleTreeWriteOperations;
23
+ protected contractsDB: PublicContractsDB;
24
+ protected globalVariables: GlobalVariables;
35
25
  protected log: Logger;
36
- constructor(merkleTree: MerkleTreeWriteOperations, contractsDB: PublicContractsDB, globalVariables: GlobalVariables, doMerkleOperations?: boolean, skipFeeEnforcement?: boolean, clientInitiatedSimulation?: boolean);
26
+ protected readonly config: PublicSimulatorConfig;
27
+ constructor(merkleTree: MerkleTreeWriteOperations, contractsDB: PublicContractsDB, globalVariables: GlobalVariables, config?: Partial<PublicSimulatorConfig>);
37
28
  /**
38
29
  * Simulate a transaction's public portion including all of its phases.
39
30
  * @param tx - The transaction to simulate.
@@ -72,16 +63,18 @@ export declare class PublicTxSimulator {
72
63
  /**
73
64
  * Insert the non-revertible accumulated data from private into the public state.
74
65
  */
75
- protected insertNonRevertiblesFromPrivate(context: PublicTxContext, tx: Tx): Promise<void>;
66
+ protected insertNonRevertiblesFromPrivate(context: PublicTxContext): Promise<void>;
76
67
  /**
77
68
  * Insert the revertible accumulated data from private into the public state.
78
- * Start by forking state so we can rollback to the end of setup if app logic or teardown reverts.
69
+ * Throws TxSimRevertibleInsertionsRevert if there is some checked error during revertible insertions.
70
+ * This function checks for the following errors:
71
+ * - NullifierLimitReachedError
72
+ * - NullifierCollisionError
73
+ * - NoteHashLimitReachedError
74
+ * - L2ToL1MessageLimitReachedError
79
75
  */
80
- protected insertRevertiblesFromPrivate(context: PublicTxContext, tx: Tx): Promise<boolean>;
76
+ protected insertRevertiblesFromPrivate(context: PublicTxContext): Promise<void>;
81
77
  private payFee;
82
- /**
83
- * Generate the proving request for the AVM circuit.
84
- */
85
- private static generateProvingRequest;
86
78
  }
87
- //# sourceMappingURL=public_tx_simulator.d.ts.map
79
+ export {};
80
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljX3R4X3NpbXVsYXRvci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3B1YmxpYy9wdWJsaWNfdHhfc2ltdWxhdG9yL3B1YmxpY190eF9zaW11bGF0b3IudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQ3BELE9BQU8sRUFBRSxLQUFLLE1BQU0sRUFBZ0IsTUFBTSx1QkFBdUIsQ0FBQztBQUdsRSxPQUFPLEVBQWdDLHF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QUUsTUFBTSxHQUNiLE9BQU8sQ0FBQyxzQkFBc0IsQ0FBQyxDQXFCakM7SUFFRDs7T0FFRztJQUNILFVBQWdCLCtCQUErQixDQUFDLE9BQU8sRUFBRSxlQUFlLGlCQXlCdkU7SUFFRDs7Ozs7Ozs7T0FRRztJQUNILFVBQWdCLDRCQUE0QixDQUFDLE9BQU8sRUFBRSxlQUFlLGlCQTBFcEU7WUFFYSxNQUFNO0NBbUNyQiJ9
@@ -1 +1 @@
1
- {"version":3,"file":"public_tx_simulator.d.ts","sourceRoot":"","sources":["../../../src/public/public_tx_simulator/public_tx_simulator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAGlE,OAAO,EAIL,KAAK,iBAAiB,EAEtB,KAAK,UAAU,EAChB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EACL,KAAK,eAAe,EACpB,yBAAyB,EACzB,6BAA6B,EAC7B,EAAE,EACF,gBAAgB,EACjB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAIjF,OAAO,EAAE,KAAK,iBAAiB,EAAiB,MAAM,yBAAyB,CAAC;AAChF,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,mCAAmC,CAAC;AACvF,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,gBAAgB,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,y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D,YAAY,EAAE,GAAG,EACjB,cAAc,EAAE,EAAE,EAClB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,sBAAsB,CAAC;IAuBlC;;OAEG;cACa,+BAA+B,CAAC,OAAO,EAAE,eAAe,EAAE,EAAE,EAAE,EAAE;IA0BhF;;;OAGG;cACa,4BAA4B,CAAC,OAAO,EAAE,eAAe,EAAE,EAAE,EAAE,EAAE,GAAgB,OAAO,CAAC,OAAO,CAAC;YAoC/F,MAAM;IAgCpB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,sBAAsB;CAStC"}
1
+ {"version":3,"file":"public_tx_simulator.d.ts","sourceRoot":"","sources":["../../../src/public/public_tx_simulator/public_tx_simulator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAGlE,OAAO,EAAgC,qBAAqB,EAAkB,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxH,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EACL,KAAK,eAAe,EACpB,yBAAyB,EACzB,6BAA6B,EAC7B,EAAE,EACF,gBAAgB,EACjB,MAAM,kBAAkB,CAAC;AAI1B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAIjF,OAAO,EAAE,KAAK,iBAAiB,EAAiB,MAAM,yBAAyB,CAAC;AAOhF,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,mCAAmC,CAAC;AACvF,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAqCrF,4BAA4B;AAC5B,KAAK,cAAc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B,CAAC,CAqBjC;IAED;;OAEG;IACH,UAAgB,+BAA+B,CAAC,OAAO,EAAE,eAAe,iBAyBvE;IAED;;;;;;;;OAQG;IACH,UAAgB,4BAA4B,CAAC,OAAO,EAAE,eAAe,iBA0EpE;YAEa,MAAM;CAmCrB"}
@@ -1,31 +1,56 @@
1
1
  import { AVM_MAX_PROCESSABLE_L2_GAS } from '@aztec/constants';
2
2
  import { createLogger } from '@aztec/foundation/log';
3
- import { ProtocolContractAddress } from '@aztec/protocol-contracts';
3
+ import { ProtocolContractAddress, ProtocolContractsList } from '@aztec/protocol-contracts';
4
4
  import { computeFeePayerBalanceStorageSlot } from '@aztec/protocol-contracts/fee-juice';
5
- import { AvmCircuitInputs, AvmExecutionHints, AvmTxHint } from '@aztec/stdlib/avm';
5
+ import { AvmExecutionHints, AvmTxHint, PublicSimulatorConfig, PublicTxEffect, PublicTxResult } from '@aztec/stdlib/avm';
6
6
  import { SimulationError } from '@aztec/stdlib/errors';
7
- import { ProvingRequestType } from '@aztec/stdlib/proofs';
8
7
  import { NestedProcessReturnValues, TxExecutionPhase } from '@aztec/stdlib/tx';
8
+ import { strict as assert } from 'assert';
9
9
  import { AvmSimulator } from '../avm/index.js';
10
10
  import { getPublicFunctionDebugName } from '../debug_fn_name.js';
11
11
  import { HintingMerkleWriteOperations, HintingPublicContractsDB } from '../hinting_db_sources.js';
12
12
  import { PublicTreesDB } from '../public_db_sources.js';
13
+ import { L2ToL1MessageLimitReachedError, NoteHashLimitReachedError, NullifierCollisionError, NullifierLimitReachedError } from '../side_effect_errors.js';
13
14
  import { PublicTxContext } from './public_tx_context.js';
15
+ // The errors below are only thrown here in the public tx simulator,
16
+ // and only during revertible phases (revertible insertions, app logic and teardown).
17
+ // These are strictly "checked" errors (not exported and never propagated).
18
+ // They are used internally for control flow to trigger rollbacks to the post-setup state.
19
+ /**
20
+ * Error thrown when public tx simulation reverts in a known/checked way during revertible insertions.
21
+ */ class TxSimRevertibleInsertionsRevert extends Error {
22
+ constructor(){
23
+ super('Public Tx Simulation reverted during Revertible Insertions');
24
+ this.name = 'TxSimRevertibleInsertionsRevert';
25
+ }
26
+ }
27
+ /**
28
+ * Error thrown when public tx simulation reverts during app logic.
29
+ */ class TxSimAppLogicRevert extends Error {
30
+ constructor(){
31
+ super('Public Tx Simulation reverted during App Logic');
32
+ this.name = 'TxSimAppLogicRevert';
33
+ }
34
+ }
35
+ /**
36
+ * Error thrown when public tx simulation reverts during teardown.
37
+ */ class TxSimTeardownRevert extends Error {
38
+ constructor(){
39
+ super('Public Tx Simulation reverted during Teardown');
40
+ this.name = 'TxSimTeardownRevert';
41
+ }
42
+ }
14
43
  export class PublicTxSimulator {
15
44
  merkleTree;
16
45
  contractsDB;
17
46
  globalVariables;
18
- doMerkleOperations;
19
- skipFeeEnforcement;
20
- clientInitiatedSimulation;
21
47
  log;
22
- constructor(merkleTree, contractsDB, globalVariables, doMerkleOperations = false, skipFeeEnforcement = false, clientInitiatedSimulation = false){
48
+ config;
49
+ constructor(merkleTree, contractsDB, globalVariables, config){
23
50
  this.merkleTree = merkleTree;
24
51
  this.contractsDB = contractsDB;
25
52
  this.globalVariables = globalVariables;
26
- this.doMerkleOperations = doMerkleOperations;
27
- this.skipFeeEnforcement = skipFeeEnforcement;
28
- this.clientInitiatedSimulation = clientInitiatedSimulation;
53
+ this.config = PublicSimulatorConfig.from(config ?? {});
29
54
  this.log = createLogger(`simulator:public_tx_simulator`);
30
55
  }
31
56
  /**
@@ -33,99 +58,98 @@ export class PublicTxSimulator {
33
58
  * @param tx - The transaction to simulate.
34
59
  * @returns The result of the transaction's public execution.
35
60
  */ async simulate(tx) {
36
- try {
37
- const txHash = this.computeTxHash(tx);
38
- this.log.debug(`Simulating ${tx.publicFunctionCalldata.length} public calls for tx ${txHash}`, {
39
- txHash
40
- });
41
- // Create hinting DBs.
42
- const hints = new AvmExecutionHints(this.globalVariables, AvmTxHint.fromTx(tx, this.globalVariables.gasFees));
43
- const hintingMerkleTree = await HintingMerkleWriteOperations.create(this.merkleTree, hints);
44
- const hintingTreesDB = new PublicTreesDB(hintingMerkleTree);
45
- const hintingContractsDB = new HintingPublicContractsDB(this.contractsDB, hints);
46
- const context = await PublicTxContext.create(hintingTreesDB, hintingContractsDB, tx, this.globalVariables, this.doMerkleOperations);
47
- // This will throw if there is a nullifier collision.
61
+ const txHash = this.computeTxHash(tx);
62
+ this.log.debug(`Simulating ${tx.publicFunctionCalldata.length} public calls for tx ${txHash}`, {
63
+ txHash
64
+ });
65
+ // Create hinting DBs.
66
+ const hints = new AvmExecutionHints(this.globalVariables, AvmTxHint.fromTx(tx, this.globalVariables.gasFees), ProtocolContractsList);
67
+ const hintingMerkleTree = await HintingMerkleWriteOperations.create(this.merkleTree, hints);
68
+ const hintingTreesDB = new PublicTreesDB(hintingMerkleTree);
69
+ const hintingContractsDB = new HintingPublicContractsDB(this.contractsDB, hints);
70
+ const context = await PublicTxContext.create(hintingTreesDB, hintingContractsDB, tx, this.globalVariables, ProtocolContractsList, this.config.proverId);
71
+ // This will throw if there is a nullifier collision.
72
+ // In that case the transaction will be thrown out.
73
+ await this.insertNonRevertiblesFromPrivate(context);
74
+ const processedPhases = [];
75
+ if (context.hasPhase(TxExecutionPhase.SETUP)) {
76
+ // This will throw if the setup phase reverts.
48
77
  // In that case the transaction will be thrown out.
49
- await this.insertNonRevertiblesFromPrivate(context, tx);
50
- const processedPhases = [];
51
- if (context.hasPhase(TxExecutionPhase.SETUP)) {
52
- // This will throw if the setup phase reverts.
53
- // In that case the transaction will be thrown out.
54
- const setupResult = await this.simulatePhase(TxExecutionPhase.SETUP, context);
55
- if (setupResult.reverted) {
56
- throw new Error(`Setup phase reverted! The transaction will be thrown out. ${setupResult.revertReason?.message}`);
57
- }
58
- processedPhases.push(setupResult);
78
+ const setupResult = await this.simulatePhase(TxExecutionPhase.SETUP, context);
79
+ if (setupResult.reverted) {
80
+ throw new Error(`[SETUP] UNRECOVERABLE ERROR! The transaction will be thrown out. ${setupResult.revertReason?.message}`);
59
81
  }
60
- // The checkpoint we should go back to if anything from now on reverts.
61
- await context.state.fork();
62
- try {
63
- // This will throw if there is a nullifier collision.
64
- await this.insertRevertiblesFromPrivate(context, tx);
65
- // Only proceed with app logic if there was no revert during revertible insertion.
66
- if (context.hasPhase(TxExecutionPhase.APP_LOGIC)) {
67
- const appLogicResult = await this.simulatePhase(TxExecutionPhase.APP_LOGIC, context);
68
- processedPhases.push(appLogicResult);
69
- if (appLogicResult.reverted) {
70
- throw new Error(`App logic phase reverted! ${appLogicResult.revertReason?.message}`);
71
- }
82
+ processedPhases.push(setupResult);
83
+ }
84
+ // The checkpoint we should go back to if anything from now on reverts.
85
+ await context.state.fork();
86
+ hintingContractsDB.createCheckpoint();
87
+ try {
88
+ // This will throw if there is a nullifier collision or other insertion error (limit reached).
89
+ await this.insertRevertiblesFromPrivate(context);
90
+ // Only proceed with app logic if there was no revert during revertible insertion.
91
+ if (context.hasPhase(TxExecutionPhase.APP_LOGIC)) {
92
+ const appLogicResult = await this.simulatePhase(TxExecutionPhase.APP_LOGIC, context);
93
+ processedPhases.push(appLogicResult);
94
+ if (appLogicResult.reverted) {
95
+ throw new TxSimAppLogicRevert();
72
96
  }
73
- } catch (e) {
74
- this.log.debug(String(e));
97
+ }
98
+ } catch (e) {
99
+ if (e instanceof TxSimRevertibleInsertionsRevert || e instanceof TxSimAppLogicRevert) {
75
100
  // We revert to the post-setup state.
76
101
  await context.state.discardForkedState();
102
+ hintingContractsDB.revertCheckpoint();
77
103
  // But we also create a new fork so that the teardown phase can transparently
78
104
  // commit or rollback at the end of teardown.
79
105
  await context.state.fork();
106
+ hintingContractsDB.createCheckpoint();
107
+ } else {
108
+ // Unchecked/unknown error - re-throw as-is
109
+ throw e;
80
110
  }
81
- try {
82
- if (context.hasPhase(TxExecutionPhase.TEARDOWN)) {
83
- const teardownResult = await this.simulatePhase(TxExecutionPhase.TEARDOWN, context);
84
- processedPhases.push(teardownResult);
85
- if (teardownResult.reverted) {
86
- throw new Error(`Teardown phase reverted! ${teardownResult.revertReason?.message}`);
87
- }
111
+ }
112
+ try {
113
+ if (context.hasPhase(TxExecutionPhase.TEARDOWN)) {
114
+ const teardownResult = await this.simulatePhase(TxExecutionPhase.TEARDOWN, context);
115
+ processedPhases.push(teardownResult);
116
+ if (teardownResult.reverted) {
117
+ throw new TxSimTeardownRevert();
88
118
  }
89
- // We commit the forked state and we are done.
90
- await context.state.mergeForkedState();
91
- } catch (e) {
92
- this.log.debug(String(e));
93
- // We rollback to the post-setup state.
94
- await context.state.discardForkedState();
95
119
  }
96
- context.halt();
97
- if (context.getActualGasUsed().l2Gas > AVM_MAX_PROCESSABLE_L2_GAS) {
98
- throw new Error(`Transaction consumes ${context.getActualGasUsed().l2Gas} L2 gas, which exceeds the AVM maximum processable gas of ${AVM_MAX_PROCESSABLE_L2_GAS}`);
120
+ // We commit the forked state and we are done.
121
+ await context.state.mergeForkedState();
122
+ hintingContractsDB.commitCheckpoint();
123
+ } catch (e) {
124
+ if (e instanceof TxSimTeardownRevert) {
125
+ // We revert to the post-setup state and we are done.
126
+ await context.state.discardForkedState();
127
+ hintingContractsDB.revertCheckpoint();
128
+ } else {
129
+ // Unchecked/unknown error - re-throw as-is
130
+ throw e;
99
131
  }
100
- await this.payFee(context);
101
- const publicInputs = await context.generateAvmCircuitPublicInputs();
102
- const avmProvingRequest = PublicTxSimulator.generateProvingRequest(publicInputs, hints);
103
- const revertCode = context.getFinalRevertCode();
104
- // Commit contracts from this TX to the block-level cache and clear tx cache
105
- // If the tx reverted, only commit non-revertible contracts
106
- // NOTE: You can't create contracts in public, so this is only relevant for private-created contracts
107
- // FIXME(fcarreiro): this should conceptually use the hinted contracts db.
108
- // However things should work as they are now because the hinted db would still pick up the new contracts.
109
- this.contractsDB.commitContractsForTx(/*onlyNonRevertibles=*/ !revertCode.isOK());
110
- return {
111
- avmProvingRequest,
112
- gasUsed: {
113
- totalGas: context.getActualGasUsed(),
114
- teardownGas: context.teardownGasUsed,
115
- publicGas: context.getActualPublicGasUsed(),
116
- billedGas: context.getTotalGasUsed()
117
- },
118
- revertCode,
119
- revertReason: context.revertReason,
120
- processedPhases: processedPhases
121
- };
122
- } finally{
123
- // Make sure there are no new contracts in the tx-level cache.
124
- // They should either be committed to block-level cache or cleared.
125
- // FIXME(fcarreiro): this should conceptually use the hinted contracts db.
126
- // However things should work as they are now because the hinted db would still pick up the new contracts.
127
- this.contractsDB.clearContractsForTx();
128
132
  }
133
+ context.halt();
134
+ // Such transactions should be filtered by GasTxValidator.
135
+ assert(context.getActualGasUsed().l2Gas <= AVM_MAX_PROCESSABLE_L2_GAS, `Transaction consumes ${context.getActualGasUsed().l2Gas} L2 gas, which exceeds the AVM maximum processable gas of ${AVM_MAX_PROCESSABLE_L2_GAS}`);
136
+ await this.payFee(context);
137
+ const publicInputs = await context.generateAvmCircuitPublicInputs();
138
+ const revertCode = context.getFinalRevertCode();
139
+ // We only return the app logic phase information, and only 1 per phase.
140
+ const appLogicReturnValues = processedPhases.find(({ phase })=>phase === TxExecutionPhase.APP_LOGIC)?.returnValues ?? [];
141
+ // TODO(fcarreiro): This is a temporary backwards compatibility layer until we migrate to the C++ simulator.
142
+ if (context.revertReason !== undefined) {
143
+ appLogicReturnValues.revertReason = context.revertReason;
144
+ }
145
+ // Create PublicTxEffect from PublicInputs.
146
+ const publicTxEffect = new PublicTxEffect(publicInputs.transactionFee, publicInputs.accumulatedData.noteHashes.filter((h)=>!h.isEmpty()), publicInputs.accumulatedData.nullifiers.filter((n)=>!n.isEmpty()), publicInputs.accumulatedData.l2ToL1Msgs.filter((m)=>!m.isEmpty()), publicInputs.accumulatedData.publicLogs.toLogs(), publicInputs.accumulatedData.publicDataWrites.filter((w)=>!w.isEmpty()));
147
+ return new PublicTxResult(/*gasUsed=*/ {
148
+ totalGas: context.getActualGasUsed(),
149
+ teardownGas: context.teardownGasUsed,
150
+ publicGas: context.getActualPublicGasUsed(),
151
+ billedGas: context.getTotalGasUsed()
152
+ }, /*revertCode=*/ revertCode, /*publicTxEffect=*/ publicTxEffect, /*callStackMetadata=*/ appLogicReturnValues, /*logs=*/ context.state.getActiveStateManager().getLogs(), /*hints=*/ hints, /*publicInputs=*/ publicInputs);
129
153
  }
130
154
  computeTxHash(tx) {
131
155
  return tx.getTxHash();
@@ -179,7 +203,7 @@ export class PublicTxSimulator {
179
203
  context.consumeGas(phase, gasUsed);
180
204
  this.log.debug(`Simulated enqueued public call (${fnName}) consumed ${gasUsed.l2Gas} L2 gas ending with ${result.gasLeft.l2Gas} L2 gas left.`);
181
205
  if (result.reverted) {
182
- const culprit = `${contractAddress}:${callRequest.functionSelector}`;
206
+ const culprit = `${contractAddress}:${fnName}`;
183
207
  context.revert(phase, result.revertReason, culprit);
184
208
  }
185
209
  return result;
@@ -200,13 +224,13 @@ export class PublicTxSimulator {
200
224
  const address = request.contractAddress;
201
225
  const sender = request.msgSender;
202
226
  this.log.debug(`Executing enqueued public call to external function ${fnName}@${address} with ${allocatedGas.l2Gas} allocated L2 gas.`);
203
- const simulator = await AvmSimulator.create(stateManager, address, sender, transactionFee, this.globalVariables, request.isStaticCall, calldata, allocatedGas, this.clientInitiatedSimulation);
227
+ const simulator = await AvmSimulator.create(stateManager, address, sender, transactionFee, this.globalVariables, request.isStaticCall, calldata, allocatedGas, this.config);
204
228
  const avmCallResult = await simulator.execute();
205
229
  return avmCallResult.finalize();
206
230
  }
207
231
  /**
208
232
  * Insert the non-revertible accumulated data from private into the public state.
209
- */ async insertNonRevertiblesFromPrivate(context, tx) {
233
+ */ async insertNonRevertiblesFromPrivate(context) {
210
234
  const stateManager = context.state.getActiveStateManager();
211
235
  for (const siloedNullifier of context.nonRevertibleAccumulatedDataFromPrivate.nullifiers.filter((n)=>!n.isEmpty())){
212
236
  await stateManager.writeSiloedNullifier(siloedNullifier);
@@ -221,46 +245,81 @@ export class PublicTxSimulator {
221
245
  stateManager.writeScopedL2ToL1Message(l2ToL1Message);
222
246
  }
223
247
  }
224
- // add new contracts to the contracts db so that their functions may be found and called
225
- // TODO(#6464): Should we allow emitting contracts in the private setup phase?
226
- // FIXME(fcarreiro): this should conceptually use the hinted contracts db.
227
- // However things should work as they are now because the hinted db would still pick up the new contracts.
228
- await this.contractsDB.addNewNonRevertibleContracts(tx);
248
+ // add new contracts to the contracts db so that their code may be found and called
249
+ // FIXME(fcarreiro): this should conceptually use the hinting contracts db.
250
+ // However, things work as expected because later calls to getters on the hintingContractsDB
251
+ // will pick up the new contracts and will generate the necessary hints.
252
+ // So, a consumer of the hints will always see the new contracts.
253
+ await this.contractsDB.addContracts(context.nonRevertibleContractDeploymentData);
229
254
  }
230
255
  /**
231
256
  * Insert the revertible accumulated data from private into the public state.
232
- * Start by forking state so we can rollback to the end of setup if app logic or teardown reverts.
233
- */ async insertRevertiblesFromPrivate(context, tx) {
257
+ * Throws TxSimRevertibleInsertionsRevert if there is some checked error during revertible insertions.
258
+ * This function checks for the following errors:
259
+ * - NullifierLimitReachedError
260
+ * - NullifierCollisionError
261
+ * - NoteHashLimitReachedError
262
+ * - L2ToL1MessageLimitReachedError
263
+ */ async insertRevertiblesFromPrivate(context) {
234
264
  const stateManager = context.state.getActiveStateManager();
235
265
  try {
236
266
  for (const siloedNullifier of context.revertibleAccumulatedDataFromPrivate.nullifiers.filter((n)=>!n.isEmpty())){
237
267
  await stateManager.writeSiloedNullifier(siloedNullifier);
238
268
  }
239
269
  } catch (e) {
240
- context.revert(TxExecutionPhase.APP_LOGIC, new SimulationError(`Nullifier collision encountered when inserting revertible nullifiers from private.\nDetails: ${String(e)}`, []));
241
- throw e;
270
+ if (e instanceof NullifierLimitReachedError || e instanceof NullifierCollisionError) {
271
+ context.revert(TxExecutionPhase.APP_LOGIC, new SimulationError(`Error encountered when inserting revertible nullifiers from private.\nDetails: ${e.message}`, []));
272
+ throw new TxSimRevertibleInsertionsRevert();
273
+ } else {
274
+ // Unchecked/unknown error - re-throw as-is
275
+ throw e;
276
+ }
242
277
  }
243
- for (const noteHash of context.revertibleAccumulatedDataFromPrivate.noteHashes){
244
- if (!noteHash.isEmpty()) {
245
- // Revertible note hashes from private are not hashed with nonce, since private can't know their final position, only we can.
246
- await stateManager.writeSiloedNoteHash(noteHash);
278
+ try {
279
+ for (const noteHash of context.revertibleAccumulatedDataFromPrivate.noteHashes){
280
+ if (!noteHash.isEmpty()) {
281
+ // Revertible note hashes from private are not hashed with nonce, since private can't know their final position, only we can.
282
+ await stateManager.writeSiloedNoteHash(noteHash);
283
+ }
284
+ }
285
+ } catch (e) {
286
+ if (e instanceof NoteHashLimitReachedError) {
287
+ context.revert(TxExecutionPhase.APP_LOGIC, new SimulationError(`Error encountered when inserting revertible note hashes from private.\nDetails: ${e.message}`, []));
288
+ throw new TxSimRevertibleInsertionsRevert();
289
+ } else {
290
+ // Unchecked/unknown error - re-throw as-is
291
+ throw e;
247
292
  }
248
293
  }
249
- for (const l2ToL1Message of context.revertibleAccumulatedDataFromPrivate.l2ToL1Msgs){
250
- if (!l2ToL1Message.isEmpty()) {
251
- stateManager.writeScopedL2ToL1Message(l2ToL1Message);
294
+ try {
295
+ for (const l2ToL1Message of context.revertibleAccumulatedDataFromPrivate.l2ToL1Msgs){
296
+ if (!l2ToL1Message.isEmpty()) {
297
+ stateManager.writeScopedL2ToL1Message(l2ToL1Message);
298
+ }
299
+ }
300
+ } catch (e) {
301
+ if (e instanceof L2ToL1MessageLimitReachedError) {
302
+ context.revert(TxExecutionPhase.APP_LOGIC, new SimulationError(`Error encountered when inserting revertible L2-to-L1 messages from private.\nDetails: ${e.message}`, []));
303
+ throw new TxSimRevertibleInsertionsRevert();
304
+ } else {
305
+ // Unchecked/unknown error - re-throw as-is
306
+ throw e;
252
307
  }
253
308
  }
254
309
  // add new contracts to the contracts db so that their functions may be found and called
255
- // FIXME(fcarreiro): this should conceptually use the hinted contracts db.
256
- // However things should work as they are now because the hinted db would still pick up the new contracts.
257
- await this.contractsDB.addNewRevertibleContracts(tx);
258
- return /*success=*/ true;
310
+ // FIXME(fcarreiro): this should conceptually use the hinting contracts db.
311
+ // However, things work as expected because later calls to getters on the hintingContractsDB
312
+ // will pick up the new contracts and will generate the necessary hints.
313
+ // So, a consumer of the hints will always see the new contracts.
314
+ await this.contractsDB.addContracts(context.revertibleContractDeploymentData);
259
315
  }
260
316
  async payFee(context) {
261
317
  const txFee = context.getTransactionFee(TxExecutionPhase.TEARDOWN);
262
318
  if (context.feePayer.isZero()) {
263
- this.log.debug(`No one is paying the fee of ${txFee.toBigInt()}`);
319
+ // Real transactions are enforced by private kernel to have nonzero fee payer.
320
+ // Real transactions cannot skip fee enforcement (skipping fee enforcement makes them unprovable).
321
+ assert(this.config.skipFeeEnforcement, 'Fee payer cannot be 0 unless skipping fee enforcement for simulation');
322
+ this.log.debug(`Fee payer is 0. Skipping fee enforcement. No one is paying the fee of ${txFee.toBigInt()}`);
264
323
  return;
265
324
  }
266
325
  const feeJuiceAddress = ProtocolContractAddress.FeeJuice;
@@ -271,21 +330,13 @@ export class PublicTxSimulator {
271
330
  // We allow to fake the balance of the fee payer to allow fee estimation
272
331
  // When mocking the balance of the fee payer, the circuit should not be able to prove the simulation
273
332
  if (currentBalance.lt(txFee)) {
274
- if (!this.skipFeeEnforcement) {
275
- throw new Error(`Not enough balance for fee payer to pay for transaction (got ${currentBalance.toBigInt()} needs ${txFee.toBigInt()})`);
276
- } else {
277
- currentBalance = txFee;
278
- }
333
+ // Without "skipFeeEnforcement", such transactions should be filtered by GasTxValidator.
334
+ assert(this.config.skipFeeEnforcement, `Not enough balance for fee payer to pay for transaction (got ${currentBalance.toBigInt()} needs ${txFee.toBigInt()})`);
335
+ this.log.debug(`Fee payer balance insufficient, but we're skipping fee enforcement`);
336
+ // We still proceed and perform the storage write to minimize deviation from normal execution.
337
+ currentBalance = txFee;
279
338
  }
280
339
  const updatedBalance = currentBalance.sub(txFee);
281
340
  await stateManager.writeStorage(feeJuiceAddress, balanceSlot, updatedBalance, true);
282
341
  }
283
- /**
284
- * Generate the proving request for the AVM circuit.
285
- */ static generateProvingRequest(publicInputs, hints) {
286
- return {
287
- type: ProvingRequestType.PUBLIC_VM,
288
- inputs: new AvmCircuitInputs(hints, publicInputs)
289
- };
290
- }
291
342
  }
@@ -0,0 +1,32 @@
1
+ import type { PublicTxResult } from '@aztec/stdlib/avm';
2
+ import type { Tx } from '@aztec/stdlib/tx';
3
+ export interface PublicTxSimulatorInterface {
4
+ simulate(tx: Tx): Promise<PublicTxResult>;
5
+ /**
6
+ * Cancel the current simulation if one is in progress.
7
+ * This signals the underlying simulator (e.g., C++) to stop at the next safe point.
8
+ * Safe to call even if no simulation is in progress.
9
+ * Optional - not all implementations support cancellation.
10
+ *
11
+ * @param waitTimeoutMs - If provided, wait up to this many ms for the simulation to actually stop.
12
+ * This is important because signaling cancellation doesn't immediately stop C++ -
13
+ * it only sets a flag that C++ checks at certain points. If C++ is in the middle
14
+ * of a slow operation (e.g., pad_trees), it won't stop until that completes.
15
+ * @returns Promise that resolves when cancellation is signaled (and optionally when simulation stops)
16
+ */
17
+ cancel?(waitTimeoutMs?: number): Promise<void>;
18
+ }
19
+ export interface MeasuredPublicTxSimulatorInterface {
20
+ simulate(tx: Tx, txLabel: string): Promise<PublicTxResult>;
21
+ /**
22
+ * Cancel the current simulation if one is in progress.
23
+ * This signals the underlying simulator (e.g., C++) to stop at the next safe point.
24
+ * Safe to call even if no simulation is in progress.
25
+ * Optional - not all implementations support cancellation.
26
+ *
27
+ * @param waitTimeoutMs - If provided, wait up to this many ms for the simulation to actually stop.
28
+ * @returns Promise that resolves when cancellation is signaled (and optionally when simulation stops)
29
+ */
30
+ cancel?(waitTimeoutMs?: number): Promise<void>;
31
+ }
32
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljX3R4X3NpbXVsYXRvcl9pbnRlcmZhY2UuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9wdWJsaWMvcHVibGljX3R4X3NpbXVsYXRvci9wdWJsa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C,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAChD;AAED,MAAM,WAAW,kCAAkC;IACjD,QAAQ,CAAC,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAC3D;;;;;;;;OAQG;IACH,MAAM,CAAC,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAChD"}
@@ -1,4 +1,5 @@
1
- import type { Fr } from '@aztec/foundation/fields';
1
+ import type { Fr } from '@aztec/foundation/curves/bn254';
2
+ import type { PublicSimulatorConfig } from '@aztec/stdlib/avm';
2
3
  import type { Gas } from '@aztec/stdlib/gas';
3
4
  import type { MerkleTreeWriteOperations } from '@aztec/stdlib/trees';
4
5
  import { type GlobalVariables, PublicCallRequestWithCalldata, TxExecutionPhase } from '@aztec/stdlib/tx';
@@ -13,8 +14,8 @@ import { PublicTxContext } from './public_tx_context.js';
13
14
  */
14
15
  export declare class TelemetryPublicTxSimulator extends MeasuredPublicTxSimulator {
15
16
  readonly tracer: Tracer;
16
- constructor(merkleTree: MerkleTreeWriteOperations, contractsDB: PublicContractsDB, globalVariables: GlobalVariables, doMerkleOperations?: boolean, skipFeeEnforcement?: boolean, clientInitiatedSimulation?: boolean, telemetryClient?: TelemetryClient);
17
+ constructor(merkleTree: MerkleTreeWriteOperations, contractsDB: PublicContractsDB, globalVariables: GlobalVariables, telemetryClient?: TelemetryClient, config?: Partial<PublicSimulatorConfig>);
17
18
  protected simulateEnqueuedCall(phase: TxExecutionPhase, context: PublicTxContext, callRequest: PublicCallRequestWithCalldata): Promise<AvmFinalizedCallResult>;
18
19
  protected simulateEnqueuedCallInternal(stateManager: PublicPersistableStateManager, callRequest: PublicCallRequestWithCalldata, allocatedGas: Gas, transactionFee: Fr, fnName: string): Promise<AvmFinalizedCallResult>;
19
20
  }
20
- //# sourceMappingURL=telemetry_public_tx_simulator.d.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CQUFhLDBCQUEyQixTQUFRLHlCQUF5QjtJQUV2RSxTQUFnQixNQUFNLEVBQUUsTUFBTSxDQUFDO0lBRS9CLFlBQ0UsVUFBVSxFQUFFLHlCQUF5QixFQUNyQyxXQUFXLEVBQUUsaUJBQWlCLEVBQzlCLGVBQWUsRUFBRSxlQUFlLEVBQ2hDLGVBQWUsR0FBRSxlQUFzQyxFQUN2RCxNQUFNLENBQUMsRUFBRSxPQUFPLENBQUMscUJBQXFCLENBQUMsRUFLeEM7SUFFRCxVQU15QixvQkFBb0IsQ0FDM0MsS0FBSyxFQUFFLGdCQUFnQixFQUN2QixPQUFPLEVBQUUsZUFBZSxFQUN4QixXQUFXLEVBQUUsNkJBQTZCLEdBQ3pDLE9BQU8sQ0FBQyxzQkFBc0IsQ0FBQyxDQUVqQztJQUVELFVBTXlCLDRCQUE0QixDQUNuRCxZQUFZLEVBQUUsNkJBQTZCLEVBQzNDLFdBQVcsRUFBRSw2QkFBNkIsRUFDMUMsWUFBWSxFQUFFLEdBQUcsRUFDakIsY0FBYyxFQUFFLEVBQUUsRUFDbEIsTUFBTSxFQUFFLE1BQU0sR0FDYixPQUFPLENBQUMsc0JBQXNCLENBQUMsQ0FFakM7Q0FDRiJ9
@@ -1 +1 @@
1
- {"version":3,"file":"telemetry_public_tx_simulator.d.ts","sourceRoot":"","sources":["../../../src/public/public_tx_simulator/telemetry_public_tx_simulator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAE,KAAK,eAAe,EAAE,6BAA6B,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzG,OAAO,EAAc,KAAK,eAAe,EAAE,KAAK,MAAM,EAAiC,MAAM,yBAAyB,CAAC;AAEvH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAEjF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,mCAAmC,CAAC;AACvF,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD;;GAEG;AACH,qBAAa,0BAA2B,SAAQ,yBAAyB;IAEvE,SAAgB,MAAM,EAAE,MAAM,CAAC;gBAG7B,UAAU,EAAE,yBAAyB,EACrC,WAAW,EAAE,iBAAiB,EAC9B,eAAe,EAAE,eAAe,EAChC,kBAAkB,GAAE,OAAe,EACnC,kBAAkB,GAAE,OAAe,EACnC,yBAAyB,GAAE,OAAe,EAC1C,eAAe,GAAE,eAAsC;cAqBhC,oBAAoB,CAC3C,KAAK,EAAE,gBAAgB,EACvB,OAAO,EAAE,eAAe,EACxB,WAAW,EAAE,6BAA6B,GACzC,OAAO,CAAC,sBAAsB,CAAC;cAUT,4BAA4B,CACnD,YAAY,EAAE,6BAA6B,EAC3C,WAAW,EAAE,6BAA6B,EAC1C,YAAY,EAAE,GAAG,EACjB,cAAc,EAAE,EAAE,EAClB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,sBAAsB,CAAC;CAGnC"}
1
+ {"version":3,"file":"telemetry_public_tx_simulator.d.ts","sourceRoot":"","sources":["../../../src/public/public_tx_simulator/telemetry_public_tx_simulator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAE,KAAK,eAAe,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