Add retrieval of constructor trace, using RETURN instead of STOP as exit point

pull/310/head
Konrad Weiss 7 years ago
parent 43b27c0290
commit c8ad82bc87
  1. 19
      mythril/solidnotary/solidnotary.py

@ -19,7 +19,7 @@ class SolidNotary:
pass
def get_transaction_traces(statespace):
logging.debug("Executing module: Transaction End")
print("get_transaction_traces")
traces = []
@ -27,11 +27,28 @@ def get_transaction_traces(statespace):
node = statespace.nodes[k]
for state in node.states:
instruction = state.get_current_instruction()
# print("op: " + str(instruction['opcode']) + ((" " + instruction['argument']) if instruction['opcode'].startswith("PUSH") else "") + " stack: " + str(state.mstate.stack).replace("\n", "")+ " mem: " + str(state.mstate.memory).replace("\n", ""))
if instruction['opcode'] == "STOP":
if are_satisfiable(state.mstate.constraints):
traces.append(TransactionTrace(state.environment.active_account.storage, state.mstate.constraints))
return traces
def get_construction_traces(statespace):
print("get_constructor_traces")
traces = []
for k in statespace.nodes:
node = statespace.nodes[k]
for state in node.states:
instruction = state.get_current_instruction()
# print("op: " + str(instruction['opcode']) + ((" " + instruction['argument']) if instruction['opcode'].startswith("PUSH") else "") + " stack: " + str(state.mstate.stack).replace("\n", "")+ " mem: " + str(state.mstate.memory).replace("\n", ""))
if instruction['opcode'] == "RETURN":
if are_satisfiable(state.mstate.constraints):
traces.append(TransactionTrace(state.environment.active_account.storage, state.mstate.constraints))
return traces
def get_t_indexed_environment(active_account, index):
# Initialize the execution environment

Loading…
Cancel
Save