diff --git a/mythril/disassembler/asm.py b/mythril/disassembler/asm.py index c2b342f2..af76d5df 100644 --- a/mythril/disassembler/asm.py +++ b/mythril/disassembler/asm.py @@ -99,8 +99,8 @@ def disassemble(bytecode: str) -> list: current_instruction.argument = "0x" + argument_bytes.hex() address += int(match.group(1)) - # We use a to_dict() here for compatibility reasons - instruction_list.append(current_instruction.to_dict()) + instruction_list.append(current_instruction) address += 1 - return instruction_list + # We use a to_dict() here for compatibility reasons + return list(map(lambda element: element.to_dict(), instruction_list)) diff --git a/tests/disassembler/asm.py b/tests/disassembler/asm.py index 1bd3c286..960c27a9 100644 --- a/tests/disassembler/asm.py +++ b/tests/disassembler/asm.py @@ -58,3 +58,13 @@ def test_find_op_code_sequence(pattern, instruction_list, expected_result): # Assert assert return_value == expected_result + + +def test_disassemble(): + # Act + instruction_list = disassemble(b"\x00\x16\x06") + + # Assert + assert instruction_list[0]["opcode"] == "STOP" + assert instruction_list[1]["opcode"] == "AND" + assert instruction_list[2]["opcode"] == "MOD"