Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Companion for paritytech/substrate#12828 #6380

Merged
merged 16 commits into from
Mar 6, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions node/network/bridge/src/rx/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) = {
Expand Down
1 change: 1 addition & 0 deletions node/service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,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" }
Expand Down
24 changes: 19 additions & 5 deletions node/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,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>,
}
Expand All @@ -633,6 +634,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,
}
Expand Down Expand Up @@ -912,7 +914,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(),
Expand Down Expand Up @@ -980,6 +982,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,
Expand Down Expand Up @@ -1075,6 +1078,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,
Expand Down Expand Up @@ -1154,8 +1158,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();
Expand Down Expand Up @@ -1200,6 +1204,7 @@ where
let justifications_protocol_name = beefy_on_demand_justifications_handler.protocol_name();
let network_params = beefy_gadget::BeefyNetworkParams {
network: network.clone(),
sync: sync_service.clone(),
gossip_protocol_name: beefy_gossip_proto_name,
justifications_protocol_name,
_phantom: core::marker::PhantomData::<Block>,
Expand All @@ -1218,7 +1223,7 @@ where
on_demand_justifications_handler: beefy_on_demand_justifications_handler,
};

let gadget = beefy_gadget::start_beefy_gadget::<_, _, _, _, _, _>(beefy_params);
let gadget = beefy_gadget::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.
Expand Down Expand Up @@ -1298,6 +1303,7 @@ where
config,
link: link_half,
network: network.clone(),
sync: sync_service.clone(),
voting_rule,
prometheus_registry: prometheus_registry.clone(),
shared_voter_state,
Expand All @@ -1313,7 +1319,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")]
Expand Down
9 changes: 6 additions & 3 deletions node/service/src/overseer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,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
Expand Down Expand Up @@ -136,6 +138,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,
Expand Down Expand Up @@ -215,7 +218,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,
))
Expand All @@ -231,7 +234,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)?))
Expand Down Expand Up @@ -288,7 +291,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(
Expand Down