From b74f8e64eb77e9b64c48443850700f96e860a055 Mon Sep 17 00:00:00 2001 From: Joran Honig Date: Wed, 23 Oct 2019 15:20:21 +0200 Subject: [PATCH] add transaction end hook --- mythril/laser/ethereum/svm.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mythril/laser/ethereum/svm.py b/mythril/laser/ethereum/svm.py index fe679946..c69589d2 100644 --- a/mythril/laser/ethereum/svm.py +++ b/mythril/laser/ethereum/svm.py @@ -107,6 +107,8 @@ class LaserEVM: self._start_sym_exec_hooks = [] # type: List[Callable] self._stop_sym_exec_hooks = [] # type: List[Callable] + self._transaction_end_hooks = [] # type: List[Callable] + self.iprof = iprof if enable_coverage_strategy: @@ -356,6 +358,9 @@ class LaserEVM: -1 ] + for hook in self._transaction_end_hooks: + hook(global_state, transaction, return_global_state, end_signal.revert) + log.debug("Ending transaction %s.", transaction) if return_global_state is None: @@ -564,6 +569,8 @@ class LaserEVM: self._start_sym_trans_hooks.append(hook) elif hook_type == "stop_sym_trans": self._stop_sym_trans_hooks.append(hook) + elif hook_type == "transaction_end": + self._transaction_end_hooks.append(hook) else: raise ValueError( "Invalid hook type %s. Must be one of {add_world_state}", hook_type