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: restore Ledger keyring after restoring the vault #8740

Merged
merged 12 commits into from
Mar 14, 2024

Conversation

dawnseeker8
Copy link
Contributor

@dawnseeker8 dawnseeker8 commented Feb 27, 2024

Description

This PR will fix #5721 issue and #8713, the fix contain following change.

  1. in Vault.js, get the old ledger keyring first before KeyringController.createNewVaultAndRestore.
  2. Modify existing restoreLedgerKeyring method in Vault.js to regenerate the ledger keyring with existing account.
  3. Unit tests fix for above changes.

Related issues

Fixes: #5721
#8713

Manual testing steps

For #5721

  1. Pair a ledger account with metamask,
  2. Go to Settings
  3. Tap on Security & Privacy
  4. Scroll down to Password and tap on Change Password
  5. Enter your current password and tap on Confirm
  6. Enter a new password and tap on Reset password
  7. After new password update successfully, move to home page and you can see ledger account is still there.

For #8713

  1. install the fresh metamask mobile in android. (must be fresh MMM app)
  2. restore a account using SRP.
  3. when account appear. click the account, and bring up the account drop down list.
  4. select Add account and hardware wallet -> Add hardware wallet
  5. Select ledger and then allow all permission required.
  6. and then add a ledger account in MMM.
  7. Make sure ledger account is in the account list.
  8. Now you can close MMM and relaunch metamask. (or wait for screen lock and reactive phone which will force user relogin to metamask
  9. After user login again. you should still see the ledger account in the account list.

Screenshots/Recordings

Before

Screen_Recording_20240227_184709_MetaMask.mp4

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've clearly explained what problem this PR is solving and how it is solved.
  • I've linked related issues
  • I've included manual testing steps
  • I've included screenshots/recordings if applicable
  • I’ve included tests if applicable
  • I’ve documented my code using JSDoc format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.
  • I’ve properly set the pull request status:
    • In case it's not yet "ready for review", I've set it to "draft".
    • In case it's "ready for review", I've changed it from "draft" to "non-draft".

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

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.

@dawnseeker8 dawnseeker8 marked this pull request as draft February 27, 2024 07:10
@codecov-commenter
Copy link

codecov-commenter commented Feb 27, 2024

Codecov Report

Attention: Patch coverage is 60.00000% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 43.27%. Comparing base (1f213b0) to head (d94160a).

Files Patch % Lines
app/core/Vault.js 60.00% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8740   +/-   ##
=======================================
  Coverage   43.27%   43.27%           
=======================================
  Files        1271     1271           
  Lines       30916    30918    +2     
  Branches     3092     3092           
=======================================
+ Hits        13378    13379    +1     
- Misses      16765    16766    +1     
  Partials      773      773           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dawnseeker8 dawnseeker8 marked this pull request as ready for review February 27, 2024 08:58
@github-actions github-actions bot added the Run Smoke E2E Triggers smoke e2e on Bitrise label Feb 27, 2024
Copy link
Contributor

E2E test started on Bitrise: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/58b40dc4-ecd6-4af4-87b6-0b74f15f6544
You can also kick off another Bitrise E2E smoke test by removing and re-applying the (Run Smoke E2E) label

@dawnseeker8 dawnseeker8 added the needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) label Feb 27, 2024
@gantunesr gantunesr changed the title fix: Fix the issue ledger keyring account will disappear when passwor… fix: Ledger keyring disappearing after resetting password Feb 28, 2024
@dawnseeker8 dawnseeker8 added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Mar 4, 2024
Copy link
Contributor

github-actions bot commented Mar 4, 2024

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: 4c0ab2d
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/444d8dbb-7c6a-4140-abbd-c3f8b7569f52

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@dawnseeker8
Copy link
Contributor Author

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: 4c0ab2d Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/444d8dbb-7c6a-4140-abbd-c3f8b7569f52

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Britrise e2e tests pass even Check Bitrise E2E status github action failed, MM team will fix github action issue in main

@dawnseeker8 dawnseeker8 added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Mar 5, 2024
Copy link
Contributor

github-actions bot commented Mar 5, 2024

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: 7a2e7a6
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/1cfc64ba-9131-4ecb-9e40-2ac194857e01

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Copy link
Contributor

@tommasini tommasini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to follow the same pattern as the restoreQRKeyring, but I don't feel 100% comfortable with my knowledge on what's happening on the vault, It would be cool if this have the attention of the accounts team

@dawnseeker8
Copy link
Contributor Author

It seems to follow the same pattern as the restoreQRKeyring, but I don't feel 100% comfortable with my knowledge on what's happening on the vault, It would be cool if this have the attention of the accounts team

Just attached team-accounts to ticket so that they can provide the review.

gantunesr
gantunesr previously approved these changes Mar 13, 2024
Copy link
Member

@gantunesr gantunesr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a minor comment

app/core/Vault.js Outdated Show resolved Hide resolved
@gantunesr gantunesr changed the title fix: Ledger keyring disappearing after resetting password fix: restore Ledger keyring after restoring the vault Mar 13, 2024
Co-authored-by: Gustavo Antunes <17601467+gantunesr@users.noreply.github.com>
@gantunesr gantunesr removed the needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) label Mar 13, 2024
Copy link

sonarcloud bot commented Mar 13, 2024

@dawnseeker8
Copy link
Contributor Author

E2e tests pass even Check Bitrise E2E status failed
Here is the result, ready to be merged.
https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/1cfc64ba-9131-4ecb-9e40-2ac194857e01

@dawnseeker8 dawnseeker8 merged commit 6224e2f into main Mar 14, 2024
27 of 29 checks passed
@dawnseeker8 dawnseeker8 deleted the fix/5721-ledger-keyring-disappear-issue branch March 14, 2024 00:41
@github-actions github-actions bot locked and limited conversation to collaborators Mar 14, 2024
@metamaskbot metamaskbot added the release-7.19.0 Issue or pull request that will be included in release 7.19.0 label Mar 14, 2024
@vivek-consensys vivek-consensys added the QA Passed A successful QA run through has been done label Mar 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
QA Passed A successful QA run through has been done release-7.19.0 Issue or pull request that will be included in release 7.19.0 Run Smoke E2E Triggers smoke e2e on Bitrise team-hardware-wallets
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

[Bug] Ledger Keyring is missing after resetting password
6 participants