status-im / status-desktop

Status Desktop client made in Nim & QML
https://status.app
Mozilla Public License 2.0
287 stars 78 forks source link

Can't add ens name as watched address #13902

Closed dlipicar closed 2 weeks ago

dlipicar commented 6 months ago

Description

Tried adding an ENS name as a watched address, but the activity check seems to get stuck.

https://github.com/status-im/status-desktop/assets/11161531/3bd41abe-7bcc-48c2-be0a-92e7853c68bf

Console shows this error

DBG 2024-03-08 08:33:19.005-03:00 [threadpool task thread] initiating task   topics="task-threadpool" tid=30076119 file=threadpool.nim:54 messageType=FetchDetailsForAddressesTaskArg:ObjectType threadid=30076119 task="{\"$type\":\"FetchDetailsForAddressesTaskArg:ObjectType\",\"uniqueId\":\"1709897599\",\"chainId\":1,\"addresses\":[\"vitalik.eth\"],\"vptr\":105553126394176,\"slot\":\"onAddressDetailsFetched\",\"tptr\":4309805260}"
DBG 2024-03-08 08:33:19.006-03:00 NewBE_callPrivateRPC                       topics="rpc" tid=30076119 file=core.nim:27 rpc_method=wallet_addressExists
ERR 2024-03-08 08:33:19.006-03:00 rpc response error                         topics="rpc" tid=30076119 file=core.nim:36 err="\nstatus-go error [methodName:wallet_addressExists, code:-32602, message:invalid argument 0: json: cannot unmarshal hex string without 0x prefix into Go value of type types.Address ]\n"
ERR 2024-03-08 08:33:19.006-03:00 error doing rpc request                    topics="rpc" tid=30076119 file=core.nim:40 methodName=wallet_addressExists exception="\nstatus-go error [methodName:wallet_addressExists, code:-32602, message:invalid argument 0: json: cannot unmarshal hex string without 0x prefix into Go value of type types.Address ]\n"
ERR 2024-03-08 08:33:19.006-03:00 fetching address details error             topics="wallet-section-module" tid=30076097 file=module.nim:542 err="Error fetching details for an address: \nstatus-go error [methodName:wallet_addressExists, code:-32602, message:invalid argument 0: json: cannot unmarshal hex string without 0x prefix into Go value of type types.Address ]\n"
IvanBelyakoff commented 5 months ago

@benjthayer @John-44 do we need to store account by ENS name or by resolved address?

  1. What do we do if we store both and we find out later than the address does not match the ENS name any more or ENS name was released? Do we keep that account and display some popup? if resolved address now is different from what was resolved at the moment of saving - do we keep the old history and add new history of the freshly resolved address from this point of time further but we don't load the old history for the freshly resolved address?
  2. What do we do with collectibles in such a case - do we replace them for the new address and wipe old ones?
  3. What do we do with balance history? Maybe anything else I missed here. Sorry if it has been discussed at some point, feel free to point me to some info if there is.
John-44 commented 5 months ago

@benjthayer @John-44 do we need to store account by ENS name or by resolved address?

  1. What do we do if we store both and we find out later than the address does not match the ENS name any more or ENS name was released? Do we keep that account and display some popup? if resolved address now is different from what was resolved at the moment of saving - do we keep the old history and add new history of the freshly resolved address from this point of time further but we don't load the old history for the freshly resolved address?
  2. What do we do with collectibles in such a case - do we replace them for the new address and wipe old ones?
  3. What do we do with balance history? Maybe anything else I missed here. Sorry if it has been discussed at some point, feel free to point me to some info if there is.

We should only ever store account by ENS name, if the resolved address changes then we need to re-fetch all history.

So we should probably check that the ENS name still resolves to the address whose history we store periodically. If the ENS name still resolves to the address whose history we've stored, then all good we continue fetching new history. If the ENS name resolves to a new address, then we wipe all the stored history and re- fetch.

alaibe commented 5 months ago

@benjthayer @John-44 @IvanBelyakoff IMO we shouldn't change the address in the background. The address are the "primary key" ens are mostly UX feature

e.g if your ENS name expires in 1 year and picked up by someone else, we silently refetch all the history of another address

IMO when the ens is not associated with an address we simply display the raw address. WDYT?