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

Re-use existing raw database code for the scanner, without splitting the state yet #8001

Closed
Tracked by #7728
teor2345 opened this issue Nov 26, 2023 · 1 comment · Fixed by #8002
Closed
Tracked by #7728
Assignees
Labels
A-blockchain-scanner Area: Blockchain scanner of shielded transactions A-state Area: State / database changes C-enhancement Category: This is an improvement

Comments

@teor2345
Copy link
Contributor

teor2345 commented Nov 26, 2023

Motivation

For a new database, we can re-use the existing state database code, and pass it a different state path and column family names.

We can use the existing binary serialization formats. Database lookups are fast. Concurrent writing just works.

Rough Design

Here's a rough sketch of the minimum necessary code changes:

  • Add db_path, db_version, and column_family_list arguments to ZebraDb::new()
  • For example, db_path is state for zebra-state, and could be private-scan for zebra-scan. The other arguments are existing constants.
  • Export ZebraDb from zebra-state

Rejected Alternatives

If we re-used the existing state database, we could add a new column family name, and we don't need to change the state path. But the results are harder to delete, because they are mixed with publicly available cached data. This is a security issue.

Related Work

Originally posted by @teor2345 in #7975 (reply in thread)

@mpguerra mpguerra added this to Zebra Nov 26, 2023
@github-project-automation github-project-automation bot moved this to 🆕 New in Zebra Nov 26, 2023
@teor2345 teor2345 self-assigned this Nov 26, 2023
@teor2345 teor2345 added C-enhancement Category: This is an improvement P-Medium ⚡ A-state Area: State / database changes A-blockchain-scanner Area: Blockchain scanner of shielded transactions labels Nov 26, 2023
@mpguerra
Copy link
Contributor

@teor2345 can you please add the estimate for this issue?

@mergify mergify bot closed this as completed in #8002 Nov 28, 2023
@github-project-automation github-project-automation bot moved this from 🆕 New to ✅ Done in Zebra Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-blockchain-scanner Area: Blockchain scanner of shielded transactions A-state Area: State / database changes C-enhancement Category: This is an improvement
Projects
Status: Done
2 participants