NOTE: I am doing my work with the Ganache v1.2.2 GUI client on a Linux Ubuntu 18.04 station.
There are many
revert errors that happen during the
estimateGas() call that precedes the actual Web3.js
send() call. Unfortunately, as far as I can tell, you don't get back a Tx hash for transactions that revert during the
estimateGas() call, so you can't debug the problem with the Truffle debugger.
Instead, the Web3.js estimateGas() throws a promise rejection during that method call. I also checked carefully the Ganache log window and it never shows a Tx hash. However it does show a Tx hash for all the Ethereum transactions that concluded successfully before the one that reverts, and it does show reverted transactions that revert during the actual
When this happens, I make a temporary change to my code to skip the
estimateGas() call and go straight to the
send() call with an artificially high gas price to make sure the transaction does not
revert due to insufficient gas. This is all done just so I can get back a
Tx Hashand debug the transaction with the Truffle debugger.
This workflow works but it is tedious. Is there a better way to debug a transaction that reverts during the
estimateGas() than this?