wealdtech / go-ens

Apache License 2.0
90 stars 33 forks source link

0xD33aEc714381eC13053cdd783CE88423b7DC437E will be resolved to "0x0000000000000000" #27

Closed YoungApple closed 1 year ago

YoungApple commented 1 year ago

Expect: a "null" which means no eth name is reverse-resolved to this address.

Actually: "0x00000000000000".

mcdee commented 1 year ago

Please could you provide a code fragment that shows this issue? Thank you.

YoungApple commented 1 year ago

Sure, thanks for the quick response. Please see the attached go test case as below:

package ens

import (
    "github.com/ethereum/go-ethereum/common"
    "github.com/ethereum/go-ethereum/ethclient"
    "github.com/pkg/errors"
    "github.com/wealdtech/go-ens/v3"
    "testing"
)

func TestReverseResolve(t *testing.T) {
    client, err := ethclient.Dial("https://mainnet.infura.io/v3/c53eb4f9a0f941f7975e87de45b0e85b")
    if err != nil {
        panic(err)
    }

    address := "0xD33aEc714381eC13053cdd783CE88423b7DC437E"
    domain, err := ens.ReverseResolve(client, common.HexToAddress(address))
    if err != nil {
        t.Log(errors.Wrapf(err, "address : %s", address))
    }   
    t.Log("Address:", address, " Domain:", domain)
}

It runs with following output:

` === RUN TestReverseResolve ens_github_test.go:26: Address: 0xD33aEc714381eC13053cdd783CE88423b7DC437E Domain: 0x0000000000000000000000000000000000000000

--- PASS: TestReverseResolve (3.19s) PASS

`

mcdee commented 1 year ago

The library is returning the correct result. The reverse resolver can be found at https://etherscan.io/address/0xa2c122be93b0074270ebee7f6b7292c7deb45047#readContract and if you call the name function with parameter 0xde5de89a1773ac10f674616d159e827c47aac12d1f81ec4829023be073e73b50 (which is the namehash for d33aec714381ec13053cdd783ce88423b7dc437e.addr.reverse) then it returns the string 0x0000000000000000000000000000000000000000