|
|
@ -1,11 +1,10 @@ |
|
|
|
from copy import copy |
|
|
|
from copy import copy |
|
|
|
from typing import Set, List |
|
|
|
from typing import Set, List |
|
|
|
from mythril.laser.ethereum.svm import LaserEVM |
|
|
|
from mythril.laser.ethereum.svm import LaserEVM |
|
|
|
from mythril.laser.ethereum.plugins.plugin import LaserPlugin |
|
|
|
from mythril.laser.plugin.interface import LaserPlugin |
|
|
|
from mythril.laser.ethereum.plugins.implementations.state_merge.merge_states import ( |
|
|
|
from mythril.laser.plugin.plugins.state_merge.merge_states import merge_states |
|
|
|
merge_states, |
|
|
|
from mythril.laser.plugin.builder import PluginBuilder |
|
|
|
) |
|
|
|
from mythril.laser.plugin.plugins.state_merge.check_mergeability import ( |
|
|
|
from mythril.laser.ethereum.plugins.implementations.state_merge.check_mergeability import ( |
|
|
|
|
|
|
|
check_ws_merge_condition, |
|
|
|
check_ws_merge_condition, |
|
|
|
) |
|
|
|
) |
|
|
|
from mythril.laser.ethereum.state.world_state import WorldState |
|
|
|
from mythril.laser.ethereum.state.world_state import WorldState |
|
|
@ -19,6 +18,13 @@ class MergeAnnotation(StateAnnotation): |
|
|
|
pass |
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class StateMergePluginBuilder(PluginBuilder): |
|
|
|
|
|
|
|
plugin_name = "state merge" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def __call__(self, *args, **kwargs): |
|
|
|
|
|
|
|
return StateMerge() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class StateMerge(LaserPlugin): |
|
|
|
class StateMerge(LaserPlugin): |
|
|
|
""" |
|
|
|
""" |
|
|
|
Tries to merge states based on their similarity. |
|
|
|
Tries to merge states based on their similarity. |
|
|
@ -38,7 +44,6 @@ class StateMerge(LaserPlugin): |
|
|
|
|
|
|
|
|
|
|
|
@symbolic_vm.laser_hook("stop_sym_trans") |
|
|
|
@symbolic_vm.laser_hook("stop_sym_trans") |
|
|
|
def execute_stop_sym_trans_hook(svm: LaserEVM): |
|
|
|
def execute_stop_sym_trans_hook(svm: LaserEVM): |
|
|
|
|
|
|
|
|
|
|
|
open_states = svm.open_states |
|
|
|
open_states = svm.open_states |
|
|
|
if len(open_states) <= 1: |
|
|
|
if len(open_states) <= 1: |
|
|
|
return |
|
|
|
return |
|
|
|