Document Edge Case for supportsERC165InterfaceUnchecked(..)
#4011
Labels
documentation
Inline comments, guides, and examples.
good first issue
Low hanging fruit for new contributors to get involved!
What this issue is about ?
The
supportsERC165(..)
function when calling to check if an address supports a specific interfaceId, according to the ERC165 specs, it will check whether the address queried is supporting the ERC165 interfaceId, the queried interfaceId, also will check that the address queried is not supporting the0xffffffff
interfaceId.The
supportsERC165InterfaceUnchecked(..)
function will check whether a specific address supports a single interfaceId, through ERC165. However, some addresses will return always true regardless if they support the interfaceId or not.These are the precompile addresses
0x000..0000002
,0x000..0000003
, and0x000..0000004
. It's unclear to me why this behavior is happening. This issue was pointed out by Runtime verification auditors while doing some fuzzing tests.📝 Details
This happens only to
supportsERC165InterfaceUnchecked(..)
, because since the precompile addresses0x000..0000002
,0x000..0000003
, and0x000..0000004
will return always true for all interfaceIds, it means that these addresses are also supporting the0xffffffff
interfaceId.Since
supportsERC165(..)
checks that the address does not support0xffffffff
interfaceId, thensupportsERC165(..)
is excluded from this behavior.This issue is opened to add documentation to
supportsERC165InterfaceUnchecked(..)
function using natspec, to acknowledge this edge case, and also to make it easy for developers doing fuzzing tests using foundry, to identify why the tests are failing when lacking context that these addresses will always return true.🔢 Code to reproduce bug
You can call
supportsERC165InterfaceUnchecked(..)
on0x000..0000002
,0x000..0000003
and0x000..0000004
addresses with any interfaceId to reproduce the case.Please let me know if it makes sense to add this to the function natspec.
The text was updated successfully, but these errors were encountered: