Skip to content

chore: Remove storage functionality from Delegation Controller#8330

Open
jeffsmale90 wants to merge 6 commits intomainfrom
chore/remove-delegation-storage
Open

chore: Remove storage functionality from Delegation Controller#8330
jeffsmale90 wants to merge 6 commits intomainfrom
chore/remove-delegation-storage

Conversation

@jeffsmale90
Copy link
Copy Markdown
Contributor

@jeffsmale90 jeffsmale90 commented Mar 29, 2026

Explanation

Delegation "storage" was added the the Delegation Controller to support Remote Mode. Because this feature is no longer in development, the storage functionality is not used.

This PR removes entirely the storage functionality from the controller.

Background

#8286 aimed to migrate code from clients into the controller, but as this storage functionality is unused, it was decided to remove the functionality completely. Followup PRs will be opened in the clients to update the controller, and remove the remaining boilerplate, including awaitDeleteDelegationEntry function.

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
Breaking change: removes persisted delegations state plus the store/list/retrieve/chain/delete public APIs and related messenger action types, so downstream clients depending on them will fail to compile or lose behavior. Functional risk is otherwise contained since signing (signDelegation) remains unchanged aside from dropping AccountsController integration.

Overview
Refactors @metamask/delegation-controller into a signing-only controller by removing the persisted delegations state and deleting the storage/query APIs (store, list, retrieve, chain, delete) along with their exported messenger action types.

This also removes the package’s dependency on @metamask/accounts-controller (and related tsconfig refs), simplifies controller metadata/state to an empty object, and updates tests/docs/changelog/eslint suppressions accordingly.

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

@jeffsmale90 jeffsmale90 force-pushed the chore/remove-delegation-storage branch from bcb656a to b21d0a3 Compare March 30, 2026 00:23
@jeffsmale90 jeffsmale90 force-pushed the chore/remove-delegation-storage branch from b21d0a3 to 435164c Compare March 30, 2026 00:41
@jeffsmale90 jeffsmale90 marked this pull request as ready for review March 30, 2026 00:41
@jeffsmale90 jeffsmale90 requested review from a team as code owners March 30, 2026 00:41
mj-kiwi
mj-kiwi previously approved these changes Mar 31, 2026
Copy link
Copy Markdown

@mj-kiwi mj-kiwi left a comment

Choose a reason for hiding this comment

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

LGTM

@cryptodev-2s
Copy link
Copy Markdown
Contributor

cryptodev-2s commented Mar 31, 2026

This controller is now becoming stateless, should we make it a service instead ? we may want to just mark this controller as deprecated and create a new service instead. (then we just archive it one it's replaced in clients ?)

@jeffsmale90
Copy link
Copy Markdown
Contributor Author

This controller is now becoming stateless, should we make it a service instead ? we may want to just mark this controller as deprecated and create a new service instead. (then we just archive it one it's replaced in clients ?)

@cryptodev-2s we are likely going to re-centralise a generalised storage into this controller, so it's stateless for now, but will not be for ever.

If we end up not doing that, I think we can refactor to a service.

- from tsconfig files
- from README.md
- trim whitespace
- reordered changelog sections
@jeffsmale90 jeffsmale90 force-pushed the chore/remove-delegation-storage branch from 65e4314 to 3b0f67f Compare April 7, 2026 02:33
- **BREAKING:** Remove persisted `delegations` state ([#8330](https://github.com/MetaMask/core/pull/8330))
- `store`, `list`, `retrieve`, `chain`, and `delete` methods (and related messenger action types)
- `DelegationEntry` type export
- Remove dependency on `@metamask/accounts-controller`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit: We should consider adding in the changelog that clients should not anymore delegate AccountsController:getSelectedAccount to the messenger controller.
Good to go if you're planning to update the clients soon.

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.

3 participants