Parity-ethereum: JSON format facelift in tracing

Created on 26 Jul 2016  路  8Comments  路  Source: openethereum/parity-ethereum

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"
}
F8-enhancement 馃帄 P7-nicetohave 馃悤 Q7-involved 馃挭

Most helpful comment

All 8 comments

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

done

Was this page helpful?
0 / 5 - 0 ratings

Related issues

retotrinkler picture retotrinkler  路  3Comments

m-thomson picture m-thomson  路  3Comments

bryaan picture bryaan  路  3Comments

stone212 picture stone212  路  3Comments

famfamfam picture famfamfam  路  3Comments