@aztec/simulator 0.0.1-commit.993d52e → 0.0.1-commit.9a89641

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 (351) hide show
  1. package/dest/client.d.ts +1 -3
  2. package/dest/client.d.ts.map +1 -1
  3. package/dest/client.js +0 -2
  4. package/dest/private/acvm_wasm.d.ts +1 -1
  5. package/dest/private/acvm_wasm.d.ts.map +1 -1
  6. package/dest/private/acvm_wasm.js +3 -1
  7. package/dest/private/circuit_recording/circuit_recorder.d.ts +36 -23
  8. package/dest/private/circuit_recording/circuit_recorder.d.ts.map +1 -1
  9. package/dest/private/circuit_recording/circuit_recorder.js +65 -69
  10. package/dest/private/circuit_recording/file_circuit_recorder.d.ts +7 -19
  11. package/dest/private/circuit_recording/file_circuit_recorder.d.ts.map +1 -1
  12. package/dest/private/circuit_recording/file_circuit_recorder.js +38 -42
  13. package/dest/private/circuit_recording/simulator_recorder_wrapper.d.ts +1 -1
  14. package/dest/private/circuit_recording/simulator_recorder_wrapper.d.ts.map +1 -1
  15. package/dest/private/circuit_recording/simulator_recorder_wrapper.js +11 -14
  16. package/dest/public/avm/testing/account_proof_fetcher.d.ts +2 -0
  17. package/dest/public/avm/testing/account_proof_fetcher.d.ts.map +1 -0
  18. package/dest/public/avm/{fixtures → testing}/base_avm_simulation_tester.d.ts +2 -1
  19. package/dest/public/avm/testing/base_avm_simulation_tester.d.ts.map +1 -0
  20. package/dest/public/avm/{fixtures → testing}/base_avm_simulation_tester.js +18 -3
  21. package/dest/public/avm/testing/utils.d.ts +32 -0
  22. package/dest/public/avm/testing/utils.d.ts.map +1 -0
  23. package/dest/public/avm/{fixtures → testing}/utils.js +4 -34
  24. package/dest/public/avm_simulator.d.ts +28 -0
  25. package/dest/public/avm_simulator.d.ts.map +1 -0
  26. package/dest/public/avm_simulator.js +4 -0
  27. package/dest/public/avm_simulator_pool.d.ts +45 -0
  28. package/dest/public/avm_simulator_pool.d.ts.map +1 -0
  29. package/dest/public/avm_simulator_pool.js +197 -0
  30. package/dest/public/cdb_ipc_server.d.ts +40 -0
  31. package/dest/public/cdb_ipc_server.d.ts.map +1 -0
  32. package/dest/public/cdb_ipc_server.js +153 -0
  33. package/dest/public/contracts_db_checkpoint.d.ts +2 -2
  34. package/dest/public/contracts_db_checkpoint.d.ts.map +1 -1
  35. package/dest/public/contracts_db_checkpoint.js +1 -1
  36. package/dest/public/fixtures/amm_test.js +2 -2
  37. package/dest/public/fixtures/bulk_test.d.ts +1 -1
  38. package/dest/public/fixtures/bulk_test.d.ts.map +1 -1
  39. package/dest/public/fixtures/bulk_test.js +33 -6
  40. package/dest/public/fixtures/custom_bytecode_tester.d.ts +1 -1
  41. package/dest/public/fixtures/custom_bytecode_tester.d.ts.map +1 -1
  42. package/dest/public/fixtures/custom_bytecode_tester.js +2 -2
  43. package/dest/public/fixtures/index.d.ts +2 -4
  44. package/dest/public/fixtures/index.d.ts.map +1 -1
  45. package/dest/public/fixtures/index.js +1 -3
  46. package/dest/public/fixtures/public_processor_test_env.d.ts +30 -0
  47. package/dest/public/fixtures/public_processor_test_env.d.ts.map +1 -0
  48. package/dest/public/fixtures/public_processor_test_env.js +73 -0
  49. package/dest/public/fixtures/public_tx_simulation_tester.d.ts +12 -7
  50. package/dest/public/fixtures/public_tx_simulation_tester.d.ts.map +1 -1
  51. package/dest/public/fixtures/public_tx_simulation_tester.js +32 -15
  52. package/dest/public/fixtures/simple_contract_data_source.js +1 -1
  53. package/dest/public/fixtures/token_test.js +3 -3
  54. package/dest/public/fixtures/utils.d.ts +2 -2
  55. package/dest/public/fixtures/utils.d.ts.map +1 -1
  56. package/dest/public/fixtures/utils.js +17 -16
  57. package/dest/public/fuzzing/avm_fuzzer_simulator.d.ts +11 -4
  58. package/dest/public/fuzzing/avm_fuzzer_simulator.d.ts.map +1 -1
  59. package/dest/public/fuzzing/avm_fuzzer_simulator.js +24 -10
  60. package/dest/public/fuzzing/avm_simulator_bin.js +4 -4
  61. package/dest/public/index.d.ts +5 -2
  62. package/dest/public/index.d.ts.map +1 -1
  63. package/dest/public/index.js +2 -1
  64. package/dest/public/public_db_sources.d.ts +6 -3
  65. package/dest/public/public_db_sources.d.ts.map +1 -1
  66. package/dest/public/public_db_sources.js +16 -10
  67. package/dest/public/public_processor/guarded_merkle_tree.d.ts +7 -6
  68. package/dest/public/public_processor/guarded_merkle_tree.d.ts.map +1 -1
  69. package/dest/public/public_processor/guarded_merkle_tree.js +7 -4
  70. package/dest/public/public_processor/public_processor.d.ts +12 -7
  71. package/dest/public/public_processor/public_processor.d.ts.map +1 -1
  72. package/dest/public/public_processor/public_processor.js +103 -74
  73. package/dest/public/public_processor/public_processor_metrics.d.ts +4 -1
  74. package/dest/public/public_processor/public_processor_metrics.d.ts.map +1 -1
  75. package/dest/public/public_processor/public_processor_metrics.js +8 -0
  76. package/dest/public/public_tx_simulator/dumping_public_tx_simulator.d.ts +17 -0
  77. package/dest/public/public_tx_simulator/dumping_public_tx_simulator.d.ts.map +1 -0
  78. package/dest/public/public_tx_simulator/{dumping_cpp_public_tx_simulator.js → dumping_public_tx_simulator.js} +10 -23
  79. package/dest/public/public_tx_simulator/factories.d.ts +8 -8
  80. package/dest/public/public_tx_simulator/factories.d.ts.map +1 -1
  81. package/dest/public/public_tx_simulator/factories.js +8 -8
  82. package/dest/public/public_tx_simulator/index.d.ts +4 -6
  83. package/dest/public/public_tx_simulator/index.d.ts.map +1 -1
  84. package/dest/public/public_tx_simulator/index.js +2 -4
  85. package/dest/public/public_tx_simulator/public_tx_simulator.d.ts +42 -71
  86. package/dest/public/public_tx_simulator/public_tx_simulator.d.ts.map +1 -1
  87. package/dest/public/public_tx_simulator/public_tx_simulator.js +98 -318
  88. package/dest/public/public_tx_simulator/public_tx_simulator_base.d.ts +24 -0
  89. package/dest/public/public_tx_simulator/public_tx_simulator_base.d.ts.map +1 -0
  90. package/dest/public/public_tx_simulator/public_tx_simulator_base.js +31 -0
  91. package/dest/public/public_tx_simulator/public_tx_simulator_interface.d.ts +5 -5
  92. package/package.json +20 -18
  93. package/src/client.ts +0 -2
  94. package/src/private/acvm_wasm.ts +4 -1
  95. package/src/private/circuit_recording/circuit_recorder.ts +84 -78
  96. package/src/private/circuit_recording/file_circuit_recorder.ts +38 -48
  97. package/src/private/circuit_recording/simulator_recorder_wrapper.ts +9 -15
  98. package/src/public/avm/{fixtures → testing}/base_avm_simulation_tester.ts +23 -3
  99. package/src/public/avm/{fixtures → testing}/utils.ts +4 -40
  100. package/src/public/avm_simulator.ts +29 -0
  101. package/src/public/avm_simulator_pool.ts +226 -0
  102. package/src/public/cdb_ipc_server.ts +198 -0
  103. package/src/public/contracts_db_checkpoint.ts +1 -1
  104. package/src/public/fixtures/amm_test.ts +2 -2
  105. package/src/public/fixtures/bulk_test.ts +31 -6
  106. package/src/public/fixtures/custom_bytecode_tester.ts +2 -2
  107. package/src/public/fixtures/index.ts +1 -3
  108. package/src/public/fixtures/public_processor_test_env.ts +88 -0
  109. package/src/public/fixtures/public_tx_simulation_tester.ts +44 -25
  110. package/src/public/fixtures/simple_contract_data_source.ts +1 -1
  111. package/src/public/fixtures/token_test.ts +3 -3
  112. package/src/public/fixtures/utils.ts +19 -20
  113. package/src/public/fuzzing/avm_fuzzer_simulator.ts +25 -10
  114. package/src/public/fuzzing/avm_simulator_bin.ts +3 -5
  115. package/src/public/index.ts +7 -3
  116. package/src/public/public_db_sources.ts +21 -14
  117. package/src/public/public_processor/guarded_merkle_tree.ts +10 -7
  118. package/src/public/public_processor/public_processor.ts +134 -87
  119. package/src/public/public_processor/public_processor_metrics.ts +12 -0
  120. package/src/public/public_tx_simulator/{dumping_cpp_public_tx_simulator.ts → dumping_public_tx_simulator.ts} +15 -31
  121. package/src/public/public_tx_simulator/factories.ts +27 -10
  122. package/src/public/public_tx_simulator/index.ts +6 -5
  123. package/src/public/public_tx_simulator/public_tx_simulator.ts +139 -476
  124. package/src/public/public_tx_simulator/public_tx_simulator_base.ts +37 -0
  125. package/src/public/public_tx_simulator/public_tx_simulator_interface.ts +5 -5
  126. package/dest/public/avm/avm_context.d.ts +0 -41
  127. package/dest/public/avm/avm_context.d.ts.map +0 -1
  128. package/dest/public/avm/avm_context.js +0 -44
  129. package/dest/public/avm/avm_contract_call_result.d.ts +0 -32
  130. package/dest/public/avm/avm_contract_call_result.d.ts.map +0 -1
  131. package/dest/public/avm/avm_contract_call_result.js +0 -54
  132. package/dest/public/avm/avm_execution_environment.d.ts +0 -24
  133. package/dest/public/avm/avm_execution_environment.d.ts.map +0 -1
  134. package/dest/public/avm/avm_execution_environment.js +0 -33
  135. package/dest/public/avm/avm_gas.d.ts +0 -44
  136. package/dest/public/avm/avm_gas.d.ts.map +0 -1
  137. package/dest/public/avm/avm_gas.js +0 -195
  138. package/dest/public/avm/avm_machine_state.d.ts +0 -98
  139. package/dest/public/avm/avm_machine_state.d.ts.map +0 -1
  140. package/dest/public/avm/avm_machine_state.js +0 -110
  141. package/dest/public/avm/avm_memory_types.d.ts +0 -275
  142. package/dest/public/avm/avm_memory_types.d.ts.map +0 -1
  143. package/dest/public/avm/avm_memory_types.js +0 -354
  144. package/dest/public/avm/avm_simulator.d.ts +0 -41
  145. package/dest/public/avm/avm_simulator.d.ts.map +0 -1
  146. package/dest/public/avm/avm_simulator.js +0 -192
  147. package/dest/public/avm/avm_simulator_interface.d.ts +0 -9
  148. package/dest/public/avm/avm_simulator_interface.d.ts.map +0 -1
  149. package/dest/public/avm/avm_simulator_interface.js +0 -3
  150. package/dest/public/avm/calldata.d.ts +0 -51
  151. package/dest/public/avm/calldata.d.ts.map +0 -1
  152. package/dest/public/avm/calldata.js +0 -63
  153. package/dest/public/avm/errors.d.ts +0 -104
  154. package/dest/public/avm/errors.d.ts.map +0 -1
  155. package/dest/public/avm/errors.js +0 -141
  156. package/dest/public/avm/fixtures/account_proof_fetcher.d.ts +0 -2
  157. package/dest/public/avm/fixtures/account_proof_fetcher.d.ts.map +0 -1
  158. package/dest/public/avm/fixtures/avm_simulation_tester.d.ts +0 -22
  159. package/dest/public/avm/fixtures/avm_simulation_tester.d.ts.map +0 -1
  160. package/dest/public/avm/fixtures/avm_simulation_tester.js +0 -84
  161. package/dest/public/avm/fixtures/base_avm_simulation_tester.d.ts.map +0 -1
  162. package/dest/public/avm/fixtures/initializers.d.ts +0 -42
  163. package/dest/public/avm/fixtures/initializers.d.ts.map +0 -1
  164. package/dest/public/avm/fixtures/initializers.js +0 -45
  165. package/dest/public/avm/fixtures/utils.d.ts +0 -39
  166. package/dest/public/avm/fixtures/utils.d.ts.map +0 -1
  167. package/dest/public/avm/index.d.ts +0 -2
  168. package/dest/public/avm/index.d.ts.map +0 -1
  169. package/dest/public/avm/index.js +0 -1
  170. package/dest/public/avm/opcodes/accrued_substate.d.ts +0 -74
  171. package/dest/public/avm/opcodes/accrued_substate.d.ts.map +0 -1
  172. package/dest/public/avm/opcodes/accrued_substate.js +0 -254
  173. package/dest/public/avm/opcodes/addressing_mode.d.ts +0 -31
  174. package/dest/public/avm/opcodes/addressing_mode.d.ts.map +0 -1
  175. package/dest/public/avm/opcodes/addressing_mode.js +0 -94
  176. package/dest/public/avm/opcodes/arithmetic.d.ts +0 -49
  177. package/dest/public/avm/opcodes/arithmetic.d.ts.map +0 -1
  178. package/dest/public/avm/opcodes/arithmetic.js +0 -97
  179. package/dest/public/avm/opcodes/bitwise.d.ts +0 -42
  180. package/dest/public/avm/opcodes/bitwise.d.ts.map +0 -1
  181. package/dest/public/avm/opcodes/bitwise.js +0 -99
  182. package/dest/public/avm/opcodes/comparators.d.ts +0 -25
  183. package/dest/public/avm/opcodes/comparators.d.ts.map +0 -1
  184. package/dest/public/avm/opcodes/comparators.js +0 -43
  185. package/dest/public/avm/opcodes/contract.d.ts +0 -20
  186. package/dest/public/avm/opcodes/contract.d.ts.map +0 -1
  187. package/dest/public/avm/opcodes/contract.js +0 -65
  188. package/dest/public/avm/opcodes/control_flow.d.ts +0 -41
  189. package/dest/public/avm/opcodes/control_flow.d.ts.map +0 -1
  190. package/dest/public/avm/opcodes/control_flow.js +0 -107
  191. package/dest/public/avm/opcodes/conversion.d.ts +0 -18
  192. package/dest/public/avm/opcodes/conversion.d.ts.map +0 -1
  193. package/dest/public/avm/opcodes/conversion.js +0 -333
  194. package/dest/public/avm/opcodes/ec_add.d.ts +0 -19
  195. package/dest/public/avm/opcodes/ec_add.d.ts.map +0 -1
  196. package/dest/public/avm/opcodes/ec_add.js +0 -93
  197. package/dest/public/avm/opcodes/environment_getters.d.ts +0 -28
  198. package/dest/public/avm/opcodes/environment_getters.d.ts.map +0 -1
  199. package/dest/public/avm/opcodes/environment_getters.js +0 -77
  200. package/dest/public/avm/opcodes/external_calls.d.ts +0 -59
  201. package/dest/public/avm/opcodes/external_calls.d.ts.map +0 -1
  202. package/dest/public/avm/opcodes/external_calls.js +0 -210
  203. package/dest/public/avm/opcodes/hashing.d.ts +0 -36
  204. package/dest/public/avm/opcodes/hashing.d.ts.map +0 -1
  205. package/dest/public/avm/opcodes/hashing.js +0 -119
  206. package/dest/public/avm/opcodes/index.d.ts +0 -16
  207. package/dest/public/avm/opcodes/index.d.ts.map +0 -1
  208. package/dest/public/avm/opcodes/index.js +0 -15
  209. package/dest/public/avm/opcodes/instruction.d.ts +0 -74
  210. package/dest/public/avm/opcodes/instruction.d.ts.map +0 -1
  211. package/dest/public/avm/opcodes/instruction.js +0 -95
  212. package/dest/public/avm/opcodes/instruction_impl.d.ts +0 -19
  213. package/dest/public/avm/opcodes/instruction_impl.d.ts.map +0 -1
  214. package/dest/public/avm/opcodes/instruction_impl.js +0 -30
  215. package/dest/public/avm/opcodes/memory.d.ts +0 -74
  216. package/dest/public/avm/opcodes/memory.d.ts.map +0 -1
  217. package/dest/public/avm/opcodes/memory.js +0 -257
  218. package/dest/public/avm/opcodes/misc.d.ts +0 -18
  219. package/dest/public/avm/opcodes/misc.d.ts.map +0 -1
  220. package/dest/public/avm/opcodes/misc.js +0 -73
  221. package/dest/public/avm/opcodes/storage.d.ts +0 -25
  222. package/dest/public/avm/opcodes/storage.d.ts.map +0 -1
  223. package/dest/public/avm/opcodes/storage.js +0 -78
  224. package/dest/public/avm/revert_reason.d.ts +0 -18
  225. package/dest/public/avm/revert_reason.d.ts.map +0 -1
  226. package/dest/public/avm/revert_reason.js +0 -39
  227. package/dest/public/avm/serialization/buffer_cursor.d.ts +0 -26
  228. package/dest/public/avm/serialization/buffer_cursor.d.ts.map +0 -1
  229. package/dest/public/avm/serialization/buffer_cursor.js +0 -99
  230. package/dest/public/avm/serialization/bytecode_serialization.d.ts +0 -17
  231. package/dest/public/avm/serialization/bytecode_serialization.d.ts.map +0 -1
  232. package/dest/public/avm/serialization/bytecode_serialization.js +0 -336
  233. package/dest/public/avm/serialization/instruction_serialization.d.ts +0 -114
  234. package/dest/public/avm/serialization/instruction_serialization.d.ts.map +0 -1
  235. package/dest/public/avm/serialization/instruction_serialization.js +0 -261
  236. package/dest/public/avm/test_utils.d.ts +0 -15
  237. package/dest/public/avm/test_utils.d.ts.map +0 -1
  238. package/dest/public/avm/test_utils.js +0 -44
  239. package/dest/public/debug_fn_name.d.ts +0 -18
  240. package/dest/public/debug_fn_name.d.ts.map +0 -1
  241. package/dest/public/debug_fn_name.js +0 -37
  242. package/dest/public/fixtures/custom_bytecode_tests.d.ts +0 -12
  243. package/dest/public/fixtures/custom_bytecode_tests.d.ts.map +0 -1
  244. package/dest/public/fixtures/custom_bytecode_tests.js +0 -174
  245. package/dest/public/fixtures/minimal_public_tx.d.ts +0 -4
  246. package/dest/public/fixtures/minimal_public_tx.d.ts.map +0 -1
  247. package/dest/public/fixtures/minimal_public_tx.js +0 -19
  248. package/dest/public/fixtures/opcode_spammer.d.ts +0 -122
  249. package/dest/public/fixtures/opcode_spammer.d.ts.map +0 -1
  250. package/dest/public/fixtures/opcode_spammer.js +0 -1653
  251. package/dest/public/hinting_db_sources.d.ts +0 -80
  252. package/dest/public/hinting_db_sources.d.ts.map +0 -1
  253. package/dest/public/hinting_db_sources.js +0 -355
  254. package/dest/public/public_tx_simulator/contract_provider_for_cpp.d.ts +0 -19
  255. package/dest/public/public_tx_simulator/contract_provider_for_cpp.d.ts.map +0 -1
  256. package/dest/public/public_tx_simulator/contract_provider_for_cpp.js +0 -98
  257. package/dest/public/public_tx_simulator/cpp_public_tx_simulator.d.ts +0 -53
  258. package/dest/public/public_tx_simulator/cpp_public_tx_simulator.d.ts.map +0 -1
  259. package/dest/public/public_tx_simulator/cpp_public_tx_simulator.js +0 -131
  260. package/dest/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.d.ts +0 -42
  261. package/dest/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.d.ts.map +0 -1
  262. package/dest/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.js +0 -86
  263. package/dest/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.d.ts +0 -30
  264. package/dest/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.d.ts.map +0 -1
  265. package/dest/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.js +0 -171
  266. package/dest/public/public_tx_simulator/dumping_cpp_public_tx_simulator.d.ts +0 -23
  267. package/dest/public/public_tx_simulator/dumping_cpp_public_tx_simulator.d.ts.map +0 -1
  268. package/dest/public/public_tx_simulator/measured_public_tx_simulator.d.ts +0 -31
  269. package/dest/public/public_tx_simulator/measured_public_tx_simulator.d.ts.map +0 -1
  270. package/dest/public/public_tx_simulator/measured_public_tx_simulator.js +0 -51
  271. package/dest/public/public_tx_simulator/public_tx_context.d.ts +0 -131
  272. package/dest/public/public_tx_simulator/public_tx_context.d.ts.map +0 -1
  273. package/dest/public/public_tx_simulator/public_tx_context.js +0 -300
  274. package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.d.ts +0 -21
  275. package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.d.ts.map +0 -1
  276. package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.js +0 -415
  277. package/dest/public/side_effect_trace.d.ts +0 -87
  278. package/dest/public/side_effect_trace.d.ts.map +0 -1
  279. package/dest/public/side_effect_trace.js +0 -199
  280. package/dest/public/side_effect_trace_interface.d.ts +0 -22
  281. package/dest/public/side_effect_trace_interface.d.ts.map +0 -1
  282. package/dest/public/side_effect_trace_interface.js +0 -1
  283. package/dest/public/state_manager/index.d.ts +0 -2
  284. package/dest/public/state_manager/index.d.ts.map +0 -1
  285. package/dest/public/state_manager/index.js +0 -1
  286. package/dest/public/state_manager/nullifiers.d.ts +0 -61
  287. package/dest/public/state_manager/nullifiers.d.ts.map +0 -1
  288. package/dest/public/state_manager/nullifiers.js +0 -92
  289. package/dest/public/state_manager/public_storage.d.ts +0 -66
  290. package/dest/public/state_manager/public_storage.d.ts.map +0 -1
  291. package/dest/public/state_manager/public_storage.js +0 -145
  292. package/dest/public/state_manager/state_manager.d.ts +0 -170
  293. package/dest/public/state_manager/state_manager.d.ts.map +0 -1
  294. package/dest/public/state_manager/state_manager.js +0 -402
  295. package/src/public/avm/avm_context.ts +0 -61
  296. package/src/public/avm/avm_contract_call_result.ts +0 -69
  297. package/src/public/avm/avm_execution_environment.ts +0 -51
  298. package/src/public/avm/avm_gas.ts +0 -183
  299. package/src/public/avm/avm_machine_state.ts +0 -170
  300. package/src/public/avm/avm_memory_types.ts +0 -440
  301. package/src/public/avm/avm_simulator.ts +0 -279
  302. package/src/public/avm/avm_simulator_interface.ts +0 -8
  303. package/src/public/avm/calldata.ts +0 -100
  304. package/src/public/avm/errors.ts +0 -177
  305. package/src/public/avm/fixtures/avm_simulation_tester.ts +0 -122
  306. package/src/public/avm/fixtures/initializers.ts +0 -103
  307. package/src/public/avm/index.ts +0 -1
  308. package/src/public/avm/opcodes/accrued_substate.ts +0 -285
  309. package/src/public/avm/opcodes/addressing_mode.ts +0 -111
  310. package/src/public/avm/opcodes/arithmetic.ts +0 -129
  311. package/src/public/avm/opcodes/bitwise.ts +0 -113
  312. package/src/public/avm/opcodes/comparators.ts +0 -55
  313. package/src/public/avm/opcodes/contract.ts +0 -72
  314. package/src/public/avm/opcodes/control_flow.ts +0 -123
  315. package/src/public/avm/opcodes/conversion.ts +0 -104
  316. package/src/public/avm/opcodes/ec_add.ts +0 -105
  317. package/src/public/avm/opcodes/environment_getters.ts +0 -87
  318. package/src/public/avm/opcodes/external_calls.ts +0 -262
  319. package/src/public/avm/opcodes/hashing.ts +0 -151
  320. package/src/public/avm/opcodes/index.ts +0 -15
  321. package/src/public/avm/opcodes/instruction.ts +0 -136
  322. package/src/public/avm/opcodes/instruction_impl.ts +0 -36
  323. package/src/public/avm/opcodes/memory.ts +0 -293
  324. package/src/public/avm/opcodes/misc.ts +0 -102
  325. package/src/public/avm/opcodes/storage.ts +0 -95
  326. package/src/public/avm/revert_reason.ts +0 -58
  327. package/src/public/avm/serialization/buffer_cursor.ts +0 -118
  328. package/src/public/avm/serialization/bytecode_serialization.ts +0 -215
  329. package/src/public/avm/serialization/instruction_serialization.ts +0 -249
  330. package/src/public/avm/test_utils.ts +0 -64
  331. package/src/public/debug_fn_name.ts +0 -52
  332. package/src/public/fixtures/custom_bytecode_tests.ts +0 -228
  333. package/src/public/fixtures/minimal_public_tx.ts +0 -26
  334. package/src/public/fixtures/opcode_spammer.ts +0 -1717
  335. package/src/public/hinting_db_sources.ts +0 -607
  336. package/src/public/public_tx_simulator/contract_provider_for_cpp.ts +0 -124
  337. package/src/public/public_tx_simulator/cpp_public_tx_simulator.ts +0 -210
  338. package/src/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.ts +0 -134
  339. package/src/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.ts +0 -239
  340. package/src/public/public_tx_simulator/measured_public_tx_simulator.ts +0 -105
  341. package/src/public/public_tx_simulator/public_tx_context.ts +0 -484
  342. package/src/public/public_tx_simulator/telemetry_public_tx_simulator.ts +0 -63
  343. package/src/public/side_effect_trace.ts +0 -293
  344. package/src/public/side_effect_trace_interface.ts +0 -28
  345. package/src/public/state_manager/index.ts +0 -1
  346. package/src/public/state_manager/nullifiers.ts +0 -103
  347. package/src/public/state_manager/public_storage.ts +0 -174
  348. package/src/public/state_manager/state_manager.ts +0 -569
  349. /package/dest/public/avm/{fixtures → testing}/account_proof_fetcher.js +0 -0
  350. /package/src/public/avm/{fixtures → testing}/account_proof.json +0 -0
  351. /package/src/public/avm/{fixtures → testing}/account_proof_fetcher.ts +0 -0
