-
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
isContract() Implementation is no longer valid #3355
Comments
I think it is mentioned in the document to be careful with that case. openzeppelin-contracts/contracts/utils/Address.sol Lines 18 to 24 in c12076f
#1212 also discussed the drawback of tx.origin approach.
|
hmm I see, it's still a bit misleading with the naming. |
Agree with @tina1998612 that isContract should consider cases like "a contract in construction", or it is not aligned with its function name and cannot help developers to avoid ghost contract calls. |
This as been discussed numerous times already:
|
It was recently discovered that the
account.code.length > 0
assertion for checking if an account is EOA is not valid. It can be exploited as shown in here: https://github.com/0xKitsune/Ghost-ContractOne can use
tx.origin == msg.sender
to check whether themsg.sender
is EOA. TheisContract()
method may need to be removed to avoid confusion.Current implemetation:
openzeppelin-contracts/contracts/utils/Address.sol
Line 41 in afb2011
The text was updated successfully, but these errors were encountered: