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 a scanning results reader #8104

Merged
merged 10 commits into from
Dec 14, 2023
Merged

Add a scanning results reader #8104

merged 10 commits into from
Dec 14, 2023

Conversation

upbqdn
Copy link
Member

@upbqdn upbqdn commented Dec 13, 2023

Motivation

So far, we have only used ldb to print the contents of the storage with the scanning results. Since the results contain only TXIDs, we couldn't straightforwardly tell much about their properties.

Depends-On: #8079.

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?

Solution

  • Add a separate binary into zebra-utils that prints Zebra's scanning results:

    1. Open Zebra's scanning storage and read the results containing scanning keys and TXIDs.
    2. Fetch the transactions by their TXIDs from Zebra using the getrawtransaction RPC.
    3. Decrypt the TX outputs using the corresponding scanning key.
    4. Print the memos in the outputs.
  • Add a tutorial describing how to use the tool.

Testing

I didn't add or change any tests.

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.

@upbqdn upbqdn added A-rust Area: Updates to Rust code P-Medium ⚡ A-blockchain-scanner Area: Blockchain scanner of shielded transactions labels Dec 13, 2023
@upbqdn upbqdn self-assigned this Dec 13, 2023
@upbqdn upbqdn requested a review from a team as a code owner December 13, 2023 20:33
@upbqdn upbqdn requested review from teor2345 and removed request for a team December 13, 2023 20:33
teor2345
teor2345 previously approved these changes Dec 13, 2023
Copy link
Contributor

@teor2345 teor2345 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

I wonder if we could move some of this code into scan.rs, or maybe a separate decrypt.rs module? I could imagine two APIs:

  • high-level: key string, transaction data bytes, Zebra network, height, returns Zebra typed memo data
  • low-level: zcash_primitives key type, transaction type, network, heights, returns raw or zcash_primitives memo data

This could happen in a separate ticket.

zebra-utils/Cargo.toml Outdated Show resolved Hide resolved
zebra-utils/Cargo.toml Outdated Show resolved Hide resolved
zebra-utils/README.md Outdated Show resolved Hide resolved
zebra-utils/src/bin/scanning-results-reader/main.rs Outdated Show resolved Hide resolved
zebra-utils/src/bin/scanning-results-reader/main.rs Outdated Show resolved Hide resolved
zebra-utils/src/bin/scanning-results-reader/main.rs Outdated Show resolved Hide resolved
zebra-utils/src/bin/scanning-results-reader/main.rs Outdated Show resolved Hide resolved
zebra-utils/src/bin/scanning-results-reader/main.rs Outdated Show resolved Hide resolved
zebra-utils/src/bin/scanning-results-reader/main.rs Outdated Show resolved Hide resolved
teor2345
teor2345 previously approved these changes Dec 13, 2023
Copy link
Contributor

@teor2345 teor2345 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to merge this now and do any other changes in another PR. Or do the changes here. Totally up to you!

@upbqdn
Copy link
Member Author

upbqdn commented Dec 14, 2023

I'd prefer to make the changes here. I should be done by tomorrow.

Copy link
Contributor

@teor2345 teor2345 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's go! Then we can do some cleanups later.

mergify bot added a commit that referenced this pull request Dec 14, 2023
@mergify mergify bot merged commit 8f090e6 into main Dec 14, 2023
154 checks passed
@mergify mergify bot deleted the add-scanning-results-reader branch December 14, 2023 23:19
@oxarbitrage oxarbitrage mentioned this pull request Jan 17, 2024
41 tasks
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-rust Area: Updates to Rust code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document how to run and query the results of the blockchain scanning MVP
3 participants