-
-
Notifications
You must be signed in to change notification settings - Fork 225
perf(keyring-controller): do not fire unnecessary :stageChange
in withKeyring
#5732
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
Conversation
ba27fd6
to
f603e07
Compare
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions.
|
Co-authored-by: Michele Esposito <[email protected]>
this.#assertIsUnlocked(); | ||
return this.#persistOrRollback(async () => true); | ||
return this.#withRollback(async () => { | ||
this.#assertIsUnlocked(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that I suggested to place the assertion after acquiring the mutex on purpose: I think we should change all the other ones as well (in another PR)
#5757
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions.
|
## **Description** > [!CAUTION] > Requires this PR to be merged first: > - [x] #14913 Upgrade controllers to use the new accounts perf improvements, notably: - MetaMask/core#5735 - MetaMask/core#5732 - MetaMask/core#5714 ## **Related issues** N/A ## **Manual testing steps** 1. Create a Solana account 2. It should run faster ## **Screenshots/Recordings** ### **Before** ### **After** ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **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.
Explanation
We were always calling
#updateVault
when usingwithKeyring
even when the keyring was not mutated.This PR now compare the states after the operation execution and see if the keyring got updated or not and decide to call
#updateVault
only if needed.Testing PR:
References
N/A
Changelog
N/A
Checklist