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

Add utxo_by_transparent_addr_loc index to the finalized state #3953

Closed
6 of 7 tasks
Tracked by #3134
teor2345 opened this issue Mar 24, 2022 · 0 comments · Fixed by #3999
Closed
6 of 7 tasks
Tracked by #3134

Add utxo_by_transparent_addr_loc index to the finalized state #3953

teor2345 opened this issue Mar 24, 2022 · 0 comments · Fixed by #3999
Assignees
Labels
A-state Area: State / database changes C-enhancement Category: This is an improvement lightwalletd any work associated with lightwalletd

Comments

@teor2345
Copy link
Contributor

teor2345 commented Mar 24, 2022

Motivation

We want to answer transparent address RPCs quickly, so we need new indexes in the finalized state.

Designs

utxo_by_transparent_addr_loc stores unspent transparent output locations by address. UTXO locations are appended by each block.

This list includes the AddressLocation, if it has not been spent.

When a block write deletes a UTXO from utxo_by_out_loc, that UTXO location should be deleted from utxo_by_transparent_addr_loc. The OutputLocations are in order, so the deleted UTXO can be removed efficiently. This is an index optimisation, which does not affect query results. It also simplifies the lookup code.

Types

AddressLocation: the first OutputLocation used by a transparent::Address. Always has the same value for each address, even if the first output is spent.

https://github.com/ZcashFoundation/zebra/blob/main/book/src/dev/rfcs/0005-state-updates.md#rocksdb-data-structures

Tasks

Implementation:

  • Add the new column family to the finalized state
  • When a block write deletes a UTXO, also delete it from the column family
  • Query the finalized index in the ReadRequest for ReadState, if it has already been implemented in:
  • Increment the database version

Testing:

  • Update raw data snapshot tests
  • Add struct data snapshot tests

CI:

  • If you added new Rust module files, make sure the paths in the regenerate state job are up to date
@teor2345 teor2345 added C-enhancement Category: This is an improvement S-needs-triage Status: A bug report needs triage A-state Area: State / database changes lightwalletd any work associated with lightwalletd labels Mar 24, 2022
@teor2345 teor2345 self-assigned this Mar 29, 2022
@ftm1000 ftm1000 removed the S-needs-triage Status: A bug report needs triage label Apr 11, 2022
@mergify mergify bot closed this as completed in #3999 Apr 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-state Area: State / database changes C-enhancement Category: This is an improvement lightwalletd any work associated with lightwalletd
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants