From e45bca61477187ddbc587173b7cd0231a7158621 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Mon, 22 May 2023 19:17:31 +0800 Subject: [PATCH] Companion of paritytech/substrate#12828 --- Cargo.lock | 2 +- Cargo.toml | 2 +- node/Cargo.toml | 2 +- node/src/rpc.rs | 2 +- node/src/service/mod.rs | 14 ++++++++------ 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 18d675f0b..ed56affdf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2484,8 +2484,8 @@ dependencies = [ "sc-consensus", "sc-consensus-aura", "sc-executor", - "sc-network", "sc-network-common", + "sc-network-sync", "sc-offchain", "sc-rpc", "sc-service", diff --git a/Cargo.toml b/Cargo.toml index c1691c37c..e933f8cef 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -164,8 +164,8 @@ sc-consensus = { git = "https://github.com/parityt sc-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" } sc-executor = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" } sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" } -sc-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" } sc-network-common = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" } +sc-network-sync = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" } sc-offchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" } sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" } sc-rpc-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" } diff --git a/node/Cargo.toml b/node/Cargo.toml index ab56f0a55..ae44e9b25 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -71,8 +71,8 @@ sc-client-api = { workspace = true } sc-consensus = { workspace = true } sc-consensus-aura = { workspace = true } sc-executor = { workspace = true } -sc-network = { workspace = true } sc-network-common = { workspace = true } +sc-network-sync = { workspace = true } sc-offchain = { workspace = true } sc-rpc = { workspace = true } sc-service = { workspace = true } diff --git a/node/src/rpc.rs b/node/src/rpc.rs index e518d0b16..e31bcf649 100644 --- a/node/src/rpc.rs +++ b/node/src/rpc.rs @@ -47,7 +47,7 @@ pub struct FullDeps { /// The Node authority flag pub is_authority: bool, /// Network service - pub network: Arc>, + pub network: Arc>, /// EthFilterApi pool. pub filter_pool: Option, /// Backend. diff --git a/node/src/service/mod.rs b/node/src/service/mod.rs index e0adea1e8..2247d4ce9 100644 --- a/node/src/service/mod.rs +++ b/node/src/service/mod.rs @@ -275,7 +275,7 @@ where &sc_service::TaskManager, Arc, Arc>>, - Arc>, + Arc>, sp_keystore::SyncCryptoStorePtr, bool, ) -> Result< @@ -326,7 +326,7 @@ where let prometheus_registry = parachain_config.prometheus_registry().cloned(); let import_queue_service = import_queue.service(); - let (network, system_rpc_tx, tx_handler_controller, start_network) = + let (network, system_rpc_tx, tx_handler_controller, start_network, sync_service) = sc_service::build_network(cumulus_client_service::BuildNetworkParams { parachain_config: ¶chain_config, client: client.clone(), @@ -427,6 +427,7 @@ where keystore: keystore_container.sync_keystore(), backend: backend.clone(), network: network.clone(), + sync_service: sync_service.clone(), system_rpc_tx, tx_handler_controller, telemetry: telemetry.as_mut(), @@ -456,8 +457,8 @@ where } let announce_block = { - let network = network.clone(); - Arc::new(move |hash, data| network.announce_block(hash, data)) + let sync_service = sync_service.clone(); + Arc::new(move |hash, data| sync_service.announce_block(hash, data)) }; let relay_chain_slot_duration = Duration::from_secs(6); @@ -475,7 +476,7 @@ where &task_manager, relay_chain_interface.clone(), transaction_pool, - network, + sync_service, keystore_container.sync_keystore(), force_authoring, )?; @@ -713,7 +714,7 @@ where ), } = new_partial::(&config, eth_rpc_config)?; - let (network, system_rpc_tx, tx_handler_controller, start_network) = + let (network, system_rpc_tx, tx_handler_controller, start_network, sync_service) = sc_service::build_network(cumulus_client_service::BuildNetworkParams { parachain_config: &config, client: client.clone(), @@ -913,6 +914,7 @@ where keystore: keystore_container.sync_keystore(), backend, network, + sync_service, system_rpc_tx, tx_handler_controller, telemetry: None,