This commit is contained in:
andri lim 2019-04-15 11:34:41 +07:00
parent 3bbe7fede3
commit 79630611c0
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
3 changed files with 10 additions and 7 deletions

View File

@ -300,3 +300,7 @@ proc executeOpcodes(computation: BaseComputation) =
let msg = getCurrentExceptionMsg()
computation.setError(&"Opcode Dispatch Error msg={msg}, depth={computation.msg.depth}", true)
computation.nextProc()
if computation.isError():
if computation.tracingEnabled: computation.traceError()
debug "executeOpcodes error", msg=computation.error.info

View File

@ -120,9 +120,10 @@ proc traceError*(tracer: var TransactionTracer, c: BaseComputation) =
j["error"] = %(c.error.info)
trace "Error", json = j.pretty()
# TODO: figure out how to get gasCost
# when contract execution failed before traceOpCodeEnded called
# because exception raised
#j["gasCost"] = %
# even though the gasCost is incorrect,
# we have something to display,
# it is an error anyway
let gasRemaining = j["gas"].getInt()
j["gasCost"] = %(gasRemaining - c.gasMeter.gasRemaining)
tracer.trace["failed"] = %true

View File

@ -74,7 +74,7 @@ proc execComputation*(computation: var BaseComputation): bool =
for deletedAccount in computation.accountsForDeletion:
db.deleteAccount deletedAccount
inc suicidedCount
# FIXME: hook this into actual RefundSelfDestruct
const RefundSelfDestruct = 24_000
computation.gasMeter.refundGas(RefundSelfDestruct * suicidedCount)
@ -82,8 +82,6 @@ proc execComputation*(computation: var BaseComputation): bool =
result = computation.isSuccess
if result:
computation.vmState.addLogs(computation.logEntries)
else:
if computation.tracingEnabled: computation.traceError()
proc refundGas*(computation: BaseComputation, tx: Transaction, sender: EthAddress): GasInt =
let