oscoin / oscoin-parity-wasm-prototype

Prototype implemenation of Oscoin ledger on Parity Ethereum Wasm
0 stars 0 forks source link

Show debug info when deploying/calling contract #36

Open geigerzaehler opened 5 years ago

geigerzaehler commented 5 years ago

When a contract is deployed, called, or receives a transaction and there is an error we don’t receive any valuable debug information. For instance if the contract code panics or there is not enough gas or there is an issue with the Wasm interpreter. To make debugging easier the tools like the client and the osc-deploy command should provide more information when there is an error.

Fortunately, Parity Ethereum provides the Trace API. The simplest solution for debugging would be to write a small CLI tool that retrieves the trace given a transaction hash (using trace_transaction) and ensure that the transaction hash is printed when an error occurs.

Since this would only work for transactions we would need a different mechanism for calls to a contract. Here the client could use trace_call method when an environment variable is set and print the trace on error. The same behavior could be used for transactions to avoid having to use a different CLI to further inspect an error.