Skip to content
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

Add addNewAccountWithoutUpdate method #288

Merged
merged 1 commit into from
Oct 22, 2020

Conversation

rickycodes
Copy link
Member

@rickycodes rickycodes commented Oct 13, 2020

This adds a new method for adding accounts without updating identities in the preferences controller

this is currently being used in MetaMask/metamask-mobile#1879

@rickycodes rickycodes requested a review from a team as a code owner October 13, 2020 20:44
estebanmino
estebanmino previously approved these changes Oct 13, 2020
Copy link
Contributor

@estebanmino estebanmino left a comment

Choose a reason for hiding this comment

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

LGTM!

estebanmino
estebanmino previously approved these changes Oct 14, 2020
Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

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

This approach would certainly work, but it is a departure from how the rest of the methods in this controller are designed. In the rest of the methods, all of the required "side-effects" of the action are handled as part of the same function. This controller was a port of various functions in the extension that are directly in metamask-controller.js that interact with the underlying eth-keyring-controller library that both projects use.

So to stay in line with existing patterns, the natural place to find and add new accounts would be during createVaultAndRestore, which is where it's done in the extension. So instead of adding this new method, you'd move this detect-and-add-accounts logic from MetaMask/metamask-mobile#1879 into this controller instead.

I don't feel strongly either way about this so I won't block on it, but because this was how it was done before I thought it should be considered.

@Gudahtt
Copy link
Member

Gudahtt commented Oct 21, 2020

I see that createNewVaultAndRestore is used in a few places where new-account-detection would be undesired (e.g. upon changing your password), so maybe putting the logic there is less than ideal.

Maybe there should be two methods - createNewVaultAndRestore for this, and recreateVault for re-creating a vault with the same contents? 🤷 I think all of the uses are one of these two cases.

This might be a good idea for the extension as well 🤔

@rickycodes rickycodes marked this pull request as draft October 21, 2020 21:10
@rickycodes rickycodes marked this pull request as ready for review October 22, 2020 16:55
@rickycodes rickycodes merged commit b7e3316 into develop Oct 22, 2020
@rickycodes rickycodes deleted the feature/add-new-account-without-update branch October 22, 2020 17:14
MajorLift pushed a commit that referenced this pull request Oct 11, 2023
MajorLift pushed a commit that referenced this pull request Oct 11, 2023
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