extension icon indicating copy to clipboard operation
extension copied to clipboard

:eye: Trust but verify

Open mhluongo opened this issue 2 years ago • 14 comments

Add a warning in the wallet asset list when interacting with assets whose metadata has been inferred from transaction history.

Screenshot from 2022-08-06 21-30-32 Screenshot from 2022-08-06 22-20-45

To test

  • [ ] Load a read-only account with tokens that aren't on our lists
  • [ ] As historical activities are loaded, additional token balances should be discovered
  • [ ] Tokens that aren't on our lists should show a warning

Refs #1021, #1893

Latest build: extension-builds-1840 (as of Thu, 12 Jan 2023 13:33:46 GMT).

mhluongo avatar Jul 25 '22 16:07 mhluongo

@Shadowfiend would love your thoughts on how to make this consistent with your plans in https://github.com/tallycash/extension/pull/1788

I'd like to add an "internal" token list for each user in a future PR, and use that to track custom assets going forward. But in the meantime, this PR should be enough to show discovered assets and warn people of scams... except they won't currently show up at all with after this change

https://github.com/tallycash/extension/pull/1788/files#diff-b0e4a7036b74ef74bb2061264a7470aa9dc941d5bb0b326556464bb28480fc80L328

mhluongo avatar Jul 29 '22 20:07 mhluongo

We already have the internal list--that is what the custom asset stuff is I believe. This todo explains a reasonable path to adding the relevant metadata there:

https://github.com/tallycash/extension/blob/6a69598bdab150ee1c0cebc3b81e05d6369a0fa6/background/services/indexing/index.ts#L294-L299

Shadowfiend avatar Jul 30 '22 17:07 Shadowfiend

~~I think we have started using custom assets for assets with 0 balance at some point.~~

Don't comment based on vague memories and from mobile :) we use custom assets during the discovery in indexing service #453 as it should be used.

greg-nagy avatar Jul 30 '22 17:07 greg-nagy

Taking a different tack: this PR shows a warning for any asset in the asset list that isn't on a token list.

It appears that these assets are no longer auto-discovered from the asset transfer call as of #1788... given that we have a warning now, should I revert part of that PR here?

mhluongo avatar Aug 01 '22 19:08 mhluongo

Yes, I think this is the way.

Nit: I wouldn't revert that change but reintroduce a modified version according to this comment

Nit2: The definition of baselineTrustedAsset will also need to be updated.

greg-nagy avatar Aug 03 '22 05:08 greg-nagy

I think two paths we can take here and it's ultimately a product decision. We can nuke the baseline trust concept, always display the warning for non-token list assets without a way to mark them trusted, then separately add a warning dismissal path that adds the token to the custom token list. Or we can land this, invisible because those assets are never added, and then fill out the trust concept as per the TODO and attach the warnings to that.

Either way works for me.

Shadowfiend avatar Aug 03 '22 16:08 Shadowfiend

I think the former is the shorter path, but will confirm.

Getting to more token balances in the wallet sooner is going to be a big win for users.

mhluongo avatar Aug 07 '22 00:08 mhluongo

@mr-michael calling your attention here: merging this PR means we'll pick up all / nearly all token balances at the risk of including scam tokens, though they'll have clear and obvious warnings.

My thought is we merge this, then do the next bit (allowing tokens to be flagged as trusted or ignored) in a future PR / release based on other priorities. I think that's the right call because it immediately improves the UX for new wallets. It can degrade UX a bit for older wallets like mine with a bunch of spam tokens, but most users seem to be onboarding with new accounts.

mhluongo avatar Aug 07 '22 02:08 mhluongo

@Shadowfiend @greg-nagy I opened https://github.com/tallycash/extension/issues/1893 to continue the asset trust discussion and unify the two approaches.

mhluongo avatar Aug 07 '22 02:08 mhluongo

Let's add a feature flag here too

jagodarybacka avatar Dec 14 '22 16:12 jagodarybacka

Found the issue (took forever!), fixed the issue, added regression tests. Should be ready for another look @jagodarybacka ✅

0xDaedalus avatar Jan 04 '23 21:01 0xDaedalus

Should be good for another look - note that AVAX on polygon is displayed as untrusted because it is indeed not on the official polygon tokenlist that we use. Otherwise, network base assets erroneously showing as untrusted should be fixed.

0xDaedalus avatar Jan 05 '23 18:01 0xDaedalus

Hmm 😞 image

jagodarybacka avatar Jan 06 '23 13:01 jagodarybacka

For reference - reproduction steps:

https://user-images.githubusercontent.com/20949277/212067677-8278e920-e1bf-4464-94e8-1ca59df03d10.mov

After account is fully loaded it seems to be fixed: image

Problem here is because MATIC token doesn't contain coinType property and because of it it is not considered base asset.

jagodarybacka avatar Jan 12 '23 12:01 jagodarybacka