vm.push(imm_opcode_val) vm.pushinsnimm() vm.halt() vm.set_label(arb.ast.AVMLabel("base_error_handler")) vm.push(arb.value.ERROR_CODE_POINT) vm.errset() vm.error() tests = [ ["opcodetestmath", test_arithmetic], ["opcodetestlogic", test_logic], ["opcodetesthash", test_hash, 4], ["opcodetestethhash2", test_ethhash2], ["opcodeteststack", test_stack], ["opcodetestdup", test_dup], ["opcodetesttuple", test_tuple], ["opcodetestarbgas", test_arbgas], ["opcodetestecrecover", test_ecrecover], ["opcodetestcode", test_code], ] for vm_test in tests: code = arb.compile_block(vm_test[1]) vm = arb.compile_program(arb.ast.BlockStatement([]), code) if len(vm_test) > 2: vm.static = vm_test[2] with open("../arb-avm-cpp/tests/machine-cases/" + vm_test[0] + ".mexe", "w") as f: json.dump(arb.marshall.marshall_vm_json(vm), f)
def makeAoFile(func, filepath): code = arb.compile_block(func) vm = arb.compile_program(arb.ast.BlockStatement([]), code) vm.static = 4 with open(filepath, "wb") as f: arb.marshall.marshall_vm(vm, f)