|
|
@ -63,7 +63,6 @@ class DependencyPruner(LaserPlugin): |
|
|
|
"""Creates DependencyPruner""" |
|
|
|
"""Creates DependencyPruner""" |
|
|
|
self.iteration = 0 |
|
|
|
self.iteration = 0 |
|
|
|
self.dependency_map = {} # type: Dict[int, List] |
|
|
|
self.dependency_map = {} # type: Dict[int, List] |
|
|
|
self.jumpdests_seen = [] # type: int |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _reset(self): |
|
|
|
def _reset(self): |
|
|
|
"""TODO: Reset this plugin""" |
|
|
|
"""TODO: Reset this plugin""" |
|
|
@ -92,16 +91,7 @@ class DependencyPruner(LaserPlugin): |
|
|
|
return |
|
|
|
return |
|
|
|
|
|
|
|
|
|
|
|
if address not in self.dependency_map: |
|
|
|
if address not in self.dependency_map: |
|
|
|
if address in self.jumpdests_seen: |
|
|
|
return |
|
|
|
logging.info("Skipping known path with no state dependencies") |
|
|
|
|
|
|
|
raise PluginSkipState |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
self.jumpdests_seen.append(address) |
|
|
|
|
|
|
|
logging.info("New basic block discovered: {}".format(address)) |
|
|
|
|
|
|
|
# This is a new path |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.jumpdests_seen.append(address) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not set(annotation.storage_written).intersection( |
|
|
|
if not set(annotation.storage_written).intersection( |
|
|
|
set(self.dependency_map[address]) |
|
|
|
set(self.dependency_map[address]) |
|
|
@ -118,7 +108,9 @@ class DependencyPruner(LaserPlugin): |
|
|
|
@symbolic_vm.pre_hook("SSTORE") |
|
|
|
@symbolic_vm.pre_hook("SSTORE") |
|
|
|
def mutator_hook(state: GlobalState): |
|
|
|
def mutator_hook(state: GlobalState): |
|
|
|
annotation = get_dependency_annotation(state) |
|
|
|
annotation = get_dependency_annotation(state) |
|
|
|
annotation.storage_written.append(state.mstate.stack[-1]) |
|
|
|
|
|
|
|
|
|
|
|
logging.info("SSTORE: Write storage {}".format(state.mstate.stack[-1])) |
|
|
|
|
|
|
|
|
|
|
|
annotation.storage_written = list( |
|
|
|
annotation.storage_written = list( |
|
|
|
set(annotation.storage_written + [state.mstate.stack[-1]]) |
|
|
|
set(annotation.storage_written + [state.mstate.stack[-1]]) |
|
|
|
) |
|
|
|
) |
|
|
|