Skip to content

Conversation

jeffsmale90
Copy link
Contributor

@jeffsmale90 jeffsmale90 commented Aug 18, 2025

Adds methods wallet_requestExecutionPermissions and wallet_revokeExecutionPermission, as defined in this revision of the EIP-7715 specification ethereum/ERCs#1098.

This supports Readable Permissions project, and is related to the following PRs:

Note: workflows are failing due to existing problems, fixed by #397

@jeffsmale90 jeffsmale90 force-pushed the feat/eip7715_executionPermissions branch from 6eb865b to 4f8bc87 Compare August 18, 2025 21:19
@jeffsmale90 jeffsmale90 force-pushed the feat/eip7715_executionPermissions branch from 4f8bc87 to f339980 Compare August 18, 2025 21:26
@jeffsmale90 jeffsmale90 changed the title add methods to support EIP-7715 feat: add RPC methods described in (revised) EIP-7715 Aug 19, 2025
@jeffsmale90 jeffsmale90 marked this pull request as ready for review August 19, 2025 07:28
@jeffsmale90 jeffsmale90 requested review from a team as code owners August 19, 2025 07:28
cursor[bot]

This comment was marked as outdated.

…to 5792 and 7715 async middleware to match correct naming.
@jeffsmale90 jeffsmale90 requested a review from mcmire August 20, 2025 21:48
cursor[bot]

This comment was marked as outdated.

ffmcgee725
ffmcgee725 previously approved these changes Aug 26, 2025
jiexi
jiexi previously approved these changes Aug 26, 2025
Copy link

@jiexi jiexi left a comment

Choose a reason for hiding this comment

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

functionally LGTM. I have some concerns regarding spec about if isAdjustmentAllowed should even be included as it ultimately is a proxy for something optional and if something is not strictly required for execution then IMO it should not be included in the request by the dapp

Please ping for re-approval if you feel that my nit above is fair

Comment on lines +88 to +89
res.result = await processRequestExecutionPermissions(params, req);
}
Copy link
Contributor

@adonesky1 adonesky1 Aug 26, 2025

Choose a reason for hiding this comment

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

I believe you'll need to pass end in as a param as well for the JSON RPC Engine to handle this gracefully

Suggested change
res.result = await processRequestExecutionPermissions(params, req);
}
res.result = await processRequestExecutionPermissions(params, req);
return end()
}

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess they aren't doing this in the 5792 methods you used as a model. Need to figure out why that's ok 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

From @metamask/json-rpc-engine - createAsyncMiddleware:

* Async middleware have no "end" function. Instead, they "end" if they return
* without calling "next". Rather than passing in explicit return handlers,
* async middleware can simply await "next", and perform operations on the
* response object when execution resumes.

The async middleware function accepts a next parameter, but no end parameter. 😅

@jeffsmale90 jeffsmale90 dismissed stale reviews from jiexi and ffmcgee725 via 8085971 September 2, 2025 05:15
cursor[bot]

This comment was marked as outdated.

@jeffsmale90 jeffsmale90 force-pushed the feat/eip7715_executionPermissions branch from 8085971 to 52b0346 Compare September 2, 2025 05:22
src/index.ts Outdated
Comment on lines 31 to 32
RevokeExecutionPermissionsRequestParams,
RevokeExecutionPermissionsResult,
Copy link

Choose a reason for hiding this comment

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

Should these two type names be singular to stay consistent with the singular form of wallet_revokeExecutionPermission?

Copy link
Contributor Author

@jeffsmale90 jeffsmale90 Sep 3, 2025

Choose a reason for hiding this comment

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

You are absolutely correct!

@jeffsmale90 jeffsmale90 requested review from jiexi and mj-kiwi September 3, 2025 04:28
@jeffsmale90 jeffsmale90 merged commit a10c7fb into main Sep 3, 2025
20 checks passed
@jeffsmale90 jeffsmale90 deleted the feat/eip7715_executionPermissions branch September 3, 2025 20:36
jeffsmale90 added a commit that referenced this pull request Sep 3, 2025
This is the release for version 17.1.0.

```
a10c7fb feat: add RPC methods described in (revised) EIP-7715 (#396)
45ed998 Run compatibility test only in main branch. (#397)
```

---------

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Jeff Smale <6363749+jeffsmale90@users.noreply.github.com>
Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
github-merge-queue bot pushed a commit to MetaMask/metamask-extension that referenced this pull request Sep 9, 2025
Adds the method `wallet_requestExecutionPermissions` which is defined in
this proposed revision of the EIP-7715 specification
ethereum/ERCs#1098.

## **Description**

This method is proxied to `@metamask/permissions-kernel-snap`, which
implements the exact same method. This snap will be preinstalled in
Extension, before the feature is enabled for any users.

The feature is gated by
`process.env.EIP_7715_READABLE_PERMISSIONS_ENABLED` and requires
`process.env.PERMISSIONS_KERNEL_SNAP_ID` to be set. Presently
`EIP_7715_READABLE_PERMISSIONS_ENABLED` is set to false, and
`PERMISSIONS_KERNEL_SNAP_ID` is set to an empty string for all builds.

Requires MetaMask/eth-json-rpc-middleware#396
released in
https://github.com/MetaMask/eth-json-rpc-middleware/releases/tag/v17.1.0.
This change also adds support for `wallet_revokePermission`, which will
be implemented in a future PR, once the revocation UI is implemented.


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

## **Changelog**

CHANGELOG entry: As this is behind a local feature gate, there are no
public facing changes.

## **Manual testing steps**

Can be tested with
MetaMask/delegation-toolkit#60 which adds
support to the delegation-toolkit's experimental api to call the wallet
method directly, rather than via `wallet_invokeSnap`.

## **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/main/.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/main/.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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants