From ea0b155c6b4377cd276436d4b6c3474726bb052c Mon Sep 17 00:00:00 2001 From: Nikhil Parasaram Date: Wed, 7 Nov 2018 22:10:24 +0530 Subject: [PATCH] Raise error as exception and reformat code with black --- mythril/laser/ethereum/call.py | 2 +- mythril/laser/ethereum/state.py | 4 +--- mythril/laser/ethereum/util.py | 6 ++++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mythril/laser/ethereum/call.py b/mythril/laser/ethereum/call.py index 55066aac..c9d95854 100644 --- a/mythril/laser/ethereum/call.py +++ b/mythril/laser/ethereum/call.py @@ -124,7 +124,7 @@ def get_callee_account(global_state, callee_address, dynamic_loader): code = dynamic_loader.dynld(environment.active_account.address, callee_address) except ValueError as error: logging.debug("Unable to execute dynamic loader because: {}".format(str(error))) - raise ValueError(str(error)) + raise error if code is None: logging.debug("No code returned, not a contract account?") raise ValueError() diff --git a/mythril/laser/ethereum/state.py b/mythril/laser/ethereum/state.py index a2dcf8ae..7f8bcb1f 100644 --- a/mythril/laser/ethereum/state.py +++ b/mythril/laser/ethereum/state.py @@ -100,9 +100,7 @@ class Calldata: if stop is None: stop = self.calldatasize current_index = ( - start - if isinstance(start, BitVecRef) - else BitVecVal(start, 256) + start if isinstance(start, BitVecRef) else BitVecVal(start, 256) ) dataparts = [] while simplify(current_index != stop): diff --git a/mythril/laser/ethereum/util.py b/mythril/laser/ethereum/util.py index 8143d164..84df4027 100644 --- a/mythril/laser/ethereum/util.py +++ b/mythril/laser/ethereum/util.py @@ -89,8 +89,10 @@ def get_concrete_int(item): def concrete_int_from_bytes(_bytes, start_index): - _bytes = [_byte.as_long() if type(_byte) == BitVecNumRef else _byte for _byte in _bytes] - b = _bytes[start_index: start_index + 32] + _bytes = [ + _byte.as_long() if type(_byte) == BitVecNumRef else _byte for _byte in _bytes + ] + b = _bytes[start_index : start_index + 32] val = int.from_bytes(b, byteorder="big") return val