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

feat: eth_accounts return all permitted accounts #6499

Merged
merged 21 commits into from
Jun 28, 2023

Conversation

jiexi
Copy link
Contributor

@jiexi jiexi commented May 30, 2023

Development & PR Process

  1. Follow MetaMask Mobile Coding Standards
  2. Add release-xx label to identify the PR slated for a upcoming release (will be used in release discussion)
  3. Add needs-dev-review label when work is completed
  4. Add needs-qa label when dev review is completed
  5. Add QA Passed label when QA has signed off

Description

  • Return all permitted accounts from eth_accounts with most recently used first for browser and SDK

This change was made to align with the change suggested in extension. The goal is start returning all accounts on each eth_accounts call rather than only returning an array with a single account. We achieve this by updating the restrictReturnedAccounts decorator

Screenshots/Recordings

Screen.Recording.2023-06-07.at.4.12.55.PM.mov

NOTE: test dapp page changes are not deployed yet, but have been merged into the main branch and be run locally to reproduce the recording above.

Screen.Recording.2023-06-07.at.4.30.05.PM.mov

Issue

Ticket: mme-18515
Documentation PR

Checklist

  • There is a related GitHub issue
  • Tests are included if applicable
  • Any added code is fully documented

@jiexi jiexi requested a review from a team as a code owner May 30, 2023 21:47
@github-actions
Copy link
Contributor

github-actions bot commented May 30, 2023

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.

@jiexi jiexi marked this pull request as draft May 31, 2023 01:51
@jiexi jiexi changed the title Jl/mme 18515/eth accounts return all permitted eth_accounts return all permitted accounts May 31, 2023
@jiexi
Copy link
Contributor Author

jiexi commented May 31, 2023

I have read the CLA Document and I hereby sign the CLA

@jiexi jiexi changed the title eth_accounts return all permitted accounts feat: eth_accounts return all permitted accounts May 31, 2023
@jiexi jiexi marked this pull request as ready for review May 31, 2023 16:50
@jiexi
Copy link
Contributor Author

jiexi commented Jun 2, 2023

I'm unsure if my assumptions are correct for eth_accounts behavior:

  • Wallet Connect does not support multiple permitted accounts, and thus can only return the selectedAddress
  • SDK does support multiple permitted accounts, and thus behaves the same as browser

@jiexi
Copy link
Contributor Author

jiexi commented Jun 6, 2023

Reverted sdk and wc behavior based on discussion with @andreahaku

@jiexi jiexi added the needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) label Jun 6, 2023
Copy link
Contributor

@Cal-L Cal-L left a comment

Choose a reason for hiding this comment

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

left a comment

app/core/Permissions/specifications.js Outdated Show resolved Hide resolved
Copy link
Contributor

@Cal-L Cal-L left a comment

Choose a reason for hiding this comment

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

LGTM

@Cal-L Cal-L added needs-qa Any New Features that needs a full manual QA prior to being added to a release. and removed needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) labels Jun 7, 2023
@cortisiko
Copy link
Member

hey @jiexi I have a couple of questions:

Did you test removing accounts that were connected to a dapp?
Did you test importing accounts while one of your previous accounts was connected to a dapp?
Did you test connecting and disconnecting hardware wallets while connected to a dapp?
Was this tested against the portfolio dapp?
WC v2 was merged a couple of days ago, was this tested on the most recent main commit?

@jiexi
Copy link
Contributor Author

jiexi commented Jun 14, 2023

@cortisiko

Did you test removing accounts that were connected to a dapp?
https://github.com/MetaMask/metamask-mobile/assets/918701/8a9add6f-8f57-46e0-b5af-be6b855d3893

Did you test importing accounts while one of your previous accounts was connected to a dapp?
https://github.com/MetaMask/metamask-mobile/assets/918701/ed4b203c-08c8-4769-bccb-7d9b2e808e43

Did you test connecting and disconnecting hardware wallets while connected to a dapp?
No. Don't have access to one I can use currently

Was this tested against the portfolio dapp?
Yes, I'm not sure what the correct behavior is. Seems like revoking account access doesn't remove them from the tracked accounts. But adding multiple accounts does get all the accounts to show up in the dapp on initial connect. Adding multiple accounts after the fact only gets one account added. To get the other account to show up, you have to switch and make them the active dapp. I believe this is a problem with the portfolio dapp itself specifically pulling only the active account when permissions change.

EDIT:

This issue doesn't occur in extension partly because it's not possible to permit multiple accounts via wallet ui after initial account connection. Bug filed in slack. See conversation for video proof as well

WC v2 was merged a couple of days ago, was this tested on the most recent main commit?
Yes. Just getting the error from not having WALLET_CONNECT_PROJECT_ID set

@sonarcloud
Copy link

sonarcloud bot commented Jun 16, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

Copy link
Member

@cortisiko cortisiko left a comment

Choose a reason for hiding this comment

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

Approving! I went through some manual verifications and I did not find any issues.

@cortisiko cortisiko added QA Passed A successful QA run through has been done and removed needs-qa Any New Features that needs a full manual QA prior to being added to a release. labels Jun 28, 2023
@jiexi jiexi merged commit 60ac259 into main Jun 28, 2023
13 checks passed
@jiexi jiexi deleted the jl/mme-18515/eth_accounts-return-all-permitted branch June 28, 2023 23:14
@github-actions github-actions bot locked and limited conversation to collaborators Jun 28, 2023
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.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants