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

Various reset wallet fixes #11669

Merged
merged 4 commits into from
Dec 28, 2021
Merged

Various reset wallet fixes #11669

merged 4 commits into from
Dec 28, 2021

Conversation

bbondy
Copy link
Member

@bbondy bbondy commented Dec 21, 2021

  • Adds an observer for the front end for when the wallet is reset. Tab reloads when that happens.
  • Gives a window.alert to tell the user the wallet was reset from settings
  • Resets various other controller state. Pref reset alone isn't enough unless the user restarts the browser.

Resolves brave/brave-browser#18997
Resolves brave/brave-browser#19703
Resolves brave/brave-browser#19844

Submitter Checklist:

  • I confirm that no security/privacy review is needed, or that I have requested one
  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • Squashed any review feedback or "fixup" commits before merge, so that history is a record of what happened in the repo, not your PR
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally: npm run test -- brave_browser_tests, npm run test -- brave_unit_tests, npm run lint, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed)

Reviewer Checklist:

  • A security review is not needed, or a link to one is included in the PR description
  • New files have MPL-2.0 license header
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Test Plan:

@bbondy bbondy force-pushed the reset-wallet branch 2 times, most recently from 4b69a0f to 3820bc8 Compare December 22, 2021 01:07
@AlexeyBarabash AlexeyBarabash marked this pull request as ready for review December 22, 2021 17:08
@AlexeyBarabash AlexeyBarabash requested review from a team as code owners December 22, 2021 17:08
Copy link
Collaborator

@mkarolin mkarolin left a comment

Choose a reason for hiding this comment

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

chromium_src change LGTM


auto* rpc_controller =
brave_wallet::RpcControllerFactory::GetControllerForContext(context);
rpc_controller->Reset();
Copy link
Contributor

Choose a reason for hiding this comment

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

is it ok that this call will fire FireNetworkChanged at same time when service and keyring controller will be dropped ? maybe make a single entry point and subscribe to KeyringResetFired instead of consecutive calls call?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes I want FireNetworkChanged to be called in particular because there are some members of eth_tx_state_manager.cc needs to have that event to reset properly.

@@ -124,6 +124,10 @@ handler.on(WalletActions.keyringRestored.getType(), async (store) => {
await refreshWalletInfo(store)
})

handler.on(WalletActions.keyringReset.getType(), async (store) => {
window.location.reload()
Copy link
Contributor

@spylogsster spylogsster Dec 23, 2021

Choose a reason for hiding this comment

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

should we also make getAPIProxy().braveWalletService.reset() call inside this function?

Copy link
Member Author

Choose a reason for hiding this comment

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

No the reset is initiated by the settings page, this just listens to when it is reset so it can reload the page to show the create form again. It was easier than trying to reset all of the redux state and works fine.

@bbondy bbondy merged commit be24026 into master Dec 28, 2021
@bbondy bbondy deleted the reset-wallet branch December 28, 2021 17:13
@bbondy bbondy added this to the 1.35.x - Nightly milestone Dec 28, 2021
bbondy added a commit that referenced this pull request Jan 6, 2022
This reverts commit be24026, reversing
changes made to c1721b6.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants