Description
System information
Geth version: v1.9.10
OS & Version: Windows
Summary
Return the revert reason string when eth_estimateGas
fails due to a revert.
Description
Most dapps execute an eth_estimateGas
transaction prior to submitting a transaction. Along with being necessary in order to calculate gas costs for the transaction, it also is an opportunity to make sure the transaction will succeed prior to submitting it to the blockchain where failure still costs the user money (gas).
However, if the transaction fails due to a revert with a revert reason string, Geth will not return the reason string to the caller. The lack of revert reason string can lead to a frustrating user experience where there is not enough information presented to the dapp to appropriately handle or inform the user.
eth_call
currently returns the reason string (though as expressed in #19027 the current mechanism is problematic). eth_estimateGas
should similarly return the reason string when it is available.
Note: I recommend fixing #19027 at the same time as this. Consider following Parity's lead and returning the error in the error.data
of a JSON-RPC error response.