Refactored code

cli-code-coverage
e-ngo 5 years ago
parent 2eb9d9f6c5
commit e0b0bec825
  1. 3
      mythril/analysis/symbolic.py
  2. 8
      mythril/laser/ethereum/svm.py

@ -103,6 +103,8 @@ class SymExecWrapper:
hex(ATTACKER_ADDRESS): attacker_account, hex(ATTACKER_ADDRESS): attacker_account,
} }
instruction_laser_plugin = PluginFactory.build_instruction_coverage_plugin()
self.laser = svm.LaserEVM( self.laser = svm.LaserEVM(
dynamic_loader=dynloader, dynamic_loader=dynloader,
max_depth=max_depth, max_depth=max_depth,
@ -113,6 +115,7 @@ class SymExecWrapper:
requires_statespace=requires_statespace, requires_statespace=requires_statespace,
enable_iprof=enable_iprof, enable_iprof=enable_iprof,
enable_coverage_strategy=enable_coverage_strategy, enable_coverage_strategy=enable_coverage_strategy,
instruction_laser_plugin=instruction_laser_plugin,
) )
if loop_bound is not None: if loop_bound is not None:

@ -56,6 +56,7 @@ class LaserEVM:
requires_statespace=True, requires_statespace=True,
enable_iprof=False, enable_iprof=False,
enable_coverage_strategy=False, enable_coverage_strategy=False,
instruction_laser_plugin=None,
) -> None: ) -> None:
""" """
Initializes the laser evm object Initializes the laser evm object
@ -104,16 +105,11 @@ class LaserEVM:
self.iprof = InstructionProfiler() if enable_iprof else None self.iprof = InstructionProfiler() if enable_iprof else None
if enable_coverage_strategy: 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 ( from mythril.laser.ethereum.plugins.implementations.coverage.coverage_strategy import (
CoverageStrategy, CoverageStrategy,
) )
instruction = InstructionCoveragePlugin() self.strategy = CoverageStrategy(self.strategy, instruction_laser_plugin)
instruction.initialize(self)
self.strategy = CoverageStrategy(self.strategy, instruction)
log.info("LASER EVM initialized with dynamic loader: " + str(dynamic_loader)) log.info("LASER EVM initialized with dynamic loader: " + str(dynamic_loader))

Loading…
Cancel
Save