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

Create a "feathered" wrapper around shardtree to enable tracking witnesses for multiple candidate chains #1367

Open
str4d opened this issue Apr 24, 2024 · 0 comments
Labels
A-wallet Area: light wallet backend.

Comments

@str4d
Copy link
Contributor

str4d commented Apr 24, 2024

As part of enabling wallets to track multiple candidate chain tips (instead of implementing rewind logic for reorgs), it is necessary to track multiple alternative evolutions of the commitment trees in order to enable building witnesses at any candidate chain tip.

Currently zcash_client_* use the shardtree crate to manage a single datastructure for tracking all information about a wallet's notes. It includes checkpoint infrastructure to enable rewinding state.

The proposal in this issue is to transition to using shardtree to represent the stable base of the tree (for which we, along with zebrad, assume there is a single canonical chain), and then as a layer on top of that we track the commitment data for the last 100 blocks for all candidate chains that are observed. This layer would combine that information with the shardtree data to enable a caller to obtain witnesses for tracked notes anywhere within any of the tracked candidate chains.

Unlike zebrad, the data in shardtree would not be immutable; due to its structure mutations would occur as a side-effect of non-linear scanning, and we also want the capability to import new viewing keys. But semantically it would only be responsible for tracking data obtained from a chain that itself is treated as immutable.

The shardtree checkpoint infrastructure would then be repurposed for enabling old anchors within the stable chain section to be used for witness generation (which can be useful when a wallet has been offline for a long time, or when doing a rescan to import a new viewing key).

@str4d str4d added the A-wallet Area: light wallet backend. label Apr 24, 2024
@daira daira added this to the Zcashd wallet replacement milestone May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-wallet Area: light wallet backend.
Projects
None yet
Development

No branches or pull requests

2 participants