Migrate ENS resolution to the Universal Resolver#483
Open
tony8713 wants to merge 1 commit into
Open
Conversation
Reverse resolution went through the legacy ReverseRecords helper (getNames), which only reads on-chain reverse records. Names served by off-chain / CCIP-Read resolvers (e.g. avsa.eth) never resolved, and the batch call reverts on some inputs (e.g. expired domains), taking the whole batch down. Route reverse and forward resolution through the ENS Universal Resolver (0xeEeE…eEeE) via a viem client boxed inside the address-resolver module. viem follows the CCIP-Read OffchainLookup flow natively, and the Universal Resolver forward-verifies the reverse claim on-chain. Each address/name resolves independently so one bad entry can't fail the rest. Forward resolution no longer depends on the ENS subgraph, and the avatar resolver reads its text record through the same client. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Why
ENS reverse resolution went through the legacy ReverseRecords helper contract (
getNames), which only reads on-chain reverse records. Two real-world failures ENS reported:0x809FA673fe2ab515FaA168259cB14E2BeDeBF68e).0x9c3aC02Cd616a82C83830e40D45c9534b32c4934), which could take the whole batch down.What
Reverse and forward resolution now go through the ENS Universal Resolver (
0xeEeEEEeE14D718C2B47D9923Deab1335E144EeEe) using a viem client boxed inside the address-resolver module (src/addressResolvers/universalResolver.ts). viem follows the CCIP-ReadOffchainLookupflow natively (ethers v5 does not for raw calls), and the Universal Resolver forward-verifies the reverse claim on-chain. Each address/name is resolved independently viaPromise.allSettled, so one bad entry can't fail the rest, and reverting/expired names return null instead of throwing.The module's external API (
lookupAddresses,resolveNames) is unchanged. Forward resolution no longer depends on the ENS subgraph, and the avatar resolver reads theavatartext record through the same client (themetadata.ens.domainsfallback stays).Notes:
viemandtypescriptare pinned exactly: viem 2.55 pulls an ox version whose experimentaltempomodule fails to type-check, and ts-jest 28 targets TypeScript < 5.0. viem 2.37.6 already ships the new Universal Resolver support and TS 5.4.5 (needed for viem's types) keeps the toolchain working.Test plan
Live-verified against mainnet (
rpc.snapshot.org):0xE6D0Dd18C6C3a9Af8C2FaB57d6e6A38E29d513cC->sdntestens.eth(and forward back).0x809FA673fe2ab515FaA168259cB14E2BeDeBF68e->avsa.eth(previously unresolved).0x9c3aC02Cd616a82C83830e40D45c9534b32c4934->null, no throw.{}; mixed batches isolate the bad entry.yarn lint,yarn typecheck, andyarn buildall pass. Fullyarn testpasses except for pre-existing shibarium / unstoppable-domains integration failures that are unrelated to this change (verified identical on master).