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(grpc): get_results #8255

Merged
merged 3 commits into from
Feb 9, 2024
Merged

add(grpc): get_results #8255

merged 3 commits into from
Feb 9, 2024

Conversation

oxarbitrage
Copy link
Contributor

Motivation

We want a grpc method to get all results for a given set of keys.

Close #8163

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 get_results grpc method to return all results for given keys.

Testing

Manual testing. Output in PR comment.

Review

Anyone can 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

  • Depending on the key, the amount of returned transactions can be huge. We need to query by height range and limit the number of returned results. Extend getresults grpc #8233
  • Tests

@oxarbitrage oxarbitrage added A-rpc Area: Remote Procedure Call interfaces A-blockchain-scanner Area: Blockchain scanner of shielded transactions P-Medium ⚡ labels Feb 9, 2024
@oxarbitrage oxarbitrage requested a review from a team as a code owner February 9, 2024 13:36
@oxarbitrage oxarbitrage requested review from upbqdn and removed request for a team February 9, 2024 13:36
@oxarbitrage
Copy link
Contributor Author

I am calling get_results with the zecpages viewing key for testing. Before the key has transactions the results are null, then i called get_results when the scanner was at 1020000:

2024-02-09T13:19:40.797981Z  INFO {zebrad="2c0bc3a" net="Main"}: zebra_scan::service::scan_task::scan: Scanning the blockchain for key 0, started at block 1017001, now at block 1020000, current tip 2396031

Obtaining results:

$ grpcurl -plaintext -import-path ./proto -proto scanner.proto -d '{"keys": ["zxviews1q0duytgcqqqqpqre26wkl45gvwwwd706xw608hucmvfalr759ejwf7qshjf5r9aa7323zulvz6plhttp5mltqcgs9t039cx2d09mgq05ts63n8u35hyv6h9nc9ctqqtue2u7cer2mqegunuulq2luhq3ywjcz35yyljewa4mgkgjzyfwh6fr6jd0dzd44ghk0nxdv2hnv4j5nxfwv24rwdmgllhe0p8568sgqt9ckt02v2kxf5ahtql6s0ltjpkckw8gtymxtxuu9gcr0swvz"]}' '127.0.0.1:8231' scanner.Scanner/GetResults
{
  "results": {
    "zxviews1q0duytgcqqqqpqre26wkl45gvwwwd706xw608hucmvfalr759ejwf7qshjf5r9aa7323zulvz6plhttp5mltqcgs9t039cx2d09mgq05ts63n8u35hyv6h9nc9ctqqtue2u7cer2mqegunuulq2luhq3ywjcz35yyljewa4mgkgjzyfwh6fr6jd0dzd44ghk0nxdv2hnv4j5nxfwv24rwdmgllhe0p8568sgqt9ckt02v2kxf5ahtql6s0ltjpkckw8gtymxtxuu9gcr0swvz": {
      "transactions": {
        "780532": {
          "hash": [
            "1c519cb72bc20d024f9c0954178403d16fac7ce8db594ac60db76213e6c8826b"
          ]
        },
        "780616": {
          "hash": [
            "9ef232c16b791e5c13c067115776dcfa1544b1830401af1c282886ca6395679e"
          ]
        },
...
        "1019617": {
          "hash": [
            "7b9899f9a92cbeeb26d75434b756ba6b6e1164a1f0e2321e0438cebdc34fe8ea"
          ]
        },
        "1020152": {
          "hash": [
            "7df21d5d054b7c481fd7a4a9cd104c441dbc261b463c448458877b64352d1b89"
          ]
        },
        "1020614": {
          "hash": [
            "79a5f3dd7e2e2793a04691e4f4e52442efc269c03c8daf605b572145682140ff"
          ]
        }
      }
    }
  }
}

Copy link
Contributor

@arya2 arya2 left a comment

Choose a reason for hiding this comment

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

Looks good!

mergify bot added a commit that referenced this pull request Feb 9, 2024
@mergify mergify bot merged commit d59c730 into main Feb 9, 2024
186 checks passed
@mergify mergify bot deleted the issue8163 branch February 9, 2024 23:41
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-rpc Area: Remote Procedure Call interfaces P-Medium ⚡
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feature: Add an RPC method to retrieve scan results for a viewing key
2 participants