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 all 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
372 changes: 189 additions & 183 deletions Cargo.lock

Large diffs are not rendered by default.

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/network/bridge/src/rx/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions node/network/bridge/src/tx/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions node/service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
29 changes: 22 additions & 7 deletions node/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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.");
},
Expand Down Expand Up @@ -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>,
}
Expand All @@ -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,
}
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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>,
Expand All @@ -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.
Expand Down Expand Up @@ -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,
Expand All @@ -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")]
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 @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
))
Expand All @@ -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)?))
Expand Down Expand Up @@ -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(
Expand Down