feat/overseer: introduce closure init (#3775)

* feat/overseer: introduce closure init

Enables removal of the connected/disconnected overseer state.

* feat/overseer: allow replacement logic to access the original

Allows to re-use init-once types, which would otherwise error.

* feat/overseer: introduce external connector

Preparation for removal of `AllSubsystems`
which is another prerequisite for removing
the connect/disconnect state.

* fix/test: replace needs closure

* fixup

* simplify

* mea culpa

* all-subsystems-gen test
This commit is contained in:
Bernhard Schuster
2021-09-04 10:07:07 +02:00
committed by GitHub
parent 5596170bfb
commit 3cc5a1eee9
14 changed files with 150 additions and 45 deletions
+11 -10
View File
@@ -34,9 +34,8 @@ use polkadot_cli::{
// Import extra types relevant to the particular
// subsystem.
use polkadot_node_core_candidate_validation::{CandidateValidationSubsystem, Metrics};
use polkadot_node_core_candidate_validation::CandidateValidationSubsystem;
use polkadot_node_subsystem::messages::CandidateValidationMessage;
use polkadot_node_subsystem_util::metrics::Metrics as _;
// Filter wrapping related types.
use malus::*;
@@ -88,14 +87,16 @@ impl OverseerGen for BehaveMaleficient {
// modify the subsystem(s) as needed:
let all_subsystems = create_default_subsystems(args)?.replace_candidate_validation(
// create the filtered subsystem
FilteredSubsystem::new(
CandidateValidationSubsystem::with_config(
candidate_validation_config,
Metrics::register(registry)?,
polkadot_node_core_pvf::Metrics::register(registry)?,
),
Skippy::default(),
),
|orig: CandidateValidationSubsystem| {
FilteredSubsystem::new(
CandidateValidationSubsystem::with_config(
candidate_validation_config,
orig.metrics,
orig.pvf_metrics,
),
Skippy::default(),
)
},
);
Overseer::new(leaves, all_subsystems, registry, runtime_client, spawner)