Issue with truffle debugger.
truffle debug <txId>
Debug of transaction.
Gathering transaction data...
Error: Method not found
at /usr/lib/node_modules/truffle/build/webpack:/packages/truffle-debugger/dist/debugger.js:4813:1
at /usr/lib/node_modules/truffle/build/webpack:/packages/truffle-provider/wrapper.js:134:1
at XMLHttpRequest.request.onreadystatechange (/usr/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/httpprovider.js:128:1)
at XMLHttpRequestEventTarget.dispatchEvent (/usr/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:64:1)
at XMLHttpRequest._setReadyState (/usr/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:354:1)
at XMLHttpRequest._onHttpResponseEnd (/usr/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:509:1)
at IncomingMessage.<anonymous> (/usr/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:469:1)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickDomainCallback (internal/process/next_tick.js:218:9)
truffle(development)> TypeError: Cannot read property 'view' of undefined
at printAddressesAffected (/usr/lib/node_modules/truffle/build/webpack:/packages/truffle-core/lib/commands/debug.js:102:1)
at /usr/lib/node_modules/truffle/build/webpack:/packages/truffle-core/lib/commands/debug.js:442:1
at <anonymous>
at process._tickDomainCallback (internal/process/next_tick.js:228:7)
truffle version): Truffle v4.1.13 (core: 4.1.13)node --version): v8.11.3npm --version): 5.10.0Hi @RomanFro, thanks for bringing this up. The debugger doesn't support Parity because it doesn't provide the debug_traceTransaction method. Please try using geth instead.
Does that mean it's impossible to debug contracts on Kovan, a Parity-only network? Is there an alternative way to debug the transaction?
@gnidan Hi! Is this still true? I can't use the debugger feature on parity nodes?
@andreafspeziale Unfortunately, no.
I did some digging and found https://github.com/paritytech/parity-ethereum/issues/5727, but I'm not sure if that's seen any action since 2017.
There would be a clever workaround, i.e., to use ganache-cli's --fork feature (run ganache-cli with --fork <parity-host>:<parity-port> and have Truffle connect to that), but I just tried this out and I'm getting this exception:
...
Listening on 0.0.0.0:4545
debug_traceTransaction
Error: Given input "锟较拷(P锟斤拷A锟紸l锟絑墓^^H/S#钳%K锟統 " is not a number.
at Object.p (.../node/v8.15.0/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:47:264131)
This has been an elusive issue (almost two years since it was discovered, and not without attempts to resolve!), but last I heard it was supposed to be fixed in [email protected]: https://github.com/trufflesuite/ganache-core/issues/404. You might want to try it out yourself, but in the meantime I'll ping over there with my recent findings.
I'll leave this closed for now, but it'd be nice to have an open/blocked Truffle issue specifically to add an enhancement that automatically leverages Ganache forking in cases like this.
FYI: [email protected] was just released, finally fixing the above-referenced bug! Users looking for support to debug Parity transactions: use ganache-cli's --fork option (see ganache-cli usage readme).
@gnidan Thanks for the input. So I should run ganache-cli with --fork http://<parity-host>:<parity-port> and then truffle debug txhash?
What does fork mean? It uses the history of the node till that moment and then ganache will create its own chain? Should the node be a full node or something else?
Thanks! It's very useful (I'll do some tests)
What does fork mean? It uses the history of the node till that moment and then ganache will create its own chain?
Yep! From the point of the fork, Ganache makes new blocks. For data from the chain before that point, it defers to the underlying node. Neat, huh?
Should the node be a full node or something else?
You might need a full node to get storage info. YMMV. Let me know how it works out!
Most helpful comment
Hi @RomanFro, thanks for bringing this up. The debugger doesn't support Parity because it doesn't provide the
debug_traceTransactionmethod. Please try using geth instead.