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

Fix NOTREACHED_IN_MIGRATION for wallet #26380

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

supermassive
Copy link
Collaborator

Resolves

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 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:

Test Plan:

Copy link
Contributor

github-actions bot commented Nov 6, 2024

[puLL-Merge] - brave/brave-core@26380

Description

This PR makes several changes across the Brave Wallet codebase, primarily focused on improving error handling, removing deprecated code, and enhancing type safety. The changes include replacing NOTREACHED_IN_MIGRATION with NOTREACHED, updating function signatures to use std::optional, and refactoring some conditional logic.

Changes

Changes

  1. browser/brave_wallet/brave_wallet_ethereum_chain_browsertest.cc:

    • Replaced NOTREACHED_IN_MIGRATION() with NOTREACHED()
  2. browser/brave_wallet/brave_wallet_service_unittest.cc:

    • Updated function signatures to use std::optional<ImportError> instead of ImportError
    • Changed ImportError::kNone to std::nullopt
  3. browser/brave_wallet/external_wallets_importer.cc:

    • Fixed typos in comments
    • Replaced NOTREACHED_IN_MIGRATION() with NOTREACHED()
    • Updated function signature to use std::optional<ImportError>
  4. browser/brave_wallet/external_wallets_importer.h:

    • Updated function signature to use std::optional<ImportError>
  5. browser/brave_wallet/external_wallets_importer_unittest.cc:

    • Updated test cases to use std::optional<ImportError>
  6. browser/ui/webui/brave_wallet/android/android_wallet_page_ui.cc:

    • Removed unnecessary conditional and NOTREACHED_IN_MIGRATION() call
  7. browser/ui/webui/settings/brave_wallet_handler.cc:

    • Replaced custom enum value checking with brave_wallet::mojom::IsKnownEnumValue()
  8. components/brave_wallet/browser/account_discovery_manager.cc:

    • Replaced NOTREACHED_IN_MIGRATION() with NOTREACHED()
  9. components/brave_wallet/browser/bitcoin/bitcoin_hd_keyring.cc:

    • Replaced NOTREACHED_IN_MIGRATION() with NOTIMPLEMENTED()
  10. components/brave_wallet/browser/bitcoin/bitcoin_serializer.cc:

    • Replaced NOTREACHED_IN_MIGRATION() with NOTREACHED()
  11. components/brave_wallet/browser/bitcoin/bitcoin_test_utils.cc:

    • Replaced NOTREACHED_IN_MIGRATION() with NOTREACHED()
  12. components/brave_wallet/browser/bitcoin/bitcoin_wallet_service.cc:

    • Replaced NOTREACHED_IN_MIGRATION() with error handling
  13. components/brave_wallet/browser/brave_wallet_p3a.cc:

    • Added missing default cases in switch statements
  14. components/brave_wallet/browser/brave_wallet_service.cc:

    • Updated function signatures and logic to use std::optional<ImportError>
  15. components/brave_wallet/browser/brave_wallet_service.h:

    • Updated function signature to use std::optional<ImportError>
  16. components/brave_wallet/browser/brave_wallet_service_delegate.h:

    • Updated function signature to use std::optional<ImportError>
  17. components/brave_wallet/browser/brave_wallet_utils.cc:

    • Replaced NOTREACHED_IN_MIGRATION() with NOTREACHED()
  18. components/brave_wallet/browser/brave_wallet_utils_unittest.cc:

    • Updated test case to expect a specific death message
  19. components/brave_wallet/browser/ens_resolver_task.h:

    • Replaced NOTREACHED_IN_MIGRATION() with NOTREACHED()
  20. components/brave_wallet/browser/eth_data_builder.cc:

    • Replaced NOTREACHED_IN_MIGRATION() with NOTREACHED()
  21. components/brave_wallet/browser/ethereum_provider_impl.cc:

    • Replaced NOTREACHED_IN_MIGRATION() with NOTREACHED()
  22. components/brave_wallet/browser/fil_tx_manager.cc:

    • Removed unnecessary NOTREACHED_IN_MIGRATION() call
  23. components/brave_wallet/browser/filecoin_keyring.cc:

    • Replaced NOTREACHED_IN_MIGRATION() with NOTREACHED()
  24. components/brave_wallet/browser/hd_keyring.cc:

    • Replaced NOTREACHED_IN_MIGRATION() with NOTREACHED()
  25. components/brave_wallet/browser/json_rpc_service.cc:

    • Replaced NOTREACHED_IN_MIGRATION() with NOTREACHED()
    • Improved error handling in GetBalance function
  26. components/brave_wallet/browser/keyring_service.cc:

    • Replaced NOTREACHED_IN_MIGRATION() with NOTREACHED() or removed unnecessary checks
  27. components/brave_wallet/browser/keyring_service_migrations.cc:

    • Removed unnecessary NOTREACHED_IN_MIGRATION() calls
  28. components/brave_wallet/browser/network_manager.cc:

    • Replaced NOTREACHED_IN_MIGRATION() with NOTREACHED()
  29. components/brave_wallet/browser/sns_resolver_task.cc:

    • Replaced NOTREACHED_IN_MIGRATION() with error handling
  30. components/brave_wallet/browser/sns_resolver_task.h:

    • Replaced NOTREACHED_IN_MIGRATION() with NOTREACHED()
  31. components/brave_wallet/browser/solana_instruction_data_decoder.cc:

    • Replaced NOTREACHED_IN_MIGRATION() with NOTREACHED()
  32. components/brave_wallet/browser/solana_provider_impl.cc:

    • Replaced NOTREACHED_IN_MIGRATION() with NOTREACHED()
    • Improved error handling in OnConnect function
  33. components/brave_wallet/browser/test_utils.cc:

    • Replaced NOTREACHED_IN_MIGRATION() with NOTREACHED()
  34. components/brave_wallet/browser/wallet_data_files_installer_unittest.cc:

    • Updated test case to use std::optional<ImportError>
  35. components/brave_wallet/browser/zcash/zcash_serializer.cc:

    • Refactored blake2b256 function to use CHECK instead of NOTREACHED_IN_MIGRATION()
    • Removed unnecessary error checks
  36. components/brave_wallet/common/brave_wallet_types.h:

    • Removed kNone from ImportError enum
  37. components/brave_wallet/common/common_utils.cc:

    • Replaced NOTREACHED_IN_MIGRATION() with NOTREACHED()
  38. components/brave_wallet/common/fil_address.cc:

    • Replaced NOTREACHED_IN_MIGRATION() with NOTREACHED()
  39. components/brave_wallet/renderer/js_ethereum_provider.cc:

    • Removed unnecessary NOTREACHED_IN_MIGRATION() calls
    • Improved conditional logic in Install function
  40. renderer/brave_wallet/brave_wallet_render_frame_observer.cc:

    • Replaced NOTREACHED_IN_MIGRATION() with NOTREACHED()

Possible Issues

  • The removal of some error checks in the zcash_serializer.cc file might potentially lead to silent failures if the underlying crypto functions encounter errors.

Security Hotspots

None identified. The changes primarily focus on error handling and code cleanup, which should not introduce new security vulnerabilities.

@supermassive supermassive force-pushed the fix_wallet_not_reached_in_migration branch from af5acea to 709f8be Compare November 6, 2024 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant