feat: add decoding rules for erc20-token-allowance and native-token-allowance#8553
Draft
jeffsmale90 wants to merge 4 commits intomainfrom
Draft
feat: add decoding rules for erc20-token-allowance and native-token-allowance#8553jeffsmale90 wants to merge 4 commits intomainfrom
erc20-token-allowance and native-token-allowance#8553jeffsmale90 wants to merge 4 commits intomainfrom
Conversation
…ne to pass validation.
- erc-20-token-allowance - native-token-allowance
erc20-token-allowance and native-token-allowance
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
Requires integration of new @metamask/7715-permission-types from MetaMask/smart-accounts-kit#214
References
Checklist
Note
Medium Risk
Decoding logic now selects among multiple candidate permission rules and adds two new permission types that share enforcer sets with existing periodic permissions, which could change how delegations are classified and error out on ambiguous/invalid caveats.
Overview
Adds decoding support for unbounded allowance permissions (
native-token-allowanceanderc20-token-allowance) by introducing new permission rules and extendingDecodedPermissiontyping to include these locally-defined 7715 types.Updates the permission-type resolution flow to allow multiple rules to match the same enforcer set (
findRulesWithMatchingCaveatAddresses) and then disambiguates by validating/decoding terms (selectUniqueRuleAndDecodedPermission), with clearer errors for no-match and ambiguous delegations.Tightens periodic decoders to explicitly reject
UINT256_MAXperiodDuration(reserved to indicate allowance), adds a sharedUINT256_MAXconstant, and expands test coverage for the new rules and edge cases.Reviewed by Cursor Bugbot for commit 6423424. Bugbot is set up for automated code reviews on this repo. Configure here.