-
Notifications
You must be signed in to change notification settings - Fork 896
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
[ZCash] Implement ShardTree sync process #27255
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++ Wallet Front-end
A Storybook has been deployed to preview UI for the latest push |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wallet core lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iOS++
[puLL-Merge] - brave/brave-core@27255 DescriptionThis pull request introduces significant changes to the ZCash wallet implementation in the Brave Core, focusing on enhancing the Orchard protocol support and improving synchronization mechanisms. The changes include new tasks for scanning blocks, verifying chain state, and managing sync operations more efficiently. Possible Issues
Security Hotspots
ChangesChanges
sequenceDiagram
participant User
participant ZCashWalletService
participant ZCashShieldSyncService
participant ZCashScanBlocksTask
participant ZCashBlocksBatchScanTask
participant ZCashVerifyChainStateTask
participant OrchardSyncState
participant ZCashRPC
User->>ZCashWalletService: StartShieldSync
ZCashWalletService->>ZCashShieldSyncService: Create & Start
ZCashShieldSyncService->>ZCashVerifyChainStateTask: Create & Start
ZCashVerifyChainStateTask->>OrchardSyncState: GetAccountMeta
ZCashVerifyChainStateTask->>ZCashRPC: GetLatestBlock
ZCashVerifyChainStateTask->>ZCashRPC: GetTreeState
ZCashVerifyChainStateTask-->>ZCashShieldSyncService: Chain State Verified
ZCashShieldSyncService->>ZCashScanBlocksTask: Create & Start
loop Scanning Blocks
ZCashScanBlocksTask->>ZCashBlocksBatchScanTask: Create & Start
ZCashBlocksBatchScanTask->>ZCashRPC: GetCompactBlocks
ZCashBlocksBatchScanTask->>OrchardSyncState: ApplyScanResults
ZCashBlocksBatchScanTask-->>ZCashScanBlocksTask: Batch Complete
end
ZCashScanBlocksTask-->>ZCashShieldSyncService: Scanning Complete
ZCashShieldSyncService-->>ZCashWalletService: Sync Status Update
ZCashWalletService-->>User: Sync Complete
|
Released in v1.76.21 |
Part of #27018
Implements shard tree state sync process.
Entry point for the sync process is the per-account ZCashShieldSyncService class.
Sync process includes:
Verifying chain state. In some cases chain reorg may happen so we need to check whether latest scanned block hash hasn't been changed. Otherwise we need to clean OrchardStorage to remove notes, nullifiers and commitments that are not valid.
Preparing a set of scan ranges to scan. Each scan range ends with updating of OrchardSyncState with the discovered data.
Scanning ranges one-by-one. This includes reading compact blocks from the gRPC node and extracting related incoming notes and nullifiers for spends along with a set of commitment tree leafs to be inserted to the shard tree in the future. Extracting is done on a separate sequence. This is done using OrchardBlockScanner class.
Inserting extracted leafs to the shard tree(OrchardSyncState::ApplyScanResults).
Submitter Checklist:
QA/Yes
orQA/No
;release-notes/include
orrelease-notes/exclude
;OS/...
) to the associated issuenpm run test -- brave_browser_tests
,npm run test -- brave_unit_tests
wikinpm run presubmit
wiki,npm run gn_check
,npm run tslint
git rebase master
(if needed)Reviewer Checklist:
gn
After-merge Checklist:
changes has landed on
Test Plan: