See also summary on issue with calls here: https://forum.openzeppelin.com/t/require-in-view-pure-functions-dont-revert-on-public-networks/1211
There is a test contract 0x6491eb4fb1269c7587451cf0102437a685897b78 you can interact with on etherscan Rinkeby. It has functions getWithCheck
and setWithCheck
to get and set a value. If you pass a parameter >=0 the function will be ok, if you pass a parameter <0 the function fails at the require
statement.
For 'getWithCheck', the require statement triggers a Geth bug and you get back the mysterious value:
3963877391197344453575983046348115674221700746820753546331534351508065746944
. This value in hex becomes 0x08c379a0
which is the function selector for Error(string)
, as described in the solidity docs. However that still doesn't show the revert reason.
So no revert reason there for calls. However, when using the Remix JavaScript VM the correct message does display.
In Remix and Nethereum you get exception "gas required exceeds allowance... or always failing transaction". This gives caller a chance to not waste any gas. Similarly, on etherscan dapp screen we get "ALERT: Transaction Error. Exception thrown in contract code." without any message.
If you do send the transaction anyway, then there is nothing in the transaction logs that tells you the error message.
So no revert reason there for transactions, before or after sending them. However when using the Remix JavaScript VM the correct message does display in the console (nothing in the tx receipt that I can see).
The solidity docs suggest that the revert message should be available, see the end of this section. A comment on the Ethereum github says that the revert reason is visible only to callers that are other contracts.