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
+6 -12
View File
@@ -21,10 +21,8 @@ use crate::{
Network, Syncing, Validator,
};
use sc_network_common::{
protocol::{event::Event, ProtocolName},
sync::SyncEvent,
};
use sc_network::{event::Event, types::ProtocolName};
use sc_network_common::sync::SyncEvent;
use sc_peerset::ReputationChange;
use futures::{
@@ -340,15 +338,11 @@ mod tests {
future::poll_fn,
};
use quickcheck::{Arbitrary, Gen, QuickCheck};
use sc_network_common::{
config::MultiaddrWithPeerId,
protocol::role::ObservedRole,
service::{
NetworkBlock, NetworkEventStream, NetworkNotification, NetworkPeers,
NotificationSender, NotificationSenderError,
},
sync::SyncEventStream,
use sc_network::{
config::MultiaddrWithPeerId, NetworkBlock, NetworkEventStream, NetworkNotification,
NetworkPeers, NotificationSenderError, NotificationSenderT as NotificationSender,
};
use sc_network_common::{role::ObservedRole, sync::SyncEventStream};
use sp_runtime::{
testing::H256,
traits::{Block as BlockT, NumberFor},
+3 -4
View File
@@ -68,11 +68,10 @@ pub use self::{
};
use libp2p::{multiaddr, PeerId};
use sc_network_common::{
protocol::ProtocolName,
service::{NetworkBlock, NetworkEventStream, NetworkNotification, NetworkPeers},
sync::SyncEventStream,
use sc_network::{
types::ProtocolName, NetworkBlock, NetworkEventStream, NetworkNotification, NetworkPeers,
};
use sc_network_common::sync::SyncEventStream;
use sp_runtime::traits::{Block as BlockT, NumberFor};
use std::iter;
@@ -22,7 +22,8 @@ use ahash::AHashSet;
use libp2p::PeerId;
use lru::LruCache;
use prometheus_endpoint::{register, Counter, PrometheusError, Registry, U64};
use sc_network_common::protocol::{role::ObservedRole, ProtocolName};
use sc_network::types::ProtocolName;
use sc_network_common::role::ObservedRole;
use sp_runtime::traits::{Block as BlockT, Hash, HashFor};
use std::{collections::HashMap, iter, num::NonZeroUsize, sync::Arc, time, time::Instant};
@@ -525,13 +526,10 @@ mod tests {
use super::*;
use crate::multiaddr::Multiaddr;
use futures::prelude::*;
use sc_network_common::{
config::MultiaddrWithPeerId,
protocol::event::Event,
service::{
NetworkBlock, NetworkEventStream, NetworkNotification, NetworkPeers,
NotificationSender, NotificationSenderError,
},
use sc_network::{
config::MultiaddrWithPeerId, event::Event, NetworkBlock, NetworkEventStream,
NetworkNotification, NetworkPeers, NotificationSenderError,
NotificationSenderT as NotificationSender,
};
use sc_peerset::ReputationChange;
use sp_runtime::{
@@ -17,7 +17,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
use libp2p::PeerId;
use sc_network_common::protocol::role::ObservedRole;
use sc_network_common::role::ObservedRole;
use sp_runtime::traits::Block as BlockT;
/// Validates consensus messages.