Do not run unneeded subsystems on collator and its alongside node (#3061)

Currently, collators and their alongside nodes spin up a full-scale
overseer running a bunch of subsystems that are not needed if the node
is not a validator. That was considered to be harmless; however, we've
got problems with unused subsystems getting stalled for a reason not
currently known, resulting in the overseer exiting and bringing down the
whole node.

This PR aims to only run needed subsystems on such nodes, replacing the
rest with `DummySubsystem`.

It also enables collator-optimized availability recovery subsystem
implementation.

Partially solves #1730.
This commit is contained in:
s0me0ne-unkn0wn
2024-01-29 10:53:51 +01:00
committed by GitHub
parent 987edd8864
commit 3e8139e7de
16 changed files with 429 additions and 220 deletions
+20 -9
View File
@@ -28,7 +28,9 @@ use polkadot_overseer::Handle;
use polkadot_primitives::{Balance, CollatorPair, HeadData, Id as ParaId, ValidationCode};
use polkadot_runtime_common::BlockHashCount;
use polkadot_runtime_parachains::paras::{ParaGenesisArgs, ParaKind};
use polkadot_service::{Error, FullClient, IsParachainNode, NewFull, PrometheusConfig};
use polkadot_service::{
Error, FullClient, IsParachainNode, NewFull, OverseerGen, PrometheusConfig,
};
use polkadot_test_runtime::{
ParasCall, ParasSudoWrapperCall, Runtime, SignedExtra, SignedPayload, SudoCall,
UncheckedExtrinsic, VERSION,
@@ -69,10 +71,11 @@ pub use polkadot_service::{FullBackend, GetLastTimestamp};
/// Create a new full node.
#[sc_tracing::logging::prefix_logs_with(config.network.node_name.as_str())]
pub fn new_full(
pub fn new_full<OverseerGenerator: OverseerGen>(
config: Configuration,
is_parachain_node: IsParachainNode,
workers_path: Option<PathBuf>,
overseer_gen: OverseerGenerator,
) -> Result<NewFull, Error> {
let workers_path = Some(workers_path.unwrap_or_else(get_relative_workers_path_for_test));
@@ -88,7 +91,7 @@ pub fn new_full(
secure_validator_mode: false,
workers_path,
workers_names: None,
overseer_gen: polkadot_service::RealOverseerGen,
overseer_gen,
overseer_message_channel_capacity_override: None,
malus_finality_delay: None,
hwbench: None,
@@ -207,9 +210,13 @@ pub fn run_validator_node(
worker_program_path: Option<PathBuf>,
) -> PolkadotTestNode {
let multiaddr = config.network.listen_addresses[0].clone();
let NewFull { task_manager, client, network, rpc_handlers, overseer_handle, .. } =
new_full(config, IsParachainNode::No, worker_program_path)
.expect("could not create Polkadot test service");
let NewFull { task_manager, client, network, rpc_handlers, overseer_handle, .. } = new_full(
config,
IsParachainNode::No,
worker_program_path,
polkadot_service::ValidatorOverseerGen,
)
.expect("could not create Polkadot test service");
let overseer_handle = overseer_handle.expect("test node must have an overseer handle");
let peer_id = network.local_peer_id();
@@ -239,9 +246,13 @@ pub fn run_collator_node(
) -> PolkadotTestNode {
let config = node_config(storage_update_func, tokio_handle, key, boot_nodes, false);
let multiaddr = config.network.listen_addresses[0].clone();
let NewFull { task_manager, client, network, rpc_handlers, overseer_handle, .. } =
new_full(config, IsParachainNode::Collator(collator_pair), None)
.expect("could not create Polkadot test service");
let NewFull { task_manager, client, network, rpc_handlers, overseer_handle, .. } = new_full(
config,
IsParachainNode::Collator(collator_pair),
None,
polkadot_service::CollatorOverseerGen,
)
.expect("could not create Polkadot test service");
let overseer_handle = overseer_handle.expect("test node must have an overseer handle");
let peer_id = network.local_peer_id();