Merge branch 'fix_244' of github.com:jangko/nimbus into jangko-fix_244

This commit is contained in:
Ștefan Talpalaru 2019-04-15 14:05:18 +02:00
commit 8800cb5fe5
No known key found for this signature in database
GPG Key ID: CBF7934204F1B6F9
4 changed files with 14 additions and 9 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

View File

@ -283,7 +283,8 @@
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000060"
],
"error": "Opcode Dispatch Error msg=Out of gas: Needed 20000 - Remaining 412 - Reason: SSTORE: 9a049f5d18c239efaa258af9f3e7002949a977a0[0] -> 924236965777326770894530693462975209021625492404 (0), depth=0"
"error": "Opcode Dispatch Error msg=Out of gas: Needed 20000 - Remaining 412 - Reason: SSTORE: 9a049f5d18c239efaa258af9f3e7002949a977a0[0] -> 924236965777326770894530693462975209021625492404 (0), depth=0",
"gasCost": 0
}
],
"stateDiff": {
@ -704,7 +705,8 @@
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000060"
],
"error": "Opcode Dispatch Error msg=Out of gas: Needed 20000 - Remaining 412 - Reason: SSTORE: 9a049f5d18c239efaa258af9f3e7002949a977a0[0] -> 924236965777326770894530693462975209021625492404 (0), depth=0"
"error": "Opcode Dispatch Error msg=Out of gas: Needed 20000 - Remaining 412 - Reason: SSTORE: 9a049f5d18c239efaa258af9f3e7002949a977a0[0] -> 924236965777326770894530693462975209021625492404 (0), depth=0",
"gasCost": 0
}
]
},