@aztec/simulator 0.0.1-commit.b655e406 → 0.0.1-commit.b8a057fa

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 (405) hide show
  1. package/README.md +6 -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/common/errors.d.ts +2 -2
  6. package/dest/common/errors.d.ts.map +1 -1
  7. package/dest/common/index.d.ts +1 -1
  8. package/dest/common/stats/index.d.ts +1 -1
  9. package/dest/common/stats/stats.d.ts +1 -1
  10. package/dest/private/acvm/acvm.d.ts +4 -2
  11. package/dest/private/acvm/acvm.d.ts.map +1 -1
  12. package/dest/private/acvm/acvm.js +4 -3
  13. package/dest/private/acvm/acvm_types.d.ts +1 -1
  14. package/dest/private/acvm/deserialize.d.ts +2 -2
  15. package/dest/private/acvm/deserialize.d.ts.map +1 -1
  16. package/dest/private/acvm/deserialize.js +1 -1
  17. package/dest/private/acvm/index.d.ts +1 -1
  18. package/dest/private/acvm/serialize.d.ts +2 -2
  19. package/dest/private/acvm/serialize.d.ts.map +1 -1
  20. package/dest/private/acvm/serialize.js +1 -1
  21. package/dest/private/acvm_native.d.ts +5 -3
  22. package/dest/private/acvm_native.d.ts.map +1 -1
  23. package/dest/private/acvm_native.js +8 -6
  24. package/dest/private/acvm_wasm.d.ts +4 -3
  25. package/dest/private/acvm_wasm.d.ts.map +1 -1
  26. package/dest/private/acvm_wasm.js +7 -5
  27. package/dest/private/acvm_wasm_with_blobs.d.ts +1 -1
  28. package/dest/private/acvm_wasm_with_blobs.d.ts.map +1 -1
  29. package/dest/private/circuit_recording/circuit_recorder.d.ts +39 -25
  30. package/dest/private/circuit_recording/circuit_recorder.d.ts.map +1 -1
  31. package/dest/private/circuit_recording/circuit_recorder.js +71 -72
  32. package/dest/private/circuit_recording/file_circuit_recorder.d.ts +9 -20
  33. package/dest/private/circuit_recording/file_circuit_recorder.d.ts.map +1 -1
  34. package/dest/private/circuit_recording/file_circuit_recorder.js +39 -43
  35. package/dest/private/circuit_recording/memory_circuit_recorder.d.ts +7 -2
  36. package/dest/private/circuit_recording/memory_circuit_recorder.d.ts.map +1 -1
  37. package/dest/private/circuit_recording/memory_circuit_recorder.js +4 -4
  38. package/dest/private/circuit_recording/simulator_recorder_wrapper.d.ts +1 -1
  39. package/dest/private/circuit_recording/simulator_recorder_wrapper.d.ts.map +1 -1
  40. package/dest/private/circuit_recording/simulator_recorder_wrapper.js +11 -14
  41. package/dest/private/circuit_simulator.d.ts +1 -1
  42. package/dest/private/factory.d.ts +3 -3
  43. package/dest/private/factory.d.ts.map +1 -1
  44. package/dest/private/factory.js +7 -4
  45. package/dest/public/avm/testing/account_proof_fetcher.d.ts +2 -0
  46. package/dest/public/avm/testing/account_proof_fetcher.d.ts.map +1 -0
  47. package/dest/public/avm/testing/account_proof_fetcher.js +152 -0
  48. package/dest/public/avm/{fixtures → testing}/base_avm_simulation_tester.d.ts +3 -2
  49. package/dest/public/avm/testing/base_avm_simulation_tester.d.ts.map +1 -0
  50. package/dest/public/avm/{fixtures → testing}/base_avm_simulation_tester.js +19 -4
  51. package/dest/public/avm/{fixtures → testing}/utils.d.ts +4 -10
  52. package/dest/public/avm/testing/utils.d.ts.map +1 -0
  53. package/dest/public/avm/{fixtures → testing}/utils.js +7 -36
  54. package/dest/public/avm_simulator.d.ts +28 -0
  55. package/dest/public/avm_simulator.d.ts.map +1 -0
  56. package/dest/public/avm_simulator.js +4 -0
  57. package/dest/public/avm_simulator_pool.d.ts +45 -0
  58. package/dest/public/avm_simulator_pool.d.ts.map +1 -0
  59. package/dest/public/avm_simulator_pool.js +197 -0
  60. package/dest/public/cdb/generated/api_types.d.ts +171 -0
  61. package/dest/public/cdb/generated/api_types.d.ts.map +1 -0
  62. package/dest/public/cdb/generated/api_types.js +314 -0
  63. package/dest/public/cdb/generated/server.d.ts +26 -0
  64. package/dest/public/cdb/generated/server.d.ts.map +1 -0
  65. package/dest/public/cdb/generated/server.js +135 -0
  66. package/dest/public/cdb_ipc_server.d.ts +33 -0
  67. package/dest/public/cdb_ipc_server.d.ts.map +1 -0
  68. package/dest/public/cdb_ipc_server.js +153 -0
  69. package/dest/public/contracts_db_checkpoint.d.ts +16 -0
  70. package/dest/public/contracts_db_checkpoint.d.ts.map +1 -0
  71. package/dest/public/contracts_db_checkpoint.js +30 -0
  72. package/dest/public/db_interfaces.d.ts +14 -2
  73. package/dest/public/db_interfaces.d.ts.map +1 -1
  74. package/dest/public/executor_metrics.d.ts +3 -2
  75. package/dest/public/executor_metrics.d.ts.map +1 -1
  76. package/dest/public/executor_metrics.js +13 -34
  77. package/dest/public/executor_metrics_interface.d.ts +3 -2
  78. package/dest/public/executor_metrics_interface.d.ts.map +1 -1
  79. package/dest/public/fixtures/amm_test.d.ts +1 -1
  80. package/dest/public/fixtures/amm_test.js +6 -6
  81. package/dest/public/fixtures/bulk_test.d.ts +3 -3
  82. package/dest/public/fixtures/bulk_test.d.ts.map +1 -1
  83. package/dest/public/fixtures/bulk_test.js +38 -75
  84. package/dest/public/fixtures/custom_bytecode_tester.d.ts +29 -7
  85. package/dest/public/fixtures/custom_bytecode_tester.d.ts.map +1 -1
  86. package/dest/public/fixtures/custom_bytecode_tester.js +36 -12
  87. package/dest/public/fixtures/index.d.ts +3 -3
  88. package/dest/public/fixtures/index.d.ts.map +1 -1
  89. package/dest/public/fixtures/index.js +2 -2
  90. package/dest/public/fixtures/public_processor_test_env.d.ts +30 -0
  91. package/dest/public/fixtures/public_processor_test_env.d.ts.map +1 -0
  92. package/dest/public/fixtures/public_processor_test_env.js +73 -0
  93. package/dest/public/fixtures/public_tx_simulation_tester.d.ts +32 -9
  94. package/dest/public/fixtures/public_tx_simulation_tester.d.ts.map +1 -1
  95. package/dest/public/fixtures/public_tx_simulation_tester.js +84 -26
  96. package/dest/public/fixtures/simple_contract_data_source.d.ts +5 -4
  97. package/dest/public/fixtures/simple_contract_data_source.d.ts.map +1 -1
  98. package/dest/public/fixtures/simple_contract_data_source.js +5 -5
  99. package/dest/public/fixtures/token_test.d.ts +6 -2
  100. package/dest/public/fixtures/token_test.d.ts.map +1 -1
  101. package/dest/public/fixtures/token_test.js +16 -15
  102. package/dest/public/fixtures/utils.d.ts +3 -3
  103. package/dest/public/fixtures/utils.d.ts.map +1 -1
  104. package/dest/public/fixtures/utils.js +25 -23
  105. package/dest/public/fuzzing/avm_fuzzer_simulator.d.ts +67 -0
  106. package/dest/public/fuzzing/avm_fuzzer_simulator.d.ts.map +1 -0
  107. package/dest/public/fuzzing/avm_fuzzer_simulator.js +185 -0
  108. package/dest/public/fuzzing/avm_simulator_bin.d.ts +2 -0
  109. package/dest/public/fuzzing/avm_simulator_bin.d.ts.map +1 -0
  110. package/dest/public/fuzzing/avm_simulator_bin.js +118 -0
  111. package/dest/public/index.d.ts +6 -2
  112. package/dest/public/index.d.ts.map +1 -1
  113. package/dest/public/index.js +2 -1
  114. package/dest/public/public_db_sources.d.ts +29 -66
  115. package/dest/public/public_db_sources.d.ts.map +1 -1
  116. package/dest/public/public_db_sources.js +83 -134
  117. package/dest/public/public_errors.d.ts +1 -1
  118. package/dest/public/public_errors.d.ts.map +1 -1
  119. package/dest/public/public_processor/guarded_merkle_tree.d.ts +8 -5
  120. package/dest/public/public_processor/guarded_merkle_tree.d.ts.map +1 -1
  121. package/dest/public/public_processor/guarded_merkle_tree.js +12 -4
  122. package/dest/public/public_processor/public_processor.d.ts +24 -22
  123. package/dest/public/public_processor/public_processor.d.ts.map +1 -1
  124. package/dest/public/public_processor/public_processor.js +559 -125
  125. package/dest/public/public_processor/public_processor_metrics.d.ts +5 -2
  126. package/dest/public/public_processor/public_processor_metrics.d.ts.map +1 -1
  127. package/dest/public/public_processor/public_processor_metrics.js +36 -45
  128. package/dest/public/public_tx_simulator/dumping_public_tx_simulator.d.ts +17 -0
  129. package/dest/public/public_tx_simulator/dumping_public_tx_simulator.d.ts.map +1 -0
  130. package/dest/public/public_tx_simulator/dumping_public_tx_simulator.js +39 -0
  131. package/dest/public/public_tx_simulator/factories.d.ts +14 -0
  132. package/dest/public/public_tx_simulator/factories.d.ts.map +1 -0
  133. package/dest/public/public_tx_simulator/factories.js +28 -0
  134. package/dest/public/public_tx_simulator/index.d.ts +6 -4
  135. package/dest/public/public_tx_simulator/index.d.ts.map +1 -1
  136. package/dest/public/public_tx_simulator/index.js +3 -2
  137. package/dest/public/public_tx_simulator/public_tx_simulator.d.ts +43 -90
  138. package/dest/public/public_tx_simulator/public_tx_simulator.d.ts.map +1 -1
  139. package/dest/public/public_tx_simulator/public_tx_simulator.js +99 -331
  140. package/dest/public/public_tx_simulator/public_tx_simulator_base.d.ts +24 -0
  141. package/dest/public/public_tx_simulator/public_tx_simulator_base.d.ts.map +1 -0
  142. package/dest/public/public_tx_simulator/public_tx_simulator_base.js +31 -0
  143. package/dest/public/public_tx_simulator/public_tx_simulator_interface.d.ts +25 -2
  144. package/dest/public/public_tx_simulator/public_tx_simulator_interface.d.ts.map +1 -1
  145. package/dest/public/side_effect_errors.d.ts +1 -1
  146. package/dest/public/side_effect_errors.d.ts.map +1 -1
  147. package/dest/public/test_executor_metrics.d.ts +6 -4
  148. package/dest/public/test_executor_metrics.d.ts.map +1 -1
  149. package/dest/public/test_executor_metrics.js +7 -6
  150. package/dest/public/unique_class_ids.d.ts +1 -1
  151. package/dest/public/unique_class_ids.d.ts.map +1 -1
  152. package/dest/public/utils.d.ts +1 -1
  153. package/dest/server.d.ts +1 -1
  154. package/dest/testing.d.ts +1 -1
  155. package/package.json +26 -22
  156. package/src/client.ts +0 -2
  157. package/src/common/errors.ts +1 -1
  158. package/src/private/acvm/acvm.ts +4 -3
  159. package/src/private/acvm/deserialize.ts +1 -1
  160. package/src/private/acvm/serialize.ts +1 -1
  161. package/src/private/acvm_native.ts +11 -5
  162. package/src/private/acvm_wasm.ts +11 -4
  163. package/src/private/circuit_recording/circuit_recorder.ts +90 -81
  164. package/src/private/circuit_recording/file_circuit_recorder.ts +45 -50
  165. package/src/private/circuit_recording/memory_circuit_recorder.ts +6 -4
  166. package/src/private/circuit_recording/simulator_recorder_wrapper.ts +9 -15
  167. package/src/private/factory.ts +7 -4
  168. package/src/public/avm/testing/account_proof.json +553 -0
  169. package/src/public/avm/testing/account_proof_fetcher.ts +166 -0
  170. package/src/public/avm/{fixtures → testing}/base_avm_simulation_tester.ts +24 -4
  171. package/src/public/avm/{fixtures → testing}/utils.ts +7 -42
  172. package/src/public/avm_simulator.ts +29 -0
  173. package/src/public/avm_simulator_pool.ts +226 -0
  174. package/src/public/cdb/generated/api_types.ts +457 -0
  175. package/src/public/cdb/generated/server.ts +109 -0
  176. package/src/public/cdb_ipc_server.ts +197 -0
  177. package/src/public/contracts_db_checkpoint.ts +41 -0
  178. package/src/public/db_interfaces.ts +16 -1
  179. package/src/public/executor_metrics.ts +11 -34
  180. package/src/public/executor_metrics_interface.ts +2 -1
  181. package/src/public/fixtures/amm_test.ts +6 -6
  182. package/src/public/fixtures/bulk_test.ts +40 -15
  183. package/src/public/fixtures/custom_bytecode_tester.ts +54 -20
  184. package/src/public/fixtures/index.ts +6 -2
  185. package/src/public/fixtures/public_processor_test_env.ts +88 -0
  186. package/src/public/fixtures/public_tx_simulation_tester.ts +117 -26
  187. package/src/public/fixtures/simple_contract_data_source.ts +9 -10
  188. package/src/public/fixtures/token_test.ts +21 -13
  189. package/src/public/fixtures/utils.ts +25 -27
  190. package/src/public/fuzzing/avm_fuzzer_simulator.ts +303 -0
  191. package/src/public/fuzzing/avm_simulator_bin.ts +173 -0
  192. package/src/public/index.ts +8 -2
  193. package/src/public/public_db_sources.ts +112 -174
  194. package/src/public/public_processor/guarded_merkle_tree.ts +14 -6
  195. package/src/public/public_processor/public_processor.ts +234 -138
  196. package/src/public/public_processor/public_processor_metrics.ts +28 -44
  197. package/src/public/public_tx_simulator/dumping_public_tx_simulator.ts +67 -0
  198. package/src/public/public_tx_simulator/factories.ts +61 -0
  199. package/src/public/public_tx_simulator/index.ts +8 -3
  200. package/src/public/public_tx_simulator/public_tx_simulator.ts +142 -500
  201. package/src/public/public_tx_simulator/public_tx_simulator_base.ts +37 -0
  202. package/src/public/public_tx_simulator/public_tx_simulator_interface.ts +24 -2
  203. package/src/public/test_executor_metrics.ts +10 -8
  204. package/dest/public/avm/avm_context.d.ts +0 -41
  205. package/dest/public/avm/avm_context.d.ts.map +0 -1
  206. package/dest/public/avm/avm_context.js +0 -44
  207. package/dest/public/avm/avm_contract_call_result.d.ts +0 -32
  208. package/dest/public/avm/avm_contract_call_result.d.ts.map +0 -1
  209. package/dest/public/avm/avm_contract_call_result.js +0 -54
  210. package/dest/public/avm/avm_execution_environment.d.ts +0 -23
  211. package/dest/public/avm/avm_execution_environment.d.ts.map +0 -1
  212. package/dest/public/avm/avm_execution_environment.js +0 -36
  213. package/dest/public/avm/avm_gas.d.ts +0 -44
  214. package/dest/public/avm/avm_gas.d.ts.map +0 -1
  215. package/dest/public/avm/avm_gas.js +0 -195
  216. package/dest/public/avm/avm_machine_state.d.ts +0 -97
  217. package/dest/public/avm/avm_machine_state.d.ts.map +0 -1
  218. package/dest/public/avm/avm_machine_state.js +0 -109
  219. package/dest/public/avm/avm_memory_types.d.ts +0 -275
  220. package/dest/public/avm/avm_memory_types.d.ts.map +0 -1
  221. package/dest/public/avm/avm_memory_types.js +0 -351
  222. package/dest/public/avm/avm_simulator.d.ts +0 -39
  223. package/dest/public/avm/avm_simulator.d.ts.map +0 -1
  224. package/dest/public/avm/avm_simulator.js +0 -190
  225. package/dest/public/avm/avm_simulator_interface.d.ts +0 -9
  226. package/dest/public/avm/avm_simulator_interface.d.ts.map +0 -1
  227. package/dest/public/avm/avm_simulator_interface.js +0 -3
  228. package/dest/public/avm/errors.d.ts +0 -98
  229. package/dest/public/avm/errors.d.ts.map +0 -1
  230. package/dest/public/avm/errors.js +0 -129
  231. package/dest/public/avm/fixtures/avm_simulation_tester.d.ts +0 -22
  232. package/dest/public/avm/fixtures/avm_simulation_tester.d.ts.map +0 -1
  233. package/dest/public/avm/fixtures/avm_simulation_tester.js +0 -74
  234. package/dest/public/avm/fixtures/base_avm_simulation_tester.d.ts.map +0 -1
  235. package/dest/public/avm/fixtures/initializers.d.ts +0 -43
  236. package/dest/public/avm/fixtures/initializers.d.ts.map +0 -1
  237. package/dest/public/avm/fixtures/initializers.js +0 -42
  238. package/dest/public/avm/fixtures/utils.d.ts.map +0 -1
  239. package/dest/public/avm/index.d.ts +0 -2
  240. package/dest/public/avm/index.d.ts.map +0 -1
  241. package/dest/public/avm/index.js +0 -1
  242. package/dest/public/avm/opcodes/accrued_substate.d.ts +0 -75
  243. package/dest/public/avm/opcodes/accrued_substate.d.ts.map +0 -1
  244. package/dest/public/avm/opcodes/accrued_substate.js +0 -255
  245. package/dest/public/avm/opcodes/addressing_mode.d.ts +0 -31
  246. package/dest/public/avm/opcodes/addressing_mode.d.ts.map +0 -1
  247. package/dest/public/avm/opcodes/addressing_mode.js +0 -94
  248. package/dest/public/avm/opcodes/arithmetic.d.ts +0 -47
  249. package/dest/public/avm/opcodes/arithmetic.d.ts.map +0 -1
  250. package/dest/public/avm/opcodes/arithmetic.js +0 -87
  251. package/dest/public/avm/opcodes/bitwise.d.ts +0 -42
  252. package/dest/public/avm/opcodes/bitwise.d.ts.map +0 -1
  253. package/dest/public/avm/opcodes/bitwise.js +0 -99
  254. package/dest/public/avm/opcodes/comparators.d.ts +0 -25
  255. package/dest/public/avm/opcodes/comparators.d.ts.map +0 -1
  256. package/dest/public/avm/opcodes/comparators.js +0 -43
  257. package/dest/public/avm/opcodes/contract.d.ts +0 -20
  258. package/dest/public/avm/opcodes/contract.d.ts.map +0 -1
  259. package/dest/public/avm/opcodes/contract.js +0 -65
  260. package/dest/public/avm/opcodes/control_flow.d.ts +0 -41
  261. package/dest/public/avm/opcodes/control_flow.d.ts.map +0 -1
  262. package/dest/public/avm/opcodes/control_flow.js +0 -107
  263. package/dest/public/avm/opcodes/conversion.d.ts +0 -18
  264. package/dest/public/avm/opcodes/conversion.d.ts.map +0 -1
  265. package/dest/public/avm/opcodes/conversion.js +0 -333
  266. package/dest/public/avm/opcodes/ec_add.d.ts +0 -19
  267. package/dest/public/avm/opcodes/ec_add.d.ts.map +0 -1
  268. package/dest/public/avm/opcodes/ec_add.js +0 -84
  269. package/dest/public/avm/opcodes/environment_getters.d.ts +0 -28
  270. package/dest/public/avm/opcodes/environment_getters.d.ts.map +0 -1
  271. package/dest/public/avm/opcodes/environment_getters.js +0 -77
  272. package/dest/public/avm/opcodes/external_calls.d.ts +0 -59
  273. package/dest/public/avm/opcodes/external_calls.d.ts.map +0 -1
  274. package/dest/public/avm/opcodes/external_calls.js +0 -209
  275. package/dest/public/avm/opcodes/hashing.d.ts +0 -36
  276. package/dest/public/avm/opcodes/hashing.d.ts.map +0 -1
  277. package/dest/public/avm/opcodes/hashing.js +0 -114
  278. package/dest/public/avm/opcodes/index.d.ts +0 -16
  279. package/dest/public/avm/opcodes/index.d.ts.map +0 -1
  280. package/dest/public/avm/opcodes/index.js +0 -15
  281. package/dest/public/avm/opcodes/instruction.d.ts +0 -74
  282. package/dest/public/avm/opcodes/instruction.d.ts.map +0 -1
  283. package/dest/public/avm/opcodes/instruction.js +0 -95
  284. package/dest/public/avm/opcodes/instruction_impl.d.ts +0 -19
  285. package/dest/public/avm/opcodes/instruction_impl.d.ts.map +0 -1
  286. package/dest/public/avm/opcodes/instruction_impl.js +0 -30
  287. package/dest/public/avm/opcodes/memory.d.ts +0 -74
  288. package/dest/public/avm/opcodes/memory.d.ts.map +0 -1
  289. package/dest/public/avm/opcodes/memory.js +0 -257
  290. package/dest/public/avm/opcodes/misc.d.ts +0 -18
  291. package/dest/public/avm/opcodes/misc.d.ts.map +0 -1
  292. package/dest/public/avm/opcodes/misc.js +0 -73
  293. package/dest/public/avm/opcodes/storage.d.ts +0 -24
  294. package/dest/public/avm/opcodes/storage.d.ts.map +0 -1
  295. package/dest/public/avm/opcodes/storage.js +0 -68
  296. package/dest/public/avm/revert_reason.d.ts +0 -18
  297. package/dest/public/avm/revert_reason.d.ts.map +0 -1
  298. package/dest/public/avm/revert_reason.js +0 -38
  299. package/dest/public/avm/serialization/buffer_cursor.d.ts +0 -26
  300. package/dest/public/avm/serialization/buffer_cursor.d.ts.map +0 -1
  301. package/dest/public/avm/serialization/buffer_cursor.js +0 -99
  302. package/dest/public/avm/serialization/bytecode_serialization.d.ts +0 -17
  303. package/dest/public/avm/serialization/bytecode_serialization.d.ts.map +0 -1
  304. package/dest/public/avm/serialization/bytecode_serialization.js +0 -333
  305. package/dest/public/avm/serialization/instruction_serialization.d.ts +0 -114
  306. package/dest/public/avm/serialization/instruction_serialization.d.ts.map +0 -1
  307. package/dest/public/avm/serialization/instruction_serialization.js +0 -261
  308. package/dest/public/avm/test_utils.d.ts +0 -15
  309. package/dest/public/avm/test_utils.d.ts.map +0 -1
  310. package/dest/public/avm/test_utils.js +0 -44
  311. package/dest/public/debug_fn_name.d.ts +0 -5
  312. package/dest/public/debug_fn_name.d.ts.map +0 -1
  313. package/dest/public/debug_fn_name.js +0 -9
  314. package/dest/public/fixtures/custom_bytecode_tests.d.ts +0 -9
  315. package/dest/public/fixtures/custom_bytecode_tests.d.ts.map +0 -1
  316. package/dest/public/fixtures/custom_bytecode_tests.js +0 -109
  317. package/dest/public/fixtures/minimal_public_tx.d.ts +0 -10
  318. package/dest/public/fixtures/minimal_public_tx.d.ts.map +0 -1
  319. package/dest/public/fixtures/minimal_public_tx.js +0 -29
  320. package/dest/public/hinting_db_sources.d.ts +0 -70
  321. package/dest/public/hinting_db_sources.d.ts.map +0 -1
  322. package/dest/public/hinting_db_sources.js +0 -297
  323. package/dest/public/public_tx_simulator/cpp_public_tx_simulator.d.ts +0 -41
  324. package/dest/public/public_tx_simulator/cpp_public_tx_simulator.d.ts.map +0 -1
  325. package/dest/public/public_tx_simulator/cpp_public_tx_simulator.js +0 -89
  326. package/dest/public/public_tx_simulator/measured_public_tx_simulator.d.ts +0 -24
  327. package/dest/public/public_tx_simulator/measured_public_tx_simulator.d.ts.map +0 -1
  328. package/dest/public/public_tx_simulator/measured_public_tx_simulator.js +0 -51
  329. package/dest/public/public_tx_simulator/public_tx_context.d.ts +0 -127
  330. package/dest/public/public_tx_simulator/public_tx_context.d.ts.map +0 -1
  331. package/dest/public/public_tx_simulator/public_tx_context.js +0 -292
  332. package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.d.ts +0 -21
  333. package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.d.ts.map +0 -1
  334. package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.js +0 -39
  335. package/dest/public/side_effect_trace.d.ts +0 -87
  336. package/dest/public/side_effect_trace.d.ts.map +0 -1
  337. package/dest/public/side_effect_trace.js +0 -199
  338. package/dest/public/side_effect_trace_interface.d.ts +0 -23
  339. package/dest/public/side_effect_trace_interface.d.ts.map +0 -1
  340. package/dest/public/side_effect_trace_interface.js +0 -1
  341. package/dest/public/state_manager/index.d.ts +0 -2
  342. package/dest/public/state_manager/index.d.ts.map +0 -1
  343. package/dest/public/state_manager/index.js +0 -1
  344. package/dest/public/state_manager/nullifiers.d.ts +0 -61
  345. package/dest/public/state_manager/nullifiers.d.ts.map +0 -1
  346. package/dest/public/state_manager/nullifiers.js +0 -92
  347. package/dest/public/state_manager/public_storage.d.ts +0 -66
  348. package/dest/public/state_manager/public_storage.d.ts.map +0 -1
  349. package/dest/public/state_manager/public_storage.js +0 -145
  350. package/dest/public/state_manager/state_manager.d.ts +0 -166
  351. package/dest/public/state_manager/state_manager.d.ts.map +0 -1
  352. package/dest/public/state_manager/state_manager.js +0 -391
  353. package/dest/public/tx_contract_cache.d.ts +0 -41
  354. package/dest/public/tx_contract_cache.d.ts.map +0 -1
  355. package/dest/public/tx_contract_cache.js +0 -49
  356. package/src/public/avm/avm_context.ts +0 -61
  357. package/src/public/avm/avm_contract_call_result.ts +0 -67
  358. package/src/public/avm/avm_execution_environment.ts +0 -48
  359. package/src/public/avm/avm_gas.ts +0 -183
  360. package/src/public/avm/avm_machine_state.ts +0 -169
  361. package/src/public/avm/avm_memory_types.ts +0 -436
  362. package/src/public/avm/avm_simulator.ts +0 -274
  363. package/src/public/avm/avm_simulator_interface.ts +0 -8
  364. package/src/public/avm/errors.ts +0 -163
  365. package/src/public/avm/fixtures/avm_simulation_tester.ts +0 -108
  366. package/src/public/avm/fixtures/initializers.ts +0 -104
  367. package/src/public/avm/index.ts +0 -1
  368. package/src/public/avm/opcodes/accrued_substate.ts +0 -288
  369. package/src/public/avm/opcodes/addressing_mode.ts +0 -111
  370. package/src/public/avm/opcodes/arithmetic.ts +0 -117
  371. package/src/public/avm/opcodes/bitwise.ts +0 -113
  372. package/src/public/avm/opcodes/comparators.ts +0 -55
  373. package/src/public/avm/opcodes/contract.ts +0 -75
  374. package/src/public/avm/opcodes/control_flow.ts +0 -123
  375. package/src/public/avm/opcodes/conversion.ts +0 -104
  376. package/src/public/avm/opcodes/ec_add.ts +0 -96
  377. package/src/public/avm/opcodes/environment_getters.ts +0 -87
  378. package/src/public/avm/opcodes/external_calls.ts +0 -260
  379. package/src/public/avm/opcodes/hashing.ts +0 -145
  380. package/src/public/avm/opcodes/index.ts +0 -15
  381. package/src/public/avm/opcodes/instruction.ts +0 -136
  382. package/src/public/avm/opcodes/instruction_impl.ts +0 -36
  383. package/src/public/avm/opcodes/memory.ts +0 -293
  384. package/src/public/avm/opcodes/misc.ts +0 -102
  385. package/src/public/avm/opcodes/storage.ts +0 -87
  386. package/src/public/avm/revert_reason.ts +0 -55
  387. package/src/public/avm/serialization/buffer_cursor.ts +0 -118
  388. package/src/public/avm/serialization/bytecode_serialization.ts +0 -204
  389. package/src/public/avm/serialization/instruction_serialization.ts +0 -249
  390. package/src/public/avm/test_utils.ts +0 -64
  391. package/src/public/debug_fn_name.ts +0 -18
  392. package/src/public/fixtures/custom_bytecode_tests.ts +0 -135
  393. package/src/public/fixtures/minimal_public_tx.ts +0 -36
  394. package/src/public/hinting_db_sources.ts +0 -505
  395. package/src/public/public_tx_simulator/cpp_public_tx_simulator.ts +0 -128
  396. package/src/public/public_tx_simulator/measured_public_tx_simulator.ts +0 -109
  397. package/src/public/public_tx_simulator/public_tx_context.ts +0 -471
  398. package/src/public/public_tx_simulator/telemetry_public_tx_simulator.ts +0 -63
  399. package/src/public/side_effect_trace.ts +0 -290
  400. package/src/public/side_effect_trace_interface.ts +0 -28
  401. package/src/public/state_manager/index.ts +0 -1
  402. package/src/public/state_manager/nullifiers.ts +0 -103
  403. package/src/public/state_manager/public_storage.ts +0 -174
  404. package/src/public/state_manager/state_manager.ts +0 -560
  405. package/src/public/tx_contract_cache.ts +0 -69
@@ -1,114 +0,0 @@
1
- import { BufferCursor } from './buffer_cursor.js';
2
- /**
3
- * All AVM opcodes. (Keep in sync with cpp counterpart code avm_opcode.hpp and rs in opcodes.rs).
4
- * Source: https://yp-aztec.netlify.app/docs/public-vm/instruction-set
5
- */
6
- export declare enum Opcode {
7
- ADD_8 = 0,
8
- ADD_16 = 1,
9
- SUB_8 = 2,
10
- SUB_16 = 3,
11
- MUL_8 = 4,
12
- MUL_16 = 5,
13
- DIV_8 = 6,
14
- DIV_16 = 7,
15
- FDIV_8 = 8,
16
- FDIV_16 = 9,
17
- EQ_8 = 10,
18
- EQ_16 = 11,
19
- LT_8 = 12,
20
- LT_16 = 13,
21
- LTE_8 = 14,
22
- LTE_16 = 15,
23
- AND_8 = 16,
24
- AND_16 = 17,
25
- OR_8 = 18,
26
- OR_16 = 19,
27
- XOR_8 = 20,
28
- XOR_16 = 21,
29
- NOT_8 = 22,
30
- NOT_16 = 23,
31
- SHL_8 = 24,
32
- SHL_16 = 25,
33
- SHR_8 = 26,
34
- SHR_16 = 27,
35
- CAST_8 = 28,
36
- CAST_16 = 29,
37
- GETENVVAR_16 = 30,
38
- CALLDATACOPY = 31,
39
- SUCCESSCOPY = 32,
40
- RETURNDATASIZE = 33,
41
- RETURNDATACOPY = 34,
42
- JUMP_32 = 35,
43
- JUMPI_32 = 36,
44
- INTERNALCALL = 37,
45
- INTERNALRETURN = 38,
46
- SET_8 = 39,
47
- SET_16 = 40,
48
- SET_32 = 41,
49
- SET_64 = 42,
50
- SET_128 = 43,
51
- SET_FF = 44,
52
- MOV_8 = 45,
53
- MOV_16 = 46,
54
- SLOAD = 47,
55
- SSTORE = 48,
56
- NOTEHASHEXISTS = 49,
57
- EMITNOTEHASH = 50,
58
- NULLIFIEREXISTS = 51,
59
- EMITNULLIFIER = 52,
60
- L1TOL2MSGEXISTS = 53,
61
- GETCONTRACTINSTANCE = 54,
62
- EMITUNENCRYPTEDLOG = 55,
63
- SENDL2TOL1MSG = 56,
64
- CALL = 57,
65
- STATICCALL = 58,
66
- RETURN = 59,
67
- REVERT_8 = 60,
68
- REVERT_16 = 61,
69
- DEBUGLOG = 62,
70
- POSEIDON2 = 63,
71
- SHA256COMPRESSION = 64,
72
- KECCAKF1600 = 65,
73
- ECADD = 66,
74
- TORADIXBE = 67
75
- }
76
- export declare const MAX_OPCODE_VALUE: number;
77
- export declare enum OperandType {
78
- UINT8 = 0,
79
- UINT16 = 1,
80
- UINT32 = 2,
81
- UINT64 = 3,
82
- UINT128 = 4,
83
- FF = 5,
84
- TAG = 6
85
- }
86
- type DeserializedValue = number | bigint;
87
- /**
88
- * Returns the size of an operand in bytes.
89
- * Should not be called with unknown operand types.
90
- * @param operandType
91
- * @returns number size in bytes
92
- * @throws AssertionError if the operand type is unknown
93
- */
94
- export declare function getOperandSize(operandType: OperandType): number;
95
- /**
96
- * Reads an array of operands from a buffer.
97
- * @param cursor Buffer to read from. Might be longer than needed.
98
- * @param operands Specification of the operand types.
99
- * @returns An array as big as {@code operands}, with the converted TS values.
100
- */
101
- export declare function deserialize(cursor: BufferCursor | Buffer, operands: OperandType[]): DeserializedValue[];
102
- /**
103
- * Serializes a class using the specified operand types.
104
- * More specifically, this serializes {@code [cls.constructor.opcode, ...Object.values(cls)]}.
105
- * Observe in particular that:
106
- * (1) the first operand type specified must correspond to the opcode;
107
- * (2) the rest of the operand types must be specified in the order returned by {@code Object.values()}.
108
- * @param operands Type specification for the values to be serialized.
109
- * @param cls The class to be serialized.
110
- * @returns
111
- */
112
- export declare function serializeAs(operands: OperandType[], opcode: Opcode, cls: any): Buffer;
113
- export {};
114
- //# sourceMappingURL=instruction_serialization.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"instruction_serialization.d.ts","sourceRoot":"","sources":["../../../../src/public/avm/serialization/instruction_serialization.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD;;;GAGG;AACH,oBAAY,MAAM;IAEhB,KAAK,IAAA;IACL,MAAM,IAAA;IACN,KAAK,IAAA;IACL,MAAM,IAAA;IACN,KAAK,IAAA;IACL,MAAM,IAAA;IACN,KAAK,IAAA;IACL,MAAM,IAAA;IACN,MAAM,IAAA;IACN,OAAO,IAAA;IACP,IAAI,KAAA;IACJ,KAAK,KAAA;IACL,IAAI,KAAA;IACJ,KAAK,KAAA;IACL,KAAK,KAAA;IACL,MAAM,KAAA;IACN,KAAK,KAAA;IACL,MAAM,KAAA;IACN,IAAI,KAAA;IACJ,KAAK,KAAA;IACL,KAAK,KAAA;IACL,MAAM,KAAA;IACN,KAAK,KAAA;IACL,MAAM,KAAA;IACN,KAAK,KAAA;IACL,MAAM,KAAA;IACN,KAAK,KAAA;IACL,MAAM,KAAA;IACN,MAAM,KAAA;IACN,OAAO,KAAA;IAEP,YAAY,KAAA;IACZ,YAAY,KAAA;IACZ,WAAW,KAAA;IACX,cAAc,KAAA;IACd,cAAc,KAAA;IAEd,OAAO,KAAA;IACP,QAAQ,KAAA;IACR,YAAY,KAAA;IACZ,cAAc,KAAA;IAEd,KAAK,KAAA;IACL,MAAM,KAAA;IACN,MAAM,KAAA;IACN,MAAM,KAAA;IACN,OAAO,KAAA;IACP,MAAM,KAAA;IACN,KAAK,KAAA;IACL,MAAM,KAAA;IAEN,KAAK,KAAA;IACL,MAAM,KAAA;IACN,cAAc,KAAA;IACd,YAAY,KAAA;IACZ,eAAe,KAAA;IACf,aAAa,KAAA;IACb,eAAe,KAAA;IACf,mBAAmB,KAAA;IACnB,kBAAkB,KAAA;IAClB,aAAa,KAAA;IAEb,IAAI,KAAA;IACJ,UAAU,KAAA;IACV,MAAM,KAAA;IACN,QAAQ,KAAA;IACR,SAAS,KAAA;IAET,QAAQ,KAAA;IAER,SAAS,KAAA;IACT,iBAAiB,KAAA;IACjB,WAAW,KAAA;IACX,KAAK,KAAA;IAEL,SAAS,KAAA;CACV;AAED,eAAO,MAAM,gBAAgB,QAI5B,CAAC;AAIF,oBAAY,WAAW;IACrB,KAAK,IAAA;IACL,MAAM,IAAA;IACN,MAAM,IAAA;IACN,MAAM,IAAA;IACN,OAAO,IAAA;IACP,EAAE,IAAA;IACF,GAAG,IAAA;CACJ;AAGD,KAAK,iBAAiB,GAAG,MAAM,GAAG,MAAM,CAAC;AAgBzC;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAG/D;AAkDD;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,iBAAiB,EAAE,CAyBvG;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,WAAW,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,MAAM,CAmBrF"}
@@ -1,261 +0,0 @@
1
- import { Fr } from '@aztec/foundation/fields';
2
- import { strict as assert } from 'assert';
3
- import { TaggedMemory } from '../avm_memory_types.js';
4
- import { BufferCursor } from './buffer_cursor.js';
5
- /**
6
- * All AVM opcodes. (Keep in sync with cpp counterpart code avm_opcode.hpp and rs in opcodes.rs).
7
- * Source: https://yp-aztec.netlify.app/docs/public-vm/instruction-set
8
- */ export var Opcode = /*#__PURE__*/ function(Opcode) {
9
- // Compute
10
- Opcode[Opcode["ADD_8"] = 0] = "ADD_8";
11
- Opcode[Opcode["ADD_16"] = 1] = "ADD_16";
12
- Opcode[Opcode["SUB_8"] = 2] = "SUB_8";
13
- Opcode[Opcode["SUB_16"] = 3] = "SUB_16";
14
- Opcode[Opcode["MUL_8"] = 4] = "MUL_8";
15
- Opcode[Opcode["MUL_16"] = 5] = "MUL_16";
16
- Opcode[Opcode["DIV_8"] = 6] = "DIV_8";
17
- Opcode[Opcode["DIV_16"] = 7] = "DIV_16";
18
- Opcode[Opcode["FDIV_8"] = 8] = "FDIV_8";
19
- Opcode[Opcode["FDIV_16"] = 9] = "FDIV_16";
20
- Opcode[Opcode["EQ_8"] = 10] = "EQ_8";
21
- Opcode[Opcode["EQ_16"] = 11] = "EQ_16";
22
- Opcode[Opcode["LT_8"] = 12] = "LT_8";
23
- Opcode[Opcode["LT_16"] = 13] = "LT_16";
24
- Opcode[Opcode["LTE_8"] = 14] = "LTE_8";
25
- Opcode[Opcode["LTE_16"] = 15] = "LTE_16";
26
- Opcode[Opcode["AND_8"] = 16] = "AND_8";
27
- Opcode[Opcode["AND_16"] = 17] = "AND_16";
28
- Opcode[Opcode["OR_8"] = 18] = "OR_8";
29
- Opcode[Opcode["OR_16"] = 19] = "OR_16";
30
- Opcode[Opcode["XOR_8"] = 20] = "XOR_8";
31
- Opcode[Opcode["XOR_16"] = 21] = "XOR_16";
32
- Opcode[Opcode["NOT_8"] = 22] = "NOT_8";
33
- Opcode[Opcode["NOT_16"] = 23] = "NOT_16";
34
- Opcode[Opcode["SHL_8"] = 24] = "SHL_8";
35
- Opcode[Opcode["SHL_16"] = 25] = "SHL_16";
36
- Opcode[Opcode["SHR_8"] = 26] = "SHR_8";
37
- Opcode[Opcode["SHR_16"] = 27] = "SHR_16";
38
- Opcode[Opcode["CAST_8"] = 28] = "CAST_8";
39
- Opcode[Opcode["CAST_16"] = 29] = "CAST_16";
40
- // Execution environment
41
- Opcode[Opcode["GETENVVAR_16"] = 30] = "GETENVVAR_16";
42
- Opcode[Opcode["CALLDATACOPY"] = 31] = "CALLDATACOPY";
43
- Opcode[Opcode["SUCCESSCOPY"] = 32] = "SUCCESSCOPY";
44
- Opcode[Opcode["RETURNDATASIZE"] = 33] = "RETURNDATASIZE";
45
- Opcode[Opcode["RETURNDATACOPY"] = 34] = "RETURNDATACOPY";
46
- // Control flow
47
- Opcode[Opcode["JUMP_32"] = 35] = "JUMP_32";
48
- Opcode[Opcode["JUMPI_32"] = 36] = "JUMPI_32";
49
- Opcode[Opcode["INTERNALCALL"] = 37] = "INTERNALCALL";
50
- Opcode[Opcode["INTERNALRETURN"] = 38] = "INTERNALRETURN";
51
- // Memory
52
- Opcode[Opcode["SET_8"] = 39] = "SET_8";
53
- Opcode[Opcode["SET_16"] = 40] = "SET_16";
54
- Opcode[Opcode["SET_32"] = 41] = "SET_32";
55
- Opcode[Opcode["SET_64"] = 42] = "SET_64";
56
- Opcode[Opcode["SET_128"] = 43] = "SET_128";
57
- Opcode[Opcode["SET_FF"] = 44] = "SET_FF";
58
- Opcode[Opcode["MOV_8"] = 45] = "MOV_8";
59
- Opcode[Opcode["MOV_16"] = 46] = "MOV_16";
60
- // World state
61
- Opcode[Opcode["SLOAD"] = 47] = "SLOAD";
62
- Opcode[Opcode["SSTORE"] = 48] = "SSTORE";
63
- Opcode[Opcode["NOTEHASHEXISTS"] = 49] = "NOTEHASHEXISTS";
64
- Opcode[Opcode["EMITNOTEHASH"] = 50] = "EMITNOTEHASH";
65
- Opcode[Opcode["NULLIFIEREXISTS"] = 51] = "NULLIFIEREXISTS";
66
- Opcode[Opcode["EMITNULLIFIER"] = 52] = "EMITNULLIFIER";
67
- Opcode[Opcode["L1TOL2MSGEXISTS"] = 53] = "L1TOL2MSGEXISTS";
68
- Opcode[Opcode["GETCONTRACTINSTANCE"] = 54] = "GETCONTRACTINSTANCE";
69
- Opcode[Opcode["EMITUNENCRYPTEDLOG"] = 55] = "EMITUNENCRYPTEDLOG";
70
- Opcode[Opcode["SENDL2TOL1MSG"] = 56] = "SENDL2TOL1MSG";
71
- // External calls
72
- Opcode[Opcode["CALL"] = 57] = "CALL";
73
- Opcode[Opcode["STATICCALL"] = 58] = "STATICCALL";
74
- Opcode[Opcode["RETURN"] = 59] = "RETURN";
75
- Opcode[Opcode["REVERT_8"] = 60] = "REVERT_8";
76
- Opcode[Opcode["REVERT_16"] = 61] = "REVERT_16";
77
- // Misc
78
- Opcode[Opcode["DEBUGLOG"] = 62] = "DEBUGLOG";
79
- // Gadgets
80
- Opcode[Opcode["POSEIDON2"] = 63] = "POSEIDON2";
81
- Opcode[Opcode["SHA256COMPRESSION"] = 64] = "SHA256COMPRESSION";
82
- Opcode[Opcode["KECCAKF1600"] = 65] = "KECCAKF1600";
83
- Opcode[Opcode["ECADD"] = 66] = "ECADD";
84
- // Conversion
85
- Opcode[Opcode["TORADIXBE"] = 67] = "TORADIXBE";
86
- return Opcode;
87
- }({});
88
- export const MAX_OPCODE_VALUE = Math.max(...Object.values(Opcode).map((k)=>+k).filter((k)=>!isNaN(k)));
89
- // Possible types for an instruction's operand in its wire format.
90
- // The counterpart cpp file is: vm2/simulation/lib/serialization.hpp.
91
- export var OperandType = /*#__PURE__*/ function(OperandType) {
92
- OperandType[OperandType["UINT8"] = 0] = "UINT8";
93
- OperandType[OperandType["UINT16"] = 1] = "UINT16";
94
- OperandType[OperandType["UINT32"] = 2] = "UINT32";
95
- OperandType[OperandType["UINT64"] = 3] = "UINT64";
96
- OperandType[OperandType["UINT128"] = 4] = "UINT128";
97
- OperandType[OperandType["FF"] = 5] = "FF";
98
- OperandType[OperandType["TAG"] = 6] = "TAG";
99
- return OperandType;
100
- }({});
101
- // Specifies how to read and write each operand type.
102
- const OPERAND_SPEC = new Map([
103
- [
104
- 0,
105
- [
106
- 1,
107
- Buffer.prototype.readUint8,
108
- Buffer.prototype.writeUint8
109
- ]
110
- ],
111
- [
112
- 1,
113
- [
114
- 2,
115
- Buffer.prototype.readUint16BE,
116
- Buffer.prototype.writeUint16BE
117
- ]
118
- ],
119
- [
120
- 2,
121
- [
122
- 4,
123
- Buffer.prototype.readUint32BE,
124
- Buffer.prototype.writeUint32BE
125
- ]
126
- ],
127
- [
128
- 3,
129
- [
130
- 8,
131
- readUint64BE,
132
- writeUint64BE
133
- ]
134
- ],
135
- [
136
- 4,
137
- [
138
- 16,
139
- readUint128BE,
140
- writeUint128BE
141
- ]
142
- ],
143
- [
144
- 5,
145
- [
146
- 32,
147
- readUint254BE,
148
- writeUint254BE
149
- ]
150
- ],
151
- [
152
- 6,
153
- [
154
- 1,
155
- Buffer.prototype.readUint8,
156
- Buffer.prototype.writeUint8
157
- ]
158
- ]
159
- ]);
160
- /**
161
- * Returns the size of an operand in bytes.
162
- * Should not be called with unknown operand types.
163
- * @param operandType
164
- * @returns number size in bytes
165
- * @throws AssertionError if the operand type is unknown
166
- */ export function getOperandSize(operandType) {
167
- assert(OPERAND_SPEC.has(operandType), `Unknown operand type: ${operandType}`);
168
- return OPERAND_SPEC.get(operandType)[0];
169
- }
170
- function readUintBE(buf, offset, totalBytes) {
171
- let value = 0n;
172
- for(let i = 0; i < totalBytes; ++i){
173
- value <<= 8n;
174
- value |= BigInt(buf.readUint8(i + offset));
175
- }
176
- return value;
177
- }
178
- function writeUintBE(buf, value, totalBytes) {
179
- for(let offset = totalBytes - 1; offset >= 0; --offset){
180
- buf.writeUint8(Number(value & 0xffn), offset);
181
- value >>= 8n;
182
- }
183
- }
184
- function readUint64BE(offset) {
185
- return readUintBE(this, offset, 8);
186
- }
187
- function writeUint64BE(value) {
188
- writeUintBE(this, value, 8);
189
- }
190
- function readUint254BE(offset) {
191
- let value = readUintBE(this, offset, 32);
192
- // In circuit, we only support values up to Fr.MODULUS and any deserialized value
193
- // would naturally undergo a modulus reduction.
194
- if (value >= Fr.MODULUS) {
195
- value = value % Fr.MODULUS;
196
- }
197
- return value;
198
- }
199
- function writeUint254BE(value) {
200
- writeUintBE(this, value, 32);
201
- }
202
- function readUint128BE(offset) {
203
- return readUintBE(this, offset, 16);
204
- }
205
- function writeUint128BE(value) {
206
- writeUintBE(this, value, 16);
207
- }
208
- /**
209
- * Reads an array of operands from a buffer.
210
- * @param cursor Buffer to read from. Might be longer than needed.
211
- * @param operands Specification of the operand types.
212
- * @returns An array as big as {@code operands}, with the converted TS values.
213
- */ export function deserialize(cursor, operands) {
214
- const argValues = [];
215
- if (Buffer.isBuffer(cursor)) {
216
- cursor = new BufferCursor(cursor);
217
- }
218
- for (const opType of operands){
219
- const [sizeBytes, reader, _writer] = OPERAND_SPEC.get(opType);
220
- const value = reader.call(cursor.buffer(), cursor.position());
221
- argValues.push(value);
222
- cursor.advance(sizeBytes);
223
- }
224
- // We first want to detect other parsing errors (e.g., instruction size
225
- // is longer than remaining bytes) first and therefore tag validation is done after completion
226
- // of parsing above. Order of errors need to match with circuit.
227
- for(let i = 0; i < operands.length; i++){
228
- if (operands[i] === 6) {
229
- // We parsed a single byte (readUInt8()) and therefore value is of number type (not bigint)
230
- // We need to cast to number because checkIsValidTag expects a number.
231
- TaggedMemory.checkIsValidTag(Number(argValues[i] ?? 0));
232
- }
233
- }
234
- return argValues;
235
- }
236
- /**
237
- * Serializes a class using the specified operand types.
238
- * More specifically, this serializes {@code [cls.constructor.opcode, ...Object.values(cls)]}.
239
- * Observe in particular that:
240
- * (1) the first operand type specified must correspond to the opcode;
241
- * (2) the rest of the operand types must be specified in the order returned by {@code Object.values()}.
242
- * @param operands Type specification for the values to be serialized.
243
- * @param cls The class to be serialized.
244
- * @returns
245
- */ export function serializeAs(operands, opcode, cls) {
246
- const chunks = [];
247
- const rawClassValues = [
248
- opcode,
249
- ...Object.values(cls)
250
- ];
251
- assert(rawClassValues.length === operands.length, `Got ${rawClassValues.length} values but only ${operands.length} serialization operands are specified!`);
252
- const classValues = rawClassValues;
253
- for(let i = 0; i < operands.length; i++){
254
- const opType = operands[i];
255
- const [sizeBytes, _reader, writer] = OPERAND_SPEC.get(opType);
256
- const buf = Buffer.alloc(sizeBytes);
257
- writer.call(buf, classValues[i]);
258
- chunks.push(buf);
259
- }
260
- return Buffer.concat(chunks);
261
- }
@@ -1,15 +0,0 @@
1
- import { Fr } from '@aztec/foundation/fields';
2
- import type { ContractClassPublic, ContractInstanceWithAddress } from '@aztec/stdlib/contract';
3
- import type { PublicContractsDB, PublicTreesDB } from '../public_db_sources.js';
4
- import type { PublicSideEffectTraceInterface } from '../side_effect_trace_interface.js';
5
- export declare function mockTraceFork(trace: PublicSideEffectTraceInterface, nestedTrace?: PublicSideEffectTraceInterface): void;
6
- export declare function mockStorageRead(worldStateDB: PublicTreesDB, value: Fr): void;
7
- export declare function mockNoteHashCount(mockedTrace: PublicSideEffectTraceInterface, count: number): void;
8
- export declare function mockStorageReadWithMap(worldStateDB: PublicTreesDB, mockedStorage: Map<bigint, Fr>): void;
9
- export declare function mockGetNoteHash(worldStateDB: PublicTreesDB, _leafIndex: bigint, value?: Fr): void;
10
- export declare function mockCheckNullifierExists(worldStateDB: PublicTreesDB, exists: boolean, _ignoredValue?: Fr): void;
11
- export declare function mockGetL1ToL2LeafValue(worldStateDB: PublicTreesDB, leafIndex: bigint, value?: Fr): void;
12
- export declare function mockGetContractInstance(contractsDB: PublicContractsDB, contractInstance: ContractInstanceWithAddress): void;
13
- export declare function mockGetContractClass(contractsDB: PublicContractsDB, contractClass: ContractClassPublic): void;
14
- export declare function mockGetBytecodeCommitment(contractsDB: PublicContractsDB, commitment: Fr): void;
15
- //# sourceMappingURL=test_utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"test_utils.d.ts","sourceRoot":"","sources":["../../../src/public/avm/test_utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAK/F,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAChF,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,mCAAmC,CAAC;AAExF,wBAAgB,aAAa,CAAC,KAAK,EAAE,8BAA8B,EAAE,WAAW,CAAC,EAAE,8BAA8B,QAIhH;AAED,wBAAgB,eAAe,CAAC,YAAY,EAAE,aAAa,EAAE,KAAK,EAAE,EAAE,QAErE;AAED,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,8BAA8B,EAAE,KAAK,EAAE,MAAM,QAE3F;AAED,wBAAgB,sBAAsB,CAAC,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,QAIjG;AAED,wBAAgB,eAAe,CAAC,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,EAAE,QAQ1F;AAED,wBAAgB,wBAAwB,CAAC,YAAY,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,CAAC,EAAE,EAAE,QAExG;AAED,wBAAgB,sBAAsB,CAAC,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,EAAE,QAQhG;AAED,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,2BAA2B,QAEpH;AAED,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,iBAAiB,EAAE,aAAa,EAAE,mBAAmB,QAEtG;AAED,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,iBAAiB,EAAE,UAAU,EAAE,EAAE,QAEvF"}
@@ -1,44 +0,0 @@
1
- import { Fr } from '@aztec/foundation/fields';
2
- import { mock } from 'jest-mock-extended';
3
- export function mockTraceFork(trace, nestedTrace) {
4
- trace.fork.mockReturnValue(nestedTrace ?? mock());
5
- }
6
- export function mockStorageRead(worldStateDB, value) {
7
- worldStateDB.storageRead.mockResolvedValue(value);
8
- }
9
- export function mockNoteHashCount(mockedTrace, count) {
10
- mockedTrace.getNoteHashCount.mockReturnValue(count);
11
- }
12
- export function mockStorageReadWithMap(worldStateDB, mockedStorage) {
13
- worldStateDB.storageRead.mockImplementation((_address, slot)=>Promise.resolve(mockedStorage.get(slot.toBigInt()) ?? Fr.ZERO));
14
- }
15
- export function mockGetNoteHash(worldStateDB, _leafIndex, value) {
16
- worldStateDB.getNoteHash.mockImplementation((index)=>{
17
- if (index == _leafIndex && value) {
18
- return Promise.resolve(value);
19
- } else {
20
- return Promise.resolve(Fr.ZERO);
21
- }
22
- });
23
- }
24
- export function mockCheckNullifierExists(worldStateDB, exists, _ignoredValue) {
25
- worldStateDB.checkNullifierExists.mockResolvedValue(exists);
26
- }
27
- export function mockGetL1ToL2LeafValue(worldStateDB, leafIndex, value) {
28
- worldStateDB.getL1ToL2LeafValue.mockImplementation((index)=>{
29
- if (index == leafIndex && value) {
30
- return Promise.resolve(value);
31
- } else {
32
- return Promise.resolve(Fr.ZERO);
33
- }
34
- });
35
- }
36
- export function mockGetContractInstance(contractsDB, contractInstance) {
37
- contractsDB.getContractInstance.mockResolvedValue(contractInstance);
38
- }
39
- export function mockGetContractClass(contractsDB, contractClass) {
40
- contractsDB.getContractClass.mockResolvedValue(contractClass);
41
- }
42
- export function mockGetBytecodeCommitment(contractsDB, commitment) {
43
- contractsDB.getBytecodeCommitment.mockResolvedValue(commitment);
44
- }
@@ -1,5 +0,0 @@
1
- import type { Fr } from '@aztec/foundation/fields';
2
- import type { AztecAddress } from '@aztec/stdlib/aztec-address';
3
- import type { PublicContractsDBInterface } from './db_interfaces.js';
4
- export declare function getPublicFunctionDebugName(db: PublicContractsDBInterface, contractAddress: AztecAddress, calldata: Fr[]): Promise<string>;
5
- //# sourceMappingURL=debug_fn_name.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"debug_fn_name.d.ts","sourceRoot":"","sources":["../../src/public/debug_fn_name.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAEnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAErE,wBAAsB,0BAA0B,CAC9C,EAAE,EAAE,0BAA0B,EAC9B,eAAe,EAAE,YAAY,EAC7B,QAAQ,EAAE,EAAE,EAAE,GACb,OAAO,CAAC,MAAM,CAAC,CAOjB"}
@@ -1,9 +0,0 @@
1
- import { FunctionSelector } from '@aztec/stdlib/abi';
2
- export async function getPublicFunctionDebugName(db, contractAddress, calldata) {
3
- // Public function is dispatched and therefore the target function is passed in the first argument.
4
- if (!calldata[0]) {
5
- return `<calldata[0] undefined> (Contract Address: ${contractAddress})`;
6
- }
7
- const selector = FunctionSelector.fromField(calldata[0]);
8
- return await db.getDebugFunctionName(contractAddress, selector) ?? selector.toString();
9
- }
@@ -1,9 +0,0 @@
1
- import { PublicTxSimulationTester } from './public_tx_simulation_tester.js';
2
- export declare function addressingWithBaseTagIssueTest(isIndirect: boolean, tester: PublicTxSimulationTester): Promise<import("../index.js").PublicTxResult>;
3
- export declare function pcOutOfRangeTest(tester: PublicTxSimulationTester): Promise<import("../index.js").PublicTxResult>;
4
- export declare function invalidOpcodeTest(tester: PublicTxSimulationTester): Promise<import("../index.js").PublicTxResult>;
5
- export declare function invalidByteTest(tester: PublicTxSimulationTester): Promise<import("../index.js").PublicTxResult>;
6
- export declare function instructionTruncatedTest(tester: PublicTxSimulationTester): Promise<import("../index.js").PublicTxResult>;
7
- export declare function invalidTagValueTest(tester: PublicTxSimulationTester): Promise<import("../index.js").PublicTxResult>;
8
- export declare function invalidTagValueAndInstructionTruncatedTest(tester: PublicTxSimulationTester): Promise<import("../index.js").PublicTxResult>;
9
- //# sourceMappingURL=custom_bytecode_tests.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"custom_bytecode_tests.d.ts","sourceRoot":"","sources":["../../../src/public/fixtures/custom_bytecode_tests.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAI5E,wBAAsB,8BAA8B,CAAC,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,wBAAwB,iDAczG;AAED,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,wBAAwB,iDAQtE;AAED,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,wBAAwB,iDAiBvE;AAGD,wBAAsB,eAAe,CAAC,MAAM,EAAE,wBAAwB,iDAOrE;AAGD,wBAAsB,wBAAwB,CAAC,MAAM,EAAE,wBAAwB,iDAU9E;AAGD,wBAAsB,mBAAmB,CAAC,MAAM,EAAE,wBAAwB,iDAYzE;AAGD,wBAAsB,0CAA0C,CAAC,MAAM,EAAE,wBAAwB,iDAchG"}
@@ -1,109 +0,0 @@
1
- import { strict as assert } from 'assert';
2
- import { TypeTag } from '../avm/avm_memory_types.js';
3
- import { Addressing, AddressingMode } from '../avm/opcodes/addressing_mode.js';
4
- import { CalldataCopy, Jump, Return, Set } from '../avm/opcodes/index.js';
5
- import { encodeToBytecode } from '../avm/serialization/bytecode_serialization.js';
6
- import { MAX_OPCODE_VALUE, Opcode, OperandType, getOperandSize } from '../avm/serialization/instruction_serialization.js';
7
- import { testCustomBytecode } from './custom_bytecode_tester.js';
8
- // First instruction resolved a base address (offset 0) which is uninitialized and therefore
9
- // of invalid tag (FF). This will trigger an exceptional halt.
10
- export async function addressingWithBaseTagIssueTest(isIndirect, tester) {
11
- const addressingMode = Addressing.fromModes([
12
- isIndirect ? AddressingMode.INDIRECT_RELATIVE : AddressingMode.RELATIVE,
13
- AddressingMode.DIRECT,
14
- AddressingMode.DIRECT
15
- ]);
16
- const bytecode = encodeToBytecode([
17
- new CalldataCopy(/*indirect=*/ addressingMode.toWire(), /*copySize=*/ 1, /*cdOffset=*/ 0, /*dstOffset=*/ 0),
18
- new Return(/*indirect=*/ 0, /*copySizeOffset=*/ 0, /*returnOffset=*/ 0)
19
- ]);
20
- const txLabel = isIndirect ? 'AddressingWithBaseTagInvalidIndirect' : 'AddressingWithBaseTagInvalidDirect';
21
- return await testCustomBytecode(bytecode, tester, txLabel);
22
- }
23
- export async function pcOutOfRangeTest(tester) {
24
- const bytecode = encodeToBytecode([
25
- new Jump(/*jumpOffset=*/ 123),
26
- new Return(/*indirect=*/ 0, /*copySizeOffset=*/ 0, /*returnOffset=*/ 0)
27
- ]);
28
- const txLabel = 'PcOutOfRange';
29
- return await testCustomBytecode(bytecode, tester, txLabel);
30
- }
31
- export async function invalidOpcodeTest(tester) {
32
- let bytecode = encodeToBytecode([
33
- new Set(/*indirect=*/ 0, /*dstOffset=*/ 0, TypeTag.UINT32, /*value=*/ 0).as(Opcode.SET_8, Set.wireFormat8)
34
- ]);
35
- const offsetReturnOpcodeByte = bytecode.length;
36
- bytecode = Buffer.concat([
37
- bytecode,
38
- encodeToBytecode([
39
- new Return(/*indirect=*/ 0, /*copySizeOffset=*/ 0, /*returnOffset=*/ 0)
40
- ])
41
- ]);
42
- // Manipulate the Return opcode to make the opcode invalid (out of range).
43
- bytecode[offsetReturnOpcodeByte] = MAX_OPCODE_VALUE + 1; // opcode is invalid.
44
- const txLabel = 'InvalidOpcode';
45
- return await testCustomBytecode(bytecode, tester, txLabel);
46
- }
47
- // Single invalid byte in the bytecode.
48
- export async function invalidByteTest(tester) {
49
- const invalidOpcode = MAX_OPCODE_VALUE + 7;
50
- assert(invalidOpcode < 256, 'Invalid opcode must fit in a single byte');
51
- const bytecode = Buffer.from([
52
- invalidOpcode
53
- ]);
54
- const txLabel = 'InvalidByte';
55
- return await testCustomBytecode(bytecode, tester, txLabel);
56
- }
57
- // Truncate the last instruction in the bytecode.
58
- export async function instructionTruncatedTest(tester) {
59
- let bytecode = encodeToBytecode([
60
- new Set(/*indirect=*/ 0, /*dstOffset=*/ 0, TypeTag.UINT32, /*value=*/ 0).as(Opcode.SET_8, Set.wireFormat8)
61
- ]);
62
- // Truncate the bytecode.
63
- bytecode = bytecode.subarray(0, -1);
64
- const txLabel = 'InstructionTruncated';
65
- return await testCustomBytecode(bytecode, tester, txLabel);
66
- }
67
- // Invalid tag value byte in an instruction.
68
- export async function invalidTagValueTest(tester) {
69
- const bytecode = encodeToBytecode([
70
- new Set(/*indirect=*/ 0, /*dstOffset=*/ 0, TypeTag.UINT32, /*value=*/ 0).as(Opcode.SET_8, Set.wireFormat8),
71
- new Return(/*indirect=*/ 0, /*copySizeOffset=*/ 0, /*returnOffset=*/ 0)
72
- ]);
73
- const tagOffset = getTagOffsetInInstruction(Set.wireFormat8);
74
- assert(bytecode[tagOffset].valueOf() == TypeTag.UINT32.valueOf(), 'Set instruction tag should be UINT32 in test');
75
- bytecode[tagOffset] = TypeTag.INVALID;
76
- const txLabel = 'InvalidTagValue';
77
- return await testCustomBytecode(bytecode, tester, txLabel);
78
- }
79
- // Combine an invalid tag in the last instruction that is truncated.
80
- export async function invalidTagValueAndInstructionTruncatedTest(tester) {
81
- let bytecode = encodeToBytecode([
82
- // Important: value argument must be a bigint otherwise a type error will be thrown.
83
- new Set(/*indirect=*/ 0, /*dstOffset=*/ 0, TypeTag.UINT128, /*value=*/ 0n).as(Opcode.SET_128, Set.wireFormat128)
84
- ]);
85
- // Truncate the bytecode.
86
- bytecode = bytecode.subarray(0, -5);
87
- const tagOffset = getTagOffsetInInstruction(Set.wireFormat128);
88
- assert(bytecode[tagOffset].valueOf() == TypeTag.UINT128.valueOf(), 'Set instruction tag should be UINT128 in test');
89
- bytecode[tagOffset] = 0x6f; // Invalid tag value.
90
- const txLabel = 'InvalidTagValueAndInstructionTruncated';
91
- return await testCustomBytecode(bytecode, tester, txLabel);
92
- }
93
- /**
94
- * Returns the offset of the tag in an instruction.
95
- * @details Loops over the wire format operand type entries until it finds the tag.
96
- * Returns the byte offset of the tag based on each operand size that is passed.
97
- *
98
- * @param wireFormat array of operand types
99
- * @returns byte offset of the tag
100
- */ function getTagOffsetInInstruction(wireFormat) {
101
- let offset = 0;
102
- for (const operand of wireFormat){
103
- if (operand === OperandType.TAG) {
104
- break;
105
- }
106
- offset += getOperandSize(operand);
107
- }
108
- return offset;
109
- }
@@ -1,10 +0,0 @@
1
- import { AvmCircuitInputs } from '@aztec/stdlib/avm';
2
- import type { PublicTxResult } from '../public_tx_simulator/public_tx_simulator.js';
3
- import { PublicTxSimulationTester } from './public_tx_simulation_tester.js';
4
- export declare function executeAvmMinimalPublicTx(tester: PublicTxSimulationTester): Promise<PublicTxResult>;
5
- /**
6
- * Reads the AVM circuit inputs for the minimal public tx from a pre-generated JSON file.
7
- * @returns The AvmCircuitInputs for the minimal public tx.
8
- */
9
- export declare function readAvmMinimalPublicTxInputsFromFile(): AvmCircuitInputs;
10
- //# sourceMappingURL=minimal_public_tx.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"minimal_public_tx.d.ts","sourceRoot":"","sources":["../../../src/public/fixtures/minimal_public_tx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAQrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAEpF,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAE5E,wBAAsB,yBAAyB,CAAC,MAAM,EAAE,wBAAwB,GAAG,OAAO,CAAC,cAAc,CAAC,CAezG;AAED;;;GAGG;AACH,wBAAgB,oCAAoC,IAAI,gBAAgB,CAEvE"}
@@ -1,29 +0,0 @@
1
- import { AvmCircuitInputs } from '@aztec/stdlib/avm';
2
- import { ProtocolContracts } from '@aztec/stdlib/tx';
3
- import avmMinimalCircuitInputsJson from '../../../artifacts/avm_minimal_inputs.json' with {
4
- type: 'json'
5
- };
6
- import { TypeTag } from '../avm/avm_memory_types.js';
7
- import { Add, Return, Set } from '../avm/opcodes/index.js';
8
- import { encodeToBytecode } from '../avm/serialization/bytecode_serialization.js';
9
- import { Opcode } from '../avm/serialization/instruction_serialization.js';
10
- import { testCustomBytecode } from './custom_bytecode_tester.js';
11
- export async function executeAvmMinimalPublicTx(tester) {
12
- const minimalBytecode = encodeToBytecode([
13
- new Set(/*indirect*/ 0, /*dstOffset*/ 0, TypeTag.UINT32, /*value*/ 1).as(Opcode.SET_8, Set.wireFormat8),
14
- new Set(/*indirect*/ 0, /*dstOffset*/ 1, TypeTag.UINT32, /*value*/ 2).as(Opcode.SET_8, Set.wireFormat8),
15
- new Add(/*indirect=*/ 0, /*aOffset=*/ 0, /*bOffset=*/ 1, /*dstOffset=*/ 2).as(Opcode.ADD_8, Add.wireFormat8),
16
- new Return(/*indirect=*/ 0, /*copySizeOffset=*/ 0, /*returnOffset=*/ 2)
17
- ]);
18
- const result = await testCustomBytecode(minimalBytecode, tester, 'MinimalTx', 'AvmMinimalContract');
19
- // Modify the protocol contracts to be all zeros
20
- result.avmProvingRequest.inputs.hints.protocolContracts = ProtocolContracts.empty();
21
- result.avmProvingRequest.inputs.publicInputs.protocolContracts = ProtocolContracts.empty();
22
- return result;
23
- }
24
- /**
25
- * Reads the AVM circuit inputs for the minimal public tx from a pre-generated JSON file.
26
- * @returns The AvmCircuitInputs for the minimal public tx.
27
- */ export function readAvmMinimalPublicTxInputsFromFile() {
28
- return AvmCircuitInputs.schema.parse(avmMinimalCircuitInputsJson);
29
- }