Unverified Commit 20a8a61e authored by Fedor Sakharov's avatar Fedor Sakharov Committed by GitHub
Browse files

A real overseer feature (#1892)



* A real overseer feature

* Fix build without feature

* Update node/service/src/lib.rs
Co-authored-by: default avatarBastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: asynchronous rob's avatarRobert Habermeier <rphmeier@gmail.com>
Co-authored-by: default avatarBastian Köcher <bkchr@users.noreply.github.com>
parent 12b3027e
Pipeline #112790 passed with stages
in 23 minutes and 52 seconds
......@@ -85,6 +85,7 @@ panic = "unwind"
[features]
runtime-benchmarks=["cli/runtime-benchmarks"]
real-overseer=["cli/real-overseer"]
# Configuration for building a .deb package - for use with `cargo-deb`
[package.metadata.deb]
......
......@@ -54,3 +54,4 @@ browser = [
runtime-benchmarks = [ "service/runtime-benchmarks" ]
trie-memory-tracker = [ "sp-trie/memory-tracker" ]
full-node = [ "service/full-node" ]
real-overseer = [ "service/real-overseer" ]
......@@ -99,14 +99,16 @@ env_logger = "0.8.1"
[features]
default = ["db", "full-node"]
db = ["service/db"]
runtime-benchmarks = ["polkadot-runtime/runtime-benchmarks", "kusama-runtime/runtime-benchmarks", "westend-runtime/runtime-benchmarks"]
full-node = [
"polkadot-node-core-av-store",
]
runtime-benchmarks = ["polkadot-runtime/runtime-benchmarks", "kusama-runtime/runtime-benchmarks", "westend-runtime/runtime-benchmarks"]
real-overseer = [
"polkadot-availability-bitfield-distribution",
"polkadot-availability-distribution",
"polkadot-collator-protocol",
"polkadot-network-bridge",
"polkadot-node-collation-generation",
"polkadot-node-core-av-store",
"polkadot-node-core-backing",
"polkadot-node-core-bitfield-signing",
"polkadot-node-core-candidate-selection",
......
......@@ -285,7 +285,7 @@ fn new_partial<RuntimeApi, Executor>(config: &mut Configuration) -> Result<
})
}
#[cfg(feature="full-node")]
#[cfg(all(feature="full-node", not(feature = "real-overseer")))]
fn real_overseer<Spawner, RuntimeClient>(
leaves: impl IntoIterator<Item = BlockInfo>,
_: SyncCryptoStorePtr,
......@@ -310,6 +310,117 @@ where
).map_err(|e| Error::Other(format!("Failed to create an Overseer: {:?}", e)))
}
#[cfg(all(feature = "full-node", feature = "real-overseer"))]
fn real_overseer<Spawner, RuntimeClient>(
leaves: impl IntoIterator<Item = BlockInfo>,
keystore: SyncCryptoStorePtr,
runtime_client: Arc<RuntimeClient>,
availability_config: AvailabilityConfig,
network_service: Arc<sc_network::NetworkService<Block, Hash>>,
authority_discovery: AuthorityDiscoveryService,
registry: Option<&Registry>,
spawner: Spawner,
is_collator: IsCollator,
) -> Result<(Overseer<Spawner>, OverseerHandler), Error>
where
RuntimeClient: 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block>,
RuntimeClient::Api: ParachainHost<Block>,
Spawner: 'static + SpawnNamed + Clone + Unpin,
{
use polkadot_node_subsystem_util::metrics::Metrics;
use polkadot_availability_distribution::AvailabilityDistributionSubsystem;
use polkadot_node_core_av_store::AvailabilityStoreSubsystem;
use polkadot_availability_bitfield_distribution::BitfieldDistribution as BitfieldDistributionSubsystem;
use polkadot_node_core_bitfield_signing::BitfieldSigningSubsystem;
use polkadot_node_core_backing::CandidateBackingSubsystem;
use polkadot_node_core_candidate_selection::CandidateSelectionSubsystem;
use polkadot_node_core_candidate_validation::CandidateValidationSubsystem;
use polkadot_node_core_chain_api::ChainApiSubsystem;
use polkadot_node_collation_generation::CollationGenerationSubsystem;
use polkadot_collator_protocol::{CollatorProtocolSubsystem, ProtocolSide};
use polkadot_network_bridge::NetworkBridge as NetworkBridgeSubsystem;
use polkadot_pov_distribution::PoVDistribution as PoVDistributionSubsystem;
use polkadot_node_core_provisioner::ProvisioningSubsystem as ProvisionerSubsystem;
use polkadot_node_core_runtime_api::RuntimeApiSubsystem;
use polkadot_statement_distribution::StatementDistribution as StatementDistributionSubsystem;
let all_subsystems = AllSubsystems {
availability_distribution: AvailabilityDistributionSubsystem::new(
keystore.clone(),
Metrics::register(registry)?,
),
availability_store: AvailabilityStoreSubsystem::new_on_disk(
availability_config,
Metrics::register(registry)?,
)?,
bitfield_distribution: BitfieldDistributionSubsystem::new(
Metrics::register(registry)?,
),
bitfield_signing: BitfieldSigningSubsystem::new(
spawner.clone(),
keystore.clone(),
Metrics::register(registry)?,
),
candidate_backing: CandidateBackingSubsystem::new(
spawner.clone(),
keystore.clone(),
Metrics::register(registry)?,
),
candidate_selection: CandidateSelectionSubsystem::new(
spawner.clone(),
(),
Metrics::register(registry)?,
),
candidate_validation: CandidateValidationSubsystem::new(
spawner.clone(),
Metrics::register(registry)?,
),
chain_api: ChainApiSubsystem::new(
runtime_client.clone(),
Metrics::register(registry)?,
),
collation_generation: CollationGenerationSubsystem::new(
Metrics::register(registry)?,
),
collator_protocol: {
let side = match is_collator {
IsCollator::Yes(id) => ProtocolSide::Collator(id, Metrics::register(registry)?),
IsCollator::No => ProtocolSide::Validator(Metrics::register(registry)?),
};
CollatorProtocolSubsystem::new(
side,
)
},
network_bridge: NetworkBridgeSubsystem::new(
network_service,
authority_discovery,
),
pov_distribution: PoVDistributionSubsystem::new(
Metrics::register(registry)?,
),
provisioner: ProvisionerSubsystem::new(
spawner.clone(),
(),
Metrics::register(registry)?,
),
runtime_api: RuntimeApiSubsystem::new(
runtime_client,
Metrics::register(registry)?,
),
statement_distribution: StatementDistributionSubsystem::new(
Metrics::register(registry)?,
),
};
Overseer::new(
leaves,
all_subsystems,
registry,
spawner,
).map_err(|e| Error::Other(format!("Failed to create an Overseer: {:?}", e)))
}
#[cfg(feature = "full-node")]
pub struct NewFull<C> {
pub task_manager: TaskManager,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment