-
Notifications
You must be signed in to change notification settings - Fork 20.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
eth_call cannot distinguish between success and failure with require-reason #19027
Comments
Replying as there hasn't been update in the past few months. Geth doesn't return the revert reason on view/pure functions. Now that OpenZeppelin 2.3.0 and others includes revert reasons on each require, more and more people will face this. For example: 1, 2, 3, 4, 5, 6 You can test it here, read "getPersonIdForName" with the name "0". The code is verified so you can see it. The returned value is always 0x8C379A0...0. Which is the EVM function selector for Error(string). |
This is a shame that this bug was not fixed for such a long time... :( |
I am having the same problem with this. I should get revert but instead, I got (The number above when you turn to hex it's |
Do we have any hope for this issue to be resolved?.. |
I agree, every |
This was implemented in the PR above. The error format we chose is:
|
# Description upstream PR: [0xPolygon#1566](0xPolygon#1566) This allows returning custom revert errors from solidity, they are ABI encoded functions that can represent rich and gas efficient revert messages. Details of custom errors: https://blog.soliditylang.org/2021/04/21/custom-errors/ This is the implementation expected by ethers.js and web3.js and the format go-ethereum chose ethereum/go-ethereum#19027 (comment) # Changes include - [x] New feature (non-breaking change that adds functionality) # Checklist - [x] I have assigned this PR to myself - [x] I have added at least 1 reviewer - [x] I have added the relevant labels ## Testing - [x] I have tested this code with the official test suite
Geth version:
1.8.22
OS & Version: Linux
Commit hash : (
Official docker image
)Expected behaviour
When using the JSON-RPC interface to make an eth_call to a contract call that fails with a require-with-reason, I expect the response to this request to clearly and unambiguously indicate that call has failed.
Actual behaviour
When using the JSON-RPC, an eth_call that hits a require with a reason will return a response to the call which does not indicate anything failed, except that the response starts with
0x08c379a0
.Steps to reproduce the behaviour
Take this contract as an example:
Making an eth_call against
good()
(0xaa8fb40b
):A call against
bad()
(0x9c3674fc
):The
result
here is identical, even though one indicates a failure/revert and the other succeeded.Backtrace
n/a
Additional Notes:
For context, parity returns the
bad()
call with:It seems like this could be a security problem, since it doesn't matter where in the call stack the require-with-reason occurs, the reason will be returned in the eth_call directly. If some balance lookup triggered an external contract which performed this require (easily performed within a gas stipend), you could trick the caller into reading data improperly from their own node
The text was updated successfully, but these errors were encountered: