Skip to content

refactor: decompose rule decoders, and refactor permission decoding#8730

Open
jeffsmale90 wants to merge 7 commits into
mainfrom
refactor/decompose-rule-decoders
Open

refactor: decompose rule decoders, and refactor permission decoding#8730
jeffsmale90 wants to merge 7 commits into
mainfrom
refactor/decompose-rule-decoders

Conversation

@jeffsmale90
Copy link
Copy Markdown
Contributor

@jeffsmale90 jeffsmale90 commented May 7, 2026

Explanation

Refactor of permission decoding logic in order to:

  • clarify terminology (decoders rather than rules - rule is a highly overloaded term)
  • make rule (as in 7155 rules) more composable, rather than inherently part of the decoding process
  • prepare the permission decoders for potential decomposition into a separate package
    no functional change, therefore no changelog required

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
Refactors the core permission decoding pipeline (type identification and caveat decoding) across multiple permission types, so regressions could change how delegations are classified/decoded even though intent is no functional change.

Overview
Refactors permission decoding from monolithic PermissionRules to PermissionDecoders built via makePermissionDecoder, with composable RuleDecoders that independently derive 7715 rules (new expiryRule, nativePayeeRule, erc20PayeeRule, redeemerRule) and hoist expiry.

Updates the controller and decode flow APIs (findDecodersWithMatchingCaveatAddresses, selectUniqueDecoderAndDecodedPermission, createPermissionDecodersForContracts) and removes the old rules/ implementation (makePermissionRule). Adds EXECUTION_PERMISSION_EXPIRY_RULE_TYPE, expands tests to cover the new rule decoders, and marks DecodedPermission.expiry as deprecated in favor of rules.

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

@jeffsmale90 jeffsmale90 force-pushed the refactor/decompose-rule-decoders branch from 71e997b to 4d784ae Compare May 7, 2026 23:22
@jeffsmale90 jeffsmale90 force-pushed the refactor/decompose-rule-decoders branch from 4d784ae to 98adc20 Compare May 7, 2026 23:25
@jeffsmale90 jeffsmale90 changed the title Rename PermissionRule to PermissionDecoder. Decompose rule decoders f… refactor: decompose rule decoders, and refactor permission decoding May 7, 2026
@jeffsmale90 jeffsmale90 marked this pull request as ready for review May 7, 2026 23:40
@jeffsmale90 jeffsmale90 requested a review from a team as a code owner May 7, 2026 23:40
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 f94844b. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant