-
Notifications
You must be signed in to change notification settings - Fork 11.8k
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
Reliability of the truthiness in isContract
method
#2215
Comments
isContract
methodisContract
method
Hi @corydickson! We have been able to reproduce this issue by following these steps:
Target.solpragma solidity ^0.6.0;
contract Target {
function destroy() public {
selfdestruct(msg.sender);
}
} Check.solpragma solidity ^0.6.0;
import "@openzeppelin/contracts/utils/Address.sol";
import "./Target.sol";
contract Check {
using Address for address;
Target public target;
event Status(bool newValue);
function check() public {
target = new Target();
target.destroy();
emit Status(address(target).isContract());
}
function check2() public {
emit Status(address(target).isContract());
}
}
Thanks so much for reporting it! The project owner will review and triage this issue during the next week. |
Thank you for testing this @abcoathup. @corydickson Can you please rephrase in more detail what is the issue that you see here? I'm not sure I understand. The semantics of |
Thanks both @abcoathup @frangio for reaching out to address the concern. It more has to do with the naming of the API and in the documentation it says:
But the test case provided shows how if in the same tx a contract is created/selfdestructed this check still returns True. Could we update the docs to reflect this, or maybe change the name of this function to be |
I dug a bit into EIPs 1052 and 161 to better understand how However, I think the current behavior, if perhaps strange, is still valid and useful. Any account for which We may want to add a note to that effect to our docs. |
The name |
Got it so sounds like we're aligned about the "desired" functionality behind the API semantics. Not sure how to achieve this in the EVM either, but as @nventuro suggested maybe updating the docs is all that can be done for now. |
I believe those are the semantics that we have now! Unfortunately we're not testing for the more complex scenarios involving contract creation and selfdestruct, but it would be nice to incorporate that into the test suite. |
When reviewing this EIP, it is unclear to me if someone were to selfdestruct a contract in the same transaction it was created that this function would still return True. Is this intended behavior?
I feel like this would lead to some obscure bugs, namely contracts that behave in test cases 5/6 described above.
The text was updated successfully, but these errors were encountered: