-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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: cherry pick Duplicate accounts fix (#9943) #9963
Conversation
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> This PR addresses the issue of duplicate accounts showing up in the wallet. This bug was introduced when [the accounts controller was integrated](#8759) but was only visible to users in [this PR](#9733) when we started rendering account information in the accounts list. The is that when we ran migration `036.ts`, we simply added the all of the identities from the preferences controller into the AccountsController. However the accounts controller also consumes addresses from the KeyringController and those addresses are in lowercase. The result would be two accounts with the same address, one in checksum format and one in lowercase format. This would result in duplicates when rendering the UI. This PR addresses this issue in two ways... 1. for users who are using <= v7.19.0 - I have patched migration 36 to ensure that the addresses that are added are lowercase. 2. For users who have are using version >= 7.20.0 and are already effected by this bug - I have created a new migration to deduplicate the accounts in the accounts controller and ensure that we are only storing lowercase addresses in state. Fixes: #9823 - [Current branch](https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/c68d80ea-dbaa-4e81-9018-fe9757cab397) - [7.18.0](https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/011ac0b3-b1d8-4e53-9595-ea0f739d4d10) - [7.24.0](https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/a5c54c50-8382-45ad-b203-687b66273c4e) 1. Install [7.18.0](https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/011ac0b3-b1d8-4e53-9595-ea0f739d4d10) and import a wallet with multiple addresses already 2. Install [7.24.0](https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/a5c54c50-8382-45ad-b203-687b66273c4e) and upgrade app. 3. EXPECTED: You should see duplicate accounts when you open the accounts list. If you had 5 accounts previously there will be should now be 10. 4. Install [the current branch QA build](https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/c68d80ea-dbaa-4e81-9018-fe9757cab397) and upgrade. 5. EXPECT: The duplicate accounts should be removed (back to 5 accounts from 10) 6. EXPECT: The previously selected address should still be selected 7. EXPECT: The account names should be in tact and in chronological order if they are the default account name. this occurs for users who have not upgraded from 7.19.0 yet 1. Install [7.18.0](https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/011ac0b3-b1d8-4e53-9595-ea0f739d4d10) and import a wallet with multiple addresses already 2. Install [the current branch QA build](https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/c68d80ea-dbaa-4e81-9018-fe9757cab397) and upgrade. 3. EXPECT: All of the account should appear in the accounts list without duplicates 4. EXPECT: The previously selected address should be the same 5. EXPECT: The account names should be the same <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> 7.18.0 <img src="https://github.com/MetaMask/metamask-mobile/assets/22918444/3ee9b1f3-f042-414b-9ce4-82cad7d791cf" width="200" height="400"> After Upgrading to 7.24.0 <img src="https://github.com/MetaMask/metamask-mobile/assets/22918444/47b5ff3d-d2d0-4373-b8a0-ae0007b19b7b" width="200" height="400"> Upgrading to this branch <img src="https://github.com/MetaMask/metamask-mobile/assets/22918444/9ed8d80a-ef3c-40a6-9152-e661a1ecdd25" width="200" height="400"> - [x] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. - [x] 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.
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. |
Bitrise✅✅✅ Commit hash: 0b07555 Note
|
0b07555
to
82a76fd
Compare
Quality Gate passedIssues Measures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
No release label on PR. Adding release label release-7.24.3 on PR, as PR was cherry-picked in branch 7.24.3. |
This PR addresses the issue of duplicate accounts showing up in the wallet. This bug was introduced when the accounts controller was integrated but was only visible to users in this
PR when we started rendering account information in the accounts list. The is that when we ran migration
036.ts
, we simply added the all of the identities from the preferences controller into the AccountsController. However the accounts controller also consumes addresses from the KeyringController and those addresses are in lowercase. The result would be two accounts with the same address, one in checksum format and one in lowercase format. This would result in duplicates when rendering the UI.This PR addresses this issue in two ways...
Fixes: #9823
7.18.0 -
7.24.0
this occurs for users who have not upgraded from 7.19.0 yet
7.18.0
After Upgrading to 7.24.0
Upgrading to this branch
I’ve followed MetaMask Contributor Docs and MetaMask Mobile Coding
Standards.
I've completed the PR template to the best of my ability
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 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.
Description
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist