Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with legacy ledger account list #14508

Closed
wants to merge 5 commits into from
Closed

Fix issue with legacy ledger account list #14508

wants to merge 5 commits into from

Conversation

jpuri
Copy link
Contributor

@jpuri jpuri commented Apr 22, 2022

Fixes: #6012

For ledger legacy the account list can get out of sync:
Screenshot 2022-04-23 at 12 32 04 AM

User can thus end up sending funds to wrong account.

I found that the reason was that we save the selected ledger type in app state:
Screenshot 2022-04-23 at 12 36 37 AM
Thus though the account list was for Ledger Live the dropdown was showing Ledger (Mew / MyCrypto). PR fixes the issue by resetting state when connect hardware component un-mounts.

@github-actions
Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@jpuri
Copy link
Contributor Author

jpuri commented Apr 22, 2022

Hey @seaona : can you plz test this fix.

@metamaskbot
Copy link
Collaborator

Builds ready [4b70010]
Page Load Metrics (1252 ± 36 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint77182932311
domContentLoaded1162149312377938
load1162149312527536
domInteractive1162149312377938

@jpuri
Copy link
Contributor Author

jpuri commented Apr 23, 2022

I am not sure why we are saving defaultHdPaths in app state. I could not find it being used anywhere except this component. A better approach may be to refactor use of defaultHdPaths and move it to this component state rather.

@seaona
Copy link
Contributor

seaona commented Apr 25, 2022

@jpuri the fix is working for me.
This PR also fixes this issue #14424

@metamaskbot
Copy link
Collaborator

Builds ready [4a17dc8]
Page Load Metrics (1335 ± 53 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint881272173257124
domContentLoaded12041725132411354
load12131725133511053
domInteractive12041725132411354

@seaona
Copy link
Contributor

seaona commented Apr 27, 2022

New Observations: at the moment,when you import some Hardware Wallet accounts, and later on import some more, the first ones disappear from the Metamask wallet. This happens with both Trezor and Ledger.

Steps:

  1. Import a couple of Trezor/Ledger accounts and accept
  2. Import again 2 other Trezor/Ledger accounts and accept.

Result: the first imported accounts have disappeared from Metamask wallet.

trezor-accounts-disappear.mp4

Maybe that was the reason for keeping the "state" @jpuri ?

@danjm
Copy link
Contributor

danjm commented Apr 27, 2022

Adding to @seaona's most recent comment, I think the default path in state aimed to ensure that if changing the path, the new selection would be the selection upon later returning to the flow

Using ledger I am able to generate at least 4 different account lists. I want to understand exactly what inputs are producing those

@jpuri
Copy link
Contributor Author

jpuri commented Apr 28, 2022

@danjm: I see in that case when we return to connect hardware flow we should try to get accounts for saved default path.

Yep not sure what can cause the 4 different lists of accounts, I tried it again and I could not get 4 different set of account. I got only 3 for ledger corresponding to :

  1. Ledger Live
  2. Legacy (MEW / MyCrypto)
  3. BIP44 Standard (e.g. MetaMask, Trezor)

@jpuri
Copy link
Contributor Author

jpuri commented Apr 28, 2022

@seaona : the issue mentioned here does not look related to code changes in this PR - as in the PR I only reset the dropdown selection.

In fact I do expect metamask to forget account if hardware wallet is not more connected.

@metamaskbot
Copy link
Collaborator

Builds ready [8386dd4]
Page Load Metrics (1386 ± 48 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint781631022110
domContentLoaded1206157013498842
load12181570138610048
domInteractive1206157013498842

@seaona
Copy link
Contributor

seaona commented Apr 29, 2022

@jpuri from what I've seen, on develop branch the behaviour is different: the accounts are not removed, when I add new ones. See below:

trezor-accounts-not-disappearing.mp4

All this process is without disconnecting the device. Just importing 2 accounts and then importing 2 more:

  • on fix branch: seems device is "forgotten" in between, as I have to give permissions again for importing the 2 new accounts.
  • on develop branch: I don't have to give permissions a second time (after importing the first 2 accounts)

@kumavis
Copy link
Member

kumavis commented May 26, 2022

resolved here MetaMask/eth-ledger-bridge-keyring#146

@jpuri
Copy link
Contributor Author

jpuri commented May 27, 2022

Issue has been fixed with PR here: MetaMask/eth-ledger-bridge-keyring#146

I will create a separate PR in extension repo to update eth-ledger-bridge-keyring.

@jpuri jpuri closed this May 27, 2022
@jpuri jpuri deleted the issue_6012 branch May 27, 2022 06:17
@github-actions github-actions bot locked and limited conversation to collaborators May 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ledger Nano: Metamask Address does not correspond to Ledger
5 participants