-
Notifications
You must be signed in to change notification settings - Fork 11.7k
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
Add warning on SELFDESTRUCT
usage with isContract
#3875
Conversation
This looks like a warning that should be part of the NatSpec rather than a part of the implementation comments. To be honest even the existing comment that we have inside the function seems redundant too. |
I actually agree - I was not sure however what you planned to change for the upcoming releases. You want me to put it into the NatSpec section instead? |
The plan is to remove this function in 5.0 (#3417) but that is still a couple of months away. In any case we will want to keep the docs about how this kind of check can cause issues. Yes I think we should move this to the NatSpec... I'm not sure exactly where it fits, I feel it's somewhat covered already where it says " |
Right, in theory, it's nothing new that you can interact with a selfdestructed contract within the same transaction, but many people don't know about this behavior, to be honest. That's why I want to cover the
|
I would go with "Furthermore, this function will return true even if the contract is already scheduled for destruction via |
quickly pushed an adjusted version of yours: "Furthermore, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Docs changes don't need to go in the changelog.
As title. An interesting scenario in the context of upgradable contracts that could be "exploited" (not sure this is the correct wording tho) is the following:
selfdestruct
possibility;selfdestruct
;->
newImplementation
== EOAThe check
require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
would be successful in such a case.