mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-17 02:01:02 +00:00
Implement Network Bridge (#1280)
* network bridge skeleton * move some primitives around and add debug impls * protocol registration glue & abstract network interface * add send_msgs to subsystemctx * select logic * transform different events into actions and handle * implement remaining network bridge state machine * start test skeleton * make network methods asynchronous * extract subsystem out to subsystem crate * port over overseer to subsystem context trait * fix minimal example * fix overseer doc test * update network-bridge crate * write a subsystem test-helpers crate * write a network test helper for network-bridge * set up (broken) view test * Revamp network to be more async-friendly and not require Sync * fix spacing * fix test compilation * insert side-channel for actions * Add some more message types to AllMessages * introduce a test harness * add some tests * ensure service compiles and passes tests * fix typo * fix service-new compilation * Subsystem test helpers send messages synchronously * remove smelly action inspector * remove superfluous let binding * fix warnings * Update node/network/bridge/src/lib.rs Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com> * fix compilation Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
90de55918a
commit
d16e7485d4
@@ -29,10 +29,10 @@ 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, Subsystem, SubsystemContext, SpawnedSubsystem,
|
||||
CandidateValidationMessage, CandidateBackingMessage,
|
||||
use polkadot_overseer::{self as overseer, BlockInfo, Overseer, OverseerHandler};
|
||||
use polkadot_subsystem::{
|
||||
Subsystem, SubsystemContext, SpawnedSubsystem,
|
||||
messages::{CandidateValidationMessage, CandidateBackingMessage},
|
||||
};
|
||||
pub use service::{
|
||||
Role, PruningMode, TransactionPoolOptions, Error, RuntimeGenesis,
|
||||
@@ -269,8 +269,10 @@ macro_rules! new_full_start {
|
||||
|
||||
struct CandidateValidationSubsystem;
|
||||
|
||||
impl Subsystem<CandidateValidationMessage> for CandidateValidationSubsystem {
|
||||
fn start(&mut self, mut ctx: SubsystemContext<CandidateValidationMessage>) -> SpawnedSubsystem {
|
||||
impl<C> Subsystem<C> for CandidateValidationSubsystem
|
||||
where C: SubsystemContext<Message = CandidateValidationMessage>
|
||||
{
|
||||
fn start(&mut self, mut ctx: C) -> SpawnedSubsystem {
|
||||
SpawnedSubsystem(Box::pin(async move {
|
||||
while let Ok(_) = ctx.recv().await {}
|
||||
}))
|
||||
@@ -279,8 +281,10 @@ impl Subsystem<CandidateValidationMessage> for CandidateValidationSubsystem {
|
||||
|
||||
struct CandidateBackingSubsystem;
|
||||
|
||||
impl Subsystem<CandidateBackingMessage> for CandidateBackingSubsystem {
|
||||
fn start(&mut self, mut ctx: SubsystemContext<CandidateBackingMessage>) -> SpawnedSubsystem {
|
||||
impl<C> Subsystem<C> for CandidateBackingSubsystem
|
||||
where C: SubsystemContext<Message = CandidateBackingMessage>
|
||||
{
|
||||
fn start(&mut self, mut ctx: C) -> SpawnedSubsystem {
|
||||
SpawnedSubsystem(Box::pin(async move {
|
||||
while let Ok(_) = ctx.recv().await {}
|
||||
}))
|
||||
|
||||
Reference in New Issue
Block a user