@aztec/simulator 0.0.1-commit.3100065 → 0.0.1-commit.321f6a9

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 (319) hide show
  1. package/dest/public/avm/testing/account_proof_fetcher.d.ts +2 -0
  2. package/dest/public/avm/testing/account_proof_fetcher.d.ts.map +1 -0
  3. package/dest/public/avm/{fixtures → testing}/base_avm_simulation_tester.d.ts +1 -1
  4. package/dest/public/avm/testing/base_avm_simulation_tester.d.ts.map +1 -0
  5. package/dest/public/avm/testing/utils.d.ts +32 -0
  6. package/dest/public/avm/testing/utils.d.ts.map +1 -0
  7. package/dest/public/avm/{fixtures → testing}/utils.js +0 -33
  8. package/dest/public/avm_simulator.d.ts +28 -0
  9. package/dest/public/avm_simulator.d.ts.map +1 -0
  10. package/dest/public/avm_simulator.js +4 -0
  11. package/dest/public/avm_simulator_pool.d.ts +45 -0
  12. package/dest/public/avm_simulator_pool.d.ts.map +1 -0
  13. package/dest/public/avm_simulator_pool.js +197 -0
  14. package/dest/public/cdb/generated/api_types.d.ts +171 -0
  15. package/dest/public/cdb/generated/api_types.d.ts.map +1 -0
  16. package/dest/public/cdb/generated/api_types.js +314 -0
  17. package/dest/public/cdb/generated/server.d.ts +26 -0
  18. package/dest/public/cdb/generated/server.d.ts.map +1 -0
  19. package/dest/public/cdb/generated/server.js +135 -0
  20. package/dest/public/cdb_ipc_server.d.ts +33 -0
  21. package/dest/public/cdb_ipc_server.d.ts.map +1 -0
  22. package/dest/public/cdb_ipc_server.js +153 -0
  23. package/dest/public/fixtures/index.d.ts +2 -4
  24. package/dest/public/fixtures/index.d.ts.map +1 -1
  25. package/dest/public/fixtures/index.js +1 -3
  26. package/dest/public/fixtures/public_processor_test_env.d.ts +30 -0
  27. package/dest/public/fixtures/public_processor_test_env.d.ts.map +1 -0
  28. package/dest/public/fixtures/public_processor_test_env.js +73 -0
  29. package/dest/public/fixtures/public_tx_simulation_tester.d.ts +11 -7
  30. package/dest/public/fixtures/public_tx_simulation_tester.d.ts.map +1 -1
  31. package/dest/public/fixtures/public_tx_simulation_tester.js +29 -41
  32. package/dest/public/fixtures/simple_contract_data_source.js +1 -1
  33. package/dest/public/fuzzing/avm_fuzzer_simulator.d.ts +11 -4
  34. package/dest/public/fuzzing/avm_fuzzer_simulator.d.ts.map +1 -1
  35. package/dest/public/fuzzing/avm_fuzzer_simulator.js +24 -10
  36. package/dest/public/fuzzing/avm_simulator_bin.js +4 -4
  37. package/dest/public/index.d.ts +5 -2
  38. package/dest/public/index.d.ts.map +1 -1
  39. package/dest/public/index.js +2 -1
  40. package/dest/public/public_db_sources.d.ts +2 -2
  41. package/dest/public/public_db_sources.d.ts.map +1 -1
  42. package/dest/public/public_db_sources.js +1 -1
  43. package/dest/public/public_processor/guarded_merkle_tree.d.ts +4 -3
  44. package/dest/public/public_processor/guarded_merkle_tree.d.ts.map +1 -1
  45. package/dest/public/public_processor/guarded_merkle_tree.js +3 -0
  46. package/dest/public/public_processor/public_processor.d.ts +8 -4
  47. package/dest/public/public_processor/public_processor.d.ts.map +1 -1
  48. package/dest/public/public_processor/public_processor.js +19 -34
  49. package/dest/public/public_tx_simulator/dumping_public_tx_simulator.d.ts +17 -0
  50. package/dest/public/public_tx_simulator/dumping_public_tx_simulator.d.ts.map +1 -0
  51. package/dest/public/public_tx_simulator/{dumping_cpp_public_tx_simulator.js → dumping_public_tx_simulator.js} +10 -23
  52. package/dest/public/public_tx_simulator/factories.d.ts +8 -8
  53. package/dest/public/public_tx_simulator/factories.d.ts.map +1 -1
  54. package/dest/public/public_tx_simulator/factories.js +8 -8
  55. package/dest/public/public_tx_simulator/index.d.ts +4 -6
  56. package/dest/public/public_tx_simulator/index.d.ts.map +1 -1
  57. package/dest/public/public_tx_simulator/index.js +2 -4
  58. package/dest/public/public_tx_simulator/public_tx_simulator.d.ts +42 -75
  59. package/dest/public/public_tx_simulator/public_tx_simulator.d.ts.map +1 -1
  60. package/dest/public/public_tx_simulator/public_tx_simulator.js +98 -323
  61. package/dest/public/public_tx_simulator/public_tx_simulator_base.d.ts +24 -0
  62. package/dest/public/public_tx_simulator/public_tx_simulator_base.d.ts.map +1 -0
  63. package/dest/public/public_tx_simulator/public_tx_simulator_base.js +31 -0
  64. package/dest/public/public_tx_simulator/public_tx_simulator_interface.d.ts +5 -5
  65. package/dest/public/test_executor_metrics.d.ts +1 -6
  66. package/dest/public/test_executor_metrics.d.ts.map +1 -1
  67. package/dest/public/test_executor_metrics.js +0 -22
  68. package/package.json +22 -19
  69. package/src/public/avm/{fixtures → testing}/utils.ts +0 -39
  70. package/src/public/avm_simulator.ts +29 -0
  71. package/src/public/avm_simulator_pool.ts +226 -0
  72. package/src/public/cdb/generated/api_types.ts +457 -0
  73. package/src/public/cdb/generated/server.ts +109 -0
  74. package/src/public/cdb_ipc_server.ts +197 -0
  75. package/src/public/fixtures/index.ts +1 -3
  76. package/src/public/fixtures/public_processor_test_env.ts +88 -0
  77. package/src/public/fixtures/public_tx_simulation_tester.ts +37 -50
  78. package/src/public/fixtures/simple_contract_data_source.ts +1 -1
  79. package/src/public/fuzzing/avm_fuzzer_simulator.ts +25 -10
  80. package/src/public/fuzzing/avm_simulator_bin.ts +3 -5
  81. package/src/public/index.ts +7 -3
  82. package/src/public/public_db_sources.ts +1 -1
  83. package/src/public/public_processor/guarded_merkle_tree.ts +5 -2
  84. package/src/public/public_processor/public_processor.ts +25 -39
  85. package/src/public/public_tx_simulator/{dumping_cpp_public_tx_simulator.ts → dumping_public_tx_simulator.ts} +15 -31
  86. package/src/public/public_tx_simulator/factories.ts +27 -10
  87. package/src/public/public_tx_simulator/index.ts +6 -5
  88. package/src/public/public_tx_simulator/public_tx_simulator.ts +139 -480
  89. package/src/public/public_tx_simulator/public_tx_simulator_base.ts +37 -0
  90. package/src/public/public_tx_simulator/public_tx_simulator_interface.ts +5 -5
  91. package/src/public/test_executor_metrics.ts +0 -24
  92. package/dest/public/avm/avm_context.d.ts +0 -41
  93. package/dest/public/avm/avm_context.d.ts.map +0 -1
  94. package/dest/public/avm/avm_context.js +0 -44
  95. package/dest/public/avm/avm_contract_call_result.d.ts +0 -32
  96. package/dest/public/avm/avm_contract_call_result.d.ts.map +0 -1
  97. package/dest/public/avm/avm_contract_call_result.js +0 -54
  98. package/dest/public/avm/avm_execution_environment.d.ts +0 -24
  99. package/dest/public/avm/avm_execution_environment.d.ts.map +0 -1
  100. package/dest/public/avm/avm_execution_environment.js +0 -33
  101. package/dest/public/avm/avm_gas.d.ts +0 -44
  102. package/dest/public/avm/avm_gas.d.ts.map +0 -1
  103. package/dest/public/avm/avm_gas.js +0 -195
  104. package/dest/public/avm/avm_machine_state.d.ts +0 -98
  105. package/dest/public/avm/avm_machine_state.d.ts.map +0 -1
  106. package/dest/public/avm/avm_machine_state.js +0 -110
  107. package/dest/public/avm/avm_memory_types.d.ts +0 -275
  108. package/dest/public/avm/avm_memory_types.d.ts.map +0 -1
  109. package/dest/public/avm/avm_memory_types.js +0 -354
  110. package/dest/public/avm/avm_simulator.d.ts +0 -41
  111. package/dest/public/avm/avm_simulator.d.ts.map +0 -1
  112. package/dest/public/avm/avm_simulator.js +0 -192
  113. package/dest/public/avm/avm_simulator_interface.d.ts +0 -9
  114. package/dest/public/avm/avm_simulator_interface.d.ts.map +0 -1
  115. package/dest/public/avm/avm_simulator_interface.js +0 -3
  116. package/dest/public/avm/calldata.d.ts +0 -51
  117. package/dest/public/avm/calldata.d.ts.map +0 -1
  118. package/dest/public/avm/calldata.js +0 -64
  119. package/dest/public/avm/errors.d.ts +0 -104
  120. package/dest/public/avm/errors.d.ts.map +0 -1
  121. package/dest/public/avm/errors.js +0 -141
  122. package/dest/public/avm/fixtures/account_proof_fetcher.d.ts +0 -2
  123. package/dest/public/avm/fixtures/account_proof_fetcher.d.ts.map +0 -1
  124. package/dest/public/avm/fixtures/avm_simulation_tester.d.ts +0 -22
  125. package/dest/public/avm/fixtures/avm_simulation_tester.d.ts.map +0 -1
  126. package/dest/public/avm/fixtures/avm_simulation_tester.js +0 -84
  127. package/dest/public/avm/fixtures/base_avm_simulation_tester.d.ts.map +0 -1
  128. package/dest/public/avm/fixtures/initializers.d.ts +0 -42
  129. package/dest/public/avm/fixtures/initializers.d.ts.map +0 -1
  130. package/dest/public/avm/fixtures/initializers.js +0 -45
  131. package/dest/public/avm/fixtures/utils.d.ts +0 -39
  132. package/dest/public/avm/fixtures/utils.d.ts.map +0 -1
  133. package/dest/public/avm/index.d.ts +0 -2
  134. package/dest/public/avm/index.d.ts.map +0 -1
  135. package/dest/public/avm/index.js +0 -1
  136. package/dest/public/avm/opcodes/accrued_substate.d.ts +0 -74
  137. package/dest/public/avm/opcodes/accrued_substate.d.ts.map +0 -1
  138. package/dest/public/avm/opcodes/accrued_substate.js +0 -254
  139. package/dest/public/avm/opcodes/addressing_mode.d.ts +0 -31
  140. package/dest/public/avm/opcodes/addressing_mode.d.ts.map +0 -1
  141. package/dest/public/avm/opcodes/addressing_mode.js +0 -94
  142. package/dest/public/avm/opcodes/arithmetic.d.ts +0 -49
  143. package/dest/public/avm/opcodes/arithmetic.d.ts.map +0 -1
  144. package/dest/public/avm/opcodes/arithmetic.js +0 -97
  145. package/dest/public/avm/opcodes/bitwise.d.ts +0 -42
  146. package/dest/public/avm/opcodes/bitwise.d.ts.map +0 -1
  147. package/dest/public/avm/opcodes/bitwise.js +0 -99
  148. package/dest/public/avm/opcodes/comparators.d.ts +0 -25
  149. package/dest/public/avm/opcodes/comparators.d.ts.map +0 -1
  150. package/dest/public/avm/opcodes/comparators.js +0 -43
  151. package/dest/public/avm/opcodes/contract.d.ts +0 -21
  152. package/dest/public/avm/opcodes/contract.d.ts.map +0 -1
  153. package/dest/public/avm/opcodes/contract.js +0 -69
  154. package/dest/public/avm/opcodes/control_flow.d.ts +0 -41
  155. package/dest/public/avm/opcodes/control_flow.d.ts.map +0 -1
  156. package/dest/public/avm/opcodes/control_flow.js +0 -107
  157. package/dest/public/avm/opcodes/conversion.d.ts +0 -18
  158. package/dest/public/avm/opcodes/conversion.d.ts.map +0 -1
  159. package/dest/public/avm/opcodes/conversion.js +0 -333
  160. package/dest/public/avm/opcodes/ec_add.d.ts +0 -17
  161. package/dest/public/avm/opcodes/ec_add.d.ts.map +0 -1
  162. package/dest/public/avm/opcodes/ec_add.js +0 -79
  163. package/dest/public/avm/opcodes/environment_getters.d.ts +0 -28
  164. package/dest/public/avm/opcodes/environment_getters.d.ts.map +0 -1
  165. package/dest/public/avm/opcodes/environment_getters.js +0 -77
  166. package/dest/public/avm/opcodes/external_calls.d.ts +0 -59
  167. package/dest/public/avm/opcodes/external_calls.d.ts.map +0 -1
  168. package/dest/public/avm/opcodes/external_calls.js +0 -210
  169. package/dest/public/avm/opcodes/hashing.d.ts +0 -36
  170. package/dest/public/avm/opcodes/hashing.d.ts.map +0 -1
  171. package/dest/public/avm/opcodes/hashing.js +0 -119
  172. package/dest/public/avm/opcodes/index.d.ts +0 -16
  173. package/dest/public/avm/opcodes/index.d.ts.map +0 -1
  174. package/dest/public/avm/opcodes/index.js +0 -15
  175. package/dest/public/avm/opcodes/instruction.d.ts +0 -74
  176. package/dest/public/avm/opcodes/instruction.d.ts.map +0 -1
  177. package/dest/public/avm/opcodes/instruction.js +0 -95
  178. package/dest/public/avm/opcodes/instruction_impl.d.ts +0 -19
  179. package/dest/public/avm/opcodes/instruction_impl.d.ts.map +0 -1
  180. package/dest/public/avm/opcodes/instruction_impl.js +0 -30
  181. package/dest/public/avm/opcodes/memory.d.ts +0 -74
  182. package/dest/public/avm/opcodes/memory.d.ts.map +0 -1
  183. package/dest/public/avm/opcodes/memory.js +0 -257
  184. package/dest/public/avm/opcodes/misc.d.ts +0 -18
  185. package/dest/public/avm/opcodes/misc.d.ts.map +0 -1
  186. package/dest/public/avm/opcodes/misc.js +0 -73
  187. package/dest/public/avm/opcodes/storage.d.ts +0 -25
  188. package/dest/public/avm/opcodes/storage.d.ts.map +0 -1
  189. package/dest/public/avm/opcodes/storage.js +0 -78
  190. package/dest/public/avm/revert_reason.d.ts +0 -18
  191. package/dest/public/avm/revert_reason.d.ts.map +0 -1
  192. package/dest/public/avm/revert_reason.js +0 -39
  193. package/dest/public/avm/serialization/buffer_cursor.d.ts +0 -26
  194. package/dest/public/avm/serialization/buffer_cursor.d.ts.map +0 -1
  195. package/dest/public/avm/serialization/buffer_cursor.js +0 -99
  196. package/dest/public/avm/serialization/bytecode_serialization.d.ts +0 -17
  197. package/dest/public/avm/serialization/bytecode_serialization.d.ts.map +0 -1
  198. package/dest/public/avm/serialization/bytecode_serialization.js +0 -336
  199. package/dest/public/avm/serialization/instruction_serialization.d.ts +0 -114
  200. package/dest/public/avm/serialization/instruction_serialization.d.ts.map +0 -1
  201. package/dest/public/avm/serialization/instruction_serialization.js +0 -261
  202. package/dest/public/avm/test_utils.d.ts +0 -15
  203. package/dest/public/avm/test_utils.d.ts.map +0 -1
  204. package/dest/public/avm/test_utils.js +0 -44
  205. package/dest/public/debug_fn_name.d.ts +0 -18
  206. package/dest/public/debug_fn_name.d.ts.map +0 -1
  207. package/dest/public/debug_fn_name.js +0 -37
  208. package/dest/public/fixtures/custom_bytecode_tests.d.ts +0 -19
  209. package/dest/public/fixtures/custom_bytecode_tests.d.ts.map +0 -1
  210. package/dest/public/fixtures/custom_bytecode_tests.js +0 -263
  211. package/dest/public/fixtures/minimal_public_tx.d.ts +0 -4
  212. package/dest/public/fixtures/minimal_public_tx.d.ts.map +0 -1
  213. package/dest/public/fixtures/minimal_public_tx.js +0 -19
  214. package/dest/public/fixtures/opcode_spammer.d.ts +0 -122
  215. package/dest/public/fixtures/opcode_spammer.d.ts.map +0 -1
  216. package/dest/public/fixtures/opcode_spammer.js +0 -1645
  217. package/dest/public/hinting_db_sources.d.ts +0 -80
  218. package/dest/public/hinting_db_sources.d.ts.map +0 -1
  219. package/dest/public/hinting_db_sources.js +0 -356
  220. package/dest/public/public_tx_simulator/contract_provider_for_cpp.d.ts +0 -19
  221. package/dest/public/public_tx_simulator/contract_provider_for_cpp.d.ts.map +0 -1
  222. package/dest/public/public_tx_simulator/contract_provider_for_cpp.js +0 -99
  223. package/dest/public/public_tx_simulator/cpp_public_tx_simulator.d.ts +0 -53
  224. package/dest/public/public_tx_simulator/cpp_public_tx_simulator.d.ts.map +0 -1
  225. package/dest/public/public_tx_simulator/cpp_public_tx_simulator.js +0 -131
  226. package/dest/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.d.ts +0 -42
  227. package/dest/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.d.ts.map +0 -1
  228. package/dest/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.js +0 -86
  229. package/dest/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.d.ts +0 -30
  230. package/dest/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.d.ts.map +0 -1
  231. package/dest/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.js +0 -171
  232. package/dest/public/public_tx_simulator/dumping_cpp_public_tx_simulator.d.ts +0 -23
  233. package/dest/public/public_tx_simulator/dumping_cpp_public_tx_simulator.d.ts.map +0 -1
  234. package/dest/public/public_tx_simulator/measured_public_tx_simulator.d.ts +0 -31
  235. package/dest/public/public_tx_simulator/measured_public_tx_simulator.d.ts.map +0 -1
  236. package/dest/public/public_tx_simulator/measured_public_tx_simulator.js +0 -51
  237. package/dest/public/public_tx_simulator/public_tx_context.d.ts +0 -135
  238. package/dest/public/public_tx_simulator/public_tx_context.d.ts.map +0 -1
  239. package/dest/public/public_tx_simulator/public_tx_context.js +0 -298
  240. package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.d.ts +0 -21
  241. package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.d.ts.map +0 -1
  242. package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.js +0 -415
  243. package/dest/public/side_effect_trace.d.ts +0 -87
  244. package/dest/public/side_effect_trace.d.ts.map +0 -1
  245. package/dest/public/side_effect_trace.js +0 -199
  246. package/dest/public/side_effect_trace_interface.d.ts +0 -22
  247. package/dest/public/side_effect_trace_interface.d.ts.map +0 -1
  248. package/dest/public/side_effect_trace_interface.js +0 -1
  249. package/dest/public/state_manager/index.d.ts +0 -2
  250. package/dest/public/state_manager/index.d.ts.map +0 -1
  251. package/dest/public/state_manager/index.js +0 -1
  252. package/dest/public/state_manager/nullifiers.d.ts +0 -61
  253. package/dest/public/state_manager/nullifiers.d.ts.map +0 -1
  254. package/dest/public/state_manager/nullifiers.js +0 -92
  255. package/dest/public/state_manager/public_storage.d.ts +0 -66
  256. package/dest/public/state_manager/public_storage.d.ts.map +0 -1
  257. package/dest/public/state_manager/public_storage.js +0 -145
  258. package/dest/public/state_manager/state_manager.d.ts +0 -170
  259. package/dest/public/state_manager/state_manager.d.ts.map +0 -1
  260. package/dest/public/state_manager/state_manager.js +0 -402
  261. package/src/public/avm/avm_context.ts +0 -61
  262. package/src/public/avm/avm_contract_call_result.ts +0 -69
  263. package/src/public/avm/avm_execution_environment.ts +0 -51
  264. package/src/public/avm/avm_gas.ts +0 -183
  265. package/src/public/avm/avm_machine_state.ts +0 -170
  266. package/src/public/avm/avm_memory_types.ts +0 -440
  267. package/src/public/avm/avm_simulator.ts +0 -279
  268. package/src/public/avm/avm_simulator_interface.ts +0 -8
  269. package/src/public/avm/calldata.ts +0 -101
  270. package/src/public/avm/errors.ts +0 -177
  271. package/src/public/avm/fixtures/avm_simulation_tester.ts +0 -122
  272. package/src/public/avm/fixtures/initializers.ts +0 -103
  273. package/src/public/avm/index.ts +0 -1
  274. package/src/public/avm/opcodes/accrued_substate.ts +0 -285
  275. package/src/public/avm/opcodes/addressing_mode.ts +0 -111
  276. package/src/public/avm/opcodes/arithmetic.ts +0 -129
  277. package/src/public/avm/opcodes/bitwise.ts +0 -113
  278. package/src/public/avm/opcodes/comparators.ts +0 -55
  279. package/src/public/avm/opcodes/contract.ts +0 -76
  280. package/src/public/avm/opcodes/control_flow.ts +0 -123
  281. package/src/public/avm/opcodes/conversion.ts +0 -104
  282. package/src/public/avm/opcodes/ec_add.ts +0 -86
  283. package/src/public/avm/opcodes/environment_getters.ts +0 -87
  284. package/src/public/avm/opcodes/external_calls.ts +0 -262
  285. package/src/public/avm/opcodes/hashing.ts +0 -151
  286. package/src/public/avm/opcodes/index.ts +0 -15
  287. package/src/public/avm/opcodes/instruction.ts +0 -136
  288. package/src/public/avm/opcodes/instruction_impl.ts +0 -36
  289. package/src/public/avm/opcodes/memory.ts +0 -293
  290. package/src/public/avm/opcodes/misc.ts +0 -102
  291. package/src/public/avm/opcodes/storage.ts +0 -95
  292. package/src/public/avm/revert_reason.ts +0 -58
  293. package/src/public/avm/serialization/buffer_cursor.ts +0 -118
  294. package/src/public/avm/serialization/bytecode_serialization.ts +0 -215
  295. package/src/public/avm/serialization/instruction_serialization.ts +0 -249
  296. package/src/public/avm/test_utils.ts +0 -64
  297. package/src/public/debug_fn_name.ts +0 -52
  298. package/src/public/fixtures/custom_bytecode_tests.ts +0 -435
  299. package/src/public/fixtures/minimal_public_tx.ts +0 -26
  300. package/src/public/fixtures/opcode_spammer.ts +0 -1713
  301. package/src/public/hinting_db_sources.ts +0 -610
  302. package/src/public/public_tx_simulator/contract_provider_for_cpp.ts +0 -125
  303. package/src/public/public_tx_simulator/cpp_public_tx_simulator.ts +0 -210
  304. package/src/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.ts +0 -134
  305. package/src/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.ts +0 -239
  306. package/src/public/public_tx_simulator/measured_public_tx_simulator.ts +0 -105
  307. package/src/public/public_tx_simulator/public_tx_context.ts +0 -482
  308. package/src/public/public_tx_simulator/telemetry_public_tx_simulator.ts +0 -63
  309. package/src/public/side_effect_trace.ts +0 -293
  310. package/src/public/side_effect_trace_interface.ts +0 -28
  311. package/src/public/state_manager/index.ts +0 -1
  312. package/src/public/state_manager/nullifiers.ts +0 -103
  313. package/src/public/state_manager/public_storage.ts +0 -174
  314. package/src/public/state_manager/state_manager.ts +0 -569
  315. /package/dest/public/avm/{fixtures → testing}/account_proof_fetcher.js +0 -0
  316. /package/dest/public/avm/{fixtures → testing}/base_avm_simulation_tester.js +0 -0
  317. /package/src/public/avm/{fixtures → testing}/account_proof.json +0 -0
  318. /package/src/public/avm/{fixtures → testing}/account_proof_fetcher.ts +0 -0
  319. /package/src/public/avm/{fixtures → testing}/base_avm_simulation_tester.ts +0 -0
