From 9b964b05785d65459b935c499d5e3c1d7dd462f5 Mon Sep 17 00:00:00 2001 From: Bernhard Mueller Date: Fri, 28 Jun 2019 10:28:43 +0200 Subject: [PATCH] Remove unused code --- mythril/analysis/ops.py | 8 ------ mythril/analysis/symbolic.py | 56 ++---------------------------------- 2 files changed, 3 insertions(+), 61 deletions(-) diff --git a/mythril/analysis/ops.py b/mythril/analysis/ops.py index e993b262..c4f6ae17 100644 --- a/mythril/analysis/ops.py +++ b/mythril/analysis/ops.py @@ -91,11 +91,3 @@ class Call(Op): self.type = _type self.value = value self.data = data - - -class SStore(Op): - """The respresentation of an SSTORE operation.""" - - def __init__(self, node, state, state_index, value): - super().__init__(node, state, state_index) - self.value = value diff --git a/mythril/analysis/symbolic.py b/mythril/analysis/symbolic.py index 81177f88..ef2ff6d8 100644 --- a/mythril/analysis/symbolic.py +++ b/mythril/analysis/symbolic.py @@ -1,12 +1,9 @@ """This module contains a wrapper around LASER for extended analysis purposes.""" -import copy from mythril.analysis.security import get_detection_module_hooks, get_detection_modules from mythril.laser.ethereum import svm -from mythril.laser.ethereum.plugins.plugin_factory import PluginFactory -from mythril.laser.ethereum.plugins.plugin_loader import LaserPluginLoader from mythril.laser.ethereum.state.account import Account from mythril.laser.ethereum.state.world_state import WorldState from mythril.laser.ethereum.strategy.basic import ( @@ -30,9 +27,9 @@ from mythril.laser.ethereum.strategy.extensions.bounded_loops import ( BoundedLoopsStrategy, ) from mythril.laser.smt import symbol_factory, BitVec -from typing import Union, List, Dict, Type +from typing import Union, List, Type from mythril.solidity.soliditycontract import EVMContract, SolidityContract -from .ops import Call, SStore, VarType, get_variable +from .ops import Call, VarType, get_variable class SymExecWrapper: @@ -171,10 +168,9 @@ class SymExecWrapper: self.nodes = self.laser.nodes self.edges = self.laser.edges - # Generate lists of interesting operations + # Parse calls to make them easily accessible self.calls = [] # type: List[Call] - self.sstors = {} # type: Dict[int, Dict[str, List[SStore]]] for key in self.nodes: @@ -249,50 +245,4 @@ class SymExecWrapper: Call(self.nodes[key], state, state_index, op, to, gas) ) - elif op == "SSTORE": - stack = copy.copy(state.mstate.stack) - address = state.environment.active_account.address.value - - index, value = stack.pop(), stack.pop() - - try: - self.sstors[address] - except KeyError: - self.sstors[address] = {} - - try: - self.sstors[address][str(index)].append( - SStore(self.nodes[key], state, state_index, value) - ) - except KeyError: - self.sstors[address][str(index)] = [ - SStore(self.nodes[key], state, state_index, value) - ] - state_index += 1 - - def find_storage_write(self, address, index): - """ - - :param address: - :param index: - :return: - """ - # Find an SSTOR not constrained by caller that writes to storage index "index" - - try: - for s in self.sstors[address][index]: - - taint = True - - for constraint in s.node.constraints: - if "caller" in str(constraint): - taint = False - break - - if taint: - return s.node.function_name - - return None - except KeyError: - return None