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

Upgrade ZCashOrchardStorage for shard tree purposes #26534

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

Conversation

cypt4
Copy link
Collaborator

@cypt4 cypt4 commented Nov 13, 2024

Resolves brave/brave-browser#42281

Part of #26477

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

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

Description

This PR introduces significant changes to the ZCash Orchard implementation in the Brave Wallet. It expands and refines the data structures and functionality related to Orchard notes, shards, checkpoints, and the commitment tree. The changes aim to improve the handling of ZCash transactions, particularly in the Orchard protocol.

Changes

Changes

  1. components/brave_wallet/browser/internal/orchard_block_scanner.cc:

    • Changed OrchardNullifier to OrchardNoteSpend in the Result struct.
    • Updated the ScanBlocks method to use OrchardNoteSpend instead of OrchardNullifier.
  2. components/brave_wallet/browser/internal/orchard_block_scanner.h:

    • Updated the Result struct to use OrchardNoteSpend instead of OrchardNullifier.
  3. components/brave_wallet/browser/zcash/rust/orchard_block_decoder_impl.cc:

    • Updated the OrchardNote creation to include additional fields.
  4. components/brave_wallet/browser/zcash/zcash_orchard_storage.cc:

    • Added new methods for handling shards, checkpoints, and tree states.
    • Updated existing methods to work with the new data structures.
    • Implemented database operations for the new features.
  5. components/brave_wallet/browser/zcash/zcash_orchard_storage.h:

    • Added new methods and structures for managing shards, checkpoints, and tree states.
    • Updated existing method signatures to work with the new data structures.
  6. components/brave_wallet/common/zcash_utils.cc and components/brave_wallet/common/zcash_utils.h:

    • Added new structures and methods for Orchard notes, shards, checkpoints, and tree states.
    • Implemented serialization and deserialization methods for these structures.
  7. Various test files:

    • Updated tests to work with the new data structures and methods.

Possible Issues

  1. The changes are extensive and may require thorough testing to ensure all parts of the system work correctly with the new data structures.
  2. There might be performance implications due to the increased complexity of data structures and database operations.

Security Hotspots

  1. The handling of nullifiers and note spends has changed. Ensure that this doesn't introduce any vulnerabilities in tracking spent notes.
  2. The new checkpoint and shard management system should be carefully reviewed to ensure it doesn't allow for any manipulation of the commitment tree state.

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.

[ZCash] ZCashOrchardStorage upgrade for shard tree
1 participant