-
Notifications
You must be signed in to change notification settings - Fork 12.1k
Remove Address.isContract #3945
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
Changes from 9 commits
acd97fd
a87bd43
81667ae
26863ed
8ad9f9f
df7ff46
aa1a158
3e9c380
c484d04
0fb4423
23b8f57
95799e9
7981474
ba6ca20
300f4ff
f8d0f40
46d68bf
e697766
33b55af
91802e5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Can I restrict a function to EOAs only? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The answer to this question is closer to "no", but the content below seems to be saying "yes". The key part that is missing is that although There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see, please check the new version to see if its clear enough after the update. |
||
|
||
It is possible to restrict a function to an EOA only by learning to differentiate it from a contract address. When calling external addresses from your contract it is unsafe to assume that an address is an externally-owned account (EOA) and not a contract. | ||
|
||
Some criteria to discard an address as a contract address can be: | ||
|
||
- an externally-owned account, meaning, an address with no code | ||
- a contract in construction address | ||
- an address where a contract will be created | ||
- an address where a contract lived, but was destroyed | ||
|
||
Furthermore, a contract address can still be considered a contract if the target contract within the same transaction is already scheduled for destruction by `SELFDESTRUCT`, which only has an effect at the end of a transaction. | ||
|
||
Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract constructor. |
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.
Please create a new file at
docs/modules/ROOT/pages/knowledge.adoc
, add it indocs/modules/ROOT/nav.adoc
, and include this content there so we don't lose it. I think it should be a section called "Can I restrict a function to EOAs only?"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.
Please check the new doc page.
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.
What do you think of "FAQ" as the title for the section? Or you can check how I did it and if it can remain like that, no problem.
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.
Yes FAQ works.