State cleanup

pull/404/head
Joran Honig 6 years ago
parent 9108f48b88
commit b28130cb8e
  1. 8
      mythril/laser/ethereum/state.py

@ -143,7 +143,7 @@ class GlobalState:
""" """
GlobalState represents the current 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""" """ Constructor for GlobalState"""
self.node = node self.node = node
self.world_state = world_state self.world_state = world_state
@ -151,14 +151,15 @@ class GlobalState:
self.mstate = machine_state if machine_state else MachineState(gas=10000000) self.mstate = machine_state if machine_state else MachineState(gas=10000000)
self.transaction_stack = transaction_stack if transaction_stack else [] self.transaction_stack = transaction_stack if transaction_stack else []
self.op_code = "" self.op_code = ""
self.last_return_data = ret_data self.last_return_data = last_return_data
def __copy__(self): def __copy__(self):
world_state = copy(self.world_state) world_state = copy(self.world_state)
environment = copy(self.environment) environment = copy(self.environment)
mstate = deepcopy(self.mstate) mstate = deepcopy(self.mstate)
transaction_stack = copy(self.transaction_stack) 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 @property
def accounts(self): def accounts(self):
@ -177,6 +178,7 @@ class GlobalState:
except IndexError: except IndexError:
return None return None
class WorldState: class WorldState:
""" """
The WorldState class represents the world state as described in the yellow paper The WorldState class represents the world state as described in the yellow paper

Loading…
Cancel
Save