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: Cherry pick remove selectIdentities in favour of selectInternalAccounts #9724 #10244

Merged
merged 1 commit into from
Jul 5, 2024

Conversation

owencraston
Copy link
Contributor

@owencraston owencraston commented Jul 3, 2024

…#9724)

1. What is the reason for the change?
In an effort to make MetaMask multi chain we are migrating from an
address based accounts to account id based account. In
#8759 previous PR we
integrated the accounts controller which stores metadata like the
account name, address and supported methods. This pr migrates all the
use of `selectIdentities` to use the accounts controller as the source
of truth for all accounts information (address, name etc).
2. What is the improvement/solution?
- find all use of `selectIdentities` and replace it with
`selectInternalAccounts` and/or
`selectSelectedInternalAccountChecksummedAddress`
- These selectors are already in use in `main` and are defined
[here](https://github.com/MetaMask/metamask-mobile/blob/main/app/selectors/accountsController.ts#L11-L32).
- tests for these utils can be found
[here](https://github.com/MetaMask/metamask-mobile/blob/main/app/selectors/accountsController.test.ts#L86).
- Note that ENS resolution in the send flow is not working but has been
broken in production for a while. ENS resolution in the accounts list
and dapp transactions are working as expected.

Fixes: MetaMask/accounts-planning#410

- [QA
builds](https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/a4fca9c3-11d5-4654-80ce-4cdedd638fe6?tab=artifacts)
- [ ] Verify that there is no use of `selectIdentities` in the app
- [ ] Verify that no functions are expecting `identities` as params

1. Launch wallet
2. create a new account
4. once on the wallet view, add a new account
5. create a custom name for your account(s)
6. swipe away the app and re open
7. login
8. the selected account should be same one that was previously selected
9. all addresses should be in [checksum
format](https://coincodex.com/article/2078/ethereum-address-checksum-explained/)
10. connect the portfolio dapp via the portfolio button on the home
screen.
11. Click connect on the portfolio dapp
12. The first address in the address picker should be match the selected
address on the wallet view and be in checksum format

1. Use an existing wallet that has multiple accounts created/imported
2. Change the names of your accounts so that they have custom names
3. "upgrade" your wallet to this branch
4. the selected account should be the same as it was on the previous
branch
5. all of the account data should remain the same (names and balances)

1. Start a send transaction
2. Verify that the account names and addresses are consistent in the
relevant screens of the flow

1. Connect a hardware wallet device
2. Go to the MetaMask test dapp and try to connect an account
3. Verify that the account names and addresses are consistent

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

https://github.com/MetaMask/metamask-mobile/assets/22918444/c5df59e1-05e6-43de-9efd-9a479aa342f7

dapps

https://github.com/MetaMask/metamask-mobile/assets/22918444/2931b041-7e69-43ff-acb1-c4405e5b526b

- Ledger account connected
- Imported account with ens (orangefox.eth)
- custom account name
- derived account
- Tested....
    - send flow has the correct names ✅
- wallet list has the correct names, even after a force reload (and
correct selected account) ✅
- dapp connection request has the correct names for all accounts
including hardware and ENS account ✅
    - dapp transactions have correct names for all account types

https://github.com/MetaMask/metamask-mobile/assets/22918444/254aeb44-6301-463e-86b6-01a12d56d967

- [ ] I’ve followed [MetaMask Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] 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](https://jsdoc.app/) format
if applicable
- [ ] 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.

- [ ] 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.
@owencraston owencraston requested review from a team as code owners July 3, 2024 23:56
Copy link
Contributor

github-actions bot commented Jul 3, 2024

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.

@owencraston owencraston changed the base branch from main to release/7.26.0 July 3, 2024 23:56
@owencraston owencraston added team-accounts Run Smoke E2E Triggers smoke e2e on Bitrise labels Jul 4, 2024
@metamaskbot metamaskbot added the INVALID-PR-TEMPLATE PR's body doesn't match template label Jul 4, 2024
Copy link
Contributor

github-actions bot commented Jul 4, 2024

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: 37d387f
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/0cdde0b3-4040-4e61-a32c-eb53bb0a7676

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

@jpuri jpuri left a comment

Choose a reason for hiding this comment

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

Changes in confirmation related files look good 👍

Copy link
Contributor

@NicolasMassart NicolasMassart left a comment

Choose a reason for hiding this comment

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

Looks good to me: this cherry pick matches the original PR.

Important

make sure the related issues are closed before merging otherwise we can't tell if the testing was completely finished!

@NicolasMassart NicolasMassart marked this pull request as draft July 4, 2024 12:18
@owencraston owencraston marked this pull request as ready for review July 4, 2024 16:47
@NicolasMassart NicolasMassart marked this pull request as draft July 5, 2024 16:20
@NicolasMassart
Copy link
Contributor

I changed this PR back to draft to make sure it's not merged in this release as we decided to include it in the next one.

@NicolasMassart NicolasMassart added the DO-NOT-MERGE Pull requests that should not be merged label Jul 5, 2024
@sethkfman sethkfman changed the base branch from release/7.26.0 to release/7.26.1 July 5, 2024 21:18
@sethkfman sethkfman marked this pull request as ready for review July 5, 2024 21:18
@sethkfman sethkfman merged commit a2c0508 into release/7.26.1 Jul 5, 2024
13 of 16 checks passed
@sethkfman sethkfman deleted the chore/cherry-pick-9724 branch July 5, 2024 21:18
@github-actions github-actions bot locked and limited conversation to collaborators Jul 5, 2024
@metamaskbot metamaskbot added the release-7.26.1 Issue or pull request that will be included in release 7.26.1 label Jul 5, 2024
@metamaskbot
Copy link
Collaborator

No release label on PR. Adding release label release-7.26.1 on PR, as PR was cherry-picked in branch 7.26.1.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
DO-NOT-MERGE Pull requests that should not be merged INVALID-PR-TEMPLATE PR's body doesn't match template release-7.26.1 Issue or pull request that will be included in release 7.26.1 Run Smoke E2E Triggers smoke e2e on Bitrise team-accounts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants