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

Register wallet data files component only if user has created wallets #20741

Merged
merged 4 commits into from
Nov 4, 2023

Conversation

yrliou
Copy link
Member

@yrliou yrliou commented Oct 30, 2023

Resolves brave/brave-browser#33757
Resolves brave/brave-browser#30940

This PR does following things:

  • For normal users without wallet: wallet data files won't be registered.
  • For first time wallet users, wallet data files component will be registered
    when Create/ResotreWallet and ImportFromExternalWallet APIs are called, the
    finish callback of these APIs won't be run until wallet data files component
    is ready and content is parsed into BlockchainRegistry.
  • For existing wallet users, the behavior is unchanged, wallet data files
    component will continue to be registered and parsed upon startup.
  • Remove json sanitization on JSON files from brave wallet data
    files component served via component updater which is considered trusted data.

Note that if the installation of component or parsing failed, we won't retry and will unblock the APIs without error in this case.

Submitter Checklist:

  • I confirm that no security/privacy review is needed and no other type of reviews are needed, or that I have requested them
  • 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 wiki
    • npm run lint, npm run presubmit wiki, 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:

Screenshots:

Android - Create Wallet Android - Restore Wallet
https://github.com/brave/brave-core/assets/24739341/3fe5936c-8f51-450f-96e8-9a92d2de4af5 https://github.com/brave/brave-core/assets/24739341/76d2a094-f5e4-4710-a52f-47b3fd12bc80

Create New Wallet

Screen.Recording.27.mov

Import From Existing Wallet

Screen.Recording.28.mov

Restore From Seed Phrase

Screen.Recording.29.mov

Test Plan:

  1. Start with a new user data dir folder (clean state), npm start -- --user_data_dir_name=PR20741 or run the executable with --user-data-dir=some_path. (Should see a welcome page when started)
  2. Go to brave://components, Brave Wallet data files should not present.
  3. Go to brave://wallet, create a new wallet
  4. Visit brave://wallet/crypto/portfolio/add-asset#available-assets, should see tokens, and Brave Wallet data files should present in brave://components
  5. Start with another new user data dir folder
  6. Go to brave://components, Brave Wallet data files should not present.
  7. Go to brave://wallet, import from an existing wallet to restore from seed phrase.
  8. Visit brave://wallet/crypto/portfolio/add-asset#available-assets, should see tokens, and Brave Wallet data files should present in brave://components

Also, do the similar steps for testing import from existing wallet like above video shows.

@yrliou yrliou added the CI/skip Do not run CI builds (except noplatform) label Oct 30, 2023
@yrliou yrliou force-pushed the wallet_perf branch 4 times, most recently from 4e433ef to 104816e Compare October 30, 2023 20:36
@yrliou yrliou changed the title [WIP] Register wallet data files only when wallets created [WIP] Register wallet data files component only if user has created wallets Oct 30, 2023
@yrliou yrliou self-assigned this Oct 30, 2023
@yrliou yrliou force-pushed the wallet_perf branch 2 times, most recently from 6233e43 to 2860903 Compare November 2, 2023 03:11
@yrliou yrliou changed the title [WIP] Register wallet data files component only if user has created wallets Register wallet data files component only if user has created wallets Nov 2, 2023
@yrliou yrliou removed the CI/skip Do not run CI builds (except noplatform) label Nov 2, 2023
@yrliou yrliou marked this pull request as ready for review November 2, 2023 03:13
@yrliou yrliou requested review from a team as code owners November 2, 2023 03:13
Copy link
Collaborator

@StephenHeaps StephenHeaps left a comment

Choose a reason for hiding this comment

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

iOS++.
Hit brave/brave-browser#34095 but also hit it on master so seems unrelated to this PR.

Copy link
Member

@SergeyZhukovsky SergeyZhukovsky left a comment

Choose a reason for hiding this comment

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

android part ++

@yrliou
Copy link
Member Author

yrliou commented Nov 3, 2023

Remove needs-security-review flag and those assignees due to base::Unretained(this) which is removed now.

Your wallet is restoring...
</message>
<message name="IDS_YOUR_WALLET_IS_CREATING_PAGE_TITLE" desc="Text for a spinner page title during Brave Wallet creating. It is not displayed anywhere" translateable="false">
Your wallet is creating...
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggestions: Your wallet is being created... or Creating your wallet...

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed to Your wallet is being created..., thanks.

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.

strings++

This PR does following things:
- For normal users without wallet: wallet data files won't be registered.
- For first time wallet users, wallet data files component will be registered
  when Create/ResotreWallet and ImportFromExternalWallet APIs are called, the
  finish callback of these APIs won't be run until wallet data files component
  is ready and content is parsed into BlockchainRegistry.
- For existing wallet users, the behavior is unchanged, wallet data files
  component will continue to be registered and parsed upon startup.
- Remove json sanitization on JSON files from brave wallet data
  files component served via component updater which is considered trusted data.
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++

@yrliou yrliou force-pushed the wallet_perf branch 3 times, most recently from 49f8b9b to 6e16623 Compare November 3, 2023 20:39
Douglashdaniel and others added 3 commits November 3, 2023 20:13
…Desktop

- The timing of registration is controlled by core backend
- Remove RegisterWalletDataFilesComponentOnDemand in Android
- Remove wallet_data_files_installer_android_util

Authored by @AlexeyBarabash:
- Added Android onboaring page fragment
- Removed unused staff around Android's percentage progress while download Wallet component
@yrliou yrliou merged commit 3ac15c7 into master Nov 4, 2023
15 checks passed
@yrliou yrliou deleted the wallet_perf branch November 4, 2023 04:43
@github-actions github-actions bot added CI/storybook-url Deploy storybook and provide a unique URL for each build feature/web3/wallet feature/web3/wallet/core labels Nov 4, 2023
@github-actions github-actions bot added this to the 1.62.x - Nightly milestone Nov 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI/storybook-url Deploy storybook and provide a unique URL for each build feature/web3/wallet/core feature/web3/wallet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Do not parse JSON files in wallet component if wallet isn't created Optimize json sanitizing in Wallet