diff --git a/book/src/dev/diagrams/service-dependencies.svg b/book/src/dev/diagrams/service-dependencies.svg
index 979b44846ba..d6d02928dd5 100644
--- a/book/src/dev/diagrams/service-dependencies.svg
+++ b/book/src/dev/diagrams/service-dependencies.svg
@@ -74,15 +74,15 @@
-
+
-router_verifier
+block_verifier_router
-router_verifier
+block_verifier_router
-
+
-inbound->router_verifier
+inbound->block_verifier_router
@@ -104,9 +104,9 @@
-
+
-rpc_server->router_verifier
+rpc_server->block_verifier_router
@@ -116,9 +116,9 @@
checkpoint_verifier
-
+
-router_verifier->checkpoint_verifier
+block_verifier_router->checkpoint_verifier
@@ -128,9 +128,9 @@
block_verifier
-
+
-router_verifier->block_verifier
+block_verifier_router->block_verifier
@@ -146,9 +146,9 @@
syncer
-
+
-syncer->router_verifier
+syncer->block_verifier_router
diff --git a/book/src/dev/overview.md b/book/src/dev/overview.md
index f5e5f82afdc..2142be8b0fc 100644
--- a/book/src/dev/overview.md
+++ b/book/src/dev/overview.md
@@ -56,18 +56,18 @@ digraph services {
inbound -> state
rpc_server -> state
mempool -> transaction_verifier
- router_verifier -> checkpoint_verifier
+ block_verifier_router -> checkpoint_verifier
inbound -> mempool
rpc_server -> mempool
- inbound -> router_verifier
- syncer -> router_verifier
- rpc_server -> router_verifier [style=dotted]
+ inbound -> block_verifier_router
+ syncer -> block_verifier_router
+ rpc_server -> block_verifier_router [style=dotted]
syncer -> peer_set
mempool -> peer_set
block_verifier -> state
checkpoint_verifier -> state
block_verifier -> transaction_verifier
- router_verifier -> block_verifier
+ block_verifier_router -> block_verifier
rpc_server -> inbound [style=invis] // for layout of the diagram
}
diff --git a/zebra-consensus/src/router/tests.rs b/zebra-consensus/src/router/tests.rs
index fd35b88031e..eb2abf1b2a3 100644
--- a/zebra-consensus/src/router/tests.rs
+++ b/zebra-consensus/src/router/tests.rs
@@ -66,14 +66,18 @@ async fn verifiers_from_network(
+ 'static,
) {
let state_service = zs::init_test(network);
- let (router_verifier, _transaction_verifier, _groth16_download_handle, _max_checkpoint_height) =
- crate::router::init(Config::default(), network, state_service.clone(), true).await;
+ let (
+ block_verifier_router,
+ _transaction_verifier,
+ _groth16_download_handle,
+ _max_checkpoint_height,
+ ) = crate::router::init(Config::default(), network, state_service.clone(), true).await;
// We can drop the download task handle here, because:
// - if the download task fails, the tests will panic, and
// - if the download task hangs, the tests will hang.
- (router_verifier, state_service)
+ (block_verifier_router, state_service)
}
static BLOCK_VERIFY_TRANSCRIPT_GENESIS: Lazy<
@@ -165,15 +169,19 @@ async fn verify_checkpoint(config: Config) -> Result<(), Report> {
// init_from_verifiers.
//
// Download task panics and timeouts are propagated to the tests that use Groth16 verifiers.
- let (router_verifier, _transaction_verifier, _groth16_download_handle, _max_checkpoint_height) =
- super::init(config.clone(), network, zs::init_test(network), true).await;
+ let (
+ block_verifier_router,
+ _transaction_verifier,
+ _groth16_download_handle,
+ _max_checkpoint_height,
+ ) = super::init(config.clone(), network, zs::init_test(network), true).await;
// Add a timeout layer
- let router_verifier =
- TimeoutLayer::new(Duration::from_secs(VERIFY_TIMEOUT_SECONDS)).layer(router_verifier);
+ let block_verifier_router =
+ TimeoutLayer::new(Duration::from_secs(VERIFY_TIMEOUT_SECONDS)).layer(block_verifier_router);
let transcript = Transcript::from(BLOCK_VERIFY_TRANSCRIPT_GENESIS.iter().cloned());
- transcript.check(router_verifier).await.unwrap();
+ transcript.check(block_verifier_router).await.unwrap();
Ok(())
}
@@ -194,11 +202,11 @@ async fn verify_fail_no_coinbase() -> Result<(), Report> {
let (router, state_service) = verifiers_from_network(Network::Mainnet).await;
// Add a timeout layer
- let router_verifier =
+ let block_verifier_router =
TimeoutLayer::new(Duration::from_secs(VERIFY_TIMEOUT_SECONDS)).layer(router);
let transcript = Transcript::from(NO_COINBASE_TRANSCRIPT.iter().cloned());
- transcript.check(router_verifier).await.unwrap();
+ transcript.check(block_verifier_router).await.unwrap();
let transcript = Transcript::from(NO_COINBASE_STATE_TRANSCRIPT.iter().cloned());
transcript.check(state_service).await.unwrap();
@@ -216,14 +224,14 @@ async fn round_trip_checkpoint_test() -> Result<(), Report> {
async fn round_trip_checkpoint() -> Result<(), Report> {
let _init_guard = zebra_test::init();
- let (router_verifier, state_service) = verifiers_from_network(Network::Mainnet).await;
+ let (block_verifier_router, state_service) = verifiers_from_network(Network::Mainnet).await;
// Add a timeout layer
- let router_verifier =
- TimeoutLayer::new(Duration::from_secs(VERIFY_TIMEOUT_SECONDS)).layer(router_verifier);
+ let block_verifier_router =
+ TimeoutLayer::new(Duration::from_secs(VERIFY_TIMEOUT_SECONDS)).layer(block_verifier_router);
let transcript = Transcript::from(BLOCK_VERIFY_TRANSCRIPT_GENESIS.iter().cloned());
- transcript.check(router_verifier).await.unwrap();
+ transcript.check(block_verifier_router).await.unwrap();
let transcript = Transcript::from(STATE_VERIFY_TRANSCRIPT_GENESIS.iter().cloned());
transcript.check(state_service).await.unwrap();
@@ -241,20 +249,26 @@ async fn verify_fail_add_block_checkpoint_test() -> Result<(), Report> {
async fn verify_fail_add_block_checkpoint() -> Result<(), Report> {
let _init_guard = zebra_test::init();
- let (router_verifier, state_service) = verifiers_from_network(Network::Mainnet).await;
+ let (block_verifier_router, state_service) = verifiers_from_network(Network::Mainnet).await;
// Add a timeout layer
- let router_verifier =
- TimeoutLayer::new(Duration::from_secs(VERIFY_TIMEOUT_SECONDS)).layer(router_verifier);
+ let block_verifier_router =
+ TimeoutLayer::new(Duration::from_secs(VERIFY_TIMEOUT_SECONDS)).layer(block_verifier_router);
let transcript = Transcript::from(BLOCK_VERIFY_TRANSCRIPT_GENESIS.iter().cloned());
- transcript.check(router_verifier.clone()).await.unwrap();
+ transcript
+ .check(block_verifier_router.clone())
+ .await
+ .unwrap();
let transcript = Transcript::from(STATE_VERIFY_TRANSCRIPT_GENESIS.iter().cloned());
transcript.check(state_service.clone()).await.unwrap();
let transcript = Transcript::from(BLOCK_VERIFY_TRANSCRIPT_GENESIS_FAIL.iter().cloned());
- transcript.check(router_verifier.clone()).await.unwrap();
+ transcript
+ .check(block_verifier_router.clone())
+ .await
+ .unwrap();
let transcript = Transcript::from(STATE_VERIFY_TRANSCRIPT_GENESIS.iter().cloned());
transcript.check(state_service.clone()).await.unwrap();
diff --git a/zebra-rpc/src/methods/get_block_template_rpcs.rs b/zebra-rpc/src/methods/get_block_template_rpcs.rs
index 5afc977c16b..5f0ff5ce274 100644
--- a/zebra-rpc/src/methods/get_block_template_rpcs.rs
+++ b/zebra-rpc/src/methods/get_block_template_rpcs.rs
@@ -273,7 +273,7 @@ pub struct GetBlockTemplateRpcImpl<
latest_chain_tip: Tip,
/// The chain verifier, used for submitting blocks.
- router_verifier: BlockVerifierRouter,
+ block_verifier_router: BlockVerifierRouter,
/// The chain sync status, used for checking if Zebra is likely close to the network chain tip.
sync_status: SyncStatus,
@@ -319,7 +319,7 @@ where
mempool: Buffer,
state: State,
latest_chain_tip: Tip,
- router_verifier: BlockVerifierRouter,
+ block_verifier_router: BlockVerifierRouter,
sync_status: SyncStatus,
address_book: AddressBook,
) -> Self {
@@ -358,7 +358,7 @@ where
mempool,
state,
latest_chain_tip,
- router_verifier,
+ block_verifier_router,
sync_status,
address_book,
}
@@ -454,7 +454,7 @@ where
.and_then(get_block_template::JsonParameters::block_proposal_data)
{
return validate_block_proposal(
- self.router_verifier.clone(),
+ self.block_verifier_router.clone(),
block_proposal_bytes,
network,
latest_chain_tip,
@@ -737,7 +737,7 @@ where
HexData(block_bytes): HexData,
_parameters: Option,
) -> BoxFuture> {
- let mut router_verifier = self.router_verifier.clone();
+ let mut block_verifier_router = self.block_verifier_router.clone();
async move {
let block: Block = match block_bytes.zcash_deserialize_into() {
@@ -755,7 +755,7 @@ where
.unwrap_or_else(|| "invalid coinbase height".to_string());
let block_hash = block.hash();
- let router_verifier_response = router_verifier
+ let block_verifier_router_response = block_verifier_router
.ready()
.await
.map_err(|error| Error {
@@ -766,7 +766,7 @@ where
.call(zebra_consensus::Request::Commit(Arc::new(block)))
.await;
- let chain_error = match router_verifier_response {
+ let chain_error = match block_verifier_router_response {
// Currently, this match arm returns `null` (Accepted) for blocks committed
// to any chain, but Accepted is only for blocks in the best chain.
//
diff --git a/zebra-rpc/src/methods/get_block_template_rpcs/get_block_template.rs b/zebra-rpc/src/methods/get_block_template_rpcs/get_block_template.rs
index f18242b7cdd..04a3fa9c8e1 100644
--- a/zebra-rpc/src/methods/get_block_template_rpcs/get_block_template.rs
+++ b/zebra-rpc/src/methods/get_block_template_rpcs/get_block_template.rs
@@ -98,7 +98,7 @@ pub fn check_miner_address(
///
/// Returns a `getblocktemplate` [`Response`].
pub async fn validate_block_proposal(
- mut router_verifier: BlockVerifierRouter,
+ mut block_verifier_router: BlockVerifierRouter,
block_proposal_bytes: Vec,
network: Network,
latest_chain_tip: Tip,
@@ -129,7 +129,7 @@ where
}
};
- let router_verifier_response = router_verifier
+ let block_verifier_router_response = block_verifier_router
.ready()
.await
.map_err(|error| Error {
@@ -140,12 +140,12 @@ where
.call(zebra_consensus::Request::CheckProposal(Arc::new(block)))
.await;
- Ok(router_verifier_response
+ Ok(block_verifier_router_response
.map(|_hash| ProposalResponse::Valid)
.unwrap_or_else(|verify_chain_error| {
tracing::info!(
?verify_chain_error,
- "error response from router_verifier in CheckProposal request"
+ "error response from block_verifier_router in CheckProposal request"
);
ProposalResponse::rejected("invalid proposal", verify_chain_error)
diff --git a/zebra-rpc/src/methods/tests/snapshot/get_block_template_rpcs.rs b/zebra-rpc/src/methods/tests/snapshot/get_block_template_rpcs.rs
index 05e12874d61..f941b7e2771 100644
--- a/zebra-rpc/src/methods/tests/snapshot/get_block_template_rpcs.rs
+++ b/zebra-rpc/src/methods/tests/snapshot/get_block_template_rpcs.rs
@@ -85,7 +85,7 @@ pub async fn test_responses(
>::Future: Send,
{
let (
- router_verifier,
+ block_verifier_router,
_transaction_verifier,
_parameter_download_task_handle,
_max_checkpoint_height,
@@ -145,7 +145,7 @@ pub async fn test_responses(
Buffer::new(mempool.clone(), 1),
read_state,
mock_chain_tip.clone(),
- router_verifier.clone(),
+ block_verifier_router.clone(),
mock_sync_status.clone(),
mock_address_book,
);
@@ -267,7 +267,7 @@ pub async fn test_responses(
Buffer::new(mempool.clone(), 1),
read_state.clone(),
mock_chain_tip.clone(),
- router_verifier,
+ block_verifier_router,
mock_sync_status.clone(),
MockAddressBookPeers::default(),
);
@@ -365,16 +365,16 @@ pub async fn test_responses(
snapshot_rpc_getblocktemplate("invalid-proposal", get_block_template, None, &settings);
- // the following snapshots use a mock read_state and router_verifier
+ // the following snapshots use a mock read_state and block_verifier_router
- let mut mock_router_verifier = MockService::build().for_unit_tests();
+ let mut mock_block_verifier_router = MockService::build().for_unit_tests();
let get_block_template_rpc_mock_state_verifier = GetBlockTemplateRpcImpl::new(
network,
mining_config,
Buffer::new(mempool.clone(), 1),
read_state.clone(),
mock_chain_tip,
- mock_router_verifier.clone(),
+ mock_block_verifier_router.clone(),
mock_sync_status,
MockAddressBookPeers::default(),
);
@@ -387,15 +387,17 @@ pub async fn test_responses(
}),
);
- let mock_router_verifier_request_handler = async move {
- mock_router_verifier
+ let mock_block_verifier_router_request_handler = async move {
+ mock_block_verifier_router
.expect_request_that(|req| matches!(req, zebra_consensus::Request::CheckProposal(_)))
.await
.respond(Hash::from([0; 32]));
};
- let (get_block_template, ..) =
- tokio::join!(get_block_template_fut, mock_router_verifier_request_handler,);
+ let (get_block_template, ..) = tokio::join!(
+ get_block_template_fut,
+ mock_block_verifier_router_request_handler,
+ );
let get_block_template =
get_block_template.expect("unexpected error in getblocktemplate RPC call");
diff --git a/zebra-rpc/src/methods/tests/vectors.rs b/zebra-rpc/src/methods/tests/vectors.rs
index f3b22fce482..63d329d5051 100644
--- a/zebra-rpc/src/methods/tests/vectors.rs
+++ b/zebra-rpc/src/methods/tests/vectors.rs
@@ -830,7 +830,7 @@ async fn rpc_getblockcount() {
zebra_state::populated_state(blocks.clone(), Mainnet).await;
let (
- router_verifier,
+ block_verifier_router,
_transaction_verifier,
_parameter_download_task_handle,
_max_checkpoint_height,
@@ -849,7 +849,7 @@ async fn rpc_getblockcount() {
Buffer::new(mempool.clone(), 1),
read_state,
latest_chain_tip.clone(),
- router_verifier,
+ block_verifier_router,
MockSyncStatus::default(),
MockAddressBookPeers::default(),
);
@@ -880,7 +880,7 @@ async fn rpc_getblockcount_empty_state() {
zebra_state::init_test_services(Mainnet);
let (
- router_verifier,
+ block_verifier_router,
_transaction_verifier,
_parameter_download_task_handle,
_max_checkpoint_height,
@@ -899,7 +899,7 @@ async fn rpc_getblockcount_empty_state() {
Buffer::new(mempool.clone(), 1),
read_state,
latest_chain_tip.clone(),
- router_verifier,
+ block_verifier_router,
MockSyncStatus::default(),
MockAddressBookPeers::default(),
);
@@ -932,7 +932,7 @@ async fn rpc_getpeerinfo() {
zebra_state::init_test_services(Mainnet);
let (
- router_verifier,
+ block_verifier_router,
_transaction_verifier,
_parameter_download_task_handle,
_max_checkpoint_height,
@@ -965,7 +965,7 @@ async fn rpc_getpeerinfo() {
Buffer::new(mempool.clone(), 1),
read_state,
latest_chain_tip.clone(),
- router_verifier,
+ block_verifier_router,
MockSyncStatus::default(),
mock_address_book,
);
@@ -1007,7 +1007,7 @@ async fn rpc_getblockhash() {
zebra_state::populated_state(blocks.clone(), Mainnet).await;
let (
- router_verifier,
+ block_verifier_router,
_transaction_verifier,
_parameter_download_task_handle,
_max_checkpoint_height,
@@ -1026,7 +1026,7 @@ async fn rpc_getblockhash() {
Buffer::new(mempool.clone(), 1),
read_state,
latest_chain_tip.clone(),
- tower::ServiceBuilder::new().service(router_verifier),
+ tower::ServiceBuilder::new().service(block_verifier_router),
MockSyncStatus::default(),
MockAddressBookPeers::default(),
);
@@ -1195,7 +1195,7 @@ async fn rpc_getblocktemplate_mining_address(use_p2pkh: bool) {
let mut mempool: MockService<_, _, _, BoxError> = MockService::build().for_unit_tests();
let read_state = MockService::build().for_unit_tests();
- let router_verifier = MockService::build().for_unit_tests();
+ let block_verifier_router = MockService::build().for_unit_tests();
let mut mock_sync_status = MockSyncStatus::default();
mock_sync_status.set_is_close_to_tip(true);
@@ -1236,7 +1236,7 @@ async fn rpc_getblocktemplate_mining_address(use_p2pkh: bool) {
Buffer::new(mempool.clone(), 1),
read_state.clone(),
mock_chain_tip,
- router_verifier,
+ block_verifier_router,
mock_sync_status.clone(),
MockAddressBookPeers::default(),
);
@@ -1481,7 +1481,7 @@ async fn rpc_submitblock_errors() {
// Init RPCs
let (
- router_verifier,
+ block_verifier_router,
_transaction_verifier,
_parameter_download_task_handle,
_max_checkpoint_height,
@@ -1500,7 +1500,7 @@ async fn rpc_submitblock_errors() {
Buffer::new(mempool.clone(), 1),
read_state,
latest_chain_tip.clone(),
- router_verifier,
+ block_verifier_router,
MockSyncStatus::default(),
MockAddressBookPeers::default(),
);
@@ -1648,7 +1648,7 @@ async fn rpc_getdifficulty() {
let mempool: MockService<_, _, _, BoxError> = MockService::build().for_unit_tests();
let read_state = MockService::build().for_unit_tests();
- let router_verifier = MockService::build().for_unit_tests();
+ let block_verifier_router = MockService::build().for_unit_tests();
let mut mock_sync_status = MockSyncStatus::default();
mock_sync_status.set_is_close_to_tip(true);
@@ -1683,7 +1683,7 @@ async fn rpc_getdifficulty() {
Buffer::new(mempool.clone(), 1),
read_state.clone(),
mock_chain_tip,
- router_verifier,
+ block_verifier_router,
mock_sync_status.clone(),
MockAddressBookPeers::default(),
);
diff --git a/zebra-rpc/src/server.rs b/zebra-rpc/src/server.rs
index 43e7397d534..61a9abb11a7 100644
--- a/zebra-rpc/src/server.rs
+++ b/zebra-rpc/src/server.rs
@@ -84,7 +84,7 @@ impl RpcServer {
mempool: Buffer,
state: State,
#[cfg_attr(not(feature = "getblocktemplate-rpcs"), allow(unused_variables))]
- router_verifier: BlockVerifierRouter,
+ block_verifier_router: BlockVerifierRouter,
#[cfg_attr(not(feature = "getblocktemplate-rpcs"), allow(unused_variables))]
sync_status: SyncStatus,
#[cfg_attr(not(feature = "getblocktemplate-rpcs"), allow(unused_variables))]
@@ -149,7 +149,7 @@ impl RpcServer {
mempool.clone(),
state.clone(),
latest_chain_tip.clone(),
- router_verifier,
+ block_verifier_router,
sync_status,
address_book,
);
diff --git a/zebra-rpc/src/server/tests/vectors.rs b/zebra-rpc/src/server/tests/vectors.rs
index 657106a56b7..245a2ea3c4d 100644
--- a/zebra-rpc/src/server/tests/vectors.rs
+++ b/zebra-rpc/src/server/tests/vectors.rs
@@ -52,7 +52,7 @@ fn rpc_server_spawn(parallel_cpu_threads: bool) {
rt.block_on(async {
let mut mempool: MockService<_, _, _, BoxError> = MockService::build().for_unit_tests();
let mut state: MockService<_, _, _, BoxError> = MockService::build().for_unit_tests();
- let mut router_verifier: MockService<_, _, _, BoxError> =
+ let mut block_verifier_router: MockService<_, _, _, BoxError> =
MockService::build().for_unit_tests();
info!("spawning RPC server...");
@@ -63,7 +63,7 @@ fn rpc_server_spawn(parallel_cpu_threads: bool) {
"RPC server test",
Buffer::new(mempool.clone(), 1),
Buffer::new(state.clone(), 1),
- Buffer::new(router_verifier.clone(), 1),
+ Buffer::new(block_verifier_router.clone(), 1),
MockSyncStatus::default(),
MockAddressBookPeers::default(),
NoChainTip,
@@ -74,7 +74,7 @@ fn rpc_server_spawn(parallel_cpu_threads: bool) {
mempool.expect_no_requests().await;
state.expect_no_requests().await;
- router_verifier.expect_no_requests().await;
+ block_verifier_router.expect_no_requests().await;
// The server and queue tasks should continue without errors or panics
let rpc_server_task_result = rpc_server_task_handle.now_or_never();
@@ -138,7 +138,7 @@ fn rpc_server_spawn_unallocated_port(parallel_cpu_threads: bool, do_shutdown: bo
rt.block_on(async {
let mut mempool: MockService<_, _, _, BoxError> = MockService::build().for_unit_tests();
let mut state: MockService<_, _, _, BoxError> = MockService::build().for_unit_tests();
- let mut router_verifier: MockService<_, _, _, BoxError> =
+ let mut block_verifier_router: MockService<_, _, _, BoxError> =
MockService::build().for_unit_tests();
info!("spawning RPC server...");
@@ -149,7 +149,7 @@ fn rpc_server_spawn_unallocated_port(parallel_cpu_threads: bool, do_shutdown: bo
"RPC server test",
Buffer::new(mempool.clone(), 1),
Buffer::new(state.clone(), 1),
- Buffer::new(router_verifier.clone(), 1),
+ Buffer::new(block_verifier_router.clone(), 1),
MockSyncStatus::default(),
MockAddressBookPeers::default(),
NoChainTip,
@@ -160,7 +160,7 @@ fn rpc_server_spawn_unallocated_port(parallel_cpu_threads: bool, do_shutdown: bo
mempool.expect_no_requests().await;
state.expect_no_requests().await;
- router_verifier.expect_no_requests().await;
+ block_verifier_router.expect_no_requests().await;
if do_shutdown {
rpc_server
@@ -217,7 +217,7 @@ fn rpc_server_spawn_port_conflict() {
let test_task_handle = rt.spawn(async {
let mut mempool: MockService<_, _, _, BoxError> = MockService::build().for_unit_tests();
let mut state: MockService<_, _, _, BoxError> = MockService::build().for_unit_tests();
- let mut router_verifier: MockService<_, _, _, BoxError> =
+ let mut block_verifier_router: MockService<_, _, _, BoxError> =
MockService::build().for_unit_tests();
info!("spawning RPC server 1...");
@@ -229,7 +229,7 @@ fn rpc_server_spawn_port_conflict() {
"RPC server 1 test",
Buffer::new(mempool.clone(), 1),
Buffer::new(state.clone(), 1),
- Buffer::new(router_verifier.clone(), 1),
+ Buffer::new(block_verifier_router.clone(), 1),
MockSyncStatus::default(),
MockAddressBookPeers::default(),
NoChainTip,
@@ -246,7 +246,7 @@ fn rpc_server_spawn_port_conflict() {
"RPC server 2 conflict test",
Buffer::new(mempool.clone(), 1),
Buffer::new(state.clone(), 1),
- Buffer::new(router_verifier.clone(), 1),
+ Buffer::new(block_verifier_router.clone(), 1),
MockSyncStatus::default(),
MockAddressBookPeers::default(),
NoChainTip,
@@ -257,7 +257,7 @@ fn rpc_server_spawn_port_conflict() {
mempool.expect_no_requests().await;
state.expect_no_requests().await;
- router_verifier.expect_no_requests().await;
+ block_verifier_router.expect_no_requests().await;
// Because there is a panic inside a multi-threaded executor,
// we can't depend on the exact behaviour of the other tasks,
@@ -325,7 +325,7 @@ fn rpc_server_spawn_port_conflict_parallel_auto() {
let test_task_handle = rt.spawn(async {
let mut mempool: MockService<_, _, _, BoxError> = MockService::build().for_unit_tests();
let mut state: MockService<_, _, _, BoxError> = MockService::build().for_unit_tests();
- let mut router_verifier: MockService<_, _, _, BoxError> =
+ let mut block_verifier_router: MockService<_, _, _, BoxError> =
MockService::build().for_unit_tests();
info!("spawning parallel RPC server 1...");
@@ -337,7 +337,7 @@ fn rpc_server_spawn_port_conflict_parallel_auto() {
"RPC server 1 test",
Buffer::new(mempool.clone(), 1),
Buffer::new(state.clone(), 1),
- Buffer::new(router_verifier.clone(), 1),
+ Buffer::new(block_verifier_router.clone(), 1),
MockSyncStatus::default(),
MockAddressBookPeers::default(),
NoChainTip,
@@ -354,7 +354,7 @@ fn rpc_server_spawn_port_conflict_parallel_auto() {
"RPC server 2 conflict test",
Buffer::new(mempool.clone(), 1),
Buffer::new(state.clone(), 1),
- Buffer::new(router_verifier.clone(), 1),
+ Buffer::new(block_verifier_router.clone(), 1),
MockSyncStatus::default(),
MockAddressBookPeers::default(),
NoChainTip,
@@ -365,7 +365,7 @@ fn rpc_server_spawn_port_conflict_parallel_auto() {
mempool.expect_no_requests().await;
state.expect_no_requests().await;
- router_verifier.expect_no_requests().await;
+ block_verifier_router.expect_no_requests().await;
// Because there might be a panic inside a multi-threaded executor,
// we can't depend on the exact behaviour of the other tasks,
diff --git a/zebrad/src/commands/start.rs b/zebrad/src/commands/start.rs
index 67b9b3e78e2..53657d10e95 100644
--- a/zebrad/src/commands/start.rs
+++ b/zebrad/src/commands/start.rs
@@ -158,7 +158,7 @@ impl StartCmd {
.await;
info!("initializing verifiers");
- let (router_verifier, tx_verifier, consensus_task_handles, max_checkpoint_height) =
+ let (block_verifier_router, tx_verifier, consensus_task_handles, max_checkpoint_height) =
zebra_consensus::router::init(
config.consensus.clone(),
config.network.network,
@@ -172,7 +172,7 @@ impl StartCmd {
&config,
max_checkpoint_height,
peer_set.clone(),
- router_verifier.clone(),
+ block_verifier_router.clone(),
state.clone(),
latest_chain_tip.clone(),
);
@@ -197,7 +197,7 @@ impl StartCmd {
let setup_data = InboundSetupData {
address_book: address_book.clone(),
block_download_peer_set: peer_set.clone(),
- block_verifier: router_verifier.clone(),
+ block_verifier: block_verifier_router.clone(),
mempool: mempool.clone(),
state,
latest_chain_tip: latest_chain_tip.clone(),
@@ -218,7 +218,7 @@ impl StartCmd {
app_version(),
mempool.clone(),
read_only_state_service,
- router_verifier,
+ block_verifier_router,
sync_status.clone(),
address_book,
latest_chain_tip.clone(),
diff --git a/zebrad/src/components/sync/tests/vectors.rs b/zebrad/src/components/sync/tests/vectors.rs
index a9155184240..3a656904ef0 100644
--- a/zebrad/src/components/sync/tests/vectors.rs
+++ b/zebrad/src/components/sync/tests/vectors.rs
@@ -45,7 +45,7 @@ async fn sync_blocks_ok() -> Result<(), crate::BoxError> {
let (
chain_sync_future,
_sync_status,
- mut router_verifier,
+ mut block_verifier_router,
mut peer_set,
mut state_service,
_mock_chain_tip_sender,
@@ -88,7 +88,7 @@ async fn sync_blocks_ok() -> Result<(), crate::BoxError> {
.await
.respond(zn::Response::Blocks(vec![Available(block0.clone())]));
- router_verifier
+ block_verifier_router
.expect_request(zebra_consensus::Request::Commit(block0))
.await
.respond(block0_hash);
@@ -96,7 +96,7 @@ async fn sync_blocks_ok() -> Result<(), crate::BoxError> {
// Check that nothing unexpected happened.
// We expect more requests to the state service, because the syncer keeps on running.
peer_set.expect_no_requests().await;
- router_verifier.expect_no_requests().await;
+ block_verifier_router.expect_no_requests().await;
// State is checked for genesis again
state_service
@@ -144,7 +144,7 @@ async fn sync_blocks_ok() -> Result<(), crate::BoxError> {
// Check that nothing unexpected happened.
peer_set.expect_no_requests().await;
- router_verifier.expect_no_requests().await;
+ block_verifier_router.expect_no_requests().await;
// State is checked for all non-tip blocks (blocks 1 & 2) in response order
state_service
@@ -174,7 +174,7 @@ async fn sync_blocks_ok() -> Result<(), crate::BoxError> {
.collect();
for _ in 1..=2 {
- router_verifier
+ block_verifier_router
.expect_request_that(|req| remaining_blocks.remove(&req.block().hash()).is_some())
.await
.respond_with(|req| req.block().hash());
@@ -186,7 +186,7 @@ async fn sync_blocks_ok() -> Result<(), crate::BoxError> {
);
// Check that nothing unexpected happened.
- router_verifier.expect_no_requests().await;
+ block_verifier_router.expect_no_requests().await;
state_service.expect_no_requests().await;
// ChainSync::extend_tips
@@ -217,7 +217,7 @@ async fn sync_blocks_ok() -> Result<(), crate::BoxError> {
}
// Check that nothing unexpected happened.
- router_verifier.expect_no_requests().await;
+ block_verifier_router.expect_no_requests().await;
state_service.expect_no_requests().await;
// Blocks 3 & 4 are fetched in order, then verified concurrently
@@ -238,7 +238,7 @@ async fn sync_blocks_ok() -> Result<(), crate::BoxError> {
.collect();
for _ in 3..=4 {
- router_verifier
+ block_verifier_router
.expect_request_that(|req| remaining_blocks.remove(&req.block().hash()).is_some())
.await
.respond_with(|req| req.block().hash());
@@ -250,7 +250,7 @@ async fn sync_blocks_ok() -> Result<(), crate::BoxError> {
);
// Check that nothing unexpected happened.
- router_verifier.expect_no_requests().await;
+ block_verifier_router.expect_no_requests().await;
state_service.expect_no_requests().await;
let chain_sync_result = chain_sync_task_handle.now_or_never();
@@ -272,7 +272,7 @@ async fn sync_blocks_duplicate_hashes_ok() -> Result<(), crate::BoxError> {
let (
chain_sync_future,
_sync_status,
- mut router_verifier,
+ mut block_verifier_router,
mut peer_set,
mut state_service,
_mock_chain_tip_sender,
@@ -315,7 +315,7 @@ async fn sync_blocks_duplicate_hashes_ok() -> Result<(), crate::BoxError> {
.await
.respond(zn::Response::Blocks(vec![Available(block0.clone())]));
- router_verifier
+ block_verifier_router
.expect_request(zebra_consensus::Request::Commit(block0))
.await
.respond(block0_hash);
@@ -323,7 +323,7 @@ async fn sync_blocks_duplicate_hashes_ok() -> Result<(), crate::BoxError> {
// Check that nothing unexpected happened.
// We expect more requests to the state service, because the syncer keeps on running.
peer_set.expect_no_requests().await;
- router_verifier.expect_no_requests().await;
+ block_verifier_router.expect_no_requests().await;
// State is checked for genesis again
state_service
@@ -373,7 +373,7 @@ async fn sync_blocks_duplicate_hashes_ok() -> Result<(), crate::BoxError> {
// Check that nothing unexpected happened.
peer_set.expect_no_requests().await;
- router_verifier.expect_no_requests().await;
+ block_verifier_router.expect_no_requests().await;
// State is checked for all non-tip blocks (blocks 1 & 2) in response order
state_service
@@ -403,7 +403,7 @@ async fn sync_blocks_duplicate_hashes_ok() -> Result<(), crate::BoxError> {
.collect();
for _ in 1..=2 {
- router_verifier
+ block_verifier_router
.expect_request_that(|req| remaining_blocks.remove(&req.block().hash()).is_some())
.await
.respond_with(|req| req.block().hash());
@@ -415,7 +415,7 @@ async fn sync_blocks_duplicate_hashes_ok() -> Result<(), crate::BoxError> {
);
// Check that nothing unexpected happened.
- router_verifier.expect_no_requests().await;
+ block_verifier_router.expect_no_requests().await;
state_service.expect_no_requests().await;
// ChainSync::extend_tips
@@ -448,7 +448,7 @@ async fn sync_blocks_duplicate_hashes_ok() -> Result<(), crate::BoxError> {
}
// Check that nothing unexpected happened.
- router_verifier.expect_no_requests().await;
+ block_verifier_router.expect_no_requests().await;
state_service.expect_no_requests().await;
// Blocks 3 & 4 are fetched in order, then verified concurrently
@@ -469,7 +469,7 @@ async fn sync_blocks_duplicate_hashes_ok() -> Result<(), crate::BoxError> {
.collect();
for _ in 3..=4 {
- router_verifier
+ block_verifier_router
.expect_request_that(|req| remaining_blocks.remove(&req.block().hash()).is_some())
.await
.respond_with(|req| req.block().hash());
@@ -481,7 +481,7 @@ async fn sync_blocks_duplicate_hashes_ok() -> Result<(), crate::BoxError> {
);
// Check that nothing unexpected happened.
- router_verifier.expect_no_requests().await;
+ block_verifier_router.expect_no_requests().await;
state_service.expect_no_requests().await;
let chain_sync_result = chain_sync_task_handle.now_or_never();
@@ -500,7 +500,7 @@ async fn sync_block_lookahead_drop() -> Result<(), crate::BoxError> {
let (
chain_sync_future,
_sync_status,
- mut router_verifier,
+ mut block_verifier_router,
mut peer_set,
mut state_service,
_mock_chain_tip_sender,
@@ -535,7 +535,7 @@ async fn sync_block_lookahead_drop() -> Result<(), crate::BoxError> {
// Block is dropped because it is too far ahead of the tip.
// We expect more requests to the state service, because the syncer keeps on running.
peer_set.expect_no_requests().await;
- router_verifier.expect_no_requests().await;
+ block_verifier_router.expect_no_requests().await;
let chain_sync_result = chain_sync_task_handle.now_or_never();
assert!(
@@ -555,7 +555,7 @@ async fn sync_block_too_high_obtain_tips() -> Result<(), crate::BoxError> {
let (
chain_sync_future,
_sync_status,
- mut router_verifier,
+ mut block_verifier_router,
mut peer_set,
mut state_service,
_mock_chain_tip_sender,
@@ -597,7 +597,7 @@ async fn sync_block_too_high_obtain_tips() -> Result<(), crate::BoxError> {
.await
.respond(zn::Response::Blocks(vec![Available(block0.clone())]));
- router_verifier
+ block_verifier_router
.expect_request(zebra_consensus::Request::Commit(block0))
.await
.respond(block0_hash);
@@ -605,7 +605,7 @@ async fn sync_block_too_high_obtain_tips() -> Result<(), crate::BoxError> {
// Check that nothing unexpected happened.
// We expect more requests to the state service, because the syncer keeps on running.
peer_set.expect_no_requests().await;
- router_verifier.expect_no_requests().await;
+ block_verifier_router.expect_no_requests().await;
// State is checked for genesis again
state_service
@@ -654,7 +654,7 @@ async fn sync_block_too_high_obtain_tips() -> Result<(), crate::BoxError> {
// Check that nothing unexpected happened.
peer_set.expect_no_requests().await;
- router_verifier.expect_no_requests().await;
+ block_verifier_router.expect_no_requests().await;
// State is checked for all non-tip blocks (blocks 982k, 1, 2) in response order
state_service
@@ -710,7 +710,7 @@ async fn sync_block_too_high_extend_tips() -> Result<(), crate::BoxError> {
let (
chain_sync_future,
_sync_status,
- mut router_verifier,
+ mut block_verifier_router,
mut peer_set,
mut state_service,
_mock_chain_tip_sender,
@@ -758,7 +758,7 @@ async fn sync_block_too_high_extend_tips() -> Result<(), crate::BoxError> {
.await
.respond(zn::Response::Blocks(vec![Available(block0.clone())]));
- router_verifier
+ block_verifier_router
.expect_request(zebra_consensus::Request::Commit(block0))
.await
.respond(block0_hash);
@@ -766,7 +766,7 @@ async fn sync_block_too_high_extend_tips() -> Result<(), crate::BoxError> {
// Check that nothing unexpected happened.
// We expect more requests to the state service, because the syncer keeps on running.
peer_set.expect_no_requests().await;
- router_verifier.expect_no_requests().await;
+ block_verifier_router.expect_no_requests().await;
// State is checked for genesis again
state_service
@@ -814,7 +814,7 @@ async fn sync_block_too_high_extend_tips() -> Result<(), crate::BoxError> {
// Check that nothing unexpected happened.
peer_set.expect_no_requests().await;
- router_verifier.expect_no_requests().await;
+ block_verifier_router.expect_no_requests().await;
// State is checked for all non-tip blocks (blocks 1 & 2) in response order
state_service
@@ -844,7 +844,7 @@ async fn sync_block_too_high_extend_tips() -> Result<(), crate::BoxError> {
.collect();
for _ in 1..=2 {
- router_verifier
+ block_verifier_router
.expect_request_that(|req| remaining_blocks.remove(&req.block().hash()).is_some())
.await
.respond_with(|req| req.block().hash());
@@ -856,7 +856,7 @@ async fn sync_block_too_high_extend_tips() -> Result<(), crate::BoxError> {
);
// Check that nothing unexpected happened.
- router_verifier.expect_no_requests().await;
+ block_verifier_router.expect_no_requests().await;
state_service.expect_no_requests().await;
// ChainSync::extend_tips
@@ -888,7 +888,7 @@ async fn sync_block_too_high_extend_tips() -> Result<(), crate::BoxError> {
}
// Check that nothing unexpected happened.
- router_verifier.expect_no_requests().await;
+ block_verifier_router.expect_no_requests().await;
state_service.expect_no_requests().await;
// Blocks 3, 4, 982k are fetched in order, then verified concurrently,
@@ -951,7 +951,7 @@ fn setup() -> (
.with_max_request_delay(MAX_SERVICE_REQUEST_DELAY)
.for_unit_tests();
- let router_verifier = MockService::build()
+ let block_verifier_router = MockService::build()
.with_max_request_delay(MAX_SERVICE_REQUEST_DELAY)
.for_unit_tests();
@@ -965,7 +965,7 @@ fn setup() -> (
&config,
Height(0),
peer_set.clone(),
- router_verifier.clone(),
+ block_verifier_router.clone(),
state_service.clone(),
mock_chain_tip,
);
@@ -975,7 +975,7 @@ fn setup() -> (
(
chain_sync_future,
sync_status,
- router_verifier,
+ block_verifier_router,
peer_set,
state_service,
mock_chain_tip_sender,