Remove candidate selection (#3148)

* Create validator_side module

* Subsume Candidate Selection

* Add test to ensure candidate backing logic is correct

* Ensure secondings are adequately cleaned up and address test flakyness

* Address Feedback
This commit is contained in:
Lldenaurois
2021-06-08 14:07:19 -04:00
committed by GitHub
parent 6b1f457078
commit 2abaca3a8c
17 changed files with 576 additions and 1238 deletions
@@ -362,8 +362,8 @@ mod tests {
use super::*;
use polkadot_overseer::{Overseer, HeadSupportsParachains, AllSubsystems};
use futures::executor::block_on;
use polkadot_node_subsystem::messages::CandidateSelectionMessage;
use polkadot_primitives::v1::Hash;
use polkadot_node_subsystem::messages::CollatorProtocolMessage;
struct AlwaysSupportsParachains;
impl HeadSupportsParachains for AlwaysSupportsParachains {
@@ -374,7 +374,7 @@ mod tests {
fn forward_subsystem_works() {
let spawner = sp_core::testing::TaskExecutor::new();
let (tx, rx) = mpsc::channel(2);
let all_subsystems = AllSubsystems::<()>::dummy().replace_candidate_selection(ForwardSubsystem(tx));
let all_subsystems = AllSubsystems::<()>::dummy().replace_collator_protocol(ForwardSubsystem(tx));
let (overseer, mut handler) = Overseer::new(
Vec::new(),
all_subsystems,
@@ -385,7 +385,7 @@ mod tests {
spawner.spawn("overseer", overseer.run().then(|_| async { () }).boxed());
block_on(handler.send_msg(CandidateSelectionMessage::Invalid(Default::default(), Default::default())));
assert!(matches!(block_on(rx.into_future()).0.unwrap(), CandidateSelectionMessage::Invalid(_, _)));
block_on(handler.send_msg(CollatorProtocolMessage::CollateOn(Default::default())));
assert!(matches!(block_on(rx.into_future()).0.unwrap(), CollatorProtocolMessage::CollateOn(_)));
}
}