Skip to content
Snippets Groups Projects
Commit ce9fbe73 authored by Aaro Altonen's avatar Aaro Altonen Committed by GitHub
Browse files

Companion for paritytech/substrate#12828 (#6380)

* Companion for paritytech/substrate#12828

* Pass sync service

* Fix test

* Fix tests again

* update lockfile for {"substrate"}

* cargo fmt

---------

Co-authored-by: parity-processbot <>
parent ed6fa549
No related merge requests found
This diff is collapsed.
......@@ -145,14 +145,13 @@ where
loop {
match network_stream.next().await {
None => return Err(Error::EventStreamConcluded),
Some(NetworkEvent::Dht(_)) |
Some(NetworkEvent::SyncConnected { .. }) |
Some(NetworkEvent::SyncDisconnected { .. }) => {},
Some(NetworkEvent::Dht(_)) => {},
Some(NetworkEvent::NotificationStreamOpened {
remote: peer,
protocol,
role,
negotiated_fallback,
received_handshake: _,
}) => {
let role = ObservedRole::from(role);
let (peer_set, version) = {
......
......@@ -195,6 +195,7 @@ impl TestNetworkHandle {
protocol: self.protocol_names.get_main_name(peer_set),
negotiated_fallback: None,
role: role.into(),
received_handshake: vec![],
})
.await;
}
......
......@@ -173,6 +173,7 @@ impl TestNetworkHandle {
protocol: self.peerset_protocol_names.get_main_name(peer_set),
negotiated_fallback: None,
role: role.into(),
received_handshake: vec![],
})
.await;
}
......
......@@ -22,6 +22,7 @@ sc-consensus-slots = { git = "https://github.com/paritytech/substrate", branch =
sc-executor = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-network-common = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-network-sync = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-sync-state-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" }
......
......@@ -296,7 +296,7 @@ pub fn open_database(db_source: &DatabaseSource) -> Result<Arc<dyn Database>, Er
path.parent().ok_or(Error::DatabasePathRequired)?.into(),
parachains_db::CacheSizes::default(),
)?,
DatabaseSource::Auto { paritydb_path, rocksdb_path, .. } =>
DatabaseSource::Auto { paritydb_path, rocksdb_path, .. } => {
if paritydb_path.is_dir() && paritydb_path.exists() {
parachains_db::open_creating_paritydb(
paritydb_path.parent().ok_or(Error::DatabasePathRequired)?.into(),
......@@ -307,7 +307,8 @@ pub fn open_database(db_source: &DatabaseSource) -> Result<Arc<dyn Database>, Er
rocksdb_path.clone(),
parachains_db::CacheSizes::default(),
)?
},
}
},
DatabaseSource::Custom { .. } => {
unimplemented!("No polkadot subsystem db for custom source.");
},
......@@ -615,6 +616,7 @@ pub struct NewFull<C> {
pub client: C,
pub overseer_handle: Option<Handle>,
pub network: Arc<sc_network::NetworkService<Block, <Block as BlockT>::Hash>>,
pub sync_service: Arc<sc_network_sync::SyncingService<Block>>,
pub rpc_handlers: RpcHandlers,
pub backend: Arc<FullBackend>,
}
......@@ -628,6 +630,7 @@ impl<C> NewFull<C> {
task_manager: self.task_manager,
overseer_handle: self.overseer_handle,
network: self.network,
sync_service: self.sync_service,
rpc_handlers: self.rpc_handlers,
backend: self.backend,
}
......@@ -855,7 +858,7 @@ where
grandpa_hard_forks,
));
let (network, system_rpc_tx, tx_handler_controller, network_starter) =
let (network, system_rpc_tx, tx_handler_controller, network_starter, sync_service) =
service::build_network(service::BuildNetworkParams {
config: &config,
client: client.clone(),
......@@ -923,6 +926,7 @@ where
client: client.clone(),
keystore: keystore_container.sync_keystore(),
network: network.clone(),
sync_service: sync_service.clone(),
rpc_builder: Box::new(rpc_extensions_builder),
transaction_pool: transaction_pool.clone(),
task_manager: &mut task_manager,
......@@ -1013,6 +1017,7 @@ where
runtime_client: overseer_client.clone(),
parachains_db,
network_service: network.clone(),
sync_service: sync_service.clone(),
authority_discovery_service,
pov_req_receiver,
chunk_req_receiver,
......@@ -1092,8 +1097,8 @@ where
select_chain,
block_import,
env: proposer,
sync_oracle: network.clone(),
justification_sync_link: network.clone(),
sync_oracle: sync_service.clone(),
justification_sync_link: sync_service.clone(),
create_inherent_data_providers: move |parent, ()| {
let client_clone = client_clone.clone();
let overseer_handle = overseer_handle.clone();
......@@ -1138,6 +1143,7 @@ where
let justifications_protocol_name = beefy_on_demand_justifications_handler.protocol_name();
let network_params = beefy::BeefyNetworkParams {
network: network.clone(),
sync: sync_service.clone(),
gossip_protocol_name: beefy_gossip_proto_name,
justifications_protocol_name,
_phantom: core::marker::PhantomData::<Block>,
......@@ -1156,7 +1162,7 @@ where
on_demand_justifications_handler: beefy_on_demand_justifications_handler,
};
let gadget = beefy::start_beefy_gadget::<_, _, _, _, _, _>(beefy_params);
let gadget = beefy::start_beefy_gadget::<_, _, _, _, _, _, _>(beefy_params);
// Wococo's purpose is to be a testbed for BEEFY, so if it fails we'll
// bring the node down with it to make sure it is noticed.
......@@ -1236,6 +1242,7 @@ where
config,
link: link_half,
network: network.clone(),
sync: sync_service.clone(),
voting_rule,
prometheus_registry: prometheus_registry.clone(),
shared_voter_state,
......@@ -1251,7 +1258,15 @@ where
network_starter.start_network();
Ok(NewFull { task_manager, client, overseer_handle, network, rpc_handlers, backend })
Ok(NewFull {
task_manager,
client,
overseer_handle,
network,
sync_service,
rpc_handlers,
backend,
})
}
#[cfg(feature = "full-node")]
......
......@@ -89,6 +89,8 @@ where
pub parachains_db: Arc<dyn polkadot_node_subsystem_util::database::Database>,
/// Underlying network service implementation.
pub network_service: Arc<sc_network::NetworkService<Block, Hash>>,
/// Underlying syncing service implementation.
pub sync_service: Arc<sc_network_sync::SyncingService<Block>>,
/// Underlying authority discovery service.
pub authority_discovery_service: AuthorityDiscoveryService,
/// POV request receiver
......@@ -133,6 +135,7 @@ pub fn prepared_overseer_builder<Spawner, RuntimeClient>(
runtime_client,
parachains_db,
network_service,
sync_service,
authority_discovery_service,
pov_req_receiver,
chunk_req_receiver,
......@@ -212,7 +215,7 @@ where
.network_bridge_rx(NetworkBridgeRxSubsystem::new(
network_service.clone(),
authority_discovery_service.clone(),
Box::new(network_service.clone()),
Box::new(sync_service.clone()),
network_bridge_metrics,
peerset_protocol_names,
))
......@@ -228,7 +231,7 @@ where
.availability_store(AvailabilityStoreSubsystem::new(
parachains_db.clone(),
availability_config,
Box::new(network_service.clone()),
Box::new(sync_service.clone()),
Metrics::register(registry)?,
))
.bitfield_distribution(BitfieldDistributionSubsystem::new(Metrics::register(registry)?))
......@@ -285,7 +288,7 @@ where
approval_voting_config,
parachains_db.clone(),
keystore.clone(),
Box::new(network_service.clone()),
Box::new(sync_service.clone()),
Metrics::register(registry)?,
))
.gossip_support(GossipSupportSubsystem::new(
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment