This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 380
Remove av-store, av-distribution, chain-api subsystems from minimal node #1903
Merged
paritytech-processbot
merged 11 commits into
paritytech:master
from
skunert:remove-subsystems
Nov 27, 2022
Merged
Changes from 8 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
506048b
Remove unused subsystems
skunert 5c336d4
Merge branch 'master' into remove-subsystems
skunert 9255350
Consume requests we are not going to answer
skunert 7d8b34d
Respond to incoming chunk and pov requests.
skunert 4a63bf0
fmt
skunert dcf3496
Improve comment and logging
skunert 1c1defb
Add reputation changes
skunert 8864817
Do not register pov-chunk-request protocol
skunert 3c4daae
Remove inbound chunk request channel
skunert 93da07b
Merge branch 'master' into remove-subsystems
skunert 3f967b2
Bump Polkadot
skunert File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -21,8 +21,10 @@ use cumulus_relay_chain_rpc_interface::{RelayChainRpcInterface, Url}; | |||||||||||||||||
use polkadot_network_bridge::{peer_sets_info, IsAuthority}; | ||||||||||||||||||
use polkadot_node_network_protocol::{ | ||||||||||||||||||
peer_set::PeerSetProtocolNames, | ||||||||||||||||||
request_response::{self, IncomingRequest, ReqProtocolNames}, | ||||||||||||||||||
request_response::{v1, IncomingRequest, IncomingRequestReceiver, ReqProtocolNames}, | ||||||||||||||||||
UnifiedReputationChange, | ||||||||||||||||||
}; | ||||||||||||||||||
|
||||||||||||||||||
use polkadot_node_subsystem_util::metrics::prometheus::Registry; | ||||||||||||||||||
use polkadot_primitives::v2::CollatorPair; | ||||||||||||||||||
|
||||||||||||||||||
|
@@ -31,7 +33,7 @@ use sc_network::{Event, NetworkService}; | |||||||||||||||||
use sc_network_common::service::NetworkEventStream; | ||||||||||||||||||
use std::sync::Arc; | ||||||||||||||||||
|
||||||||||||||||||
use polkadot_service::{open_database, Configuration, TaskManager}; | ||||||||||||||||||
use polkadot_service::{Configuration, TaskManager}; | ||||||||||||||||||
|
||||||||||||||||||
use futures::StreamExt; | ||||||||||||||||||
|
||||||||||||||||||
|
@@ -44,6 +46,10 @@ mod network; | |||||||||||||||||
mod blockchain_rpc_client; | ||||||||||||||||||
pub use blockchain_rpc_client::BlockChainRpcClient; | ||||||||||||||||||
|
||||||||||||||||||
const LOG_TARGET: &'static str = "polkadot-minimal-node"; | ||||||||||||||||||
const COST_INVALID_REQUEST: UnifiedReputationChange = | ||||||||||||||||||
UnifiedReputationChange::CostMajor("Received message could not be decoded."); | ||||||||||||||||||
|
||||||||||||||||||
fn build_authority_discovery_service<Block: BlockT>( | ||||||||||||||||||
task_manager: &TaskManager, | ||||||||||||||||||
client: Arc<BlockChainRpcClient>, | ||||||||||||||||||
|
@@ -152,8 +158,10 @@ async fn new_minimal_relay_chain( | |||||||||||||||||
.extend(peer_sets_info(is_authority, &peer_set_protocol_names)); | ||||||||||||||||||
|
||||||||||||||||||
let request_protocol_names = ReqProtocolNames::new(genesis_hash, config.chain_spec.fork_id()); | ||||||||||||||||||
let (collation_req_receiver, available_data_req_receiver, pov_req_receiver, chunk_req_receiver) = | ||||||||||||||||||
let (collation_req_receiver, available_data_req_receiver, chunk_req_receiver) = | ||||||||||||||||||
build_request_response_protocol_receivers(&request_protocol_names, &mut config); | ||||||||||||||||||
drain_unwanted_request_channels(&task_manager, chunk_req_receiver); | ||||||||||||||||||
|
||||||||||||||||||
let (network, network_starter) = | ||||||||||||||||||
network::build_collator_network(network::BuildCollatorNetworkParams { | ||||||||||||||||||
config: &config, | ||||||||||||||||||
|
@@ -170,8 +178,6 @@ async fn new_minimal_relay_chain( | |||||||||||||||||
prometheus_registry.clone(), | ||||||||||||||||||
); | ||||||||||||||||||
|
||||||||||||||||||
let parachains_db = open_database(&config.database)?; | ||||||||||||||||||
|
||||||||||||||||||
let overseer_args = CollatorOverseerGenArgs { | ||||||||||||||||||
runtime_client: relay_chain_rpc_client.clone(), | ||||||||||||||||||
network_service: network.clone(), | ||||||||||||||||||
|
@@ -183,10 +189,6 @@ async fn new_minimal_relay_chain( | |||||||||||||||||
collator_pair, | ||||||||||||||||||
req_protocol_names: request_protocol_names, | ||||||||||||||||||
peer_set_protocol_names, | ||||||||||||||||||
parachains_db, | ||||||||||||||||||
availability_config: polkadot_service::AVAILABILITY_CONFIG, | ||||||||||||||||||
pov_req_receiver, | ||||||||||||||||||
chunk_req_receiver, | ||||||||||||||||||
}; | ||||||||||||||||||
|
||||||||||||||||||
let overseer_handle = collator_overseer::spawn_overseer( | ||||||||||||||||||
|
@@ -200,24 +202,47 @@ async fn new_minimal_relay_chain( | |||||||||||||||||
Ok(NewMinimalNode { task_manager, overseer_handle, network }) | ||||||||||||||||||
} | ||||||||||||||||||
|
||||||||||||||||||
/// Usually availability-distribution subsystem handles these requests. | ||||||||||||||||||
/// We do not run it in this minimal node and therefore we answer | ||||||||||||||||||
/// that we do not have the chunk/PoV. | ||||||||||||||||||
fn drain_unwanted_request_channels( | ||||||||||||||||||
task_manager: &TaskManager, | ||||||||||||||||||
mut chunk_req_receiver: IncomingRequestReceiver<v1::ChunkFetchingRequest>, | ||||||||||||||||||
) { | ||||||||||||||||||
task_manager.spawn_handle().spawn("chunk-request-drainer", None, async move { | ||||||||||||||||||
loop { | ||||||||||||||||||
if let Ok(request) = chunk_req_receiver.recv(|| vec![COST_INVALID_REQUEST]).await { | ||||||||||||||||||
tracing::debug!( | ||||||||||||||||||
target: LOG_TARGET, | ||||||||||||||||||
"Received chunk fetching request. Collators should not receive this." | ||||||||||||||||||
altonen marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||
); | ||||||||||||||||||
if let Err(err) = request.send_response(v1::ChunkFetchingResponse::NoSuchChunk) { | ||||||||||||||||||
tracing::debug!( | ||||||||||||||||||
target: LOG_TARGET, | ||||||||||||||||||
?err, | ||||||||||||||||||
"Unable to answer chunk fetching request" | ||||||||||||||||||
); | ||||||||||||||||||
} | ||||||||||||||||||
}; | ||||||||||||||||||
} | ||||||||||||||||||
}); | ||||||||||||||||||
} | ||||||||||||||||||
|
||||||||||||||||||
fn build_request_response_protocol_receivers( | ||||||||||||||||||
request_protocol_names: &ReqProtocolNames, | ||||||||||||||||||
config: &mut Configuration, | ||||||||||||||||||
) -> ( | ||||||||||||||||||
request_response::IncomingRequestReceiver<request_response::v1::CollationFetchingRequest>, | ||||||||||||||||||
request_response::IncomingRequestReceiver<request_response::v1::AvailableDataFetchingRequest>, | ||||||||||||||||||
request_response::IncomingRequestReceiver<request_response::v1::PoVFetchingRequest>, | ||||||||||||||||||
request_response::IncomingRequestReceiver<request_response::v1::ChunkFetchingRequest>, | ||||||||||||||||||
IncomingRequestReceiver<v1::CollationFetchingRequest>, | ||||||||||||||||||
IncomingRequestReceiver<v1::AvailableDataFetchingRequest>, | ||||||||||||||||||
IncomingRequestReceiver<v1::ChunkFetchingRequest>, | ||||||||||||||||||
) { | ||||||||||||||||||
let (collation_req_receiver, cfg) = | ||||||||||||||||||
IncomingRequest::get_config_receiver(request_protocol_names); | ||||||||||||||||||
config.network.request_response_protocols.push(cfg); | ||||||||||||||||||
let (available_data_req_receiver, cfg) = | ||||||||||||||||||
IncomingRequest::get_config_receiver(request_protocol_names); | ||||||||||||||||||
config.network.request_response_protocols.push(cfg); | ||||||||||||||||||
let (pov_req_receiver, cfg) = IncomingRequest::get_config_receiver(request_protocol_names); | ||||||||||||||||||
config.network.request_response_protocols.push(cfg); | ||||||||||||||||||
let (chunk_req_receiver, cfg) = IncomingRequest::get_config_receiver(request_protocol_names); | ||||||||||||||||||
config.network.request_response_protocols.push(cfg); | ||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should probably support this in Polkadot directly. When it is a collator/full node we should not register an incoming receiver |
||||||||||||||||||
(collation_req_receiver, available_data_req_receiver, pov_req_receiver, chunk_req_receiver) | ||||||||||||||||||
(collation_req_receiver, available_data_req_receiver, chunk_req_receiver) | ||||||||||||||||||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Okay, this is unneeded. We can not do two things. Either we drop this channel or we do not even register the channel.