Skip to content

Conversation

@V00D00-child
Copy link
Member

@V00D00-child V00D00-child commented Nov 12, 2025

Description

Previously, during permission revocation submission, we store a boolean revoked flag to track the permission revocation status in profile sync.

This PR replaces this flag with revocationMetadata, including the txHash of the transaction that set the delegation as revoked (if available), and the timestamp (in seconds) at which the permission was marked as revoked in the database (which may be different from the time that it was revoked onchain).

References

Required by(Core): Attach metadata when submitting a revocation to the permission provider snap

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Introduces structured revocation tracking and on-chain verification, and decouples blockchain queries into a dedicated client.

  • Store revocation metadata: Replaces isRevoked with revocationMetadata (txHash?, recordedAt) in profile sync; adds legacy parsing for old isRevoked; updates filters to infer revoked via presence of revocationMetadata; renames updatePermissionRevocationStatus to markPermissionRevoked.
  • New BlockchainClient: Centralizes on-chain checks, including disabledDelegations(bytes32) and eth_getTransactionReceipt with retry logic; moves delegation check out of BlockchainTokenMetadataClient.
  • Revocation flow updates: submitRevocation now accepts optional txHash, verifies delegation is disabled and (if provided) receipt status is success before persisting revocationMetadata.
  • Validation and types: Adds TransactionReceipt zod schema and validators; extends revocation params to include optional txHash.
  • Wiring & tests: Wires BlockchainClient into index.ts and rpcHandler; adds/updates comprehensive unit tests for new flows and error handling.

Written by Cursor Bugbot for commit ca86387. This will update automatically on new commits. Configure here.

@V00D00-child V00D00-child marked this pull request as ready for review December 17, 2025 22:28
@V00D00-child V00D00-child requested a review from a team as a code owner December 17, 2025 22:28
Copy link
Contributor

@jeffsmale90 jeffsmale90 left a comment

Choose a reason for hiding this comment

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

A couple of general comments, and, I think a more architectural concern:

I think we should remove isRevoked from the stored permission, and use the existence of revocationMetadata to determine whether the permission is revoked to help improve data integrity.

… make txHash property optional on RevocationMetadata type
…ationMetadata to handle legacy data that was created before revocationMetadata was introduced
…egation disable and transaction receipt functions checks to BlockchainMetadataClient class
…etadata optional. Infer TransactionReceipt type from zTransactionReceipt
cursor[bot]

This comment was marked as outdated.

- remove isRevoked from stored permission schema, rely on the existence of revocation metadata
- parse legacy stored permission, inferring metadata
- add recordedAt timestamp to revocation metadata
@jeffsmale90 jeffsmale90 force-pushed the feat/store-metadata-when-revoking-permission branch from acdfdfd to 9e481b1 Compare January 21, 2026 05:07
Copy link

@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 2 potential issues.

@jeffsmale90 jeffsmale90 force-pushed the feat/store-metadata-when-revoking-permission branch from 9e481b1 to c42eb7b Compare January 21, 2026 05:49
- Use current timestamp for revocationMetadata recordedAt fields for permissions marked with legacy isRevoked
- removed an errant isRevoked: false that was included on a new permission object
@jeffsmale90 jeffsmale90 force-pushed the feat/store-metadata-when-revoking-permission branch from 91442fd to 4d2e396 Compare January 21, 2026 06:27
Copy link

@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.

github-merge-queue bot pushed a commit to MetaMask/core that referenced this pull request Jan 21, 2026
…provider snap (#7503)

## Explanation

This PR extends the `GatorPermissionsController` to pass the hash of the
transaction that revoked a permission (if available).

## References

Requires(gator snap): [feat: Store metadata when revoking a
permission](MetaMask/snap-7715-permissions#228)
Required by(MM client): [chore: Bump
@metamask/gator-permissions-controller to
0.9.0](MetaMask/metamask-extension#39076)

## Checklist

- [x] I've updated the test suite for new or updated code as appropriate
- [x] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [x] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs)
- [x] I've introduced [breaking
changes](https://github.com/MetaMask/core/tree/main/docs/breaking-changes.md)
in this PR and have prepared draft pull requests for clients and
consumer packages to resolve them




<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Introduces tx-aware revocations and related type/state updates.
> 
> - **BREAKING:** `submitRevocation` now sends `txHash` via
`RevocationParams`; stored permissions may include `revocationMetadata`
(exported types updated) in `types.ts` and `index.ts`
> - GatorPermissionsController: listens for `TransactionStatus`, skips
submit on non-confirmed/failed, passes confirmed `hash` to
`permissionsProvider_submitRevocation`, always refreshes permissions
after terminal states
> - Tests expanded to cover confirmed/failed paths and metadata
propagation; minor typing/utility refinements in
`decodePermission/utils` (explicit return types, generics)
> - Changelog updated; bumps `@metamask/transaction-controller`
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
7183271. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Jeff Smale <[email protected]>
MoMannn
MoMannn previously approved these changes Jan 21, 2026
MoMannn
MoMannn previously approved these changes Jan 21, 2026
Copy link

@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 2 potential issues.

Copy link

@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.

MoMannn
MoMannn previously approved these changes Jan 21, 2026
@jeffsmale90 jeffsmale90 force-pushed the feat/store-metadata-when-revoking-permission branch from b48ffe5 to ca86387 Compare January 21, 2026 17:08
Copy link

@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.

Copy link
Contributor

@jeffsmale90 jeffsmale90 left a comment

Choose a reason for hiding this comment

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

Looks good to me!

Copy link
Member Author

@V00D00-child V00D00-child left a comment

Choose a reason for hiding this comment

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

LGTM. I can't approve since I opened the PR

@jeffsmale90 jeffsmale90 merged commit 7893c26 into main Jan 21, 2026
16 checks passed
@jeffsmale90 jeffsmale90 deleted the feat/store-metadata-when-revoking-permission branch January 21, 2026 17:47
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.

6 participants