...by Daniel Szego
quote
"On a long enough timeline we will all become Satoshi Nakamoto.."
Daniel Szego

Saturday, December 16, 2017

Solidity and Truffle Tips and Tricks - Debugging a unit test error


Well, Truffle and solidity will be surely a great thing one day, but today it is still a little bit different to make debugging things. Supposing you have a smart contract, you were writing some unit tests for that in solidity as well, and you have an error message, something like:

 Error: VM Exception while processing transaction: invalid opcode

What you can try out is to open a second window with the truffle develop --log command, rerun the unit tests and get the last transaction id in the log windows. Having the transaction id, you can try to debug your code in the truffle window with:

 debug <transaction_id>