add initialize body for mutation pruner

constantinope-reentrancy-check
Joran Honig 6 years ago
parent 20f81c73c8
commit d7426fa246
  1. 21
      mythril/laser/ethereum/plugins/mutation_pruner.py

@ -1,5 +1,8 @@
from mythril.laser.ethereum.state.annotation import StateAnnotation
from mythril.laser.ethereum.svm import LaserEVM
from mythril.laser.ethereum.plugins.signals import PluginSkipWorldState
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.ethereum.transaction.transaction_models import ContractCreationTransaction
class MutationAnnotation(StateAnnotation):
@ -28,4 +31,20 @@ class MutationPruner:
pass
def initialize(self, symbolic_vm: LaserEVM):
pass
"""Initializes the mutation pruner
Introduces hooks for SSTORE operations
:param symbolic_vm:
:return:
"""
@symbolic_vm.pre_hook("SSTORE")
def mutator_hook(global_state: GlobalState):
global_state.annotate(MutationAnnotation())
@symbolic_vm.laser_hook("add_world_state")
def world_state_filter_hook(global_state: GlobalState):
if isinstance(global_state.current_transaction, ContractCreationTransaction):
return
if len(list(global_state.get_annotations(MutationAnnotation))) == 0:
raise PluginSkipWorldState

Loading…
Cancel
Save