Skip to content
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

why not use tx.origin == msg.sender to judge the caller is a contract address or EOA? #1212

Closed
flyq opened this issue Aug 16, 2018 · 2 comments

Comments

@flyq
Copy link

flyq commented Aug 16, 2018

https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/AddressUtils.sol

@nventuro
Copy link
Contributor

nventuro commented Aug 16, 2018

First of all, isContract checks the code size for any address, not just the caller.

With that out of the way, there are multiple reasons why tx.origin is usually a bad idea, at least security-wise: see here an issue where removing it from Solidity was proposed, and here a suggestion from Vitalik to 'not assume that tx.origin will continue to be usable or meaningful'.

@flyq
Copy link
Author

flyq commented Aug 17, 2018

thx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants