openzeppelin-labs: Ensure that proxies bubble up error messages
Solidity 0.4.22 introduced support for error reasons on revert EVM operations, check that proxies correctlly forward the error reason to their clients.
As an example, let’s assume we have a logic contract named Reverter:
contract Reverter {
function willRevert() public {
require(false, "This is an error message from the contract");
}
}
If you deploy this contract and attempt to call willRevert, you get the following message. Note that the message includes the revert reason This is an error message from the contract.
transact to Reverter.willRevert errored: VM error: revert.
revert The transaction has been reverted to the initial state.
Reason provided by the contract: "This is an error message from the contract".
Debug the transaction to get more information.
Now, if you create a Proxy for Reverter via ZeppelinOS, and attempt to call willRevert on the proxy, the returned error message must include the This is an error message from the contract legend. Add a test in zos-lib to ensure it works like this, and make any necessary changes in Proxy if needed.
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 1
- Comments: 21 (5 by maintainers)
Here are my two cents on that, we could add an optional argument to the current
assertRevertexpecting it to assert a revert with a custom message when given and assert a revert without a message when not.