From 3a1f3a77c30e1da7f0da69527019b30ed10779d8 Mon Sep 17 00:00:00 2001 From: Nikhil Parasaram Date: Thu, 30 May 2019 12:22:30 +0530 Subject: [PATCH 1/2] Fix the source index problem by using proper function name --- mythril/laser/ethereum/svm.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mythril/laser/ethereum/svm.py b/mythril/laser/ethereum/svm.py index 8f74410a..7c09cbc7 100644 --- a/mythril/laser/ethereum/svm.py +++ b/mythril/laser/ethereum/svm.py @@ -436,7 +436,11 @@ class LaserEVM: environment = state.environment disassembly = environment.code - if address in disassembly.address_to_function_name: + if isinstance( + state.world_state.transaction_sequence[-1], ContractCreationTransaction + ): + environment.active_function_name = "constructor" + elif address in disassembly.address_to_function_name: # Enter a new function environment.active_function_name = disassembly.address_to_function_name[ address From 37847948f3d398509351dcea146655cf79fbe294 Mon Sep 17 00:00:00 2001 From: Nikhil Parasaram Date: Thu, 30 May 2019 12:41:28 +0530 Subject: [PATCH 2/2] Append transaction in concolic.py --- mythril/laser/ethereum/transaction/concolic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mythril/laser/ethereum/transaction/concolic.py b/mythril/laser/ethereum/transaction/concolic.py index d8c251dd..164df8db 100644 --- a/mythril/laser/ethereum/transaction/concolic.py +++ b/mythril/laser/ethereum/transaction/concolic.py @@ -88,7 +88,7 @@ def _setup_global_state_for_execution(laser_evm, transaction) -> None: condition=None, ) ) - + global_state.world_state.transaction_sequence.append(transaction) global_state.node = new_node new_node.states.append(global_state) laser_evm.work_list.append(global_state)