Move code from sc-network-common back to sc-network (#13592)

* Move service tests to `client/network/tests`

These tests depend on `sc-network` and `sc-network-sync` so they should
live outside the crate.

* Move some configs from `sc-network-common` to `sc-network`

* Move `NetworkService` traits to `sc-network`

* Move request-responses to `sc-network`

* Remove more stuff

* Remove rest of configs from `sc-network-common` to `sc-network`

* Remove more stuff

* Fix warnings

* Update client/network/src/request_responses.rs

Co-authored-by: Dmitry Markin <dmitry@markin.tech>

* Fix cargo doc

---------

Co-authored-by: Dmitry Markin <dmitry@markin.tech>
This commit is contained in:
Aaro Altonen
2023-03-14 14:06:40 +02:00
committed by GitHub
parent 5d718e45c1
commit 9ced14e2de
85 changed files with 1411 additions and 1434 deletions
+4 -7
View File
@@ -38,14 +38,11 @@ use sc_client_db::{Backend, DatabaseSettings};
use sc_consensus::import_queue::ImportQueue;
use sc_executor::RuntimeVersionOf;
use sc_keystore::LocalKeystore;
use sc_network::NetworkService;
use sc_network_bitswap::BitswapRequestHandler;
use sc_network_common::{
config::SyncMode,
protocol::role::Roles,
service::{NetworkEventStream, NetworkStateInfo, NetworkStatusProvider},
sync::warp::WarpSyncParams,
use sc_network::{
config::SyncMode, NetworkEventStream, NetworkService, NetworkStateInfo, NetworkStatusProvider,
};
use sc_network_bitswap::BitswapRequestHandler;
use sc_network_common::{role::Roles, sync::warp::WarpSyncParams};
use sc_network_light::light_client_requests::handler::LightClientRequestHandler;
use sc_network_sync::{
block_request_handler::BlockRequestHandler, engine::SyncingEngine,
+3 -7
View File
@@ -22,22 +22,18 @@ pub use sc_client_api::execution_extensions::{ExecutionStrategies, ExecutionStra
pub use sc_client_db::{BlocksPruning, Database, DatabaseSource, PruningMode};
pub use sc_executor::{WasmExecutionMethod, WasmtimeInstantiationStrategy};
pub use sc_network::{
config::{NetworkConfiguration, Role},
Multiaddr,
};
pub use sc_network_common::{
config::{
MultiaddrWithPeerId, NodeKeyConfig, NonDefaultSetConfig, ProtocolId, SetConfig,
TransportConfig,
MultiaddrWithPeerId, NetworkConfiguration, NodeKeyConfig, NonDefaultSetConfig, ProtocolId,
Role, SetConfig, SyncMode, TransportConfig,
},
request_responses::{
IncomingRequest, OutgoingResponse, ProtocolConfig as RequestResponseConfig,
},
Multiaddr,
};
use prometheus_endpoint::Registry;
use sc_chain_spec::ChainSpec;
use sc_network_common::config::SyncMode;
pub use sc_telemetry::TelemetryEndpoints;
pub use sc_transaction_pool::Options as TransactionPoolOptions;
use sp_core::crypto::SecretString;
+1 -1
View File
@@ -40,7 +40,7 @@ pub enum Error {
Consensus(#[from] sp_consensus::Error),
#[error(transparent)]
Network(#[from] sc_network_common::error::Error),
Network(#[from] sc_network::error::Error),
#[error(transparent)]
Keystore(#[from] sc_keystore::Error),
+2 -4
View File
@@ -41,10 +41,8 @@ use futures::{channel::mpsc, pin_mut, FutureExt, StreamExt};
use jsonrpsee::{core::Error as JsonRpseeError, RpcModule};
use log::{debug, error, warn};
use sc_client_api::{blockchain::HeaderBackend, BlockBackend, BlockchainEvents, ProofProvider};
use sc_network::{NetworkStateInfo, PeerId};
use sc_network_common::{
config::MultiaddrWithPeerId,
service::{NetworkBlock, NetworkPeers},
use sc_network::{
config::MultiaddrWithPeerId, NetworkBlock, NetworkPeers, NetworkStateInfo, PeerId,
};
use sc_network_sync::SyncingService;
use sc_utils::mpsc::TracingUnboundedReceiver;
+2 -5
View File
@@ -22,11 +22,8 @@ use crate::config::Configuration;
use futures_timer::Delay;
use prometheus_endpoint::{register, Gauge, GaugeVec, Opts, PrometheusError, Registry, U64};
use sc_client_api::{ClientInfo, UsageProvider};
use sc_network::config::Role;
use sc_network_common::{
service::{NetworkStatus, NetworkStatusProvider},
sync::{SyncStatus, SyncStatusProvider},
};
use sc_network::{config::Role, NetworkStatus, NetworkStatusProvider};
use sc_network_common::sync::{SyncStatus, SyncStatusProvider};
use sc_telemetry::{telemetry, TelemetryHandle, SUBSTRATE_INFO};
use sc_transaction_pool_api::{MaintainedTransactionPool, PoolStatus};
use sc_utils::metrics::register_globals;
+3 -4
View File
@@ -22,10 +22,9 @@ use futures::{task::Poll, Future, TryFutureExt as _};
use log::{debug, info};
use parking_lot::Mutex;
use sc_client_api::{Backend, CallExecutor};
use sc_network::{config::NetworkConfiguration, multiaddr};
use sc_network_common::{
config::{MultiaddrWithPeerId, TransportConfig},
service::{NetworkBlock, NetworkPeers, NetworkStateInfo},
use sc_network::{
config::{MultiaddrWithPeerId, NetworkConfiguration, TransportConfig},
multiaddr, NetworkBlock, NetworkPeers, NetworkStateInfo,
};
use sc_network_sync::SyncingService;
use sc_service::{