-
-
Notifications
You must be signed in to change notification settings - Fork 203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plan Merge EthKeyringController
with KeyringController
#2043
Labels
Comments
We should come up with a strategy here to figure out best plan forward and then estimate. We can convert this ticket to be to determine the plan. |
desi
changed the title
Consider merging
Merge Jan 3, 2024
EthKeyringController
with KeyringController
EthKeyringController
with KeyringController
desi
changed the title
Merge
Plan Merge Jan 4, 2024
EthKeyringController
with KeyringController
EthKeyringController
with KeyringController
Plan added to main comment |
The following action point:
Has been removed, as it will be difficult to move PRs across repos. We'll have to close (or land) any PR that is currently open on EthKeyringController as a prerequisite for the merge. |
Looks good to me! |
This was referenced Jan 11, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What is this about?
Historically, the
KeyringController
(@metamask/keyring-controller
) andEthKeyringController
(@metamask/eth-keyring-controller
) were designed to cater to different clients, each with its own set of similar, yet not identical features, such as encryption mechanisms, supported keyrings, and business logic.Over recent quarters, we've undertaken a significant overhaul of the
KeyringController
's API, enabling it to accommodate both sets of clients. As a result, theEthKeyringController
has transitioned to a role where it operates as an internal component within theKeyringController
.Given the blurred lines of responsibility between the two controllers, and their shared management of the same state, it's becoming evident that the
EthKeyringController
functions more like an internal module of theKeyringController
. It specifically manages certain aspects of the logic that theKeyringController
's API presents.With this in mind, it seems possible (if not necessary) to consider the fusion of these two entities into a single, unified controller. This integrated controller would retain the
KeyringController
's API and name, thereby allowing for a seamless transition for clients.Such a consolidation would significantly streamline complexity and reduce the overhead associated with maintenance, simultaneously paving the way for more efficient and targeted future API enhancements (like, for example, the Keyring API consolidation).
To visualize it
The Past
The Present
The Future
Nice! What are we waiting for?
Prerequisite assumptions
Without these assumptions, this plan should be considered blocked
How should the resulting controller look like?
Constructor & Class properties
KeyringController.#keyring
will have to be removed, andEthKeyringController.keyrings
should be moved toKeyringController.#keyrings
EthKeyringController.#cacheEncryptionKey
and.#encryptor
should be moved toKeyringController.#cacheEncryptionKey
and.#encryptor
Controller State & Messenger
State
(same as current KeyringController)
Events
(same as current KeyringController)
Actions
(same as current KeyringController)
Public Methods
fullUpdate
): we can remove this logic completely, as the resulting single controller will have a single state, and all external clients can use the KeyringController messenger to subscribe to state updatesThe resulting API should look like this:
(same as current KeyringController)
Types & Utils
@metamask/keyring-controller
packageTests
The starting point of the controllers is not bad in terms of test coverage, but when porting the logic of EthKeyringController’s methods into KeyringController’s one, there will be a significant drop: we’ll have to compensate that, adding new test cases where necessary (porting EthKeyringController’s tests when possible)
Additional Notes
createNewVaultAndKeyring
andcreateNewVaultAndRestore
are being unified on EthKeyringController (potentially also on KeyringController)How can we do this?
Action items (Potential PRs/Issues)
EthKeyringController
intoKeyringController
#3766KeyringController
test coverage to 100% #3767EthKeyringController
as in Maintenance #3768The text was updated successfully, but these errors were encountered: