rewrite network code to use notifications_protocol APIs from Substrate (#788)

* extract all network code to legacy submodule

* update references to legacy proto

* skeleton of futures-based protocol

* refactor skeleton to use background task

* rename communication_for to build_table_router

* implement internal message types for validation network

* basic ParachainNetwork and TableRouter implementations

* add some module docs

* remove exit-future from validation

* hack: adapt legacy protocol to lack of exit-future

* generalize RegisteredMessageValidator somewhat

* instantiate and teardown table routers

* clean up RouterInner drop logic

* implement most of the statement import loop

* implement statement loop in async/await

* remove unneeded TODO

* most of the collation skeleton

* send session keys and validator roles

* also send role after status

* use config in startup

* point TODO to issue

* fix test compilation
This commit is contained in:
Robert Habermeier
2020-02-10 15:20:45 +01:00
committed by GitHub
parent 6051a2b272
commit 9b23f3f1f0
21 changed files with 1941 additions and 867 deletions
+7 -3
View File
@@ -22,7 +22,10 @@ use sc_client::LongestChain;
use std::sync::Arc;
use std::time::Duration;
use polkadot_primitives::{parachain, Hash, BlockId, AccountId, Nonce, Balance};
use polkadot_network::{gossip::{self as network_gossip, Known}, validation::ValidationNetwork};
use polkadot_network::legacy::{
gossip::{self as network_gossip, Known},
validation::ValidationNetwork,
};
use service::{error::{Error as ServiceError}, ServiceBuilder};
use grandpa::{self, FinalityProofProvider as GrandpaFinalityProofProvider};
use inherents::InherentDataProviders;
@@ -39,7 +42,7 @@ pub use sc_client_api::backend::Backend;
pub use sp_api::{Core as CoreApi, ConstructRuntimeApi, ProvideRuntimeApi, StateBackend};
pub use sp_runtime::traits::HasherFor;
pub use consensus_common::SelectChain;
pub use polkadot_network::PolkadotProtocol;
pub use polkadot_network::legacy::PolkadotProtocol;
pub use polkadot_primitives::parachain::{CollatorId, ParachainHost};
pub use polkadot_primitives::Block;
pub use sp_core::Blake2Hasher;
@@ -342,7 +345,8 @@ pub fn new_full<Runtime, Dispatch, Extrinsic>(
let mut path = PathBuf::from(db_path);
path.push("availability");
let gossip = polkadot_network::AvailabilityNetworkShim(gossip_validator.clone());
let gossip = polkadot_network::legacy
::AvailabilityNetworkShim(gossip_validator.clone());
#[cfg(not(target_os = "unknown"))]
{