Repository navigation
[SDK] Fix: resolveL2Name cache key ignores the resolver chain - #9088
Open
creativityventures wants to merge 3 commits into
Open
creativityventures wants to merge 3 commits into
creativityventures wants to merge 3 commits into
Conversation
resolveL2Name built its cache key as `ens:name:${resolverChain}:${address}`.
`resolverChain` is an object, so the key became
`ens:name:[object Object]:0x...` for every chain and resolver. Resolving
the same address on Base and then on Base Sepolia (or any other L2
resolver) within the 1 minute cache window returned the first chain's
name.
The key now uses the chain id and the resolver address.
Tested: new resolve-l2-name-cache.test.ts (resolver read mocked) fails
on main ("expected 'mainnet.base.eth' to be 'testnet.basetest.eth'")
and passes with the fix.
Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: creativityventures.eth <creativityventures.official@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com> Signed-off-by: creativityventures.eth <creativityventures.official@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com> Signed-off-by: creativityventures.eth <creativityventures.official@gmail.com>
🦋 Changeset detectedLatest commit: f11e2bb The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
@creativityventures is attempting to deploy a commit to the thirdweb Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
This branch has not been deployed
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.
resolveL2Name(packages/thirdweb/src/extensions/ens/resolve-l2-name.ts) built its cache key asens:name:${resolverChain}:${address}.resolverChainis aChainobject, so the key wasens:name:[object Object]:0x…for every chain and resolver. Resolving the same address on Base and then on Base Sepolia (or any other L2 resolver) within the 1 minute cache window returned the first chain's name, e.g. a mainnet Basename on Base Sepolia.The key now uses the chain id and the resolver address. A changeset (
thirdweb: patch) is included.Notes for the reviewer
resolveNameandresolveAddressalready useresolverChain?.idin their keys; this alignsresolveL2Namewith them.How to test
New
resolve-l2-name-cache.test.ts(the resolvernameread is mocked): it resolves the same address on Base and Base Sepolia and expects two different names. It fails on main ("expected 'mainnet.base.eth' to be 'testnet.basetest.eth'") and passes with the fix.biome checkpasses on the changed files, andtsc -p tsconfig.build.jsonreports no error inextensions/ens(I only had thethirdwebpackage installed, so errors from other workspace packages were expected). Not run: the full test suite.This change was written with help from an AI assistant (Claude Code) and reviewed before submitting.
🤖 Generated with Claude Code
https://claude.ai/code/session_014cRzwuyJe8BGwXowsQ3kpw
Summary by CodeRabbit