Network sync refactoring (part 6) (#11940)

* Extract `NetworkKVProvider` trait in `sc-authority-discovery` and remove unnecessary dependency

* Extract `NetworkSyncForkRequest` trait in `sc-finality-grandpa`

* Relax requirements on `SyncOracle` trait, remove extra native methods from `NetworkService` that are already provided by trait impls

* Move `NetworkSigner` trait from `sc-authority-discovery` into `sc-network-common` and de-duplicate methods on `NetworkService`

* Move `NetworkKVProvider` trait from `sc-authority-discovery` into `sc-network-common` and de-duplicate methods on `NetworkService`

* Minimize `sc-authority-discovery` dependency on `sc-network`

* Move `NetworkSyncForkRequest` trait from `sc-finality-grandpa` to `sc-network-common` and de-duplicate methods in `NetworkService`

* Extract `NetworkStatusProvider` trait and de-duplicate methods on `NetworkService`

* Extract `NetworkPeers` trait and de-duplicate methods on `NetworkService`

* Extract `NetworkEventStream` trait and de-duplicate methods on `NetworkService`

* Move more methods from `NetworkService` into `NetworkPeers` trait

* Move `NetworkStateInfo` trait into `sc-network-common`

* Extract `NetworkNotification` trait and de-duplicate methods on `NetworkService`

* Extract `NetworkRequest` trait and de-duplicate methods on `NetworkService`

* Remove `NetworkService::local_peer_id()`, it is already provided by `NetworkStateInfo` impl

* Extract `NetworkTransaction` trait and de-duplicate methods on `NetworkService`

* Extract `NetworkBlock` trait and de-duplicate methods on `NetworkService`

* Remove dependencies on `NetworkService` from most of the methods of `sc-service`

* Address simple review comments
This commit is contained in:
Nazar Mokrynskyi
2022-08-09 21:28:32 +03:00
committed by GitHub
parent 9c56e79c43
commit a685582bfd
49 changed files with 1889 additions and 1029 deletions
+9 -2
View File
@@ -4686,6 +4686,7 @@ dependencies = [
"sc-finality-grandpa",
"sc-keystore",
"sc-network",
"sc-network-common",
"sc-rpc",
"sc-service",
"sc-service-test",
@@ -7702,7 +7703,6 @@ dependencies = [
name = "sc-authority-discovery"
version = "0.10.0-dev"
dependencies = [
"async-trait",
"futures",
"futures-timer",
"ip_network",
@@ -7715,6 +7715,7 @@ dependencies = [
"rand 0.7.3",
"sc-client-api",
"sc-network",
"sc-network-common",
"sp-api",
"sp-authority-discovery",
"sp-blockchain",
@@ -8316,7 +8317,7 @@ dependencies = [
"log",
"parity-util-mem",
"sc-client-api",
"sc-network",
"sc-network-common",
"sc-transaction-pool-api",
"sp-blockchain",
"sp-runtime",
@@ -8398,7 +8399,9 @@ dependencies = [
name = "sc-network-common"
version = "0.10.0-dev"
dependencies = [
"async-trait",
"bitflags",
"bytes",
"futures",
"libp2p",
"parity-scale-codec",
@@ -8409,6 +8412,7 @@ dependencies = [
"sp-consensus",
"sp-finality-grandpa",
"sp-runtime",
"thiserror",
]
[[package]]
@@ -8424,6 +8428,7 @@ dependencies = [
"lru",
"quickcheck",
"sc-network",
"sc-network-common",
"sp-runtime",
"substrate-prometheus-endpoint",
"substrate-test-runtime-client",
@@ -8533,6 +8538,7 @@ dependencies = [
"sc-client-api",
"sc-client-db",
"sc-network",
"sc-network-common",
"sc-transaction-pool",
"sc-transaction-pool-api",
"sc-utils",
@@ -8741,6 +8747,7 @@ dependencies = [
"sc-consensus",
"sc-executor",
"sc-network",
"sc-network-common",
"sc-service",
"sc-transaction-pool-api",
"sp-api",