@@ -1,435 +0,0 @@
1
- import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
2
-
3
- import { strict as assert } from 'assert';
4
-
5
- import { TypeTag } from '../avm/avm_memory_types.js';
6
- import { Addressing, AddressingMode } from '../avm/opcodes/addressing_mode.js';
7
- import { Add, Call, CalldataCopy, Cast, Jump, Return, Set, Sha256Compression, Xor } from '../avm/opcodes/index.js';
8
- import { encodeToBytecode } from '../avm/serialization/bytecode_serialization.js';
9
- import {
10
- MAX_OPCODE_VALUE,
11
- Opcode,
12
- OperandType,
13
- getOperandSize,
14
- } from '../avm/serialization/instruction_serialization.js';
15
- import { deployAndExecuteCustomBytecode, deployCustomBytecode } from './custom_bytecode_tester.js';
16
- import { PublicTxSimulationTester } from './public_tx_simulation_tester.js';
17
-
18
- // First instruction resolved a base address (offset 0) which is uninitialized and therefore
19
- // of invalid tag (FF). This will trigger an exceptional halt.
20
- export async function addressingWithBaseTagIssueTest(isIndirect: boolean, tester: PublicTxSimulationTester) {
21
- const addressingMode = Addressing.fromModes([
22
- isIndirect ? AddressingMode.INDIRECT_RELATIVE : AddressingMode.RELATIVE,
23
- AddressingMode.DIRECT,
24
- AddressingMode.DIRECT,
25
- ]);
26
-
27
- const bytecode = encodeToBytecode([
28
- new CalldataCopy(/*addressing_mode=*/ addressingMode.toWire(), /*copySize=*/ 1, /*cdOffset=*/ 0, /*dstOffset=*/ 0),
29
- new Return(/*addressing_mode=*/ 0, /*copySizeOffset=*/ 0, /*returnOffset=*/ 0),
30
- ]);
31
-
32
- const txLabel = isIndirect ? 'AddressingWithBaseTagInvalidIndirect' : 'AddressingWithBaseTagInvalidDirect';
33
- return await deployAndExecuteCustomBytecode(bytecode, tester, txLabel);
34
- }
35
-
36
- // First instruction sets a value with tag U64 at offset 0. Then a CalldataCopy instruction
37
- // uses INDIRECT addressing to read from offset 0, which should fail because the value at
38
- // offset 0 has tag U64 (not U32), making it an invalid address tag.
39
- export async function addressingWithIndirectTagIssueTest(tester: PublicTxSimulationTester) {
40
- // Set a U64 value at offset 0 - this will be used as an indirect address
41
- const addressingMode = Addressing.fromModes([
42
- AddressingMode.INDIRECT, // First operand (cdOffset) uses indirect addressing
43
- AddressingMode.DIRECT,
44
- AddressingMode.DIRECT,
45
- ]);
46
-
47
- const bytecode = encodeToBytecode([
48
- // Set a U64 value at offset 0 - this has the wrong tag for an address (should be U32)
49
- new Set(/*addressing_mode=*/ 0, /*dstOffset=*/ 0, TypeTag.UINT64, /*value=*/ 100n).as(
50
- Opcode.SET_64,
51
- Set.wireFormat64,
52
- ),
53
- // Try to use indirect addressing: read from offset 0, which contains a U64 value
54
- // This should fail because U64 is not a valid address tag (must be U32)
55
- new CalldataCopy(/*addressing_mode=*/ addressingMode.toWire(), /*copySize=*/ 1, /*cdOffset=*/ 0, /*dstOffset=*/ 1),
56
- new Return(/*addressing_mode=*/ 0, /*copySizeOffset=*/ 0, /*returnOffset=*/ 0),
57
- ]);
58
-
59
- const txLabel = 'AddressingWithIndirectTagInvalid';
60
- return await deployAndExecuteCustomBytecode(bytecode, tester, txLabel);
61
- }
62
-
63
- // First instruction sets a value 10 with tag U32 at offset 1 (direct, no relative).
64
- // Then an ADD_16 instruction uses INDIRECT addressing for the first operand (offset 1)
65
- // and RELATIVE addressing for the second operand (offset 2). The indirect addressing
66
- // succeeds (reads U32 value 10 from offset 1, uses it as address), but the relative
67
- // addressing fails because the base address at offset 0 has the wrong tag (uninitialized/invalid).
68
- export async function addressingWithIndirectThenRelativeTagIssueTest(tester: PublicTxSimulationTester) {
69
- const addressingMode = Addressing.fromModes([
70
- AddressingMode.INDIRECT, // First operand (aOffset) uses indirect addressing, no relative
71
- AddressingMode.RELATIVE, // Second operand (bOffset) uses relative addressing
72
- AddressingMode.DIRECT, // Third operand (dstOffset) uses direct addressing
73
- ]);
74
-
75
- const bytecode = encodeToBytecode([
76
- // Set a U32 value 10 at offset 1 - this will be used as an indirect address
77
- new Set(/*addressing_mode=*/ 0, /*dstOffset=*/ 1, TypeTag.UINT32, /*value=*/ 10).as(
78
- Opcode.SET_32,
79
- Set.wireFormat32,
80
- ),
81
- // ADD_16: first operand uses indirect addressing (reads from offset 1, gets value 10, uses as address - succeeds)
82
- // second operand uses relative addressing (tries to read base from offset 0, but offset 0 has wrong tag - fails)
83
- new Add(/*addressing_mode=*/ addressingMode.toWire(), /*aOffset=*/ 1, /*bOffset=*/ 2, /*dstOffset=*/ 3).as(
84
- Opcode.ADD_16,
85
- Add.wireFormat16,
86
- ),
87
- new Return(/*addressing_mode=*/ 0, /*copySizeOffset=*/ 0, /*returnOffset=*/ 0),
88
- ]);
89
-
90
- const txLabel = 'AddressingWithIndirectThenRelativeTagInvalid';
91
- return await deployAndExecuteCustomBytecode(bytecode, tester, txLabel);
92
- }
93
-
94
- // First instruction sets UINT32_MAX at offset 0 (base address) with tag U32.
95
- // Then an ADD_8 instruction uses INDIRECT_RELATIVE addressing for the first operand (offset 1)
96
- // and INDIRECT addressing for the second operand (offset 2). The relative addressing
97
- // for the first operand will overflow (UINT32_MAX + 1 >= MAX_MEMORY_SIZE), causing the instruction to fail.
98
- // The second operand will also fail (indirect addressing from offset 2 which is uninitialized with tag FF).
99
- export async function addressingWithRelativeOverflowAndIndirectTagIssueTest(tester: PublicTxSimulationTester) {
100
- const addressingMode = Addressing.fromModes([
101
- AddressingMode.INDIRECT_RELATIVE, // First operand (aOffset) uses both indirect and relative addressing
102
- AddressingMode.INDIRECT, // Second operand (bOffset) uses indirect addressing only
103
- AddressingMode.DIRECT, // Third operand (dstOffset) uses direct addressing
104
- ]);
105
-
106
- // UINT32_MAX = 2^32 - 1 = 4294967295
107
- const UINT32_MAX = 0xffffffff;
108
-
109
- const bytecode = encodeToBytecode([
110
- // Set UINT32_MAX at offset 0 as base address - this will cause overflow when adding relative offset 1
111
- new Set(/*addressing_mode=*/ 0, /*dstOffset=*/ 0, TypeTag.UINT32, /*value=*/ UINT32_MAX).as(
112
- Opcode.SET_32,
113
- Set.wireFormat32,
114
- ),
115
- new Add(/*addressing_mode=*/ addressingMode.toWire(), /*aOffset=*/ 1, /*bOffset=*/ 2, /*dstOffset=*/ 3).as(
116
- Opcode.ADD_8,
117
- Add.wireFormat8,
118
- ),
119
- new Return(/*addressing_mode=*/ 0, /*copySizeOffset=*/ 0, /*returnOffset=*/ 0),
120
- ]);
121
-
122
- const txLabel = 'AddressingWithRelativeOverflowAndIndirectTagInvalid';
123
- return await deployAndExecuteCustomBytecode(bytecode, tester, txLabel);
124
- }
125
-
126
- export async function pcOutOfRangeTest(tester: PublicTxSimulationTester) {
127
- const bytecode = encodeToBytecode([
128
- new Jump(/*jumpOffset=*/ 123), // Jump to out-of-range pc offset.
129
- new Return(/*addressing_mode=*/ 0, /*copySizeOffset=*/ 0, /*returnOffset=*/ 0),
130
- ]);
131
-
132
- const txLabel = 'PcOutOfRange';
133
- return await deployAndExecuteCustomBytecode(bytecode, tester, txLabel);
134
- }
135
-
136
- export async function invalidOpcodeTest(tester: PublicTxSimulationTester) {
137
- let bytecode = encodeToBytecode([
138
- new Set(/*addressing_mode=*/ 0, /*dstOffset=*/ 0, TypeTag.UINT32, /*value=*/ 0).as(Opcode.SET_8, Set.wireFormat8),
139
- ]);
140
-
141
- const offsetReturnOpcodeByte = bytecode.length;
142
-
143
- bytecode = Buffer.concat([
144
- bytecode,
145
- encodeToBytecode([new Return(/*addressing_mode=*/ 0, /*copySizeOffset=*/ 0, /*returnOffset=*/ 0)]),
146
- ]);
147
-
148
- // Manipulate the Return opcode to make the opcode invalid (out of range).
149
- bytecode[offsetReturnOpcodeByte] = MAX_OPCODE_VALUE + 1; // opcode is invalid.
150
-
151
- const txLabel = 'InvalidOpcode';
152
- return await deployAndExecuteCustomBytecode(bytecode, tester, txLabel);
153
- }
154
-
155
- // Single invalid byte in the bytecode.
156
- export async function invalidByteTest(tester: PublicTxSimulationTester) {
157
- const invalidOpcode = MAX_OPCODE_VALUE + 7;
158
- assert(invalidOpcode < 256, 'Invalid opcode must fit in a single byte');
159
- const bytecode = Buffer.from([invalidOpcode]);
160
-
161
- const txLabel = 'InvalidByte';
162
- return await deployAndExecuteCustomBytecode(bytecode, tester, txLabel);
163
- }
164
-
165
- // Truncate the last instruction in the bytecode.
166
- export async function instructionTruncatedTest(tester: PublicTxSimulationTester) {
167
- let bytecode = encodeToBytecode([
168
- new Set(/*addressing_mode=*/ 0, /*dstOffset=*/ 0, TypeTag.UINT32, /*value=*/ 0).as(Opcode.SET_8, Set.wireFormat8),
169
- ]);
170
-
171
- // Truncate the bytecode.
172
- bytecode = bytecode.subarray(0, -1);
173
-
174
- const txLabel = 'InstructionTruncated';
175
- return await deployAndExecuteCustomBytecode(bytecode, tester, txLabel);
176
- }
177
-
178
- // Invalid tag value byte in an instruction.
179
- export async function invalidTagValueTest(tester: PublicTxSimulationTester) {
180
- const bytecode = encodeToBytecode([
181
- new Set(/*addressing_mode=*/ 0, /*dstOffset=*/ 0, TypeTag.UINT32, /*value=*/ 0).as(Opcode.SET_8, Set.wireFormat8),
182
- new Return(/*addressing_mode=*/ 0, /*copySizeOffset=*/ 0, /*returnOffset=*/ 0),
183
- ]);
184
-
185
- const tagOffset = getTagOffsetInInstruction(Set.wireFormat8);
186
- assert(bytecode[tagOffset].valueOf() == TypeTag.UINT32.valueOf(), 'Set instruction tag should be UINT32 in test');
187
- bytecode[tagOffset] = TypeTag.INVALID;
188
-
189
- const txLabel = 'InvalidTagValue';
190
- return await deployAndExecuteCustomBytecode(bytecode, tester, txLabel);
191
- }
192
-
193
- // Combine an invalid tag in the last instruction that is truncated.
194
- export async function invalidTagValueAndInstructionTruncatedTest(tester: PublicTxSimulationTester) {
195
- let bytecode = encodeToBytecode([
196
- // Important: value argument must be a bigint otherwise a type error will be thrown.
197
- new Set(/*addressing_mode=*/ 0, /*dstOffset=*/ 0, TypeTag.UINT128, /*value=*/ 0n).as(
198
- Opcode.SET_128,
199
- Set.wireFormat128,
200
- ),
201
- ]);
202
-
203
- // Truncate the bytecode.
204
- bytecode = bytecode.subarray(0, -5);
205
- const tagOffset = getTagOffsetInInstruction(Set.wireFormat128);
206
- assert(bytecode[tagOffset].valueOf() == TypeTag.UINT128.valueOf(), 'Set instruction tag should be UINT128 in test');
207
- bytecode[tagOffset] = 0x6f; // Invalid tag value.
208
-
209
- const txLabel = 'InvalidTagValueAndInstructionTruncated';
210
- return await deployAndExecuteCustomBytecode(bytecode, tester, txLabel);
211
- }
212
-
213
- // Exercise SET truncation: set values whose widths exceed the target tag and
214
- // rely on `buildFromTagTruncating` to truncate to the low bits of the tag.
215
- // Covers sources larger than 128 bits (via SET_FF) and sources in (32, 128]
216
- // bits (via SET_64) against destination tags U1/U8/U16/U32/U64/U128.
217
- export async function setTruncationTest(tester: PublicTxSimulationTester) {
218
- // 200-bit value: forces truncation for every target tag up to U128.
219
- const LARGE_FIELD_VALUE = (1n << 200n) + 0x1234567890abcdef1234567890abcdefn;
220
- // 40-bit value: forces truncation for target tags up to U32.
221
- const LARGE_U64_VALUE = (1n << 40n) + 0xdeadbeefn;
222
-
223
- const bytecode = encodeToBytecode([
224
- // Zero U32 at offset 0 — used as the Return copy-size slot.
225
- new Set(/*addressing_mode=*/ 0, /*dstOffset=*/ 0, TypeTag.UINT32, /*value=*/ 0).as(Opcode.SET_8, Set.wireFormat8),
226
-
227
- // Source >128 bits (via SET_FF) truncated to smaller target tags.
228
- new Set(/*addressing_mode=*/ 0, /*dstOffset=*/ 1, TypeTag.UINT128, LARGE_FIELD_VALUE).as(
229
- Opcode.SET_FF,
230
- Set.wireFormatFF,
231
- ),
232
- new Set(/*addressing_mode=*/ 0, /*dstOffset=*/ 2, TypeTag.UINT64, LARGE_FIELD_VALUE).as(
233
- Opcode.SET_FF,
234
- Set.wireFormatFF,
235
- ),
236
- new Set(/*addressing_mode=*/ 0, /*dstOffset=*/ 3, TypeTag.UINT32, LARGE_FIELD_VALUE).as(
237
- Opcode.SET_FF,
238
- Set.wireFormatFF,
239
- ),
240
- new Set(/*addressing_mode=*/ 0, /*dstOffset=*/ 4, TypeTag.UINT16, LARGE_FIELD_VALUE).as(
241
- Opcode.SET_FF,
242
- Set.wireFormatFF,
243
- ),
244
- new Set(/*addressing_mode=*/ 0, /*dstOffset=*/ 5, TypeTag.UINT8, LARGE_FIELD_VALUE).as(
245
- Opcode.SET_FF,
246
- Set.wireFormatFF,
247
- ),
248
- new Set(/*addressing_mode=*/ 0, /*dstOffset=*/ 6, TypeTag.UINT1, LARGE_FIELD_VALUE).as(
249
- Opcode.SET_FF,
250
- Set.wireFormatFF,
251
- ),
252
-
253
- // Source in (32, 128] bits (via SET_64) truncated to smaller target tags.
254
- new Set(/*addressing_mode=*/ 0, /*dstOffset=*/ 7, TypeTag.UINT32, LARGE_U64_VALUE).as(
255
- Opcode.SET_64,
256
- Set.wireFormat64,
257
- ),
258
- new Set(/*addressing_mode=*/ 0, /*dstOffset=*/ 8, TypeTag.UINT16, LARGE_U64_VALUE).as(
259
- Opcode.SET_64,
260
- Set.wireFormat64,
261
- ),
262
- new Set(/*addressing_mode=*/ 0, /*dstOffset=*/ 9, TypeTag.UINT8, LARGE_U64_VALUE).as(
263
- Opcode.SET_64,
264
- Set.wireFormat64,
265
- ),
266
- new Set(/*addressing_mode=*/ 0, /*dstOffset=*/ 10, TypeTag.UINT1, LARGE_U64_VALUE).as(
267
- Opcode.SET_64,
268
- Set.wireFormat64,
269
- ),
270
-
271
- new Return(/*addressing_mode=*/ 0, /*copySizeOffset=*/ 0, /*returnOffset=*/ 0),
272
- ]);
273
-
274
- const txLabel = 'SetTruncation';
275
- return await deployAndExecuteCustomBytecode(bytecode, tester, txLabel);
276
- }
277
-
278
- // Exercise CAST truncation: store a wide source value in memory then CAST it
279
- // to smaller destination tags. Covers sources larger than 128 bits (FIELD
280
- // source) and sources in (32, 128] bits (UINT64 source) against destination
281
- // tags U1/U8/U16/U32/U64/U128.
282
- export async function castTruncationTest(tester: PublicTxSimulationTester) {
283
- // 200-bit source: stored as FIELD so that CASTs to any integer tag truncate.
284
- const LARGE_FIELD_VALUE = (1n << 200n) + 0x1234567890abcdef1234567890abcdefn;
285
- // 40-bit source: stored as UINT64 so CASTs to U1/U8/U16/U32 truncate.
286
- const LARGE_U64_VALUE = (1n << 40n) + 0xdeadbeefn;
287
-
288
- const bytecode = encodeToBytecode([
289
- // Zero U32 at offset 0 — used as the Return copy-size slot.
290
- new Set(/*addressing_mode=*/ 0, /*dstOffset=*/ 0, TypeTag.UINT32, /*value=*/ 0).as(Opcode.SET_8, Set.wireFormat8),
291
-
292
- // Store wide FIELD source at offset 10, then CAST to smaller tags.
293
- new Set(/*addressing_mode=*/ 0, /*dstOffset=*/ 10, TypeTag.FIELD, LARGE_FIELD_VALUE).as(
294
- Opcode.SET_FF,
295
- Set.wireFormatFF,
296
- ),
297
- new Cast(/*addressing_mode=*/ 0, /*srcOffset=*/ 10, /*dstOffset=*/ 11, TypeTag.UINT128).as(
298
- Opcode.CAST_8,
299
- Cast.wireFormat8,
300
- ),
301
- new Cast(/*addressing_mode=*/ 0, /*srcOffset=*/ 10, /*dstOffset=*/ 12, TypeTag.UINT64).as(
302
- Opcode.CAST_8,
303
- Cast.wireFormat8,
304
- ),
305
- new Cast(/*addressing_mode=*/ 0, /*srcOffset=*/ 10, /*dstOffset=*/ 13, TypeTag.UINT32).as(
306
- Opcode.CAST_8,
307
- Cast.wireFormat8,
308
- ),
309
- new Cast(/*addressing_mode=*/ 0, /*srcOffset=*/ 10, /*dstOffset=*/ 14, TypeTag.UINT16).as(
310
- Opcode.CAST_8,
311
- Cast.wireFormat8,
312
- ),
313
- new Cast(/*addressing_mode=*/ 0, /*srcOffset=*/ 10, /*dstOffset=*/ 15, TypeTag.UINT8).as(
314
- Opcode.CAST_8,
315
- Cast.wireFormat8,
316
- ),
317
- new Cast(/*addressing_mode=*/ 0, /*srcOffset=*/ 10, /*dstOffset=*/ 16, TypeTag.UINT1).as(
318
- Opcode.CAST_8,
319
- Cast.wireFormat8,
320
- ),
321
-
322
- // Store UINT64 source at offset 20, then CAST to smaller integer tags.
323
- new Set(/*addressing_mode=*/ 0, /*dstOffset=*/ 20, TypeTag.UINT64, LARGE_U64_VALUE).as(
324
- Opcode.SET_64,
325
- Set.wireFormat64,
326
- ),
327
- new Cast(/*addressing_mode=*/ 0, /*srcOffset=*/ 20, /*dstOffset=*/ 21, TypeTag.UINT32).as(
328
- Opcode.CAST_8,
329
- Cast.wireFormat8,
330
- ),
331
- new Cast(/*addressing_mode=*/ 0, /*srcOffset=*/ 20, /*dstOffset=*/ 22, TypeTag.UINT16).as(
332
- Opcode.CAST_8,
333
- Cast.wireFormat8,
334
- ),
335
- new Cast(/*addressing_mode=*/ 0, /*srcOffset=*/ 20, /*dstOffset=*/ 23, TypeTag.UINT8).as(
336
- Opcode.CAST_8,
337
- Cast.wireFormat8,
338
- ),
339
- new Cast(/*addressing_mode=*/ 0, /*srcOffset=*/ 20, /*dstOffset=*/ 24, TypeTag.UINT1).as(
340
- Opcode.CAST_8,
341
- Cast.wireFormat8,
342
- ),
343
-
344
- new Return(/*addressing_mode=*/ 0, /*copySizeOffset=*/ 0, /*returnOffset=*/ 0),
345
- ]);
346
-
347
- const txLabel = 'CastTruncation';
348
- return await deployAndExecuteCustomBytecode(bytecode, tester, txLabel);
349
- }
350
-
351
- /**
352
- * Returns the offset of the tag in an instruction.
353
- * @details Loops over the wire format operand type entries until it finds the tag.
354
- * Returns the byte offset of the tag based on each operand size that is passed.
355
- *
356
- * @param wireFormat array of operand types
357
- * @returns byte offset of the tag
358
- */
359
- function getTagOffsetInInstruction(wireFormat: OperandType[]): number {
360
- let offset = 0;
361
- for (const operand of wireFormat) {
362
- if (operand === OperandType.TAG) {
363
- break;
364
- }
365
- offset += getOperandSize(operand);
366
- }
367
- return offset;
368
- }
369
-
370
- export async function deployBitwiseSha256ErrorRowCollisionContracts(
371
- tester: PublicTxSimulationTester,
372
- ): Promise<{ innerContract: ContractInstanceWithAddress; outerContract: ContractInstanceWithAddress }> {
373
- const innerBytecode = encodeToBytecode([
374
- new Set(/*addressing_mode=*/ 0, /*dstOffset=*/ 0, TypeTag.UINT32, /*value=*/ 0).as(Opcode.SET_8, Set.wireFormat8),
375
- new Set(/*addressing_mode=*/ 0, /*dstOffset=*/ 1, TypeTag.UINT16, /*value=*/ 0).as(Opcode.SET_8, Set.wireFormat8),
376
- new Xor(/*addressing_mode=*/ 0, /*aOffset=*/ 0, /*bOffset=*/ 1, /*dstOffset=*/ 2).as(Opcode.XOR_8, Xor.wireFormat8),
377
- new Return(/*addressing_mode=*/ 0, /*copySizeOffset=*/ 0, /*returnOffset=*/ 0),
378
- ]);
379
-
380
- const outerInstructions = [
381
- new Set(/*addressing_mode=*/ 0, /*dstOffset=*/ 0, TypeTag.UINT32, /*value=*/ 0).as(Opcode.SET_8, Set.wireFormat8),
382
- new Set(/*addressing_mode=*/ 0, /*dstOffset=*/ 1, TypeTag.UINT32, /*value=*/ 1).as(Opcode.SET_8, Set.wireFormat8),
383
- new Set(/*addressing_mode=*/ 0, /*dstOffset=*/ 2, TypeTag.UINT32, /*value=*/ 100_000).as(
384
- Opcode.SET_32,
385
- Set.wireFormat32,
386
- ),
387
- new CalldataCopy(/*addressing_mode=*/ 0, /*copySizeOffset=*/ 1, /*cdStartOffset=*/ 0, /*dstOffset=*/ 3),
388
- new Call(
389
- /*addressing_mode=*/ 0,
390
- /*l2GasOffset=*/ 2,
391
- /*daGasOffset=*/ 2,
392
- /*addrOffset=*/ 3,
393
- /*argsSizeOffset=*/ 0,
394
- /*argsOffset=*/ 0,
395
- ),
396
- ];
397
-
398
- for (let i = 0; i < 8; i++) {
399
- outerInstructions.push(
400
- new Set(/*addressing_mode=*/ 0, /*dstOffset=*/ 10 + i, TypeTag.UINT32, /*value=*/ 0).as(
401
- Opcode.SET_8,
402
- Set.wireFormat8,
403
- ),
404
- );
405
- }
406
-
407
- outerInstructions.push(
408
- new Set(/*addressing_mode=*/ 0, /*dstOffset=*/ 18, TypeTag.UINT32, /*value=*/ 0x61626364).as(
409
- Opcode.SET_32,
410
- Set.wireFormat32,
411
- ),
412
- );
413
-
414
- for (let i = 0; i < 15; i++) {
415
- outerInstructions.push(
416
- new Set(/*addressing_mode=*/ 0, /*dstOffset=*/ 19 + i, TypeTag.UINT32, /*value=*/ 0).as(
417
- Opcode.SET_8,
418
- Set.wireFormat8,
419
- ),
420
- );
421
- }
422
-
423
- outerInstructions.push(
424
- new Sha256Compression(/*addressing_mode=*/ 0, /*outputOffset=*/ 34, /*stateOffset=*/ 10, /*inputsOffset=*/ 18),
425
- new Return(/*addressing_mode=*/ 0, /*copySizeOffset=*/ 0, /*returnOffset=*/ 0),
426
- );
427
-
428
- const innerContract = await deployCustomBytecode(innerBytecode, tester, 'BitwiseSha256CollisionInner');
429
- const outerContract = await deployCustomBytecode(
430
- encodeToBytecode(outerInstructions),
431
- tester,
432
- 'BitwiseSha256CollisionOuter',
433
- );
434
- return { innerContract, outerContract };
435
- }
@@ -1,26 +0,0 @@
1
- import type { PublicTxResult } from '@aztec/stdlib/avm';
2
- import { ProtocolContracts } from '@aztec/stdlib/tx';
3
-
4
- import { TypeTag } from '../avm/avm_memory_types.js';
5
- import { Add, Return, Set } from '../avm/opcodes/index.js';
6
- import { encodeToBytecode } from '../avm/serialization/bytecode_serialization.js';
7
- import { Opcode } from '../avm/serialization/instruction_serialization.js';
8
- import { deployAndExecuteCustomBytecode } from './custom_bytecode_tester.js';
9
- import { PublicTxSimulationTester } from './public_tx_simulation_tester.js';
10
-
11
- export async function executeAvmMinimalPublicTx(tester: PublicTxSimulationTester): Promise<PublicTxResult> {
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(/*addressing_mode=*/ 0, /*aOffset=*/ 0, /*bOffset=*/ 1, /*dstOffset=*/ 2).as(Opcode.ADD_8, Add.wireFormat8),
16
- new Return(/*addressing_mode=*/ 0, /*copySizeOffset=*/ 0, /*returnOffset=*/ 2),
17
- ]);
18
-
19
- const result = await deployAndExecuteCustomBytecode(minimalBytecode, tester, 'MinimalTx', 'AvmMinimalContract');
20
-
21
- // Modify the protocol contracts to be all zeros
22
- result.hints!.protocolContracts = ProtocolContracts.empty();
23
- result.publicInputs!.protocolContracts = ProtocolContracts.empty();
24
-
25
- return result;
26
- }