Closed
Description
Describe the bug
The provider.getResolver(name)
function does not work with all unicode characters. According to the definition of ENS names, unicode characters are valid. The function should resolve names including unicode characters, e.g. emoticons like 👋
Reproduction steps
const r1 = await provider.getResolver("foo.eth"); // this works
console.log(r1?.address); // output: 0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41
const r2 = await provider.getResolver("🚀🚀🚀.eth"); // this doesn't work, throws error
console.log(r2?.address);
Stack Trace
(node:39562) UnhandledPromiseRejectionWarning: Error: STRINGPREP_CONTAINS_UNASSIGNED
at /ens-test/node_modules/@ethersproject/strings/src.ts/idna.ts:193:19
at Array.forEach (<anonymous>)
at nameprep (/ens-test/node_modules/@ethersproject/strings/src.ts/idna.ts:191:11)
at namehash (/ens-test/node_modules/@ethersproject/hash/src.ts/namehash.ts:40:43)
at InfuraProvider.<anonymous> (/ens-test/node_modules/@ethersproject/providers/src.ts/base-provider.ts:1701:43)
at step (/ens-test/node_modules/@ethersproject/providers/lib/base-provider.js:48:23)
at Object.next (/ens-test/node_modules/@ethersproject/providers/lib/base-provider.js:29:53)
at fulfilled (/ens-test/node_modules/@ethersproject/providers/lib/base-provider.js:20:58)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
Affected function
ethers.js/packages/providers/src.ts/base-provider.ts
Lines 1783 to 1809 in 33a029e
The error seems to be generated here:
ethers.js/packages/strings/src.ts/idna.ts
Lines 190 to 195 in ce8f1e4
Environment:
- node v14.17.1
- ethers v5.5.4
Search Terms
ENS name resolution resolve unicode characters
Related issues
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
ricmoo commentedon Mar 3, 2022
This is a known issue, and is pending the updated stringprep-like normalization from ENS regarding UTF-8 joiners.
Closing as a duplicate of #2376, which is being kept updated. :)
Add new ENS normalization specification for wider UTF-8 support (#42, #…
Add restrictions for new UTF-8 specification ENS names (#42, #2376, #…
Relax ENS normalize for double-hyphen to only throw on punycode confl…
Applied lastest changes from ens-normalize (#42, #2376, #2754).
ricmoo commentedon Aug 19, 2022
This has been address in v5.7.0. See the related issue for details.
xwartz commentedon Sep 27, 2022
@ricmoo v5.7.0 still has problems parsing ens with ZWSP, such as
vitalik.eth
.Add new ENS normalization specification for wider UTF-8 support (#42, e…
Add restrictions for new UTF-8 specification ENS names (#42, ethers-i…
Relax ENS normalize for double-hyphen to only throw on punycode confl…
Applied lastest changes from ens-normalize (#42, ethers-io#2376, ethe…