Commit Graph

10 Commits

Author SHA1 Message Date
Arya 5e86ebb699
fix(scan): Improve gRPC method errors and add timeout to scan service to avoid hanging (#8318)
* updates ScanTask.subscribe() to return rsp_tx instead of awaiting it, returns service errors from grpc methods

* Adds a timeout to scan service and improves error message when subscribe responders are dropped

* Returns an error from `RegisterKeys` svc request when no keys are registered

* tests register keys error message

* Adds test for timeouts

* adds TODOs for fixing bugs

* Orders scan service requests in scan method

* removes CheckKeyHashes request

* fixes bad merge conflict resolution

* update test to check downcast to Elapsed error

* update errors in scan method

* update error msg in register_keys method

* fixes compiler error
2024-03-14 20:27:33 +00:00
Arya 4ebd7a80d0
add(scan): Adds gRPC reflection and documents how to use the zebra-scan gRPC server (#8288)
* adds tonic-reflection

* adds listen_addr to log

* Adds user guide for scan server to zebra book

* fixes typo

* Applies suggestions from code review

* update link

Co-authored-by: Marek <mail@marek.onl>

---------

Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
Co-authored-by: Marek <mail@marek.onl>
2024-02-22 18:51:14 +00:00
Arya 5a9281a7a8
fix(scan): Fix minor concurrency bug in the `scan` gRPC method (#8303)
* update scan task to notify subscribe caller once the new subscribed_keys are sent on the watch channel

* Fixes timing bug in scan gRPC method:

Joins register/subscribe scan service calls, sends SubscribeResults request first, and filters out duplicate results from channel

* Removes outdated TODO

* wraps subscribed_keys in an Arc before sending to watch channel, fixes typo

* Remove result senders for keys that have been removed
2024-02-21 23:29:13 +00:00
Alfredo Garcia 2f0b284997
tests(grpc): Unit tests (#8293)
* add grpc method unit tests

* add test module description

* runs tests in sequence, adds some messages to assertions, and minor cleanups (#8296)

* fix field name change

---------

Co-authored-by: Arya <aryasolhi@gmail.com>
2024-02-20 22:45:55 +00:00
Arya a7de137a7a
add(scan): Implement `scan` gRPC method (#8268)
* Adds scan method

* fix clippy warning

* Skip empty results and don't panic if the gRPC client disconnects

* moves `Results` request above `SubscribeResults` request to avoid duplicate results.

* returns early if there's a send error when sending initial results and updates response type

* move responder buffer size to const

* Adds a snapshot test for the `scan` method

* updates snapshots
2024-02-20 19:16:20 +00:00
Marek 85a7cc977a
add(scan): Implement gRPC support for registering viewing keys for scanning (#8266)
* Use `use tonic::Request` for consistency

* Add definitions of `proto` types

* Impl `register_keys` gRPC

* Fix a typo

---------

Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
2024-02-15 18:02:32 +00:00
Alfredo Garcia d59c7305b0
add(grpc): `get_results` (#8255)
* add `get_results` grpc call

* nitpick
2024-02-09 23:41:26 +00:00
Arya 2c0bc3ac92
add(scan): Start scanner gRPC server with `zebrad` (#8241)
* adds clear_results RPC method for zebra-scan

* adds delete_keys rpc method

* adds docs

* Update zebra-grpc/proto/scanner.proto

Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>

* Apply suggestions from code review

* start zebra-scan gRPC server from zebrad start command

* adds a test that the scanner starts with zebrad

* adds a `listen_addr` field to the shielded scan config

* updates test to use a random port and set the listen_addr config field

* fixes test

* Update zebra-scan/src/config.rs

Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>

* fixes panic when trying to open multiple mutable storage instances.

* open db in blocking task

* fixes test

---------

Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
2024-02-07 22:36:01 +00:00
Arya 8d1a1ac486
add(scan): Add `ClearResults` and `DeleteKeys` gRPC methods (#8237)
* adds clear_results RPC method for zebra-scan

* adds delete_keys rpc method

* adds docs

* Update zebra-grpc/proto/scanner.proto

Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>

* Apply suggestions from code review

---------

Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
2024-02-06 21:08:56 +00:00
Alfredo Garcia 78d33f3e9e
feat(grpc): Add initial `Getinfo` grpc (#8178)
* add `zebra-grpc` crate

* add missing fields

* convert to a lib

* add zebra-scan and tonic as depenency

* add a getinfo grpc

* remove zebra-scanner dependency

* Adds scan_service field to scanner grpc server

* remove dependency

* test launching the grpc server from the zebra-scan crate (not building)

* fix async issue

* fixes build issues

* add binary for manual testing

* try fix try run

---------

Co-authored-by: Arya <aryasolhi@gmail.com>
2024-01-26 01:29:37 +00:00