refactor: Use permission decoders from @metamask/7715-permission-types - #9164
Open
jeffsmale90 wants to merge 15 commits into
Open
refactor: Use permission decoders from @metamask/7715-permission-types#9164jeffsmale90 wants to merge 15 commits into
@metamask/7715-permission-types#9164jeffsmale90 wants to merge 15 commits into
Conversation
jeffsmale90
force-pushed
the
chore/permission_decoding_externalised_permissions
branch
from
July 14, 2026 02:29
7a4724f to
7eda56a
Compare
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
@metamask/gator-permissions-controller consumes Advanced Permission definitions from @metamask/7715-permission-types
jeffsmale90
force-pushed
the
chore/permission_decoding_externalised_permissions
branch
from
July 14, 2026 02:54
cb23bf0 to
c3fbd8e
Compare
jeffsmale90
marked this pull request as ready for review
July 14, 2026 02:54
jeffsmale90
temporarily deployed
to
default-branch
July 14, 2026 02:54 — with
GitHub Actions
Inactive
@metamask/gator-permissions-controller consumes Advanced Permission definitions from @metamask/7715-permission-types@metamask/7715-permission-types
jeffsmale90
marked this pull request as draft
July 14, 2026 21:25
jeffsmale90
force-pushed
the
chore/permission_decoding_externalised_permissions
branch
from
July 15, 2026 01:57
2719213 to
c436c43
Compare
jeffsmale90
marked this pull request as ready for review
July 15, 2026 01:57
jeffsmale90
temporarily deployed
to
default-branch
July 15, 2026 01:57 — with
GitHub Actions
Inactive
jeffsmale90
force-pushed
the
chore/permission_decoding_externalised_permissions
branch
from
July 15, 2026 02:02
c436c43 to
174d64e
Compare
mj-kiwi
reviewed
Jul 15, 2026
mj-kiwi
left a comment
Contributor
There was a problem hiding this comment.
Solid refactor, just a few minor notes.
… narrow scope to just test this function
Also fix various linting issues
jeffsmale90
force-pushed
the
chore/permission_decoding_externalised_permissions
branch
3 times, most recently
from
July 21, 2026 02:26
a4ef722 to
7bc7040
Compare
jeffsmale90
force-pushed
the
chore/permission_decoding_externalised_permissions
branch
from
July 21, 2026 02:46
7bc7040 to
7cbbc65
Compare
mj-kiwi
previously approved these changes
Jul 27, 2026
| throw new Error(`Contracts not found for chainId: ${chainId}`); | ||
| } | ||
|
|
||
| const contracts = toEnforcerAddressesByName(deploymentContracts); |
Contributor
There was a problem hiding this comment.
toEnforcerAddressesByName(deploymentContracts) is now called before the try block in decodePermissionFromPermissionContextForOrigin. This means a "Contract not found" error would escape unwrapped instead of being
caught and rethrown as PermissionDecodingError, which the method's @throws doc promises. Could we move this call back inside the try block, similar to how resolveGrantedPermissionOnChainStatus in permissionOnChainStatus.ts handles it?
…ound to toEnforcerAddressesByName throws
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation
MetaMask/smart-accounts-kit#259 adds permission decoder definitions to @metamask/7715-permission-types released in 0.8.0.
This PR updates @metamask/gator-permissions-controller to consume these permission definitions instead of defining the permission decoders directly in the controller.
Note:
erc20-token-revocationpermission type is no longer supported.References
Checklist
Note
High Risk
Breaking removal of a permission type and relocation of delegation decode logic to an external package affects how permissions are interpreted; misconfiguration or version skew could mis-decode or reject delegations.
Overview
Moves Gator permission decoding onto
@metamask/7715-permission-types^1.0.0 by building decoders frommakePermissionDecoderConfigsinstead of local per-type decoder modules (stream/periodic/allowance, payee/expiry/redeemer rules, etc.). Chain enforcer addresses are mapped through newtoEnforcerAddressesByName/delegationContractsByChainIdbefore decode and status sync.Breaking:
erc20-token-revocationis removed from defaultsupportedPermissionTypes, README examples, and tests. Decode failures from missing contracts or checksum errors are wrapped asPermissionDecodingErrorwith the underlying cause preserved.Tests shift to controller-level decode coverage for supported types (including allowance and
token-approval-revocation) and slimmer unit tests around decoder selection; large integration-style decoder test suites in this package are dropped.Reviewed by Cursor Bugbot for commit 0ba2af8. Bugbot is set up for automated code reviews on this repo. Configure here.