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

change(scan): Store one transaction ID per database row, to make queries easier #8062

Merged
merged 8 commits into from
Dec 6, 2023

Conversation

teor2345
Copy link
Contributor

@teor2345 teor2345 commented Dec 6, 2023

Motivation

We want technical users to be able to use ldb to query the scanner database. This means we need one transaction ID per row.

Close #8050.

PR Author Checklist

Check before marking the PR as ready for review:

  • Will the PR name make sense to users?
  • Does the PR have a priority label?
  • Have you added or updated tests?
  • Is the documentation up to date?

There is already a summary for this project in the changelog.

If a checkbox isn't relevant to the PR, mark it as done.

Complex Code or Requirements

This changes the format from:
ScannerKey | Height -> Vec<transaction::Hash> to:
ScannerKey | Height | TransactionIndex -> Option<transaction::Hash>.

None can be used to represent birthday heights and scanner progress in #8022.

This format isn't ideal, because handing None is harder to code and review. We can change it to use a custom enum later, or track keys, birthdays, and progress in a separate column family. But that's for after the MVP.

Solution

  • Change the scanner database format (see above)
  • Change the serialization formats
  • Update the major version to 1
  • Update format docs

Testing

I updated the existing tests where needed, and they pass.

Review

This is blocking finishing off the scanner, so it seems like a high priority for review.

Reviewer Checklist

Check before approving the PR:

  • Does the PR scope match the ticket?
  • Are there enough tests to make sure it works? Do the tests cover the PR motivation?
  • Are all the PR blockers dealt with?
    PR blockers can be dealt with in new tickets or PRs.

And check the PR Author checklist is complete.

Follow Up Work

@teor2345 teor2345 added C-enhancement Category: This is an improvement P-High 🔥 I-usability Zebra is hard to understand or use A-blockchain-scanner Area: Blockchain scanner of shielded transactions labels Dec 6, 2023
@teor2345 teor2345 self-assigned this Dec 6, 2023
@teor2345 teor2345 requested a review from a team as a code owner December 6, 2023 00:54
@teor2345 teor2345 requested review from oxarbitrage and removed request for a team December 6, 2023 00:54
@github-actions github-actions bot added the C-trivial Category: A trivial change that is not worth mentioning in the CHANGELOG label Dec 6, 2023
@teor2345 teor2345 changed the title Upgrade the scanner database major version to 1 change(scan): Store one transaction ID per database row, to make queries easier Dec 6, 2023
@mergify mergify bot merged commit 36f2263 into main Dec 6, 2023
128 checks passed
@mergify mergify bot deleted the scan-db-tx-row branch December 6, 2023 17:34
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 C-enhancement Category: This is an improvement C-trivial Category: A trivial change that is not worth mentioning in the CHANGELOG I-usability Zebra is hard to understand or use
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change scanner database format so it is easier for users to query for transaction IDs
2 participants