feat(resolver): resolve names on contracts that serve the ENS resolver profile without a registry - #5601
Draft
petfold wants to merge 1 commit into
Draft
Conversation
…r profile without a registry Some ENS-compatible name services (for example the Gwei Name Service, .gwei) have no registry: the name contract itself implements the ENS resolver profile (contenthash, addr, text on EIP-137 name hashes) and advertises it through EIP-165. The ENS client required the configured contract to be a registry (owner, then resolver, then contenthash) and failed on dial. When the registry probe fails, probe supportsInterface for the contenthash profile (0xbc1c58d1); if the contract answers true, keep the connection with no registry and resolve names by reading contenthash from the contract directly (goens.NewResolverAt). An empty record is reported as not found. Existing registry behaviour is unchanged. Closes ethersphere#5600
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist
resolver-optionsflag help is updated here; the docs site's page on ENS would want one sentence, which I can submit to the docs repo once this lands.)Description
Lets
resolver-optionspoint at a contract that serves the ENS resolver profile itself (contenthash,addr,texton EIP-137 name hashes) without an ENS registry in front, as the Gwei Name Service (.gwei) does. Today the ENS client requires a registry:wrapDialcallsowner("")to check the contract andwrapResolvecallsowner/resolverbeforecontenthash, so such contracts fail on dial.Change, confined to
pkg/resolver/client/ens:wrapDial: if the registry probe fails, call EIP-165supportsInterface(0xbc1c58d1)(the contenthash profile, ENSIP-7) on the same address. If it answers true, keep the connection and return a nil registry; otherwise fail as before.Client: a nil registry with a live client marks the contract as a direct resolver;Resolvethen useswrapResolveDirect, which readscontenthashthroughgoens.NewResolverAt(ethCl, name, contractAddr). An empty record maps toresolver.ErrNotFound("name is not registered"), other errors keep today's classification.TestResolveDirect(direct path chosen when dial returns no registry, registry path not used, contract address and name passed through, not-found and not-implemented cases) andTestSupportsContenthash(EIP-165 call encoding and decoding against a fake caller).--resolver-optionshelp text mentions the second kind of contract.Live check against mainnet with this branch,
WithContractAddress("0x9D51D507BC7264d4fE8Ad1cf7Fe191933A0a81d6")on a public RPC:Configuration that then works end to end:
GET /bzz/swarmtyp.gwei/serves the Swarm feed manifest the name points at.go build ./...,go vetandgo test -race ./pkg/resolver/...pass locally; I could not runmake linthere (no golangci-lint), happy to fix anything it reports.Motivation and Context (Optional)
GNS names (
.gwei) are resolved by Freedom Browser natively and served by the<name>.gwei.domainsgateway, so Swarm sites under.gweinames exist today; Bee and Swarm Desktop users are the ones who cannot open them by name. GNS'sNameNFTimplementscontenthash(bytes32 node),addr,textandsupportsInterfacefor the standard profile ids, with token id =uint256(namehash)(contracts: https://github.com/lucadonnoh/gwei-names). The same mechanism covers any other registry-less service that adopts the resolver profile.Per CONTRIBUTING this is opened as a draft pending consensus on the issue; the diff is small and self-contained, so I hope it helps the discussion.
Related Issue (Optional)
Closes #5600
AI Disclosure