Skip to content

Commit

Permalink
fix: remove submitRequest from dapp permission (#26276)
Browse files Browse the repository at this point in the history
<!--
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?
-->

This pr updates the e2e testing for user operations to use the latest
snap and removes the `submitRequest` permission from dapps.

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/26276?quickstart=1)

## **Related issues**

Fixes: MetaMask/accounts-planning#554

## **Manual testing steps**

N/A

## **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**

- [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.
  • Loading branch information
montelaidev authored and ccharly committed Aug 26, 2024
1 parent de6a636 commit 4e97d4f
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ describe('keyringSnapPermissionsBuilder', () => {
KeyringRpcMethod.GetRequest,
KeyringRpcMethod.ApproveRequest,
KeyringRpcMethod.RejectRequest,
KeyringRpcMethod.SubmitRequest,
]);
});

Expand Down
2 changes: 1 addition & 1 deletion app/scripts/lib/snap-keyring/keyring-snaps-permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const METAMASK_ALLOWED_METHODS: string[] = [

/**
* List of keyring methods a dapp can call.
* !NOTE: DO NOT INCLUDE `KeyringRpcMethod.SubmitRequest` IN THIS LIST.
*/
const WEBSITE_ALLOWED_METHODS: string[] = [
KeyringRpcMethod.ListAccounts,
Expand All @@ -45,7 +46,6 @@ const WEBSITE_ALLOWED_METHODS: string[] = [
KeyringRpcMethod.GetRequest,
KeyringRpcMethod.ApproveRequest,
KeyringRpcMethod.RejectRequest,
KeyringRpcMethod.SubmitRequest,
];

/**
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const BUNDLER_URL = 'http://localhost:3000/rpc';

/* URL of the 4337 account snap site. */
export const ERC_4337_ACCOUNT_SNAP_URL =
'https://metamask.github.io/snap-account-abstraction-keyring/0.2.2/';
'https://metamask.github.io/snap-account-abstraction-keyring/0.4.0/';

/* Salt used to generate the 4337 account. */
export const ERC_4337_ACCOUNT_SALT = '0x1';
Expand Down
32 changes: 23 additions & 9 deletions test/e2e/flask/user-operations.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,24 +71,38 @@ async function setSnapConfig(
entrypoint,
simpleAccountFactory,
paymaster,
paymasterSK,
}: {
bundlerUrl: string;
entrypoint: string;
simpleAccountFactory: string;
paymaster?: string;
paymasterSK?: string;
},
) {
const data = JSON.stringify({
bundlerUrl,
entryPoint: entrypoint,
await driver.switchToWindowWithTitle('Account Abstraction Snap');
await driver.clickElement('[data-testid="chain-select"]');
await driver.clickElement('[data-testid="chain-id-1337"]');
await driver.fill('[data-testid="bundlerUrl"]', bundlerUrl);
await driver.fill('[data-testid="entryPoint"]', entrypoint);
await driver.fill(
'[data-testid="simpleAccountFactory"]',
simpleAccountFactory,
customVerifyingPaymasterAddress: paymaster,
});
);
if (paymaster) {
await driver.fill(
'[data-testid="customVerifyingPaymasterAddress"]',
paymaster,
);
}
if (paymasterSK) {
await driver.fill(
'[data-testid="customVerifyingPaymasterSK"]',
paymasterSK,
);
}

await driver.switchToWindowWithTitle('Account Abstraction Snap');
await driver.clickElement({ text: 'Set Chain Config' });
await driver.fill('#set-chain-config-chain-config-object', data);
await driver.clickElement({ text: 'Set Chain Configs', tag: 'button' });
await driver.clickElement({ text: 'Set Chain Config', tag: 'button' });
}

async function createSwap(driver: Driver) {
Expand Down

0 comments on commit 4e97d4f

Please sign in to comment.