Currently if a tx fails because it runs out of gas the key "failedCall" is added to the "result" key with an empty array as value. It would be better to have a field "status" under the result key with the value either as "success" or "error + Error Message".
For example:
"result":{
"status": "error - Out of gas"
}
prefer "ok": true/false rather than a preformatted string.
also, callType could do with a similar facelift.
I second that. A status description would be extremely helpful. At the moment the only other way to get that is do a trace_transaction in Geth.
currently we return json in following format:
{
"action": {
"call": {
"from": "0x0000000000000000000000000000000000000004",
"to": "0x0000000000000000000000000000000000000005",
"value": "0x06",
"gas": "0x07",
"input": "0x1234",
"callType": "call"
}
},
"result": {
"call": {
"gasUsed": "0x08",
"output": "0x5678"
}
},
"traceAddress": [
"0x0a"
],
"subtraces": "0x01",
"transactionPosition": "0x0b",
"transactionHash": "0x000000000000000000000000000000000000000000000000000000000000000c",
"blockNumber": "0x0d",
"blockHash": "0x000000000000000000000000000000000000000000000000000000000000000e"
}
I would like to propose the new format:
{
"type": "call",
"action": {
"from": "0x0000000000000000000000000000000000000004",
"to": "0x0000000000000000000000000000000000000005",
"value": "0x06",
"gas": "0x07",
"input": "0x1234",
"callType": "call"
},
"result": {
"gasUsed": "0x08",
"output": "0x5678"
},
"traceAddress": [
"0x0a"
],
"subtraces": "0x01",
"transactionPosition": "0x0b",
"transactionHash": "0x000000000000000000000000000000000000000000000000000000000000000c",
"blockNumber": "0x0d",
"blockHash": "0x000000000000000000000000000000000000000000000000000000000000000e"
}
Please notice additional field type. Also action and result structures are flat.
failedCall would produce the following json:
{
"type": "call",
"action": {
"from": "0x0000000000000000000000000000000000000004",
"to": "0x0000000000000000000000000000000000000005",
"value": "0x06",
"gas": "0x07",
"input": "0x1234",
"callType": "call"
},
"error": "Stack underflow",
"traceAddress": [
"0x0a"
],
"subtraces": "0x01",
"transactionPosition": "0x0b",
"transactionHash": "0x000000000000000000000000000000000000000000000000000000000000000c",
"blockNumber": "0x0d",
"blockHash": "0x000000000000000000000000000000000000000000000000000000000000000e"
}
result field is replaced with error. It's jsonrpc-like behaviour.
What do you think about it?
Yes, that will be much easier to handle compared to the current format. Thanks!
merged do master, docs are also updated
Might be worth updating https://github.com/ethcore/parity/wiki/JSONRPC-trace-module too.
done
Most helpful comment
Might be worth updating https://github.com/ethcore/parity/wiki/JSONRPC-trace-module too.