-
Notifications
You must be signed in to change notification settings - Fork 210
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
Base node block sync RPC service #2348
Base node block sync RPC service #2348
Conversation
8b9f92b
to
7978ce2
Compare
fbed41c
to
690286a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not hugely familiar with the context of this PR but LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I think the use of heights instead of hashes could let to unexpected responses though. I would also prefer the FindChainSplit to immediately return headers to increase the cost of spoofing
base_layer/core/src/base_node/service/blockchain_state/service.rs
Outdated
Show resolved
Hide resolved
78cf393
to
9badeaf
Compare
RPC service for faster block sync. Allows streaming of full blocks, headers and a method for chain split detection. The client-side is next up. - Added BlockchainStateService. This service should eventually be the only service which provides a query interface to the blockchain database for other services. - Added BaseNodeSyncRpcService. This RPC service exposes `sync_blocks`, `sync_headers`, `get_header_by_height` and `find_chain_split`. These functions will be used in the improved block sync. - Added `NotFound` status to RpcStatus - Added `RpcStatus::log_internal_error()` convenience function to make dealing with misc errors in RPC handler functions easier. - Added `spawn_until_shutdown` method to the service initialiser context that spawns a task until the shutdown is triggered. This removes the need for implementers to worry about how to implement shutdown in initialisers. - Cleaned up some test helpers - Added unit tests for the Base node sync RPC handlers - Added unit tests for the BlockchainStateService Ref tari-project#2113
9badeaf
to
eda40f4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. The tests are really nice and easy to read.
Description
RPC service for faster block sync. Allows streaming of full blocks,
headers and a method for chain split detection. The client-side is next
up.
which provides a query interface to the blockchain database for other
services.
sync_blocks
,sync_headers
,fetch_header_by_height
andfind_chain_split
. Thesefunctions will be used in the improved block sync.
NotFound
status to RpcStatusRpcStatus::log_internal_error()
convenience function to makedealing with misc errors in RPC handler functions easier.
spawn_until_shutdown
method to the service initialiser contextthat spawns a task until the shutdown is triggered. This removes the need for
implementers to worry about how to implement shutdown in initialisers.
tokio-test
dependencyMotivation and Context
Described here: #2197 (comment)
Ref #2113
How Has This Been Tested?
Extensive unit tests
Types of changes
Checklist:
development
branch.cargo-fmt --all
before pushing.cargo test
successfully before submitting my PR.