From fe5ddf757b17b2bdb8e39fdd41b1ff0e49f833fa Mon Sep 17 00:00:00 2001 From: andri lim Date: Tue, 4 Dec 2018 17:56:16 +0700 Subject: [PATCH] fix trace returnValue --- nimbus/tracer.nim | 5 ----- nimbus/vm/transaction_tracer.nim | 4 +++- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/nimbus/tracer.nim b/nimbus/tracer.nim index 1efedefae..abed86f80 100644 --- a/nimbus/tracer.nim +++ b/nimbus/tracer.nim @@ -39,11 +39,6 @@ proc traceTransaction*(db: BaseChainDB, header: BlockHeader, result = vmState.getTracingResult() result["gas"] = %gasUsed - const returnValue = "returnValue" - let j = result["structLogs"].elems[^1] - if j.hasKey(returnValue): - result[returnValue] = j[returnValue] - # now we dump captured state db if TracerFlags.DisableState notin tracerFlags: var n = newJObject() diff --git a/nimbus/vm/transaction_tracer.nim b/nimbus/vm/transaction_tracer.nim index 36d12fa12..aaea7b33a 100644 --- a/nimbus/vm/transaction_tracer.nim +++ b/nimbus/vm/transaction_tracer.nim @@ -58,7 +58,9 @@ proc traceOpCodeEnded*(tracer: var TransactionTracer, c: BaseComputation) = j["gasCost"] = %(tracer.gasRemaining - c.gasMeter.gasRemaining) if c.lastOpCodeHasRetVal: - j["returnValue"] = %("0x" & toHex(c.rawOutput, true)) + let returnValue = %("0x" & toHex(c.rawOutput, true)) + j["returnValue"] = returnValue + tracer.trace["returnValue"] = returnValue proc traceError*(tracer: var TransactionTracer, c: BaseComputation) = let j = tracer.trace["structLogs"].elems[^1]