-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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: Release Chain Permissions #27561
Conversation
084a4bc
to
250ba94
Compare
8b33f63
to
af5271b
Compare
app/scripts/lib/rpc-method-middleware/handlers/switch-ethereum-chain.test.js
Outdated
Show resolved
Hide resolved
app/scripts/metamask-controller.js
Outdated
...(requestedPermissions[RestrictedMethods.eth_accounts] && { | ||
[PermissionNames.permittedChains]: {}, | ||
}), |
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.
do we anticipate a user trying to request permittedChains by itself? if so we probably need to populate an empty eth_accounts object here too? @adonesky1
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.
do we anticipate a user trying to request permittedChains by itself? if so we probably need to populate an empty eth_accounts object here too? @adonesky1
🤔 I think whether or not we encourage it we should include an accounts permission as part of the request to avoid confusion/frustration
I see a few more references to |
Those are for confirmation page Copy Changes. We are not removing feature flag from these files |
…ltichain-e2e-tests-v2 # Conflicts: # app/scripts/lib/rpc-method-middleware/handlers/switch-ethereum-chain.js
<!-- 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. --> ## **Description** <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/27718?quickstart=1) ## **Related issues** Fixes: ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.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-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **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.
<!-- 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. --> ## **Description** <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/27725?quickstart=1) ## **Related issues** Fixes: ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.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-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **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.
QA FindingsSigned Transaction stuck after network switchI've encountered a case where after switching networks using window.ethereum on a dapp and trying to send a transaction the tx status remains in Then I cannot send transactions on other networks, as it says there's a tx pending. Smart Transactions are disabled. Repro:
signed-tx-local.mp4Invalid v valueThis is a failure that sometimes appears in our e2e tests. I think this needs to be investigated further as might be a bug in the wallet side. I'm trying to find repro steps (no luck so far), but I find it deterministically by running this spec in the mmi build:
I've seen this in other tests too, but the tests didn't fail as they were not checking if the tx was successful or not. If that's confirmed, we'd need to add a new step to capture this deterministically |
…sendTransaction calls (#27734) <!-- 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. --> ## **Description** <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/27734?quickstart=1) ## **Related issues** Fixes: ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.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-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **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.
Quality Gate failedFailed conditions |
ci e2e webpack: Chrome errors in webpack makes test failWe see there are some empty errors that make test fails sometimes in webpack. After checking why those are empty we've seen that it's because those RPC errors don't have any value, but a description field. With the below change we can see how the error message is then displayed and we can see how those are expected RPC errors due to the server being down (in the test we shut down the 2 ganache servers)
Current ci: With logs added: Remaining part: we should fix the |
Builds ready [535b710]
Page Load Metrics (1946 ± 161 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
@seaona interesting catch. Following our slack conversation if the flakiness would be there, I will file a follow up PR and address it there. Thanks ❤️ |
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.
text: 'Switching networks will cancel all pending confirmations', | ||
tag: 'span', | ||
}); | ||
// await driver.findElement({ |
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.
We can probably remove this correct?
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!✅
await driver.clickElement({ | ||
text: 'Confirm', | ||
tag: 'button', | ||
}); | ||
|
||
await driver.waitForSelector({ text: 'OK' }); |
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.
I believe these waitForSelector
calls were added to try and combat flakiness, I don't think we should be removing them. This applies to multiple places and files in this PR.
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.
This is replaced with await driver.clickElementAndWaitForWindowToClose
. We can keep it but here we have have added an extra condition that the windown close when this button is clicked. In other instances of file, we wanted to make sure that the window is closed once we click the button.
@@ -140,12 +127,6 @@ describe('Test Snap TxInsights-v2', function () { | |||
tag: 'button', | |||
text: 'Activity', | |||
}); | |||
|
|||
// wait for transaction confirmation | |||
await driver.waitForSelector({ |
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.
How come this is removed?
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.
Yeah, this one I can add back. Can I do it in a follow up PR?
@@ -18,10 +17,6 @@ import { CaveatTypes } from '../../../../shared/constants/permissions'; | |||
* @returns {JSX.Element} A permission description node. | |||
*/ | |||
function getDescriptionNode(permission, index, accounts) { | |||
const permissionValue = permission?.permissionValue?.caveats?.find( |
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.
This seems to revert 4fa502b - is that intentional?
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.
Yes, because caveats doesn't exist in permissionValue object
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.
Hmm, any idea why this value changed since that fix then? 🤔
@@ -49,7 +49,7 @@ export const PermissionCellStatus = ({ | |||
|
|||
const renderAccountsGroup = () => ( | |||
<> | |||
{process.env.CHAIN_PERMISSIONS ? ( | |||
{networks.length > 0 ? ( |
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.
This confuses me, are we stopping rendering accounts
? If so, can we remove the code for it?
Or are we keeping it for Snaps for now? If so, this is still confusing 😅
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.
We are just keeping it for Snaps. networks is defined only in case of permittedChains
.
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.
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.
For initial connection screen, we need to show the current active account and all the enabled networks to be there , this screen should not show up for Snaps. This is connections screen, it doesn't use permission cell anyway
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.
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.
Not blocking, but I have left some comments that should probably be addressed in a follow up.
This PR is to remove feature flags and add e2e for Chain Permissions
Related issues
Fixes: https://github.com/MetaMask/MetaMask-planning/issues/2713
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist