From e0b0bec825cd8a106baba2640d233dc96a8a2f0b Mon Sep 17 00:00:00 2001 From: e-ngo Date: Tue, 23 Jul 2019 08:09:26 -0700 Subject: [PATCH] Refactored code --- mythril/analysis/symbolic.py | 3 +++ mythril/laser/ethereum/svm.py | 8 ++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/mythril/analysis/symbolic.py b/mythril/analysis/symbolic.py index 1626607e..09b00b87 100644 --- a/mythril/analysis/symbolic.py +++ b/mythril/analysis/symbolic.py @@ -103,6 +103,8 @@ class SymExecWrapper: hex(ATTACKER_ADDRESS): attacker_account, } + instruction_laser_plugin = PluginFactory.build_instruction_coverage_plugin() + self.laser = svm.LaserEVM( dynamic_loader=dynloader, max_depth=max_depth, @@ -113,6 +115,7 @@ class SymExecWrapper: requires_statespace=requires_statespace, enable_iprof=enable_iprof, enable_coverage_strategy=enable_coverage_strategy, + instruction_laser_plugin=instruction_laser_plugin, ) if loop_bound is not None: diff --git a/mythril/laser/ethereum/svm.py b/mythril/laser/ethereum/svm.py index 42e00ab8..c5d5c68e 100644 --- a/mythril/laser/ethereum/svm.py +++ b/mythril/laser/ethereum/svm.py @@ -56,6 +56,7 @@ class LaserEVM: requires_statespace=True, enable_iprof=False, enable_coverage_strategy=False, + instruction_laser_plugin=None, ) -> None: """ Initializes the laser evm object @@ -104,16 +105,11 @@ class LaserEVM: self.iprof = InstructionProfiler() if enable_iprof else None if enable_coverage_strategy: - from mythril.laser.ethereum.plugins.implementations.coverage.coverage_plugin import ( - InstructionCoveragePlugin, - ) from mythril.laser.ethereum.plugins.implementations.coverage.coverage_strategy import ( CoverageStrategy, ) - instruction = InstructionCoveragePlugin() - instruction.initialize(self) - self.strategy = CoverageStrategy(self.strategy, instruction) + self.strategy = CoverageStrategy(self.strategy, instruction_laser_plugin) log.info("LASER EVM initialized with dynamic loader: " + str(dynamic_loader))