mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 02:17:58 +00:00
Integrate all (dummy) subsystems with the Overseer (#1374)
* overseer: introduce a utility typemap * it's ugly but it compiles * move DummySubsystem to subsystem crate * fix tests fallout * use a struct for all subsystems * more tests fallout * add missing pov_distribution subsystem * remove unused imports and bounds * fix minimal-example
This commit is contained in:
@@ -29,11 +29,8 @@ use grandpa::{self, FinalityProofProvider as GrandpaFinalityProofProvider};
|
||||
use sc_executor::native_executor_instance;
|
||||
use log::info;
|
||||
use sp_blockchain::HeaderBackend;
|
||||
use polkadot_overseer::{self as overseer, BlockInfo, Overseer, OverseerHandler};
|
||||
use polkadot_subsystem::{
|
||||
Subsystem, SubsystemContext, SpawnedSubsystem,
|
||||
messages::{CandidateValidationMessage, CandidateBackingMessage},
|
||||
};
|
||||
use polkadot_overseer::{self as overseer, AllSubsystems, BlockInfo, Overseer, OverseerHandler};
|
||||
use polkadot_subsystem::DummySubsystem;
|
||||
use polkadot_node_core_proposer::ProposerFactory;
|
||||
use sp_trie::PrefixedMemoryDB;
|
||||
pub use service::{
|
||||
@@ -275,38 +272,28 @@ macro_rules! new_full_start {
|
||||
}}
|
||||
}
|
||||
|
||||
struct CandidateValidationSubsystem;
|
||||
|
||||
impl<C> Subsystem<C> for CandidateValidationSubsystem
|
||||
where C: SubsystemContext<Message = CandidateValidationMessage>
|
||||
{
|
||||
fn start(self, mut ctx: C) -> SpawnedSubsystem {
|
||||
SpawnedSubsystem(Box::pin(async move {
|
||||
while let Ok(_) = ctx.recv().await {}
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
struct CandidateBackingSubsystem;
|
||||
|
||||
impl<C> Subsystem<C> for CandidateBackingSubsystem
|
||||
where C: SubsystemContext<Message = CandidateBackingMessage>
|
||||
{
|
||||
fn start(self, mut ctx: C) -> SpawnedSubsystem {
|
||||
SpawnedSubsystem(Box::pin(async move {
|
||||
while let Ok(_) = ctx.recv().await {}
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
fn real_overseer<S: futures::task::Spawn>(
|
||||
leaves: impl IntoIterator<Item = BlockInfo>,
|
||||
s: S,
|
||||
) -> Result<(Overseer<S>, OverseerHandler), ServiceError> {
|
||||
let validation = CandidateValidationSubsystem;
|
||||
let candidate_backing = CandidateBackingSubsystem;
|
||||
Overseer::new(leaves, validation, candidate_backing, s)
|
||||
.map_err(|e| ServiceError::Other(format!("Failed to create an Overseer: {:?}", e)))
|
||||
let all_subsystems = AllSubsystems {
|
||||
candidate_validation: DummySubsystem,
|
||||
candidate_backing: DummySubsystem,
|
||||
candidate_selection: DummySubsystem,
|
||||
statement_distribution: DummySubsystem,
|
||||
availability_distribution: DummySubsystem,
|
||||
bitfield_distribution: DummySubsystem,
|
||||
provisioner: DummySubsystem,
|
||||
pov_distribution: DummySubsystem,
|
||||
runtime_api: DummySubsystem,
|
||||
availability_store: DummySubsystem,
|
||||
network_bridge: DummySubsystem,
|
||||
};
|
||||
Overseer::new(
|
||||
leaves,
|
||||
all_subsystems,
|
||||
s,
|
||||
).map_err(|e| ServiceError::Other(format!("Failed to create an Overseer: {:?}", e)))
|
||||
}
|
||||
|
||||
/// Builds a new service for a full client.
|
||||
|
||||
Reference in New Issue
Block a user