To quickly recap on the thought process: during design, IContractName seemed like the better candidate, since it’s incredibly simple, but during implementation, a problem surfaced: it’s harder for an indexer to implement, since it’s an alternative resolution path (unless you’re invoking the resolver for each query.)
When contract naming was added to ENSv2, IContractNamer was used for everything that wasn’t Ownable. IContractNamer works great with EAC (supports multiple namers via simple role check), it works great with delegation (just return another contract’s isContractNamer() response), and it doesn’t imply the same mutable connotations that Ownable does.
ENSv2 core contract naming overview:
Ownablecontracts name as expected- There is a single
ContractNamerfor the DAO - Any contract w/EAC implements
IContractNamer, has roleROLE_CAN_NAME, and grants it to the DAO (Example)PermissionedRegistry(andUserRegistryandWrapperRegistry)PermissionedResolverPermissionedAddressSetStandardRentPriceOracle
- Any contract w/o EAC delegates to the shared
ContractNamerviaDelegatedContractNamer
(Example)
Although IContractName isn’t used by the core contracts, it’s still a useful design. An improvement to the initial design would be a new event which should be emit anytime the underlying name changes to improve indexing efficiency.
We also want to be able to rename contracts, so we can version them if they get replaced. Although both techniques allow mutability, IContractNamer is less code if an existing authorization method already exists (the shared ContractNamer).
Lastly, there is a new library AccountNamerLib which codifies the authorization logic.
Other resources:
- Add ENSIP: Contract Self-Naming by nxt3d · Pull Request #60 · ensdomains/ensips · GitHub
- Contract Naming
- Add `ReverseNamer` by adraffy · Pull Request #482 · ensdomains/ens-contracts · GitHub
- Add `IContractName` to `L2ReverseRegistrar` by adraffy · Pull Request #225 · ensdomains/contracts-v2 · GitHub
- Add `IContractNamer` by adraffy · Pull Request #297 · ensdomains/contracts-v2 · GitHub
- Finish Contract Naming by adraffy · Pull Request #328 · ensdomains/contracts-v2 · GitHub