@@ -1,261 +0,0 @@
1
- import { Fr } from '@aztec/foundation/curves/bn254';
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["EMITPUBLICLOG"] = 55] = "EMITPUBLICLOG";
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/curves/bn254';
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=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdF91dGlscy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3B1YmxpYy9hdm0vdGVzdF91dGlscy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDcEQsT0FBTyxLQUFLLEVBQUUsbUJBQW1CLEVBQUUsMkJBQTJCLEVBQUUsTUFBTSx3QkFBd0IsQ0FBQztBQUsvRixPQUFPLEtBQUssRUFBRSxpQkFBaUIsRUFBRSxhQUFhLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUNoRixPQUFPLEtBQUssRUFBRSw4QkFBOEIsRUFBRSxNQUFNLG1DQUFtQyxDQUFDO0FBRXhGLHdCQUFnQixhQUFhLENBQUMsS0FBSyxFQUFFLDhCQUE4QixFQUFFLFdBQVcsQ0FBQyxFQUFFLDhCQUE4QixRQUloSDtBQUVELHdCQUFnQixlQUFlLENBQUMsWUFBWSxFQUFFLGFBQWEsRUFBRSxLQUFLLEVBQUUsRUFBRSxRQUVyRTtBQUVELHdCQUFnQixpQkFBaUIsQ0FBQyxXQUFXLEVBQUUsOEJBQThCLEVBQUUsS0FBSyxFQUFFLE1BQU0sUUFFM0Y7QUFFRCx3QkFBZ0Isc0JBQXNCLENBQUMsWUFBWSxFQUFFLGFBQWEsRUFBRSxhQUFhLEVBQUUsR0FBRyxDQUFDLE1BQU0sRUFBRSxFQUFFLENBQUMsUUFJakc7QUFFRCx3QkFBZ0IsZUFBZSxDQUFDLFlBQVksRUFBRSxhQUFhLEVBQUUsVUFBVSxFQUFFLE1BQU0sRUFBRSxLQUFLLENBQUMsRUFBRSxFQUFFLFFBUTFGO0FBRUQsd0JBQWdCLHdCQUF3QixDQUFDLFlBQVksRUFBRSxhQUFhLEVBQUUsTUFBTSxFQUFFLE9BQU8sRUFBRSxhQUFhLENBQUMsRUFBRSxFQUFFLFFBRXhHO0FBRUQsd0JBQWdCLHNCQUFzQixDQUFDLFlBQVksRUFBRSxhQUFhLEVBQUUsU0FBUyxFQUFFLE1BQU0sRUFBRSxLQUFLLENBQUMsRUFBRSxFQUFFLFFBUWhHO0FBRUQsd0JBQWdCLHVCQUF1QixDQUFDLFdBQVcsRUFBRSxpQkFBaUIsRUFBRSxnQkFBZ0IsRUFBRSwyQkFBMkIsUUFFcEg7QUFFRCx3QkFBZ0Isb0JBQW9CLENBQUMsV0FBVyxFQUFFLGlCQUFpQixFQUFFLGFBQWEsRUFBRSxtQkFBbUIsUUFFdEc7QUFFRCx3QkFBZ0IseUJBQXlCLENBQUMsV0FBVyxFQUFFLGlCQUFpQixFQUFFLFVBQVUsRUFBRSxFQUFFLFFBRXZGIn0=
@@ -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,gCAAgC,CAAC;AACpD,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/curves/bn254';
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,18 +0,0 @@
1
- import { FunctionSelector } from '@aztec/stdlib/abi';
2
- import type { AztecAddress } from '@aztec/stdlib/aztec-address';
3
- import type { CallData } from './avm/calldata.js';
4
- import type { PublicContractsDBInterface } from './db_interfaces.js';
5
- export declare function getPublicFunctionDebugName(db: PublicContractsDBInterface, contractAddress: AztecAddress, calldata: CallData): Promise<string>;
6
- /**
7
- * Get the function selector and optional debug name for a public function.
8
- * Returns the selector and name separately, with name only populated if a debug name is available.
9
- * @param db - The contracts database
10
- * @param contractAddress - The contract address
11
- * @param calldata - The calldata (selector is in calldata[0])
12
- * @returns An object with functionSelector (always if calldata[0] exists) and functionName (only if debug name found)
13
- */
14
- export declare function getPublicFunctionSelectorAndName(db: PublicContractsDBInterface, contractAddress: AztecAddress, calldata: CallData): Promise<{
15
- functionSelector?: FunctionSelector;
16
- functionName?: string;
17
- }>;
18
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVidWdfZm5fbmFtZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3B1YmxpYy9kZWJ1Z19mbl9uYW1lLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBQ3JELE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBRWhFLE9BQU8sS0FBSyxFQUFFLFFBQVEsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBQ2xELE9BQU8sS0FBSyxFQUFFLDBCQUEwQixFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFFckUsd0JBQXNCLDBCQUEwQixDQUM5QyxFQUFFLEVBQUUsMEJBQTBCLEVBQzlCLGVBQWUsRUFBRSxZQUFZLEVBQzdCLFFBQVEsRUFBRSxRQUFRLEdBQ2pCLE9BQU8sQ0FBQyxNQUFNLENBQUMsQ0FZakI7QUFFRDs7Ozs7OztHQU9HO0FBQ0gsd0JBQXNCLGdDQUFnQyxDQUNwRCxFQUFFLEVBQUUsMEJBQTBCLEVBQzlCLGVBQWUsRUFBRSxZQUFZLEVBQzdCLFFBQVEsRUFBRSxRQUFRLEdBQ2pCLE9BQU8sQ0FBQztJQUFFLGdCQUFnQixDQUFDLEVBQUUsZ0JBQWdCLENBQUM7SUFBQyxZQUFZLENBQUMsRUFBRSxNQUFNLENBQUE7Q0FBRSxDQUFDLENBZXpFIn0=
@@ -1 +0,0 @@
1
- {"version":3,"file":"debug_fn_name.d.ts","sourceRoot":"","sources":["../../src/public/debug_fn_name.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAErE,wBAAsB,0BAA0B,CAC9C,EAAE,EAAE,0BAA0B,EAC9B,eAAe,EAAE,YAAY,EAC7B,QAAQ,EAAE,QAAQ,GACjB,OAAO,CAAC,MAAM,CAAC,CAYjB;AAED;;;;;;;GAOG;AACH,wBAAsB,gCAAgC,CACpD,EAAE,EAAE,0BAA0B,EAC9B,eAAe,EAAE,YAAY,EAC7B,QAAQ,EAAE,QAAQ,GACjB,OAAO,CAAC;IAAE,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAezE"}
@@ -1,37 +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
- const selectorField = calldata.read(0);
5
- if (!selectorField) {
6
- return `<calldata[0] undefined> (Contract Address: ${contractAddress})`;
7
- }
8
- const fallbackName = `<calldata[0]:${selectorField.toString()}> (Contract Address: ${contractAddress})`;
9
- const selector = FunctionSelector.fromFieldOrUndefined(selectorField);
10
- if (!selector) {
11
- return fallbackName;
12
- }
13
- return await db.getDebugFunctionName(contractAddress, selector) ?? fallbackName;
14
- }
15
- /**
16
- * Get the function selector and optional debug name for a public function.
17
- * Returns the selector and name separately, with name only populated if a debug name is available.
18
- * @param db - The contracts database
19
- * @param contractAddress - The contract address
20
- * @param calldata - The calldata (selector is in calldata[0])
21
- * @returns An object with functionSelector (always if calldata[0] exists) and functionName (only if debug name found)
22
- */ export async function getPublicFunctionSelectorAndName(db, contractAddress, calldata) {
23
- // Public function is dispatched and therefore the target function is passed in the first argument.
24
- const selectorField = calldata.read(0);
25
- if (!selectorField) {
26
- return {};
27
- }
28
- const selector = FunctionSelector.fromFieldOrUndefined(selectorField);
29
- if (!selector) {
30
- return {};
31
- }
32
- const debugName = await db.getDebugFunctionName(contractAddress, selector);
33
- return {
34
- functionSelector: selector,
35
- functionName: debugName ?? undefined
36
- };
37
- }
@@ -1,12 +0,0 @@
1
- import { PublicTxSimulationTester } from './public_tx_simulation_tester.js';
2
- export declare function addressingWithBaseTagIssueTest(isIndirect: boolean, tester: PublicTxSimulationTester): Promise<import("@aztec/stdlib/avm").PublicTxResult>;
3
- export declare function addressingWithIndirectTagIssueTest(tester: PublicTxSimulationTester): Promise<import("@aztec/stdlib/avm").PublicTxResult>;
4
- export declare function addressingWithIndirectThenRelativeTagIssueTest(tester: PublicTxSimulationTester): Promise<import("@aztec/stdlib/avm").PublicTxResult>;
5
- export declare function addressingWithRelativeOverflowAndIndirectTagIssueTest(tester: PublicTxSimulationTester): Promise<import("@aztec/stdlib/avm").PublicTxResult>;
6
- export declare function pcOutOfRangeTest(tester: PublicTxSimulationTester): Promise<import("@aztec/stdlib/avm").PublicTxResult>;
7
- export declare function invalidOpcodeTest(tester: PublicTxSimulationTester): Promise<import("@aztec/stdlib/avm").PublicTxResult>;
8
- export declare function invalidByteTest(tester: PublicTxSimulationTester): Promise<import("@aztec/stdlib/avm").PublicTxResult>;
9
- export declare function instructionTruncatedTest(tester: PublicTxSimulationTester): Promise<import("@aztec/stdlib/avm").PublicTxResult>;
10
- export declare function invalidTagValueTest(tester: PublicTxSimulationTester): Promise<import("@aztec/stdlib/avm").PublicTxResult>;
11
- export declare function invalidTagValueAndInstructionTruncatedTest(tester: PublicTxSimulationTester): Promise<import("@aztec/stdlib/avm").PublicTxResult>;
12
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3VzdG9tX2J5dGVjb2RlX3Rlc3RzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvcHVibGljL2ZpeHR1cmVzL2N1c3RvbV9ieXRlY29kZV90ZXN0cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFhQSxPQUFPLEVBQUUsd0JBQXdCLEVBQUUsTUFBTSxrQ0FBa0MsQ0FBQztBQUk1RSx3QkFBc0IsOEJBQThCLENBQUMsVUFBVSxFQUFFLE9BQU8sRUFBRSxNQUFNLEVBQUUsd0JBQXdCLHVEQWN6RztBQUtELHdCQUFzQixrQ0FBa0MsQ0FBQyxNQUFNLEVBQUUsd0JBQXdCLHVEQXNCeEY7QUFPRCx3QkFBc0IsOENBQThDLENBQUMsTUFBTSxFQUFFLHdCQUF3Qix1REF3QnBHO0FBT0Qsd0JBQXNCLHFEQUFxRCxDQUFDLE1BQU0sRUFBRSx3QkFBd0IsdURBeUIzRztBQUVELHdCQUFzQixnQkFBZ0IsQ0FBQyxNQUFNLEVBQUUsd0JBQXdCLHVEQVF0RTtBQUVELHdCQUFzQixpQkFBaUIsQ0FBQyxNQUFNLEVBQUUsd0JBQXdCLHVEQWlCdkU7QUFHRCx3QkFBc0IsZUFBZSxDQUFDLE1BQU0sRUFBRSx3QkFBd0IsdURBT3JFO0FBR0Qsd0JBQXNCLHdCQUF3QixDQUFDLE1BQU0sRUFBRSx3QkFBd0IsdURBVTlFO0FBR0Qsd0JBQXNCLG1CQUFtQixDQUFDLE1BQU0sRUFBRSx3QkFBd0IsdURBWXpFO0FBR0Qsd0JBQXNCLDBDQUEwQyxDQUFDLE1BQU0sRUFBRSx3QkFBd0IsdURBaUJoRyJ9
@@ -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,uDAczG;AAKD,wBAAsB,kCAAkC,CAAC,MAAM,EAAE,wBAAwB,uDAsBxF;AAOD,wBAAsB,8CAA8C,CAAC,MAAM,EAAE,wBAAwB,uDAwBpG;AAOD,wBAAsB,qDAAqD,CAAC,MAAM,EAAE,wBAAwB,uDAyB3G;AAED,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,wBAAwB,uDAQtE;AAED,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,wBAAwB,uDAiBvE;AAGD,wBAAsB,eAAe,CAAC,MAAM,EAAE,wBAAwB,uDAOrE;AAGD,wBAAsB,wBAAwB,CAAC,MAAM,EAAE,wBAAwB,uDAU9E;AAGD,wBAAsB,mBAAmB,CAAC,MAAM,EAAE,wBAAwB,uDAYzE;AAGD,wBAAsB,0CAA0C,CAAC,MAAM,EAAE,wBAAwB,uDAiBhG"}
@@ -1,174 +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 { Add, 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 { deployAndExecuteCustomBytecode } 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(/*addressing_mode=*/ addressingMode.toWire(), /*copySize=*/ 1, /*cdOffset=*/ 0, /*dstOffset=*/ 0),
18
- new Return(/*addressing_mode=*/ 0, /*copySizeOffset=*/ 0, /*returnOffset=*/ 0)
19
- ]);
20
- const txLabel = isIndirect ? 'AddressingWithBaseTagInvalidIndirect' : 'AddressingWithBaseTagInvalidDirect';
21
- return await deployAndExecuteCustomBytecode(bytecode, tester, txLabel);
22
- }
23
- // First instruction sets a value with tag U64 at offset 0. Then a CalldataCopy instruction
24
- // uses INDIRECT addressing to read from offset 0, which should fail because the value at
25
- // offset 0 has tag U64 (not U32), making it an invalid address tag.
26
- export async function addressingWithIndirectTagIssueTest(tester) {
27
- // Set a U64 value at offset 0 - this will be used as an indirect address
28
- const addressingMode = Addressing.fromModes([
29
- AddressingMode.INDIRECT,
30
- AddressingMode.DIRECT,
31
- AddressingMode.DIRECT
32
- ]);
33
- const bytecode = encodeToBytecode([
34
- // Set a U64 value at offset 0 - this has the wrong tag for an address (should be U32)
35
- new Set(/*addressing_mode=*/ 0, /*dstOffset=*/ 0, TypeTag.UINT64, /*value=*/ 100n).as(Opcode.SET_64, Set.wireFormat64),
36
- // Try to use indirect addressing: read from offset 0, which contains a U64 value
37
- // This should fail because U64 is not a valid address tag (must be U32)
38
- new CalldataCopy(/*addressing_mode=*/ addressingMode.toWire(), /*copySize=*/ 1, /*cdOffset=*/ 0, /*dstOffset=*/ 1),
39
- new Return(/*addressing_mode=*/ 0, /*copySizeOffset=*/ 0, /*returnOffset=*/ 0)
40
- ]);
41
- const txLabel = 'AddressingWithIndirectTagInvalid';
42
- return await deployAndExecuteCustomBytecode(bytecode, tester, txLabel);
43
- }
44
- // First instruction sets a value 10 with tag U32 at offset 1 (direct, no relative).
45
- // Then an ADD_16 instruction uses INDIRECT addressing for the first operand (offset 1)
46
- // and RELATIVE addressing for the second operand (offset 2). The indirect addressing
47
- // succeeds (reads U32 value 10 from offset 1, uses it as address), but the relative
48
- // addressing fails because the base address at offset 0 has the wrong tag (uninitialized/invalid).
49
- export async function addressingWithIndirectThenRelativeTagIssueTest(tester) {
50
- const addressingMode = Addressing.fromModes([
51
- AddressingMode.INDIRECT,
52
- AddressingMode.RELATIVE,
53
- AddressingMode.DIRECT
54
- ]);
55
- const bytecode = encodeToBytecode([
56
- // Set a U32 value 10 at offset 1 - this will be used as an indirect address
57
- new Set(/*addressing_mode=*/ 0, /*dstOffset=*/ 1, TypeTag.UINT32, /*value=*/ 10).as(Opcode.SET_32, Set.wireFormat32),
58
- // ADD_16: first operand uses indirect addressing (reads from offset 1, gets value 10, uses as address - succeeds)
59
- // second operand uses relative addressing (tries to read base from offset 0, but offset 0 has wrong tag - fails)
60
- new Add(/*addressing_mode=*/ addressingMode.toWire(), /*aOffset=*/ 1, /*bOffset=*/ 2, /*dstOffset=*/ 3).as(Opcode.ADD_16, Add.wireFormat16),
61
- new Return(/*addressing_mode=*/ 0, /*copySizeOffset=*/ 0, /*returnOffset=*/ 0)
62
- ]);
63
- const txLabel = 'AddressingWithIndirectThenRelativeTagInvalid';
64
- return await deployAndExecuteCustomBytecode(bytecode, tester, txLabel);
65
- }
66
- // First instruction sets UINT32_MAX at offset 0 (base address) with tag U32.
67
- // Then an ADD_8 instruction uses INDIRECT_RELATIVE addressing for the first operand (offset 1)
68
- // and INDIRECT addressing for the second operand (offset 2). The relative addressing
69
- // for the first operand will overflow (UINT32_MAX + 1 >= MAX_MEMORY_SIZE), causing the instruction to fail.
70
- // The second operand will also fail (indirect addressing from offset 2 which is uninitialized with tag FF).
71
- export async function addressingWithRelativeOverflowAndIndirectTagIssueTest(tester) {
72
- const addressingMode = Addressing.fromModes([
73
- AddressingMode.INDIRECT_RELATIVE,
74
- AddressingMode.INDIRECT,
75
- AddressingMode.DIRECT
76
- ]);
77
- // UINT32_MAX = 2^32 - 1 = 4294967295
78
- const UINT32_MAX = 0xffffffff;
79
- const bytecode = encodeToBytecode([
80
- // Set UINT32_MAX at offset 0 as base address - this will cause overflow when adding relative offset 1
81
- new Set(/*addressing_mode=*/ 0, /*dstOffset=*/ 0, TypeTag.UINT32, /*value=*/ UINT32_MAX).as(Opcode.SET_32, Set.wireFormat32),
82
- new Add(/*addressing_mode=*/ addressingMode.toWire(), /*aOffset=*/ 1, /*bOffset=*/ 2, /*dstOffset=*/ 3).as(Opcode.ADD_8, Add.wireFormat8),
83
- new Return(/*addressing_mode=*/ 0, /*copySizeOffset=*/ 0, /*returnOffset=*/ 0)
84
- ]);
85
- const txLabel = 'AddressingWithRelativeOverflowAndIndirectTagInvalid';
86
- return await deployAndExecuteCustomBytecode(bytecode, tester, txLabel);
87
- }
88
- export async function pcOutOfRangeTest(tester) {
89
- const bytecode = encodeToBytecode([
90
- new Jump(/*jumpOffset=*/ 123),
91
- new Return(/*addressing_mode=*/ 0, /*copySizeOffset=*/ 0, /*returnOffset=*/ 0)
92
- ]);
93
- const txLabel = 'PcOutOfRange';
94
- return await deployAndExecuteCustomBytecode(bytecode, tester, txLabel);
95
- }
96
- export async function invalidOpcodeTest(tester) {
97
- let bytecode = encodeToBytecode([
98
- new Set(/*addressing_mode=*/ 0, /*dstOffset=*/ 0, TypeTag.UINT32, /*value=*/ 0).as(Opcode.SET_8, Set.wireFormat8)
99
- ]);
100
- const offsetReturnOpcodeByte = bytecode.length;
101
- bytecode = Buffer.concat([
102
- bytecode,
103
- encodeToBytecode([
104
- new Return(/*addressing_mode=*/ 0, /*copySizeOffset=*/ 0, /*returnOffset=*/ 0)
105
- ])
106
- ]);
107
- // Manipulate the Return opcode to make the opcode invalid (out of range).
108
- bytecode[offsetReturnOpcodeByte] = MAX_OPCODE_VALUE + 1; // opcode is invalid.
109
- const txLabel = 'InvalidOpcode';
110
- return await deployAndExecuteCustomBytecode(bytecode, tester, txLabel);
111
- }
112
- // Single invalid byte in the bytecode.
113
- export async function invalidByteTest(tester) {
114
- const invalidOpcode = MAX_OPCODE_VALUE + 7;
115
- assert(invalidOpcode < 256, 'Invalid opcode must fit in a single byte');
116
- const bytecode = Buffer.from([
117
- invalidOpcode
118
- ]);
119
- const txLabel = 'InvalidByte';
120
- return await deployAndExecuteCustomBytecode(bytecode, tester, txLabel);
121
- }
122
- // Truncate the last instruction in the bytecode.
123
- export async function instructionTruncatedTest(tester) {
124
- let bytecode = encodeToBytecode([
125
- new Set(/*addressing_mode=*/ 0, /*dstOffset=*/ 0, TypeTag.UINT32, /*value=*/ 0).as(Opcode.SET_8, Set.wireFormat8)
126
- ]);
127
- // Truncate the bytecode.
128
- bytecode = bytecode.subarray(0, -1);
129
- const txLabel = 'InstructionTruncated';
130
- return await deployAndExecuteCustomBytecode(bytecode, tester, txLabel);
131
- }
132
- // Invalid tag value byte in an instruction.
133
- export async function invalidTagValueTest(tester) {
134
- const bytecode = encodeToBytecode([
135
- new Set(/*addressing_mode=*/ 0, /*dstOffset=*/ 0, TypeTag.UINT32, /*value=*/ 0).as(Opcode.SET_8, Set.wireFormat8),
136
- new Return(/*addressing_mode=*/ 0, /*copySizeOffset=*/ 0, /*returnOffset=*/ 0)
137
- ]);
138
- const tagOffset = getTagOffsetInInstruction(Set.wireFormat8);
139
- assert(bytecode[tagOffset].valueOf() == TypeTag.UINT32.valueOf(), 'Set instruction tag should be UINT32 in test');
140
- bytecode[tagOffset] = TypeTag.INVALID;
141
- const txLabel = 'InvalidTagValue';
142
- return await deployAndExecuteCustomBytecode(bytecode, tester, txLabel);
143
- }
144
- // Combine an invalid tag in the last instruction that is truncated.
145
- export async function invalidTagValueAndInstructionTruncatedTest(tester) {
146
- let bytecode = encodeToBytecode([
147
- // Important: value argument must be a bigint otherwise a type error will be thrown.
148
- new Set(/*addressing_mode=*/ 0, /*dstOffset=*/ 0, TypeTag.UINT128, /*value=*/ 0n).as(Opcode.SET_128, Set.wireFormat128)
149
- ]);
150
- // Truncate the bytecode.
151
- bytecode = bytecode.subarray(0, -5);
152
- const tagOffset = getTagOffsetInInstruction(Set.wireFormat128);
153
- assert(bytecode[tagOffset].valueOf() == TypeTag.UINT128.valueOf(), 'Set instruction tag should be UINT128 in test');
154
- bytecode[tagOffset] = 0x6f; // Invalid tag value.
155
- const txLabel = 'InvalidTagValueAndInstructionTruncated';
156
- return await deployAndExecuteCustomBytecode(bytecode, tester, txLabel);
157
- }
158
- /**
159
- * Returns the offset of the tag in an instruction.
160
- * @details Loops over the wire format operand type entries until it finds the tag.
161
- * Returns the byte offset of the tag based on each operand size that is passed.
162
- *
163
- * @param wireFormat array of operand types
164
- * @returns byte offset of the tag
165
- */ function getTagOffsetInInstruction(wireFormat) {
166
- let offset = 0;
167
- for (const operand of wireFormat){
168
- if (operand === OperandType.TAG) {
169
- break;
170
- }
171
- offset += getOperandSize(operand);
172
- }
173
- return offset;
174
- }
@@ -1,4 +0,0 @@
1
- import type { PublicTxResult } from '@aztec/stdlib/avm';
2
- import { PublicTxSimulationTester } from './public_tx_simulation_tester.js';
3
- export declare function executeAvmMinimalPublicTx(tester: PublicTxSimulationTester): Promise<PublicTxResult>;
4
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWluaW1hbF9wdWJsaWNfdHguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9wdWJsaWMvZml4dHVyZXMvbWluaW1hbF9wdWJsaWNfdHgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsY0FBYyxFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFReEQsT0FBTyxFQUFFLHdCQUF3QixFQUFFLE1BQU0sa0NBQWtDLENBQUM7QUFFNUUsd0JBQXNCLHlCQUF5QixDQUFDLE1BQU0sRUFBRSx3QkFBd0IsR0FBRyxPQUFPLENBQUMsY0FBYyxDQUFDLENBZXpHIn0=
@@ -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,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAQxD,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAE5E,wBAAsB,yBAAyB,CAAC,MAAM,EAAE,wBAAwB,GAAG,OAAO,CAAC,cAAc,CAAC,CAezG"}
@@ -1,19 +0,0 @@
1
- import { ProtocolContracts } from '@aztec/stdlib/tx';
2
- import { TypeTag } from '../avm/avm_memory_types.js';
3
- import { Add, Return, Set } from '../avm/opcodes/index.js';
4
- import { encodeToBytecode } from '../avm/serialization/bytecode_serialization.js';
5
- import { Opcode } from '../avm/serialization/instruction_serialization.js';
6
- import { deployAndExecuteCustomBytecode } from './custom_bytecode_tester.js';
7
- export async function executeAvmMinimalPublicTx(tester) {
8
- const minimalBytecode = encodeToBytecode([
9
- new Set(/*indirect*/ 0, /*dstOffset*/ 0, TypeTag.UINT32, /*value*/ 1).as(Opcode.SET_8, Set.wireFormat8),
10
- new Set(/*indirect*/ 0, /*dstOffset*/ 1, TypeTag.UINT32, /*value*/ 2).as(Opcode.SET_8, Set.wireFormat8),
11
- new Add(/*addressing_mode=*/ 0, /*aOffset=*/ 0, /*bOffset=*/ 1, /*dstOffset=*/ 2).as(Opcode.ADD_8, Add.wireFormat8),
12
- new Return(/*addressing_mode=*/ 0, /*copySizeOffset=*/ 0, /*returnOffset=*/ 2)
13
- ]);
14
- const result = await deployAndExecuteCustomBytecode(minimalBytecode, tester, 'MinimalTx', 'AvmMinimalContract');
15
- // Modify the protocol contracts to be all zeros
16
- result.hints.protocolContracts = ProtocolContracts.empty();
17
- result.publicInputs.protocolContracts = ProtocolContracts.empty();
18
- return result;
19
- }