After loading gator permissions, resolve status for each item#8445
Draft
jeffsmale90 wants to merge 4 commits intomainfrom
Draft
After loading gator permissions, resolve status for each item#8445jeffsmale90 wants to merge 4 commits intomainfrom
jeffsmale90 wants to merge 4 commits intomainfrom
Conversation
- if revocationMetadata exists, or revoked onchain - 'Revoked' - if expiration after onchain block timestamp 'Expired' - otherwise 'Active'
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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 46e2976. Configure here.
- Rename PermissionStatus to GatorPermissionStatus - Rename resolvePermissionStatusAfterSync to resolveGrantedPermissionOnChainStatus for clarity - Add missing jsdocs
1517a54 to
01ee3ff
Compare
…when adding metadata to stored permission
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
Gator permissions loaded from storage may be either active, revoked, or expired - this is in addition to the "Revoked" metadata stored with the permission.
With this change, after loading the permissions we resolve the status for each item. While the status is being resolved, we show the previous status held in storage for this item, or "Active" if it doesn't have a previous status.
When resolving the status:
Mocked up UI in Extension:
References
Checklist
Note
Medium Risk
Adds post-sync on-chain resolution of permission lifecycle status using NetworkController RPC calls, which changes persisted/used-in-UI state shape and introduces new network-dependent logic that could affect performance or correctness across chains.
Overview
After fetching granted permissions from the snap, the controller now derives and maintains a per-permission
status(Active/Revoked/Expired) and updates it after sync based on revocation metadata plus on-chain checks.This introduces a new
permissionOnChainStatusmodule that decodes the permission context, callsDelegationManager.disabledDelegationsviaeth_call, and compares any TimestampEnforcer expiry against the latest block timestamp, usingNetworkControllerto obtain the chain provider. Tests are expanded and added to cover status merging/defaulting and the on-chain resolution paths, and@metamask/network-controller/@metamask/abi-utilsare added as dependencies.Reviewed by Cursor Bugbot for commit 46e2976. Bugbot is set up for automated code reviews on this repo. Configure here.