@aztec/simulator 0.0.1-commit.a072138 → 0.0.1-commit.a4600f49

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 (358) hide show
  1. package/README.md +4 -4
  2. package/dest/client.d.ts +1 -3
  3. package/dest/client.d.ts.map +1 -1
  4. package/dest/client.js +0 -2
  5. package/dest/private/acvm_wasm.d.ts +1 -1
  6. package/dest/private/acvm_wasm.d.ts.map +1 -1
  7. package/dest/private/acvm_wasm.js +3 -1
  8. package/dest/private/circuit_recording/circuit_recorder.d.ts +36 -23
  9. package/dest/private/circuit_recording/circuit_recorder.d.ts.map +1 -1
  10. package/dest/private/circuit_recording/circuit_recorder.js +65 -69
  11. package/dest/private/circuit_recording/file_circuit_recorder.d.ts +7 -19
  12. package/dest/private/circuit_recording/file_circuit_recorder.d.ts.map +1 -1
  13. package/dest/private/circuit_recording/file_circuit_recorder.js +38 -42
  14. package/dest/private/circuit_recording/simulator_recorder_wrapper.d.ts +1 -1
  15. package/dest/private/circuit_recording/simulator_recorder_wrapper.d.ts.map +1 -1
  16. package/dest/private/circuit_recording/simulator_recorder_wrapper.js +11 -14
  17. package/dest/public/avm/testing/account_proof_fetcher.d.ts +2 -0
  18. package/dest/public/avm/testing/account_proof_fetcher.d.ts.map +1 -0
  19. package/dest/public/avm/testing/account_proof_fetcher.js +152 -0
  20. package/dest/public/avm/{fixtures → testing}/base_avm_simulation_tester.d.ts +2 -1
  21. package/dest/public/avm/testing/base_avm_simulation_tester.d.ts.map +1 -0
  22. package/dest/public/avm/{fixtures → testing}/base_avm_simulation_tester.js +18 -3
  23. package/dest/public/avm/testing/utils.d.ts +32 -0
  24. package/dest/public/avm/testing/utils.d.ts.map +1 -0
  25. package/dest/public/avm/{fixtures → testing}/utils.js +4 -34
  26. package/dest/public/avm_simulator.d.ts +28 -0
  27. package/dest/public/avm_simulator.d.ts.map +1 -0
  28. package/dest/public/avm_simulator.js +4 -0
  29. package/dest/public/avm_simulator_pool.d.ts +45 -0
  30. package/dest/public/avm_simulator_pool.d.ts.map +1 -0
  31. package/dest/public/avm_simulator_pool.js +197 -0
  32. package/dest/public/cdb/generated/api_types.d.ts +171 -0
  33. package/dest/public/cdb/generated/api_types.d.ts.map +1 -0
  34. package/dest/public/cdb/generated/api_types.js +314 -0
  35. package/dest/public/cdb/generated/server.d.ts +26 -0
  36. package/dest/public/cdb/generated/server.d.ts.map +1 -0
  37. package/dest/public/cdb/generated/server.js +135 -0
  38. package/dest/public/cdb_ipc_server.d.ts +33 -0
  39. package/dest/public/cdb_ipc_server.d.ts.map +1 -0
  40. package/dest/public/cdb_ipc_server.js +153 -0
  41. package/dest/public/contracts_db_checkpoint.d.ts +2 -2
  42. package/dest/public/contracts_db_checkpoint.d.ts.map +1 -1
  43. package/dest/public/contracts_db_checkpoint.js +1 -1
  44. package/dest/public/fixtures/amm_test.js +4 -4
  45. package/dest/public/fixtures/bulk_test.d.ts +1 -1
  46. package/dest/public/fixtures/bulk_test.d.ts.map +1 -1
  47. package/dest/public/fixtures/bulk_test.js +33 -6
  48. package/dest/public/fixtures/custom_bytecode_tester.d.ts +1 -1
  49. package/dest/public/fixtures/custom_bytecode_tester.d.ts.map +1 -1
  50. package/dest/public/fixtures/custom_bytecode_tester.js +2 -2
  51. package/dest/public/fixtures/index.d.ts +2 -4
  52. package/dest/public/fixtures/index.d.ts.map +1 -1
  53. package/dest/public/fixtures/index.js +1 -3
  54. package/dest/public/fixtures/public_processor_test_env.d.ts +30 -0
  55. package/dest/public/fixtures/public_processor_test_env.d.ts.map +1 -0
  56. package/dest/public/fixtures/public_processor_test_env.js +73 -0
  57. package/dest/public/fixtures/public_tx_simulation_tester.d.ts +12 -7
  58. package/dest/public/fixtures/public_tx_simulation_tester.d.ts.map +1 -1
  59. package/dest/public/fixtures/public_tx_simulation_tester.js +32 -15
  60. package/dest/public/fixtures/simple_contract_data_source.js +1 -1
  61. package/dest/public/fixtures/token_test.js +3 -3
  62. package/dest/public/fixtures/utils.d.ts +2 -2
  63. package/dest/public/fixtures/utils.d.ts.map +1 -1
  64. package/dest/public/fixtures/utils.js +21 -20
  65. package/dest/public/fuzzing/avm_fuzzer_simulator.d.ts +11 -4
  66. package/dest/public/fuzzing/avm_fuzzer_simulator.d.ts.map +1 -1
  67. package/dest/public/fuzzing/avm_fuzzer_simulator.js +24 -10
  68. package/dest/public/fuzzing/avm_simulator_bin.js +4 -4
  69. package/dest/public/index.d.ts +5 -2
  70. package/dest/public/index.d.ts.map +1 -1
  71. package/dest/public/index.js +2 -1
  72. package/dest/public/public_db_sources.d.ts +6 -3
  73. package/dest/public/public_db_sources.d.ts.map +1 -1
  74. package/dest/public/public_db_sources.js +16 -10
  75. package/dest/public/public_processor/guarded_merkle_tree.d.ts +8 -7
  76. package/dest/public/public_processor/guarded_merkle_tree.d.ts.map +1 -1
  77. package/dest/public/public_processor/guarded_merkle_tree.js +8 -5
  78. package/dest/public/public_processor/public_processor.d.ts +15 -8
  79. package/dest/public/public_processor/public_processor.d.ts.map +1 -1
  80. package/dest/public/public_processor/public_processor.js +117 -78
  81. package/dest/public/public_processor/public_processor_metrics.d.ts +4 -1
  82. package/dest/public/public_processor/public_processor_metrics.d.ts.map +1 -1
  83. package/dest/public/public_processor/public_processor_metrics.js +8 -0
  84. package/dest/public/public_tx_simulator/dumping_public_tx_simulator.d.ts +17 -0
  85. package/dest/public/public_tx_simulator/dumping_public_tx_simulator.d.ts.map +1 -0
  86. package/dest/public/public_tx_simulator/{dumping_cpp_public_tx_simulator.js → dumping_public_tx_simulator.js} +10 -23
  87. package/dest/public/public_tx_simulator/factories.d.ts +8 -8
  88. package/dest/public/public_tx_simulator/factories.d.ts.map +1 -1
  89. package/dest/public/public_tx_simulator/factories.js +9 -9
  90. package/dest/public/public_tx_simulator/index.d.ts +4 -6
  91. package/dest/public/public_tx_simulator/index.d.ts.map +1 -1
  92. package/dest/public/public_tx_simulator/index.js +2 -4
  93. package/dest/public/public_tx_simulator/public_tx_simulator.d.ts +42 -71
  94. package/dest/public/public_tx_simulator/public_tx_simulator.d.ts.map +1 -1
  95. package/dest/public/public_tx_simulator/public_tx_simulator.js +98 -318
  96. package/dest/public/public_tx_simulator/public_tx_simulator_base.d.ts +24 -0
  97. package/dest/public/public_tx_simulator/public_tx_simulator_base.d.ts.map +1 -0
  98. package/dest/public/public_tx_simulator/public_tx_simulator_base.js +31 -0
  99. package/dest/public/public_tx_simulator/public_tx_simulator_interface.d.ts +5 -5
  100. package/package.json +22 -19
  101. package/src/client.ts +0 -2
  102. package/src/private/acvm_wasm.ts +4 -1
  103. package/src/private/circuit_recording/circuit_recorder.ts +84 -78
  104. package/src/private/circuit_recording/file_circuit_recorder.ts +38 -48
  105. package/src/private/circuit_recording/simulator_recorder_wrapper.ts +9 -15
  106. package/src/public/avm/testing/account_proof.json +553 -0
  107. package/src/public/avm/testing/account_proof_fetcher.ts +166 -0
  108. package/src/public/avm/{fixtures → testing}/base_avm_simulation_tester.ts +23 -3
  109. package/src/public/avm/{fixtures → testing}/utils.ts +4 -40
  110. package/src/public/avm_simulator.ts +29 -0
  111. package/src/public/avm_simulator_pool.ts +226 -0
  112. package/src/public/cdb/generated/api_types.ts +457 -0
  113. package/src/public/cdb/generated/server.ts +109 -0
  114. package/src/public/cdb_ipc_server.ts +197 -0
  115. package/src/public/contracts_db_checkpoint.ts +1 -1
  116. package/src/public/fixtures/amm_test.ts +4 -4
  117. package/src/public/fixtures/bulk_test.ts +31 -6
  118. package/src/public/fixtures/custom_bytecode_tester.ts +2 -2
  119. package/src/public/fixtures/index.ts +1 -3
  120. package/src/public/fixtures/public_processor_test_env.ts +88 -0
  121. package/src/public/fixtures/public_tx_simulation_tester.ts +45 -18
  122. package/src/public/fixtures/simple_contract_data_source.ts +1 -1
  123. package/src/public/fixtures/token_test.ts +3 -3
  124. package/src/public/fixtures/utils.ts +23 -24
  125. package/src/public/fuzzing/avm_fuzzer_simulator.ts +26 -11
  126. package/src/public/fuzzing/avm_simulator_bin.ts +3 -5
  127. package/src/public/index.ts +7 -3
  128. package/src/public/public_db_sources.ts +21 -14
  129. package/src/public/public_processor/guarded_merkle_tree.ts +11 -8
  130. package/src/public/public_processor/public_processor.ts +154 -98
  131. package/src/public/public_processor/public_processor_metrics.ts +12 -0
  132. package/src/public/public_tx_simulator/{dumping_cpp_public_tx_simulator.ts → dumping_public_tx_simulator.ts} +15 -31
  133. package/src/public/public_tx_simulator/factories.ts +29 -11
  134. package/src/public/public_tx_simulator/index.ts +6 -5
  135. package/src/public/public_tx_simulator/public_tx_simulator.ts +139 -476
  136. package/src/public/public_tx_simulator/public_tx_simulator_base.ts +37 -0
  137. package/src/public/public_tx_simulator/public_tx_simulator_interface.ts +5 -5
  138. package/dest/public/avm/avm_context.d.ts +0 -41
  139. package/dest/public/avm/avm_context.d.ts.map +0 -1
  140. package/dest/public/avm/avm_context.js +0 -44
  141. package/dest/public/avm/avm_contract_call_result.d.ts +0 -32
  142. package/dest/public/avm/avm_contract_call_result.d.ts.map +0 -1
  143. package/dest/public/avm/avm_contract_call_result.js +0 -54
  144. package/dest/public/avm/avm_execution_environment.d.ts +0 -24
  145. package/dest/public/avm/avm_execution_environment.d.ts.map +0 -1
  146. package/dest/public/avm/avm_execution_environment.js +0 -33
  147. package/dest/public/avm/avm_gas.d.ts +0 -44
  148. package/dest/public/avm/avm_gas.d.ts.map +0 -1
  149. package/dest/public/avm/avm_gas.js +0 -195
  150. package/dest/public/avm/avm_machine_state.d.ts +0 -98
  151. package/dest/public/avm/avm_machine_state.d.ts.map +0 -1
  152. package/dest/public/avm/avm_machine_state.js +0 -110
  153. package/dest/public/avm/avm_memory_types.d.ts +0 -275
  154. package/dest/public/avm/avm_memory_types.d.ts.map +0 -1
  155. package/dest/public/avm/avm_memory_types.js +0 -354
  156. package/dest/public/avm/avm_simulator.d.ts +0 -41
  157. package/dest/public/avm/avm_simulator.d.ts.map +0 -1
  158. package/dest/public/avm/avm_simulator.js +0 -192
  159. package/dest/public/avm/avm_simulator_interface.d.ts +0 -9
  160. package/dest/public/avm/avm_simulator_interface.d.ts.map +0 -1
  161. package/dest/public/avm/avm_simulator_interface.js +0 -3
  162. package/dest/public/avm/calldata.d.ts +0 -51
  163. package/dest/public/avm/calldata.d.ts.map +0 -1
  164. package/dest/public/avm/calldata.js +0 -63
  165. package/dest/public/avm/errors.d.ts +0 -104
  166. package/dest/public/avm/errors.d.ts.map +0 -1
  167. package/dest/public/avm/errors.js +0 -141
  168. package/dest/public/avm/fixtures/avm_simulation_tester.d.ts +0 -22
  169. package/dest/public/avm/fixtures/avm_simulation_tester.d.ts.map +0 -1
  170. package/dest/public/avm/fixtures/avm_simulation_tester.js +0 -84
  171. package/dest/public/avm/fixtures/base_avm_simulation_tester.d.ts.map +0 -1
  172. package/dest/public/avm/fixtures/initializers.d.ts +0 -42
  173. package/dest/public/avm/fixtures/initializers.d.ts.map +0 -1
  174. package/dest/public/avm/fixtures/initializers.js +0 -45
  175. package/dest/public/avm/fixtures/utils.d.ts +0 -39
  176. package/dest/public/avm/fixtures/utils.d.ts.map +0 -1
  177. package/dest/public/avm/index.d.ts +0 -2
  178. package/dest/public/avm/index.d.ts.map +0 -1
  179. package/dest/public/avm/index.js +0 -1
  180. package/dest/public/avm/opcodes/accrued_substate.d.ts +0 -74
  181. package/dest/public/avm/opcodes/accrued_substate.d.ts.map +0 -1
  182. package/dest/public/avm/opcodes/accrued_substate.js +0 -255
  183. package/dest/public/avm/opcodes/addressing_mode.d.ts +0 -31
  184. package/dest/public/avm/opcodes/addressing_mode.d.ts.map +0 -1
  185. package/dest/public/avm/opcodes/addressing_mode.js +0 -94
  186. package/dest/public/avm/opcodes/arithmetic.d.ts +0 -49
  187. package/dest/public/avm/opcodes/arithmetic.d.ts.map +0 -1
  188. package/dest/public/avm/opcodes/arithmetic.js +0 -97
  189. package/dest/public/avm/opcodes/bitwise.d.ts +0 -42
  190. package/dest/public/avm/opcodes/bitwise.d.ts.map +0 -1
  191. package/dest/public/avm/opcodes/bitwise.js +0 -99
  192. package/dest/public/avm/opcodes/comparators.d.ts +0 -25
  193. package/dest/public/avm/opcodes/comparators.d.ts.map +0 -1
  194. package/dest/public/avm/opcodes/comparators.js +0 -43
  195. package/dest/public/avm/opcodes/contract.d.ts +0 -20
  196. package/dest/public/avm/opcodes/contract.d.ts.map +0 -1
  197. package/dest/public/avm/opcodes/contract.js +0 -65
  198. package/dest/public/avm/opcodes/control_flow.d.ts +0 -41
  199. package/dest/public/avm/opcodes/control_flow.d.ts.map +0 -1
  200. package/dest/public/avm/opcodes/control_flow.js +0 -107
  201. package/dest/public/avm/opcodes/conversion.d.ts +0 -18
  202. package/dest/public/avm/opcodes/conversion.d.ts.map +0 -1
  203. package/dest/public/avm/opcodes/conversion.js +0 -333
  204. package/dest/public/avm/opcodes/ec_add.d.ts +0 -19
  205. package/dest/public/avm/opcodes/ec_add.d.ts.map +0 -1
  206. package/dest/public/avm/opcodes/ec_add.js +0 -93
  207. package/dest/public/avm/opcodes/environment_getters.d.ts +0 -28
  208. package/dest/public/avm/opcodes/environment_getters.d.ts.map +0 -1
  209. package/dest/public/avm/opcodes/environment_getters.js +0 -77
  210. package/dest/public/avm/opcodes/external_calls.d.ts +0 -59
  211. package/dest/public/avm/opcodes/external_calls.d.ts.map +0 -1
  212. package/dest/public/avm/opcodes/external_calls.js +0 -210
  213. package/dest/public/avm/opcodes/hashing.d.ts +0 -36
  214. package/dest/public/avm/opcodes/hashing.d.ts.map +0 -1
  215. package/dest/public/avm/opcodes/hashing.js +0 -119
  216. package/dest/public/avm/opcodes/index.d.ts +0 -16
  217. package/dest/public/avm/opcodes/index.d.ts.map +0 -1
  218. package/dest/public/avm/opcodes/index.js +0 -15
  219. package/dest/public/avm/opcodes/instruction.d.ts +0 -74
  220. package/dest/public/avm/opcodes/instruction.d.ts.map +0 -1
  221. package/dest/public/avm/opcodes/instruction.js +0 -95
  222. package/dest/public/avm/opcodes/instruction_impl.d.ts +0 -19
  223. package/dest/public/avm/opcodes/instruction_impl.d.ts.map +0 -1
  224. package/dest/public/avm/opcodes/instruction_impl.js +0 -30
  225. package/dest/public/avm/opcodes/memory.d.ts +0 -74
  226. package/dest/public/avm/opcodes/memory.d.ts.map +0 -1
  227. package/dest/public/avm/opcodes/memory.js +0 -257
  228. package/dest/public/avm/opcodes/misc.d.ts +0 -18
  229. package/dest/public/avm/opcodes/misc.d.ts.map +0 -1
  230. package/dest/public/avm/opcodes/misc.js +0 -73
  231. package/dest/public/avm/opcodes/storage.d.ts +0 -25
  232. package/dest/public/avm/opcodes/storage.d.ts.map +0 -1
  233. package/dest/public/avm/opcodes/storage.js +0 -78
  234. package/dest/public/avm/revert_reason.d.ts +0 -18
  235. package/dest/public/avm/revert_reason.d.ts.map +0 -1
  236. package/dest/public/avm/revert_reason.js +0 -39
  237. package/dest/public/avm/serialization/buffer_cursor.d.ts +0 -26
  238. package/dest/public/avm/serialization/buffer_cursor.d.ts.map +0 -1
  239. package/dest/public/avm/serialization/buffer_cursor.js +0 -99
  240. package/dest/public/avm/serialization/bytecode_serialization.d.ts +0 -17
  241. package/dest/public/avm/serialization/bytecode_serialization.d.ts.map +0 -1
  242. package/dest/public/avm/serialization/bytecode_serialization.js +0 -336
  243. package/dest/public/avm/serialization/instruction_serialization.d.ts +0 -114
  244. package/dest/public/avm/serialization/instruction_serialization.d.ts.map +0 -1
  245. package/dest/public/avm/serialization/instruction_serialization.js +0 -261
  246. package/dest/public/avm/test_utils.d.ts +0 -15
  247. package/dest/public/avm/test_utils.d.ts.map +0 -1
  248. package/dest/public/avm/test_utils.js +0 -44
  249. package/dest/public/debug_fn_name.d.ts +0 -18
  250. package/dest/public/debug_fn_name.d.ts.map +0 -1
  251. package/dest/public/debug_fn_name.js +0 -37
  252. package/dest/public/fixtures/custom_bytecode_tests.d.ts +0 -12
  253. package/dest/public/fixtures/custom_bytecode_tests.d.ts.map +0 -1
  254. package/dest/public/fixtures/custom_bytecode_tests.js +0 -174
  255. package/dest/public/fixtures/minimal_public_tx.d.ts +0 -4
  256. package/dest/public/fixtures/minimal_public_tx.d.ts.map +0 -1
  257. package/dest/public/fixtures/minimal_public_tx.js +0 -19
  258. package/dest/public/fixtures/opcode_spammer.d.ts +0 -122
  259. package/dest/public/fixtures/opcode_spammer.d.ts.map +0 -1
  260. package/dest/public/fixtures/opcode_spammer.js +0 -1653
  261. package/dest/public/hinting_db_sources.d.ts +0 -80
  262. package/dest/public/hinting_db_sources.d.ts.map +0 -1
  263. package/dest/public/hinting_db_sources.js +0 -355
  264. package/dest/public/public_tx_simulator/contract_provider_for_cpp.d.ts +0 -19
  265. package/dest/public/public_tx_simulator/contract_provider_for_cpp.d.ts.map +0 -1
  266. package/dest/public/public_tx_simulator/contract_provider_for_cpp.js +0 -98
  267. package/dest/public/public_tx_simulator/cpp_public_tx_simulator.d.ts +0 -53
  268. package/dest/public/public_tx_simulator/cpp_public_tx_simulator.d.ts.map +0 -1
  269. package/dest/public/public_tx_simulator/cpp_public_tx_simulator.js +0 -132
  270. package/dest/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.d.ts +0 -42
  271. package/dest/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.d.ts.map +0 -1
  272. package/dest/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.js +0 -86
  273. package/dest/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.d.ts +0 -30
  274. package/dest/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.d.ts.map +0 -1
  275. package/dest/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.js +0 -171
  276. package/dest/public/public_tx_simulator/dumping_cpp_public_tx_simulator.d.ts +0 -23
  277. package/dest/public/public_tx_simulator/dumping_cpp_public_tx_simulator.d.ts.map +0 -1
  278. package/dest/public/public_tx_simulator/measured_public_tx_simulator.d.ts +0 -31
  279. package/dest/public/public_tx_simulator/measured_public_tx_simulator.d.ts.map +0 -1
  280. package/dest/public/public_tx_simulator/measured_public_tx_simulator.js +0 -51
  281. package/dest/public/public_tx_simulator/public_tx_context.d.ts +0 -131
  282. package/dest/public/public_tx_simulator/public_tx_context.d.ts.map +0 -1
  283. package/dest/public/public_tx_simulator/public_tx_context.js +0 -300
  284. package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.d.ts +0 -21
  285. package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.d.ts.map +0 -1
  286. package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.js +0 -415
  287. package/dest/public/side_effect_trace.d.ts +0 -87
  288. package/dest/public/side_effect_trace.d.ts.map +0 -1
  289. package/dest/public/side_effect_trace.js +0 -199
  290. package/dest/public/side_effect_trace_interface.d.ts +0 -22
  291. package/dest/public/side_effect_trace_interface.d.ts.map +0 -1
  292. package/dest/public/side_effect_trace_interface.js +0 -1
  293. package/dest/public/state_manager/index.d.ts +0 -2
  294. package/dest/public/state_manager/index.d.ts.map +0 -1
  295. package/dest/public/state_manager/index.js +0 -1
  296. package/dest/public/state_manager/nullifiers.d.ts +0 -61
  297. package/dest/public/state_manager/nullifiers.d.ts.map +0 -1
  298. package/dest/public/state_manager/nullifiers.js +0 -92
  299. package/dest/public/state_manager/public_storage.d.ts +0 -66
  300. package/dest/public/state_manager/public_storage.d.ts.map +0 -1
  301. package/dest/public/state_manager/public_storage.js +0 -145
  302. package/dest/public/state_manager/state_manager.d.ts +0 -170
  303. package/dest/public/state_manager/state_manager.d.ts.map +0 -1
  304. package/dest/public/state_manager/state_manager.js +0 -402
  305. package/src/public/avm/avm_context.ts +0 -61
  306. package/src/public/avm/avm_contract_call_result.ts +0 -69
  307. package/src/public/avm/avm_execution_environment.ts +0 -51
  308. package/src/public/avm/avm_gas.ts +0 -183
  309. package/src/public/avm/avm_machine_state.ts +0 -170
  310. package/src/public/avm/avm_memory_types.ts +0 -440
  311. package/src/public/avm/avm_simulator.ts +0 -279
  312. package/src/public/avm/avm_simulator_interface.ts +0 -8
  313. package/src/public/avm/calldata.ts +0 -100
  314. package/src/public/avm/errors.ts +0 -177
  315. package/src/public/avm/fixtures/avm_simulation_tester.ts +0 -122
  316. package/src/public/avm/fixtures/initializers.ts +0 -103
  317. package/src/public/avm/index.ts +0 -1
  318. package/src/public/avm/opcodes/accrued_substate.ts +0 -286
  319. package/src/public/avm/opcodes/addressing_mode.ts +0 -111
  320. package/src/public/avm/opcodes/arithmetic.ts +0 -129
  321. package/src/public/avm/opcodes/bitwise.ts +0 -113
  322. package/src/public/avm/opcodes/comparators.ts +0 -55
  323. package/src/public/avm/opcodes/contract.ts +0 -72
  324. package/src/public/avm/opcodes/control_flow.ts +0 -123
  325. package/src/public/avm/opcodes/conversion.ts +0 -104
  326. package/src/public/avm/opcodes/ec_add.ts +0 -105
  327. package/src/public/avm/opcodes/environment_getters.ts +0 -87
  328. package/src/public/avm/opcodes/external_calls.ts +0 -262
  329. package/src/public/avm/opcodes/hashing.ts +0 -151
  330. package/src/public/avm/opcodes/index.ts +0 -15
  331. package/src/public/avm/opcodes/instruction.ts +0 -136
  332. package/src/public/avm/opcodes/instruction_impl.ts +0 -36
  333. package/src/public/avm/opcodes/memory.ts +0 -293
  334. package/src/public/avm/opcodes/misc.ts +0 -102
  335. package/src/public/avm/opcodes/storage.ts +0 -95
  336. package/src/public/avm/revert_reason.ts +0 -58
  337. package/src/public/avm/serialization/buffer_cursor.ts +0 -118
  338. package/src/public/avm/serialization/bytecode_serialization.ts +0 -215
  339. package/src/public/avm/serialization/instruction_serialization.ts +0 -249
  340. package/src/public/avm/test_utils.ts +0 -64
  341. package/src/public/debug_fn_name.ts +0 -52
  342. package/src/public/fixtures/custom_bytecode_tests.ts +0 -228
  343. package/src/public/fixtures/minimal_public_tx.ts +0 -26
  344. package/src/public/fixtures/opcode_spammer.ts +0 -1721
  345. package/src/public/hinting_db_sources.ts +0 -607
  346. package/src/public/public_tx_simulator/contract_provider_for_cpp.ts +0 -124
  347. package/src/public/public_tx_simulator/cpp_public_tx_simulator.ts +0 -211
  348. package/src/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.ts +0 -134
  349. package/src/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.ts +0 -239
  350. package/src/public/public_tx_simulator/measured_public_tx_simulator.ts +0 -105
  351. package/src/public/public_tx_simulator/public_tx_context.ts +0 -484
  352. package/src/public/public_tx_simulator/telemetry_public_tx_simulator.ts +0 -63
  353. package/src/public/side_effect_trace.ts +0 -293
  354. package/src/public/side_effect_trace_interface.ts +0 -28
  355. package/src/public/state_manager/index.ts +0 -1
  356. package/src/public/state_manager/nullifiers.ts +0 -103
  357. package/src/public/state_manager/public_storage.ts +0 -174
  358. package/src/public/state_manager/state_manager.ts +0 -569
@@ -1,210 +0,0 @@
1
- import { TypeTag, Uint1 } from '../avm_memory_types.js';
2
- import { CallDataMemory, ReturnDataMemory } from '../calldata.js';
3
- import { Opcode, OperandType } from '../serialization/instruction_serialization.js';
4
- import { Addressing } from './addressing_mode.js';
5
- import { Instruction } from './instruction.js';
6
- class ExternalCall extends Instruction {
7
- addressingMode;
8
- l2GasOffset;
9
- daGasOffset;
10
- addrOffset;
11
- argsSizeOffset;
12
- argsOffset;
13
- // Informs (de)serialization. See Instruction.deserialize.
14
- static wireFormat = [
15
- OperandType.UINT8,
16
- OperandType.UINT16,
17
- OperandType.UINT16,
18
- OperandType.UINT16,
19
- OperandType.UINT16,
20
- OperandType.UINT16,
21
- OperandType.UINT16
22
- ];
23
- constructor(addressingMode, l2GasOffset, daGasOffset, addrOffset, argsSizeOffset, argsOffset){
24
- super(), this.addressingMode = addressingMode, this.l2GasOffset = l2GasOffset, this.daGasOffset = daGasOffset, this.addrOffset = addrOffset, this.argsSizeOffset = argsSizeOffset, this.argsOffset = argsOffset;
25
- }
26
- async execute(context) {
27
- const memory = context.machineState.memory;
28
- const addressing = Addressing.fromWire(this.addressingMode);
29
- context.machineState.consumeGas(this.baseGasCost(addressing.indirectOperandsCount(), addressing.relativeOperandsCount()));
30
- const operands = [
31
- this.l2GasOffset,
32
- this.daGasOffset,
33
- this.addrOffset,
34
- this.argsSizeOffset,
35
- this.argsOffset
36
- ];
37
- const [l2GasOffset, daGasOffset, addrOffset, argsSizeOffset, argsOffset] = addressing.resolve(operands, memory);
38
- memory.checkTags(TypeTag.UINT32, l2GasOffset);
39
- memory.checkTags(TypeTag.UINT32, daGasOffset);
40
- memory.checkTag(TypeTag.FIELD, addrOffset);
41
- memory.checkTag(TypeTag.UINT32, argsSizeOffset);
42
- const calldataSize = memory.get(argsSizeOffset).toNumber();
43
- const calldata = new CallDataMemory(memory, argsOffset, calldataSize);
44
- const callAddress = memory.getAs(addrOffset);
45
- // If we are already in a static call, we propagate the environment.
46
- const callType = context.environment.isStaticCall ? 'STATICCALL' : this.type;
47
- // We consume the gas allocated for the nested call. The excess will be refunded later.
48
- // Gas allocation is capped by the amount of gas left in the current context.
49
- // We have to do some dancing here because the gas allocation is a field,
50
- // but in the machine state we track gas as a number.
51
- const allocatedL2Gas = Number(BigIntMin(memory.get(l2GasOffset).toBigInt(), BigInt(context.machineState.l2GasLeft)));
52
- const allocatedDaGas = Number(BigIntMin(memory.get(daGasOffset).toBigInt(), BigInt(context.machineState.daGasLeft)));
53
- const allocatedGas = {
54
- l2Gas: allocatedL2Gas,
55
- daGas: allocatedDaGas
56
- };
57
- context.machineState.consumeGas(allocatedGas);
58
- const aztecAddress = callAddress.toAztecAddress();
59
- const nestedContext = await context.createNestedContractCallContext(aztecAddress, calldata, allocatedGas, callType);
60
- const simulator = await context.provideSimulator(nestedContext);
61
- const nestedCallResults = await simulator.execute();
62
- const success = !nestedCallResults.reverted;
63
- // Save return/revert data for later.
64
- const returnData = nestedCallResults.output;
65
- context.machineState.nestedReturndata = returnData;
66
- // Track the success status directly
67
- context.machineState.nestedCallSuccess = success;
68
- // Account for all instructions executed in the nested call
69
- context.machineState.instrCounter += nestedCallResults.totalInstructions;
70
- // If the nested call reverted, we try to save the reason and the revert data.
71
- // This will be used by the caller to try to reconstruct the call stack.
72
- // This is only a heuristic and may not always work. It is intended to work
73
- // for the case where a nested call reverts and the caller always rethrows
74
- // (in Noir code).
75
- if (!success) {
76
- context.machineState.collectedRevertInfo = {
77
- revertDataRepresentative: returnData.bestEffortReadAll(),
78
- recursiveRevertReason: nestedCallResults.revertReason
79
- };
80
- }
81
- // Refund unused gas
82
- context.machineState.refundGas(nestedCallResults.gasLeft);
83
- // Merge nested call's state and trace based on whether it succeeded.
84
- if (success) {
85
- await context.persistableState.merge(nestedContext.persistableState);
86
- } else {
87
- await context.persistableState.reject(nestedContext.persistableState);
88
- }
89
- }
90
- }
91
- export class Call extends ExternalCall {
92
- static type = 'CALL';
93
- static opcode = Opcode.CALL;
94
- get type() {
95
- return Call.type;
96
- }
97
- }
98
- export class StaticCall extends ExternalCall {
99
- static type = 'STATICCALL';
100
- static opcode = Opcode.STATICCALL;
101
- get type() {
102
- return StaticCall.type;
103
- }
104
- }
105
- export class SuccessCopy extends Instruction {
106
- addressingMode;
107
- dstOffset;
108
- static type = 'SUCCESSCOPY';
109
- static opcode = Opcode.SUCCESSCOPY;
110
- // Informs (de)serialization. See Instruction.deserialize.
111
- static wireFormat = [
112
- OperandType.UINT8,
113
- OperandType.UINT8,
114
- OperandType.UINT16
115
- ];
116
- constructor(addressingMode, dstOffset){
117
- super(), this.addressingMode = addressingMode, this.dstOffset = dstOffset;
118
- }
119
- async execute(context) {
120
- const memory = context.machineState.memory;
121
- const addressing = Addressing.fromWire(this.addressingMode);
122
- context.machineState.consumeGas(this.baseGasCost(addressing.indirectOperandsCount(), addressing.relativeOperandsCount()));
123
- const operands = [
124
- this.dstOffset
125
- ];
126
- const [dstOffset] = addressing.resolve(operands, memory);
127
- // Use the direct success tracking property
128
- const success = context.machineState.nestedCallSuccess;
129
- // Write the success flag to the provided memory location
130
- memory.set(dstOffset, new Uint1(success ? 1 : 0));
131
- }
132
- }
133
- export class Return extends Instruction {
134
- addressingMode;
135
- returnSizeOffset;
136
- returnOffset;
137
- static type = 'RETURN';
138
- static opcode = Opcode.RETURN;
139
- // Informs (de)serialization. See Instruction.deserialize.
140
- static wireFormat = [
141
- OperandType.UINT8,
142
- OperandType.UINT8,
143
- OperandType.UINT16,
144
- OperandType.UINT16
145
- ];
146
- constructor(addressingMode, returnSizeOffset, returnOffset){
147
- super(), this.addressingMode = addressingMode, this.returnSizeOffset = returnSizeOffset, this.returnOffset = returnOffset;
148
- }
149
- async execute(context) {
150
- const memory = context.machineState.memory;
151
- const addressing = Addressing.fromWire(this.addressingMode);
152
- context.machineState.consumeGas(this.baseGasCost(addressing.indirectOperandsCount(), addressing.relativeOperandsCount()));
153
- const operands = [
154
- this.returnSizeOffset,
155
- this.returnOffset
156
- ];
157
- const [returnSizeOffset, returnOffset] = addressing.resolve(operands, memory);
158
- memory.checkTag(TypeTag.UINT32, returnSizeOffset);
159
- const returnSize = memory.get(returnSizeOffset).toNumber();
160
- const output = new ReturnDataMemory(memory, returnOffset, returnSize);
161
- context.machineState.return(output);
162
- }
163
- handlesPC() {
164
- return true;
165
- }
166
- }
167
- export class Revert extends Instruction {
168
- addressingMode;
169
- retSizeOffset;
170
- returnOffset;
171
- static type = 'REVERT';
172
- static opcode = Opcode.REVERT_8;
173
- static wireFormat8 = [
174
- OperandType.UINT8,
175
- OperandType.UINT8,
176
- OperandType.UINT8,
177
- OperandType.UINT8
178
- ];
179
- static wireFormat16 = [
180
- OperandType.UINT8,
181
- OperandType.UINT8,
182
- OperandType.UINT16,
183
- OperandType.UINT16
184
- ];
185
- constructor(addressingMode, retSizeOffset, returnOffset){
186
- super(), this.addressingMode = addressingMode, this.retSizeOffset = retSizeOffset, this.returnOffset = returnOffset;
187
- }
188
- async execute(context) {
189
- const memory = context.machineState.memory;
190
- const addressing = Addressing.fromWire(this.addressingMode);
191
- context.machineState.consumeGas(this.baseGasCost(addressing.indirectOperandsCount(), addressing.relativeOperandsCount()));
192
- const operands = [
193
- this.retSizeOffset,
194
- this.returnOffset
195
- ];
196
- const [retSizeOffset, returnOffset] = addressing.resolve(operands, memory);
197
- memory.checkTag(TypeTag.UINT32, retSizeOffset);
198
- const retSize = memory.get(retSizeOffset).toNumber();
199
- const output = new ReturnDataMemory(memory, returnOffset, retSize);
200
- context.machineState.revert(output);
201
- }
202
- // We don't want to increase the PC after reverting because it breaks messages.
203
- // Maybe we can remove this once messages don't depend on PCs.
204
- handlesPC() {
205
- return true;
206
- }
207
- }
208
- /** Returns the smaller of two bigints. */ function BigIntMin(a, b) {
209
- return a < b ? a : b;
210
- }
@@ -1,36 +0,0 @@
1
- import type { AvmContext } from '../avm_context.js';
2
- import { Opcode, OperandType } from '../serialization/instruction_serialization.js';
3
- import { Instruction } from './instruction.js';
4
- export declare class Poseidon2 extends Instruction {
5
- private addressingMode;
6
- private inputStateOffset;
7
- private outputStateOffset;
8
- static type: string;
9
- static readonly opcode: Opcode;
10
- static readonly stateSize = 4;
11
- static readonly wireFormat: OperandType[];
12
- constructor(addressingMode: number, inputStateOffset: number, outputStateOffset: number);
13
- execute(context: AvmContext): Promise<void>;
14
- }
15
- export declare class KeccakF1600 extends Instruction {
16
- private addressingMode;
17
- private dstOffset;
18
- private inputOffset;
19
- static type: string;
20
- static readonly opcode: Opcode;
21
- static readonly wireFormat: OperandType[];
22
- constructor(addressingMode: number, dstOffset: number, inputOffset: number);
23
- execute(context: AvmContext): Promise<void>;
24
- }
25
- export declare class Sha256Compression extends Instruction {
26
- private addressingMode;
27
- private outputOffset;
28
- private stateOffset;
29
- private inputsOffset;
30
- static type: string;
31
- static readonly opcode: Opcode;
32
- static readonly wireFormat: OperandType[];
33
- constructor(addressingMode: number, outputOffset: number, stateOffset: number, inputsOffset: number);
34
- execute(context: AvmContext): Promise<void>;
35
- }
36
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaGFzaGluZy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL3B1YmxpYy9hdm0vb3Bjb2Rlcy9oYXNoaW5nLnRzIl0sIm5hbWVzIjpbXSwib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nB,YAAY,EAAE,MAAM,EAG7B;IAEY,OAAO,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CA8BvD;CACF"}
@@ -1,119 +0,0 @@
1
- import { keccakf1600 } from '@aztec/foundation/crypto/keccak';
2
- import { poseidon2Permutation } from '@aztec/foundation/crypto/poseidon';
3
- import { sha256Compression } from '@aztec/foundation/crypto/sha256';
4
- import { Field, TypeTag, Uint32, Uint64 } from '../avm_memory_types.js';
5
- import { Opcode, OperandType } from '../serialization/instruction_serialization.js';
6
- import { Addressing } from './addressing_mode.js';
7
- import { Instruction } from './instruction.js';
8
- export class Poseidon2 extends Instruction {
9
- addressingMode;
10
- inputStateOffset;
11
- outputStateOffset;
12
- static type = 'POSEIDON2';
13
- static opcode = Opcode.POSEIDON2;
14
- static stateSize = 4;
15
- // Informs (de)serialization. See Instruction.deserialize.
16
- static wireFormat = [
17
- OperandType.UINT8,
18
- OperandType.UINT8,
19
- OperandType.UINT16,
20
- OperandType.UINT16
21
- ];
22
- constructor(addressingMode, inputStateOffset, outputStateOffset){
23
- super(), this.addressingMode = addressingMode, this.inputStateOffset = inputStateOffset, this.outputStateOffset = outputStateOffset;
24
- }
25
- async execute(context) {
26
- const memory = context.machineState.memory;
27
- const addressing = Addressing.fromWire(this.addressingMode);
28
- context.machineState.consumeGas(this.baseGasCost(addressing.indirectOperandsCount(), addressing.relativeOperandsCount()));
29
- const operands = [
30
- this.inputStateOffset,
31
- this.outputStateOffset
32
- ];
33
- const [inputOffset, outputOffset] = addressing.resolve(operands, memory);
34
- const inputState = memory.getSlice(inputOffset, Poseidon2.stateSize);
35
- memory.checkTagsRange(TypeTag.FIELD, inputOffset, Poseidon2.stateSize);
36
- const outputState = await poseidon2Permutation(inputState);
37
- memory.setSlice(outputOffset, outputState.map((word)=>new Field(word)));
38
- }
39
- }
40
- export class KeccakF1600 extends Instruction {
41
- addressingMode;
42
- dstOffset;
43
- inputOffset;
44
- static type = 'KECCAKF1600';
45
- static opcode = Opcode.KECCAKF1600;
46
- // Informs (de)serialization. See Instruction.deserialize.
47
- static wireFormat = [
48
- OperandType.UINT8,
49
- OperandType.UINT8,
50
- OperandType.UINT16,
51
- OperandType.UINT16
52
- ];
53
- constructor(addressingMode, dstOffset, inputOffset){
54
- super(), this.addressingMode = addressingMode, this.dstOffset = dstOffset, this.inputOffset = inputOffset;
55
- }
56
- // pub fn keccakf1600(input: [u64; 25]) -> [u64; 25]
57
- async execute(context) {
58
- const inputSize = 25;
59
- const memory = context.machineState.memory;
60
- const addressing = Addressing.fromWire(this.addressingMode);
61
- context.machineState.consumeGas(this.baseGasCost(addressing.indirectOperandsCount(), addressing.relativeOperandsCount()));
62
- const operands = [
63
- this.dstOffset,
64
- this.inputOffset
65
- ];
66
- const [dstOffset, inputOffset] = addressing.resolve(operands, memory);
67
- const stateData = memory.getSlice(inputOffset, inputSize).map((word)=>word.toBigInt());
68
- memory.checkTagsRange(TypeTag.UINT64, inputOffset, inputSize);
69
- const updatedState = keccakf1600(stateData);
70
- const res = updatedState.map((word)=>new Uint64(word));
71
- memory.setSlice(dstOffset, res);
72
- }
73
- }
74
- export class Sha256Compression extends Instruction {
75
- addressingMode;
76
- outputOffset;
77
- stateOffset;
78
- inputsOffset;
79
- static type = 'SHA256COMPRESSION';
80
- static opcode = Opcode.SHA256COMPRESSION;
81
- // Informs (de)serialization. See Instruction.deserialize.
82
- static wireFormat = [
83
- OperandType.UINT8,
84
- OperandType.UINT8,
85
- OperandType.UINT16,
86
- OperandType.UINT16,
87
- OperandType.UINT16
88
- ];
89
- constructor(addressingMode, outputOffset, stateOffset, inputsOffset){
90
- super(), this.addressingMode = addressingMode, this.outputOffset = outputOffset, this.stateOffset = stateOffset, this.inputsOffset = inputsOffset;
91
- }
92
- async execute(context) {
93
- const STATE_SIZE = 8;
94
- const INPUTS_SIZE = 16;
95
- const memory = context.machineState.memory;
96
- const addressing = Addressing.fromWire(this.addressingMode);
97
- context.machineState.consumeGas(this.baseGasCost(addressing.indirectOperandsCount(), addressing.relativeOperandsCount()));
98
- const operands = [
99
- this.outputOffset,
100
- this.stateOffset,
101
- this.inputsOffset
102
- ];
103
- const [outputOffset, stateOffset, inputsOffset] = addressing.resolve(operands, memory);
104
- // Note: size of output is same as size of state
105
- const inputs = memory.getSlice(inputsOffset, INPUTS_SIZE).map((word)=>word.toBigInt());
106
- const state = memory.getSlice(stateOffset, STATE_SIZE).map((word)=>word.toBigInt());
107
- memory.checkTagsRange(TypeTag.UINT32, inputsOffset, INPUTS_SIZE);
108
- memory.checkTagsRange(TypeTag.UINT32, stateOffset, STATE_SIZE);
109
- // At this point both state and inputs are Uint32Array-compatible
110
- const inputsArray = new Uint32Array(inputs.map((i)=>Number(i)));
111
- const stateArray = new Uint32Array(state.map((i)=>Number(i)));
112
- const output = sha256Compression(stateArray, inputsArray);
113
- // Conversion required from Uint32Array to Uint32[] (can't map directly, need `...`)
114
- const res = [
115
- ...output
116
- ].map((word)=>new Uint32(word));
117
- memory.setSlice(outputOffset, res);
118
- }
119
- }
@@ -1,16 +0,0 @@
1
- export * from './arithmetic.js';
2
- export * from './bitwise.js';
3
- export * from './control_flow.js';
4
- export * from './contract.js';
5
- export * from './conversion.js';
6
- export * from './instruction.js';
7
- export * from './comparators.js';
8
- export * from './memory.js';
9
- export * from './misc.js';
10
- export * from './storage.js';
11
- export * from './external_calls.js';
12
- export * from './environment_getters.js';
13
- export * from './accrued_substate.js';
14
- export * from './hashing.js';
15
- export * from './ec_add.js';
16
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9wdWJsaWMvYXZtL29wY29kZXMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyxpQkFBaUIsQ0FBQztBQUNoQyxjQUFjLGNBQWMsQ0FBQztBQUM3QixjQUFjLG1CQUFtQixDQUFDO0FBQ2xDLGNBQWMsZUFBZSxDQUFDO0FBQzlCLGNBQWMsaUJBQWlCLENBQUM7QUFDaEMsY0FBYyxrQkFBa0IsQ0FBQztBQUNqQyxjQUFjLGtCQUFrQixDQUFDO0FBQ2pDLGNBQWMsYUFBYSxDQUFDO0FBQzVCLGNBQWMsV0FBVyxDQUFDO0FBQzFCLGNBQWMsY0FBYyxDQUFDO0FBQzdCLGNBQWMscUJBQXFCLENBQUM7QUFDcEMsY0FBYywwQkFBMEIsQ0FBQztBQUN6QyxjQUFjLHVCQUF1QixDQUFDO0FBQ3RDLGNBQWMsY0FBYyxDQUFDO0FBQzdCLGNBQWMsYUFBYSxDQUFDIn0=
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/public/avm/opcodes/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC"}
@@ -1,15 +0,0 @@
1
- export * from './arithmetic.js';
2
- export * from './bitwise.js';
3
- export * from './control_flow.js';
4
- export * from './contract.js';
5
- export * from './conversion.js';
6
- export * from './instruction.js';
7
- export * from './comparators.js';
8
- export * from './memory.js';
9
- export * from './misc.js';
10
- export * from './storage.js';
11
- export * from './external_calls.js';
12
- export * from './environment_getters.js';
13
- export * from './accrued_substate.js';
14
- export * from './hashing.js';
15
- export * from './ec_add.js';
@@ -1,74 +0,0 @@
1
- import type { Bufferable } from '@aztec/foundation/serialize';
2
- import type { AvmContext } from '../avm_context.js';
3
- import { type Gas } from '../avm_gas.js';
4
- import type { BufferCursor } from '../serialization/buffer_cursor.js';
5
- import { Opcode, type OperandType } from '../serialization/instruction_serialization.js';
6
- type InstructionConstructor = {
7
- new (...args: any[]): Instruction;
8
- };
9
- /**
10
- * Parent class for all AVM instructions.
11
- * It's most important aspects are execute and (de)serialize.
12
- */
13
- export declare abstract class Instruction {
14
- /**
15
- * Consumes gas and executes the instruction.
16
- * This is the main entry point for the instruction.
17
- * @param context - The AvmContext in which the instruction executes.
18
- */
19
- abstract execute(context: AvmContext): Promise<void>;
20
- /**
21
- * Whether the instruction will modify the PC itself.
22
- */
23
- handlesPC(): boolean;
24
- /**
25
- * Generate a string representation of the instruction including
26
- * the instruction sub-class name all of its flags and operands.
27
- * @returns Thee string representation.
28
- */
29
- toString(): string;
30
- static fromBuffer(this: InstructionConstructor & {
31
- wireFormat: OperandType[];
32
- as: any;
33
- }, buf: BufferCursor | Buffer): Instruction;
34
- toBuffer(): Buffer;
35
- /**
36
- * Returns a new instruction instance that can be serialized with the given opcode and wire format.
37
- * @param opcode The opcode of the instruction.
38
- * @param wireFormat The wire format of the instruction.
39
- * @returns The new instruction instance.
40
- */
41
- as(opcode: Opcode, wireFormat: OperandType[]): Instruction & Bufferable;
42
- /**
43
- * Returns a new instruction class that can be deserialized with the given opcode and wire format.
44
- * @param opcode The opcode of the instruction.
45
- * @param wireFormat The wire format of the instruction.
46
- * @returns The new instruction class.
47
- */
48
- static as(this: InstructionConstructor, wireFormat: OperandType[]): InstructionConstructor & {
49
- fromBuffer: (buf: Buffer<ArrayBufferLike> | BufferCursor) => Instruction;
50
- };
51
- /**
52
- * Returns the base gas cost for the instruction.
53
- * @returns The base gas cost.
54
- */
55
- protected baseGasCost(indirectOperandsCount: number, relativeOperandsCount: number): Gas;
56
- /**
57
- * Computes the dynamic gas cost for the instruction
58
- * @param dynMultiplier - The multiplier for the dynamic gas cost.
59
- * @returns The dynamic gas cost.
60
- */
61
- protected dynamicGasCost(dynMultiplier?: number): Gas;
62
- /**
63
- * Returns the stringified type of the instruction.
64
- * Instruction sub-classes should have a static `type` property.
65
- */
66
- get type(): string;
67
- /**
68
- * Returns the opcode of the instruction.
69
- * Instruction sub-classes should have a static `opcode` property.
70
- */
71
- get opcode(): Opcode;
72
- }
73
- export {};
74
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5zdHJ1Y3Rpb24uZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9wdWJsaWMvYXZtL29wY29kZXMvaW5zdHJ1Y3Rpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsVUFBVSxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFJOUQsT0FBTyxLQUFLLEVBQUUsVUFBVSxFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFDcEQsT0FBTyxFQUFFLEtBQUssR0FBRyxFQUE0RSxNQUFNLGVBQWUsQ0FBQztBQUNuSCxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSxtQ0FBbUMsQ0FBQztBQUN0RSxPQUFPLEVBQUUsTUFBTSxFQUFFLEtBQUssV0FBVyxFQUE0QixNQUFNLCtDQUErQyxDQUFDO0FBRW5ILEtBQUssc0JBQXNCLEdBQUc7SUFDNUIsS0FBSyxHQUFHLElBQUksRUFBRSxHQUFHLEVBQUUsR0FBRyxXQUFXLENBQUM7Q0FDbkMsQ0FBQztBQUVGOzs7R0FHRztBQUNILDhCQUFzQixXQUFXO0lBQy9COzs7O09BSUc7SUFDSCxTQUFnQixPQUFPLENBQUMsT0FBTyxFQUFFLFVBQVUsR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLENBQUM7SUFFNUQ7O09BRUc7SUFDSSxTQUFTLElBQUksT0F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 -1,95 +0,0 @@
1
- import { strict as assert } from 'assert';
2
- import { computeAddressingCost, getBaseGasCost, getDynamicGasCost, mulGas, sumGas } from '../avm_gas.js';
3
- import { Opcode, deserialize, serializeAs } from '../serialization/instruction_serialization.js';
4
- /**
5
- * Parent class for all AVM instructions.
6
- * It's most important aspects are execute and (de)serialize.
7
- */ export class Instruction {
8
- /**
9
- * Whether the instruction will modify the PC itself.
10
- */ handlesPC() {
11
- return false;
12
- }
13
- /**
14
- * Generate a string representation of the instruction including
15
- * the instruction sub-class name all of its flags and operands.
16
- * @returns Thee string representation.
17
- */ toString() {
18
- // Note: we could have this be the actual wire opcode if `bytecode_serialization.ts` were to
19
- // pass it into the class' static `Instruction.as(this, wireFormat)` method.
20
- let instructionStr = this.constructor.name + ': ';
21
- // assumes that all properties are flags or operands
22
- for (const prop of Object.getOwnPropertyNames(this)){
23
- instructionStr += `${prop}:${this[prop].toString()}, `;
24
- }
25
- return instructionStr;
26
- }
27
- // Default deserialization which uses Class.opcode and Class.wireFormat.
28
- static fromBuffer(buf) {
29
- return this.as(this.wireFormat).fromBuffer(buf);
30
- }
31
- // Default serialization which uses Class.opcode and Class.wireFormat.
32
- toBuffer() {
33
- const klass = this.constructor;
34
- assert(klass.opcode !== undefined && klass.opcode !== null);
35
- assert(klass.wireFormat !== undefined && klass.wireFormat !== null);
36
- return this.as(klass.opcode, klass.wireFormat).toBuffer();
37
- }
38
- /**
39
- * Returns a new instruction instance that can be serialized with the given opcode and wire format.
40
- * @param opcode The opcode of the instruction.
41
- * @param wireFormat The wire format of the instruction.
42
- * @returns The new instruction instance.
43
- */ as(opcode, wireFormat) {
44
- return Object.defineProperty(this, 'toBuffer', {
45
- value: ()=>{
46
- return serializeAs(wireFormat, opcode, this);
47
- },
48
- enumerable: false
49
- });
50
- }
51
- /**
52
- * Returns a new instruction class that can be deserialized with the given opcode and wire format.
53
- * @param opcode The opcode of the instruction.
54
- * @param wireFormat The wire format of the instruction.
55
- * @returns The new instruction class.
56
- */ static as(wireFormat) {
57
- return Object.assign(this, {
58
- fromBuffer: (buf)=>{
59
- const res = deserialize(buf, wireFormat);
60
- const args = res.slice(1); // Remove opcode.
61
- return new this(...args);
62
- }
63
- });
64
- }
65
- /**
66
- * Returns the base gas cost for the instruction.
67
- * @returns The base gas cost.
68
- */ baseGasCost(indirectOperandsCount, relativeOperandsCount) {
69
- return sumGas(getBaseGasCost(this.opcode), computeAddressingCost(indirectOperandsCount, relativeOperandsCount));
70
- }
71
- /**
72
- * Computes the dynamic gas cost for the instruction
73
- * @param dynMultiplier - The multiplier for the dynamic gas cost.
74
- * @returns The dynamic gas cost.
75
- */ dynamicGasCost(dynMultiplier = 0) {
76
- return mulGas(getDynamicGasCost(this.opcode), dynMultiplier);
77
- }
78
- /**
79
- * Returns the stringified type of the instruction.
80
- * Instruction sub-classes should have a static `type` property.
81
- */ get type() {
82
- const type = 'type' in this.constructor && this.constructor.type;
83
- assert(!!type, `Instruction class ${this.constructor.name} does not have a static 'type' property defined.`);
84
- return type;
85
- }
86
- /**
87
- * Returns the opcode of the instruction.
88
- * Instruction sub-classes should have a static `opcode` property.
89
- */ get opcode() {
90
- const opcode = 'opcode' in this.constructor ? this.constructor.opcode : undefined;
91
- assert(opcode !== undefined, `Instruction class ${this.constructor.name} does not have a static 'opcode' property defined.`);
92
- assert(Opcode[opcode] !== undefined, `Invalid opcode ${opcode} for instruction class ${this.constructor.name}.`);
93
- return opcode;
94
- }
95
- }
@@ -1,19 +0,0 @@
1
- import { OperandType } from '../serialization/instruction_serialization.js';
2
- import { Instruction } from './instruction.js';
3
- /** Wire format that informs deserialization for instructions with three operands. */
4
- export declare const ThreeOperandWireFormat8: OperandType[];
5
- export declare const ThreeOperandWireFormat16: OperandType[];
6
- /**
7
- * Covers (de)serialization for an instruction with:
8
- * addressing mode, inTag, and three operands.
9
- */
10
- export declare abstract class ThreeOperandInstruction extends Instruction {
11
- protected addressingMode: number;
12
- protected aOffset: number;
13
- protected bOffset: number;
14
- protected dstOffset: number;
15
- static readonly wireFormat8: OperandType[];
16
- static readonly wireFormat16: OperandType[];
17
- constructor(addressingMode: number, aOffset: number, bOffset: number, dstOffset: number);
18
- }
19
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5zdHJ1Y3Rpb25faW1wbC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL3B1YmxpYy9hdm0vb3Bjb2Rlcy9pbnN0cnVjdGlvbl9pbXBsLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSwrQ0FBK0MsQ0FBQztBQUM1RSxPQUFPLEVBQUUsV0FBVyxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFFL0MscUZBQXFGO0FBQ3JGLGVBQU8sTUFBTSx1QkFBdUIsZUFNbkMsQ0FBQztBQUNGLGVBQU8sTUFBTSx3QkFBd0IsZUFNcEMsQ0FBQztBQUVGOzs7R0FHRztBQUNILDhCQUFzQix1QkFBd0IsU0FBUSxXQUFXO0lBSzdELFNBQVMsQ0FBQyxjQUFjLEVBQUUsTUFBTTtJQUNoQyxTQUFTLENBQUMsT0FBTyxFQUFFLE1BQU07SUFDekIsU0FBUyxDQUFDLE9BQU8sRUFBRSxNQUFNO0lBQ3pCLFNBQVMsQ0FBQyxTQUFTLEVBQUUsTUFBTTtJQVA3QixNQUFNLENBQUMsUUFBUSxDQUFDLFdBQVcsRUFBRSxXQUFXLEVBQUUsQ0FBMkI7SUFDckUsTUFBTSxDQUFDLFFBQVEsQ0FBQyxZQUFZLEVBQUUsV0FBVyxFQUFFLENBQTRCO0lBRXZFLFlBQ1ksY0FBYyxFQUFFLE1BQU0sRUFDdEIsT0FBTyxFQUFFLE1BQU0sRUFDZixPQUFPLEVBQUUsTUFBTSxFQUNmLFNBQVMsRUFBRSxNQUFNLEVBRzVCO0NBQ0YifQ==
@@ -1 +0,0 @@
1
- {"version":3,"file":"instruction_impl.d.ts","sourceRoot":"","sources":["../../../../src/public/avm/opcodes/instruction_impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,qFAAqF;AACrF,eAAO,MAAM,uBAAuB,eAMnC,CAAC;AACF,eAAO,MAAM,wBAAwB,eAMpC,CAAC;AAEF;;;GAGG;AACH,8BAAsB,uBAAwB,SAAQ,WAAW;IAK7D,SAAS,CAAC,cAAc,EAAE,MAAM;IAChC,SAAS,CAAC,OAAO,EAAE,MAAM;IACzB,SAAS,CAAC,OAAO,EAAE,MAAM;IACzB,SAAS,CAAC,SAAS,EAAE,MAAM;IAP7B,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,WAAW,EAAE,CAA2B;IACrE,MAAM,CAAC,QAAQ,CAAC,YAAY,EAAE,WAAW,EAAE,CAA4B;IAEvE,YACY,cAAc,EAAE,MAAM,EACtB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EAG5B;CACF"}
@@ -1,30 +0,0 @@
1
- import { OperandType } from '../serialization/instruction_serialization.js';
2
- import { Instruction } from './instruction.js';
3
- /** Wire format that informs deserialization for instructions with three operands. */ export const ThreeOperandWireFormat8 = [
4
- OperandType.UINT8,
5
- OperandType.UINT8,
6
- OperandType.UINT8,
7
- OperandType.UINT8,
8
- OperandType.UINT8
9
- ];
10
- export const ThreeOperandWireFormat16 = [
11
- OperandType.UINT8,
12
- OperandType.UINT8,
13
- OperandType.UINT16,
14
- OperandType.UINT16,
15
- OperandType.UINT16
16
- ];
17
- /**
18
- * Covers (de)serialization for an instruction with:
19
- * addressing mode, inTag, and three operands.
20
- */ export class ThreeOperandInstruction extends Instruction {
21
- addressingMode;
22
- aOffset;
23
- bOffset;
24
- dstOffset;
25
- static wireFormat8 = ThreeOperandWireFormat8;
26
- static wireFormat16 = ThreeOperandWireFormat16;
27
- constructor(addressingMode, aOffset, bOffset, dstOffset){
28
- super(), this.addressingMode = addressingMode, this.aOffset = aOffset, this.bOffset = bOffset, this.dstOffset = dstOffset;
29
- }
30
- }