From b28130cb8ef8a50d8d290a1b28f63f12d58c93a8 Mon Sep 17 00:00:00 2001 From: Joran Honig Date: Wed, 1 Aug 2018 14:16:09 +0200 Subject: [PATCH] State cleanup --- mythril/laser/ethereum/state.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mythril/laser/ethereum/state.py b/mythril/laser/ethereum/state.py index db2bcd90..81702d89 100644 --- a/mythril/laser/ethereum/state.py +++ b/mythril/laser/ethereum/state.py @@ -143,7 +143,7 @@ class GlobalState: """ GlobalState represents the current globalstate """ - def __init__(self, world_state, environment, node, machine_state=None, transaction_stack=None, ret_data=None): + def __init__(self, world_state, environment, node, machine_state=None, transaction_stack=None, last_return_data=None): """ Constructor for GlobalState""" self.node = node self.world_state = world_state @@ -151,20 +151,21 @@ class GlobalState: self.mstate = machine_state if machine_state else MachineState(gas=10000000) self.transaction_stack = transaction_stack if transaction_stack else [] self.op_code = "" - self.last_return_data = ret_data + self.last_return_data = last_return_data def __copy__(self): world_state = copy(self.world_state) environment = copy(self.environment) mstate = deepcopy(self.mstate) transaction_stack = copy(self.transaction_stack) - return GlobalState(world_state, environment, self.node, mstate, transaction_stack=transaction_stack, ret_data=self.last_return_data) + return GlobalState(world_state, environment, self.node, mstate, transaction_stack=transaction_stack, + last_return_data=self.last_return_data) @property def accounts(self): return self.world_state.accounts - #TODO: remove this, as two instructions are confusing + # TODO: remove this, as two instructions are confusing def get_current_instruction(self): """ Gets the current instruction for this GlobalState""" instructions = self.environment.code.instruction_list @@ -177,6 +178,7 @@ class GlobalState: except IndexError: return None + class WorldState: """ The WorldState class represents the world state as described in the yellow paper