-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Do not add extcodesize check when revertStrings
is set to debug
#16068
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
Conversation
Thank you for your contribution to the Solidity compiler! A team member will follow up shortly. If you haven't read our contributing guidelines and our review checklist before, please do it now, this makes the reviewing process and accepting your contribution smoother. If you have any questions or need our help, feel free to post them in the PR or talk to us directly on the #solidity-dev channel on Matrix. |
This isn't a bug - it was implemented as part of #8178 in order to provide revert strings for internal reverts as a way to provide additional debug info.
Compilers do that all the time, especially with regards to optimizations, or lack thereof in case of debug builds. That's why you're not supposed to deploy code generated using a debug build (gas costs aside), or in general use debug builds for anything other than debugging (rule of thumb for all languages, not just Solidity). |
To expand on what @nikola-matic said, the fact that the compiler skips The problem is that enabling verbose revert reasons makes these two reverts distinguishable. To be able to return accurate information, we have to keep it. Otherwise the behavior would not be consistent between calls that return something and ones that do not. |
I'm not sure I understood your point correctly. Let me clarify my concerns. What if the callee is not EOA but custom precompile and we call it as a regular contract (I understand it is a controversial approach but still)? In that case we have just different contract logic: without a verbose revert, everything works fine; but with verbose revert - it fails due to Even if the address is an EOA, calling |
It fails at a different point, but the observable end result (aside from gas) is the same - a revert without a message.
Ok, I see your point. True, when you enable verbose reverts this check prevents high-level calls to precompiles. That's unfortunate, though the fact that external calls even work with precompiles was not really intended in the first place. I don't think this is enough of a reason to change this behavior in a general case. You can always work around it with a low-level call after all. Still, the contract.someFunc{checked: false}() I'd recommend opening a separate issue or forum thread for that topic if you want to pursue it though. |
AFAIU the result with
Initially, I was going to open an issue, but then decided to create a PR right away since I was confident it was a bug :) Anyway, thanks for the explanation! |
If
revertStrings
option is set todebug
or higher, then the compiler always adds theextcodesize
check even if the function has a return value.I believe it's a bug because it's unnatural for the compiler to change its logic just because a debug option is provided.