Skip to content

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

Merged
jeffsmale90 merged 7 commits into
mainfrom
feat/token-approval-revocation
May 20, 2026
Merged

Add decoders for token-approval-revocation permission type#8823
jeffsmale90 merged 7 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-type decoder and updates enforcer address resolution, which can change how on-chain permission caveats are classified/decoded. Dependency bumps to @metamask/delegation-* and @metamask/7715-permission-types may also subtly affect decoding behavior across consumers.

Overview
Adds support for decoding the new token-approval-revocation execution permission type in @metamask/gator-permissions-controller, including a new decoder that validates an ApprovalRevocationEnforcer bitmask and exposes the decoded capability flags (plus optional expiry via TimestampEnforcer).

Updates enforcer-address plumbing and types to include ApprovalRevocationEnforcer, expands the canonical decoder set (and matching logic tests) to recognize this permission, and adds dedicated unit coverage for validation/error cases and full-flag decoding.

Bumps dependencies (@metamask/7715-permission-types, @metamask/delegation-core, @metamask/delegation-deployments) and updates changelogs; money-account-upgrade-controller is bumped to the newer delegation packages as well.

Reviewed by Cursor Bugbot for commit bbef885. 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.1100 +110072 +194 +5100
Updated@​metamask/​delegation-deployments@​1.3.0 ⏵ 1.4.0100 +110081 +195 +2100
Updated@​metamask/​delegation-core@​2.0.0 ⏵ 2.2.1100 +110010096 +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
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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have updated both @metamask/delegation-core and @metamask/7715-permission-types with permit2ApproveZero renamed to 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.

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 7ea9ad2. Configure here.

Comment thread packages/gator-permissions-controller/src/decodePermission/types.ts Outdated
@metamask/delegation-core from ^2.2.0 to ^2.2.1
@jeffsmale90 jeffsmale90 force-pushed the feat/token-approval-revocation branch from 7ea9ad2 to cecc5c0 Compare May 20, 2026 01:24
@jeffsmale90 jeffsmale90 enabled auto-merge May 20, 2026 04:28
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.

LGTM

@jeffsmale90 jeffsmale90 added this pull request to the merge queue May 20, 2026
Merged via the queue into main with commit a1fa399 May 20, 2026
370 checks passed
@jeffsmale90 jeffsmale90 deleted the feat/token-approval-revocation branch May 20, 2026 05:11
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