black fixes

pull/635/head
Joran Honig 6 years ago
parent a83936a94c
commit 9846019ab5
  1. 5
      mythril/analysis/report.py
  2. 5
      mythril/disassembler/asm.py
  3. 2
      mythril/version.py
  4. 1
      tests/analysis/test_delegatecall.py

@ -5,6 +5,7 @@ from jinja2 import PackageLoader, Environment
import _pysha3 as sha3 import _pysha3 as sha3
import hashlib import hashlib
class Issue: class Issue:
def __init__( def __init__(
self, self,
@ -36,7 +37,9 @@ class Issue:
keccak.update(bytes.fromhex(bytecode)) keccak.update(bytes.fromhex(bytecode))
self.bytecode_hash = "0x" + keccak.hexdigest() self.bytecode_hash = "0x" + keccak.hexdigest()
except ValueError: except ValueError:
logging.debug("Unable to change the bytecode to bytes. Bytecode: {}".format(bytecode)) logging.debug(
"Unable to change the bytecode to bytes. Bytecode: {}".format(bytecode)
)
self.bytecode_hash = "" self.bytecode_hash = ""
@property @property

@ -11,6 +11,7 @@ opcodes[254] = ["ASSERT_FAIL", 0, 0, 0]
class EvmInstruction: class EvmInstruction:
""" Model to hold the information of the disassembly """ """ Model to hold the information of the disassembly """
def __init__(self, address, op_code, argument=None): def __init__(self, address, op_code, argument=None):
self.address = address self.address = address
self.op_code = op_code self.op_code = op_code
@ -66,7 +67,7 @@ def is_sequence_match(pattern: list, instruction_list: list, index: int) -> bool
""" """
for index, pattern_slot in enumerate(pattern, start=index): for index, pattern_slot in enumerate(pattern, start=index):
try: try:
if not instruction_list[index]['opcode'] in pattern_slot: if not instruction_list[index]["opcode"] in pattern_slot:
return False return False
except IndexError: except IndexError:
return False return False
@ -95,7 +96,7 @@ def disassemble(bytecode: str) -> list:
match = re.search(regex_PUSH, op_code_name) match = re.search(regex_PUSH, op_code_name)
if match: if match:
argument_bytes = bytecode[address + 1: address + 1 + int(match.group(1))] argument_bytes = bytecode[address + 1 : address + 1 + int(match.group(1))]
current_instruction.argument = "0x" + argument_bytes.hex() current_instruction.argument = "0x" + argument_bytes.hex()
address += int(match.group(1)) address += int(match.group(1))

@ -1,3 +1,3 @@
# This file is suitable for sourcing inside POSIX shell, e.g. bash as # This file is suitable for sourcing inside POSIX shell, e.g. bash as
# well as for importing into Python # well as for importing into Python
VERSION="v0.18.13" # NOQA VERSION = "v0.18.13" # NOQA

@ -12,6 +12,7 @@ from unittest.mock import MagicMock, patch
import pytest_mock import pytest_mock
from mythril.disassembler.disassembly import Disassembly from mythril.disassembler.disassembly import Disassembly
def test_concrete_call(): def test_concrete_call():
# arrange # arrange
address = "0x10" address = "0x10"

Loading…
Cancel
Save