Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update documentation
  • Loading branch information
JulissaDantes committed Jan 16, 2023
commit 23b8f57576a66f30481bf3ef02fd48b9f957312b
2 changes: 1 addition & 1 deletion docs/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@

* xref:utilities.adoc[Utilities]

* xref:knowledge.adoc[Knowledge]
* xref:fag.adoc[FAQ]
14 changes: 14 additions & 0 deletions docs/modules/ROOT/pages/faq.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Can I restrict a function to EOAs only?

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. 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.

Some criteria to discard an address as a contract address can be:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If an address has code size = 0, this does not mean that it is not a contract. Some counterexamples are:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check the updated version


- 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.
Although checking that the address has code, `address.code.length > 0`, may seem to differentiate contracts from EOAs, it can only say that an address is currently a contract, and its negation (that an address is not currently a contract) does not imply that the address is an EOA.

14 changes: 0 additions & 14 deletions docs/modules/ROOT/pages/knowledge.adoc

This file was deleted.