erc6551 / reference

ERC-6551 reference implementation
153 stars 50 forks source link

Add ERC165 support to ERC6551Registry for address validation #20

Closed sullof closed 1 year ago

sullof commented 1 year ago

When integrating the ERC6551Registry contract into other smart contracts, there is currently no way to securely validate that a passed address parameter is in fact the official ERC6551Registry address.

This is because ERC6551Registry does not implement ERC165, the standard interface detection pattern. As a result, even though ERC6551Registry extends IERC6551Registry, a consuming contract cannot actually detect and prove the interface is properly implemented.

I can make the change and raise a PR for it, if you like.

jaydenwindle commented 1 year ago

@sullof responded in the ETH Magicians thread, but reposting here as well.

Since the Registry is a singleton contract whose address will be well-known and included in the proposal, contracts can trivially validate whether a given address matches the canonical Registry address. This address check also guarantees that the IERC6551Registry interface is properly implemented. As such, unlike other ERCs where multiple instances of a contract implementing a certain interface are expected, I don’t think ERC-165 interface detection on the Registry provides much benefit here.

That said, I’m not opposed to adding interface detection if there is a enough demand or a compelling argument for it.

jaydenwindle commented 1 year ago

Closing this based on conversations in the ETH Magicians thread