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(scan): Implement gRPC support for registering viewing keys for scanning #8266

Merged
merged 7 commits into from
Feb 15, 2024

Conversation

upbqdn
Copy link
Member

@upbqdn upbqdn commented Feb 12, 2024

Motivation

Close #8176

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

Testing

We'll start with tests in #8244.

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

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

It seems we have a problem with the new optional field in the proto file https://github.com/ZcashFoundation/zebra/actions/runs/7888805960/job/21527160060?pr=8266#step:10:1572

@upbqdn
Copy link
Member Author

upbqdn commented Feb 13, 2024

We shouldn't see that error since Protocol Buffers v3.15.0, which was released back in 2021. Look at the first entry in the changelog: https://github.com/protocolbuffers/protobuf/releases/tag/v3.15.0. The issue describing the error was closed a long time ago: google/protobuf-gradle-plugin#415.

@gustavovalverde could you please have a look? It looks like we're using version pre 3.15.0?

@upbqdn
Copy link
Member Author

upbqdn commented Feb 13, 2024

I couldn't reproduce the error locally.

@upbqdn
Copy link
Member Author

upbqdn commented Feb 13, 2024

The error is:

protoc failed: proto/scanner.proto: This file contains proto3 optional fields, but --experimental_allow_proto3_optional was not set.

@arya2
Copy link
Contributor

arya2 commented Feb 14, 2024

Try using oneof with only one option, it worked for me earlier. (It's an issue with prost, not protoc)

Update: I was using an outdated version of protoc locally.

@upbqdn
Copy link
Member Author

upbqdn commented Feb 14, 2024

PR #8273 should resolve the issue.

@upbqdn
Copy link
Member Author

upbqdn commented Feb 15, 2024

PR #8273 should resolve the issue.

It did.

@arya2
Copy link
Contributor

arya2 commented Feb 15, 2024

Could you show the manual test output?

@arya2
Copy link
Contributor

arya2 commented Feb 15, 2024

Manual test output:

~/github/zebra$ grpcurl -plaintext -import-path ./zebra-grpc/proto -proto zebra-grpc/proto/scanner.proto -d '{"keys": [{ "key": "zxviews1q0duytgcqqqqpqre26wkl45gvwwwd706xw608hucmvfalr759ejwf7qshjf5r9aa7323zulvz6plhttp5mltqcgs9t039cx2d09mgq05ts63n8u35hyv6h9nc9ctqqtue2u7cer2mqegunuulq2luhq3ywjcz35yyljewa4mgkgjzyfwh6fr6jd0dzd44ghk0nxdv2hnv4j5nxfwv24rwdmgllhe0p8568sgqt9ckt02v2kxf5ahtql6s0ltjpkckw8gtymxtxuu9gcr0swvz" }]}' '127.0.0.1:8231' scanner.Scanner/RegisterKeys
{
  "keys": [
    "zxviews1q0duytgcqqqqpqre26wkl45gvwwwd706xw608hucmvfalr759ejwf7qshjf5r9aa7323zulvz6plhttp5mltqcgs9t039cx2d09mgq05ts63n8u35hyv6h9nc9ctqqtue2u7cer2mqegunuulq2luhq3ywjcz35yyljewa4mgkgjzyfwh6fr6jd0dzd44ghk0nxdv2hnv4j5nxfwv24rwdmgllhe0p8568sgqt9ckt02v2kxf5ahtql6s0ltjpkckw8gtymxtxuu9gcr0swvz"
  ]
}

Output for an already-registered key:

~/github/zebra$ grpcurl -plaintext -import-path ./zebra-grpc/proto -proto zebra-grpc/proto/scanner.proto -d '{"keys": ["zxviews1q0duytgcqqqqpqre26wkl45gvwwwd706xw608hucmvfalr759ejwf7qshjf5r9aa7323zulvz6plhttp5mltqcgs9t039cx2d09mgq05ts63n8u35hyv6h9nc9ctqqtue2u7cer2mqegunuulq2luhq3ywjcz35
yyljewa4mgkgjzyfwh6fr6jd0dzd44ghk0nxdv2hnv4j5nxfwv24rwdmgllhe0p8568sgqt9ckt02v2kxf5ahtql6s0ltjpkckw8gtymxtxuu9gcr0swvz"]}' '127.0.0.1:8231' scanner.Scanner/DeleteKeys
{}

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!

@arya2 arya2 mentioned this pull request Feb 15, 2024
9 tasks
@mergify mergify bot merged commit 85a7cc9 into main Feb 15, 2024
186 checks passed
@mergify mergify bot deleted the reg-keys-grpc branch February 15, 2024 18:02
upbqdn added a commit that referenced this pull request Feb 16, 2024
…anning (#8266)

* Use `use tonic::Request` for consistency

* Add definitions of `proto` types

* Impl `register_keys` gRPC

* Fix a typo

---------

Co-authored-by: Alfredo Garcia <[email protected]>
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.

add(scan): RegisterKeys gRPC
3 participants