ensdomains / ens-app

Legacy ENS manager app
https://legacy.ens.domains/
BSD 2-Clause "Simplified" License
223 stars 267 forks source link

EIP-2304: inconsistency between coin type index and path component. #1588

Closed q9f closed 1 year ago

q9f commented 1 year ago

Describe the bug The ENS apps does not consistently use the coin type index. The AddrResolver contract uses the following coin type index for Ethereum as default:

uint constant private COIN_TYPE_ETH = 60;

This is the coin type index as defined in SLIP-44.

However, if I use the ENS app to set a custom coin record, it uses the path component, not the coin type index.

To Reproduce Steps to reproduce the behavior:

  1. Go to app.ens.domains
  2. Set a record for a domain you control
  3. Set one record for ETH and one for ETC.
  4. Submit on chain
  5. See below.

If I set both ETH and ETC address records for my resolver using the ENS app, it stores the ETH record using the coin type index 60 but the ETC record using the path component 0x8000003d.

Here's the transaction event log (last entry): https://etherscan.io/tx/0x32c1eedf6d99a5458cc3f81ccbfc0f463226f131d34ada06b2364880d1f96309#eventlog

Expected behavior EIP-2304 specifies to use the index not the path:

coinType is the cryptocurrency coin type index from SLIP44.

The app should default to 61 for ETC, and so on, using only the coin type index.

Screenshots

## using a public resolver on mainnet
resolver.address
# => "0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41"

## calling the resolver for the default record (ETH)
infura.call(resolver, "addr", ens.namehash("ncwc6edqldzy6mlo.eth"))
# => "0xde270e46d63b1816d1b798cff473c4ba238aca73"

## calling the resolver for the coin type for ETH and ETC
infura.call(resolver, "addr", ens.namehash("ncwc6edqldzy6mlo.eth"), 60).unpack('H*').first
# => "de270e46d63b1816d1b798cff473c4ba238aca73"
infura.call(resolver, "addr", ens.namehash("ncwc6edqldzy6mlo.eth"), 61).unpack('H*').first
# => ""

## calling the resolver for the path component for ETH and ETC
infura.call(resolver, "addr", ens.namehash("ncwc6edqldzy6mlo.eth"), 0x8000003c).unpack('H*').first
# => ""
infura.call(resolver, "addr", ens.namehash("ncwc6edqldzy6mlo.eth"), 0x8000003d).unpack('H*').first
# => "37287f68ac899b769faa57033c78b78c76c68dc0"

I can't really tell which component introduces this. I checked the address encoder which uses the index correctly.

hexChecksumChain('ETC_LEGACY', 61),
q9f commented 1 year ago

I manually removed the coin type 2147483709 to set it back to an empty record 0x and forced to set an 61 coin type record and now I see the following in the app.

Screenshot at 2023-02-16 11-59-21

But where is this documented?

makoto commented 1 year ago

Hi. any EVM chains except ETH is using ENSIP11 https://docs.ens.domains/ens-improvement-proposals/ensip-11-evmchain-address-resolution . We still leave ETH to use ENSIP9 because it's set as a default Probably we should modify ENSIP11 to exclude ETH(60) as an exception

q9f commented 1 year ago

Thank you. ENSIP11 answers my question. 👍🏼