Merge branch 'jangko-fix_244'

This commit is contained in:
Ștefan Talpalaru 2019-04-15 14:20:33 +02:00
commit 91bf7630ae
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() let msg = getCurrentExceptionMsg()
computation.setError(&"Opcode Dispatch Error msg={msg}, depth={computation.msg.depth}", true) computation.setError(&"Opcode Dispatch Error msg={msg}, depth={computation.msg.depth}", true)
computation.nextProc() 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) j["error"] = %(c.error.info)
trace "Error", json = j.pretty() trace "Error", json = j.pretty()
# TODO: figure out how to get gasCost # even though the gasCost is incorrect,
# when contract execution failed before traceOpCodeEnded called # we have something to display,
# because exception raised # it is an error anyway
#j["gasCost"] = % let gasRemaining = j["gas"].getInt()
j["gasCost"] = %(gasRemaining - c.gasMeter.gasRemaining)
tracer.trace["failed"] = %true tracer.trace["failed"] = %true

View File

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

View File

@ -283,7 +283,8 @@
"0000000000000000000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000060" "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": { "stateDiff": {
@ -704,7 +705,8 @@
"0000000000000000000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000060" "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
} }
] ]
}, },