unstoppabledomains / resolution

A library to resolve blockchain domain names.
MIT License
222 stars 66 forks source link

Incorrect padding when comparing namehash to tokenId #226

Closed gmuresan closed 1 year ago

gmuresan commented 2 years ago

I am trying to call Resolution.reverse but it is failing some validation. I purchased a domain "gmuresan.blockchain", so when performing a reverse resolution, "0xC91DDAea75Ce715Eb9cb6DC9B5F087c471834b60" should resolve to "gmuresan.blockchain".

I followed the code and the correct metadata.name is being fetched, but then at the very end it is trying to compare this.namehash(metadata.name) to tokenId. They almost match completely except there is a missing 0 right after the "0x" of the hash.

this.namehash(metadata.name) ===
'0x0e8fdea5c14443bc696f6354ee866275bff50dd99e09a3b80c8a6b4e9d6c2e4e'
tokenId ===
'0xe8fdea5c14443bc696f6354ee866275bff50dd99e09a3b80c8a6b4e9d6c2e4e'

It seems to be doing the decimal to hex conversion incorrectly at some point. The result of Resolution.reverse is an exception with the message "Service provider returned an invalid domain name".

Screen Shot 2022-08-17 at 9 38 46 PM
sammyluo commented 2 years ago

@gmuresan Thanks for raising this issue! Our team is currently looking into it. Thank you!

sammyluo commented 2 years ago

@gmuresan This issue has been fixed in our latest package (v8.3.3). Thank you!