Skip to content

Add decoders for token-approval-revocation permission type#8823

Open
jeffsmale90 wants to merge 5 commits into
mainfrom
feat/token-approval-revocation
Open

Add decoders for token-approval-revocation permission type#8823
jeffsmale90 wants to merge 5 commits into
mainfrom
feat/token-approval-revocation

Conversation

@jeffsmale90
Copy link
Copy Markdown
Contributor

@jeffsmale90 jeffsmale90 commented May 15, 2026

Explanation

Adds decoding logic for new token-approval-revocation permission type.

Bumps delegation dependencies:

  • @metamask/7715-permission-types from ^0.6.0 to ^0.7.0
  • @metamask/delegation-core from ^2.0.0 to ^2.2.0
  • @metamask/delegation-deployments from ^1.3.0 to ^1.4.0

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Medium Risk
Adds a new permission decoder and expands enforcer-address resolution, plus bumps delegation-related dependencies; mistakes could misclassify or mis-decode on-chain permission caveats.

Overview
Adds support for decoding the new token-approval-revocation permission type in gator-permissions-controller, including wiring a new decoder into the canonical decoder list and extending enforcer resolution/types to include ApprovalRevocationEnforcer.

The new decoder validates and decodes an approval-revocation bitmask from caveat terms (rejecting empty/zero/out-of-range masks) and is covered by new/updated unit tests for both caveat-address matching and term decoding.

Bumps dependencies to pick up the new enforcer and permission type support (@metamask/7715-permission-types ^0.7.0, @metamask/delegation-core ^2.2.0, @metamask/delegation-deployments ^1.4.0), with matching changelog updates (also in money-account-upgrade-controller).

Reviewed by Cursor Bugbot for commit 4c87d7f. Bugbot is set up for automated code reviews on this repo. Configure here.

@jeffsmale90 jeffsmale90 force-pushed the feat/token-approval-revocation branch 4 times, most recently from aa81108 to 17d77a9 Compare May 18, 2026 22:20
@socket-security
Copy link
Copy Markdown

socket-security Bot commented May 18, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updated@​metamask/​7715-permission-types@​0.6.0 ⏵ 0.7.0100 +110072 +193 +4100
Updated@​metamask/​delegation-deployments@​1.3.0 ⏵ 1.4.0100 +110081 +195 +2100
Updated@​metamask/​delegation-core@​2.0.0 ⏵ 2.2.0100 +110010095 +2100

View full report

Base automatically changed from refactor/decompose-rule-decoders to main May 18, 2026 22:50
@jeffsmale90 jeffsmale90 force-pushed the feat/token-approval-revocation branch 6 times, most recently from d15bbcb to 4b4531e Compare May 19, 2026 02:36
@jeffsmale90 jeffsmale90 marked this pull request as ready for review May 19, 2026 02:37
@jeffsmale90 jeffsmale90 requested review from a team as code owners May 19, 2026 02:37
@jeffsmale90 jeffsmale90 force-pushed the feat/token-approval-revocation branch from 4b4531e to e90a225 Compare May 19, 2026 02:38
- @metamask/7715-permission-types from ^0.6.0 to ^0.7.0
- @metamask/delegation-core from ^2.0.0 to ^2.2.0
- @metamask/delegation-deployments from ^1.3.0 to ^1.4.0
@jeffsmale90 jeffsmale90 force-pushed the feat/token-approval-revocation branch from e90a225 to b8dc019 Compare May 19, 2026 04:01
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b8dc019. Configure here.

Copy link
Copy Markdown
Contributor

@mj-kiwi mj-kiwi left a comment

Choose a reason for hiding this comment

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

Just some quesitons

erc20Approve: boolean;
erc721Approve: boolean;
erc721SetApprovalForAll: boolean;
permit2Approve: boolean;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The @metamask/7715-permission-types defines the same permission type with permit2ApproveZero, not permit2Approve

mask,
ApprovalRevocationFlag.Erc721SetApprovalForAll,
),
permit2Approve: isFlagEnabled(mask, ApprovalRevocationFlag.Permit2Approve),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same question here, the name of Permit2Approve is different between @metamask/7715-permission-types and here

*
* Not yet defined in `@metamask/7715-permission-types`, so declared locally.
*/
type TokenApprovalRevocationPermission = BasePermission & {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we redefine the permissions type here? it has been exported from @metamask/7715-permission-types, same question to the other permission types in this file.

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.

2 participants