From cbb57a13a57a5e364efa7f121199a08c9fdbf77a Mon Sep 17 00:00:00 2001 From: seaona <54408225+seaona@users.noreply.github.com> Date: Fri, 29 Nov 2024 10:18:23 +0100 Subject: [PATCH 1/2] fix: SIWE e2e test timing out and breaking ci (#28801) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## **Description** SIWE tests are timing out, making our ci broken, as they take very long to execute (there are several instances of waiting for event payload which take 20 seconds each, making reach the total limit of 80 seconds). This updates the timeout limits for that spec to unblock ci (based on a similar fix @chloeYue did for another long test). The Confirmations team can investigate further if that's expected ![Screenshot from 2024-11-29 09-21-45](https://github.com/user-attachments/assets/fd87f087-e291-49f6-b2fe-3acd8108bd2f) ![Screenshot from 2024-11-29 09-06-04](https://github.com/user-attachments/assets/da118cb2-d55f-4c92-9b60-430118ede4fb) [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/28801?quickstart=1) ## **Related issues** Fixes: ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** ### **Before** ### **After** ## **Pre-merge author checklist** - [x] 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). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] 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-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. --- test/e2e/tests/confirmations/signatures/siwe.spec.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/test/e2e/tests/confirmations/signatures/siwe.spec.ts b/test/e2e/tests/confirmations/signatures/siwe.spec.ts index 4e90ac788a08..ab614095d793 100644 --- a/test/e2e/tests/confirmations/signatures/siwe.spec.ts +++ b/test/e2e/tests/confirmations/signatures/siwe.spec.ts @@ -31,6 +31,7 @@ import { } from './signature-helpers'; describe('Confirmation Signature - SIWE @no-mmi', function (this: Suite) { + this.timeout(200000); // This test is very long, so we need an unusually high timeout it('initiates and confirms', async function () { await withTransactionEnvelopeTypeFixtures( this.test?.fullTitle(), From db4386f6e25c8a96bd2510588c9ba462a51d9ca1 Mon Sep 17 00:00:00 2001 From: Frederik Bolding Date: Fri, 29 Nov 2024 11:31:07 +0100 Subject: [PATCH 2/2] fix: Correct preferences controller usage for `isOnPhishingList` hook (#28803) ## **Description** In [this commit](https://github.com/MetaMask/metamask-extension/commit/cedabc62e45601c77871689425320c54d717275e) the preferences controller was converted to `BaseControllerV2`, however the `isOnPhishingList` hook was not corrected to reference the state properly. The hook will currently always throw which means that link validation fails for Snaps notifications, making them unable to display. This PR corrects that mistake. Note: This is an edge-case of the Snaps API that doesn't have good E2E coverage yet. We should prioritize that. [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/28803?quickstart=1) ## **Manual testing steps** The following Snap should work correctly and display a notification: ``` export const onRpcRequest: OnRpcRequestHandler = async ({ origin, request, }) => { switch (request.method) { case 'hello': return snap.request({ method: 'snap_notify', params: { type: 'inApp', message: 'Hello! [metamask.io](https://metamask.io)', }, }); default: throw new Error('Method not found.'); } }; ``` --- app/scripts/metamask-controller.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 992302983baf..d60d937e1c3c 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -2897,8 +2897,7 @@ export default class MetamaskController extends EventEmitter { ); }, isOnPhishingList: (url) => { - const { usePhishDetect } = - this.preferencesController.store.getState(); + const { usePhishDetect } = this.preferencesController.state; if (!usePhishDetect) { return false;