Implement Network Bridge (#1280)

* network bridge skeleton

* move some primitives around and add debug impls

* protocol registration glue & abstract network interface

* add send_msgs to subsystemctx

* select logic

* transform different events into actions and handle

* implement remaining network bridge state machine

* start test skeleton

* make network methods asynchronous

* extract subsystem out to subsystem crate

* port over overseer to subsystem context trait

* fix minimal example

* fix overseer doc test

* update network-bridge crate

* write a subsystem test-helpers crate

* write a network test helper for network-bridge

* set up (broken) view test

* Revamp network to be more async-friendly and not require Sync

* fix spacing

* fix test compilation

* insert side-channel for actions

* Add some more message types to AllMessages

* introduce a test harness

* add some tests

* ensure service compiles and passes tests

* fix typo

* fix service-new compilation

* Subsystem test helpers send messages synchronously

* remove smelly action inspector

* remove superfluous let binding

* fix warnings

* Update node/network/bridge/src/lib.rs

Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com>

* fix compilation

Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com>
This commit is contained in:
Robert Habermeier
2020-06-30 11:21:40 -04:00
committed by GitHub
parent 90de55918a
commit d16e7485d4
16 changed files with 1533 additions and 169 deletions
+56 -12
View File
@@ -256,6 +256,17 @@ dependencies = [
"webpki-roots 0.19.0",
]
[[package]]
name = "async-trait"
version = "0.1.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a265e3abeffdce30b2e26b7a11b222fe37c6067404001b434101457d0385eb92"
dependencies = [
"proc-macro2 1.0.18",
"quote 1.0.7",
"syn 1.0.31",
]
[[package]]
name = "atty"
version = "0.2.14"
@@ -4348,6 +4359,25 @@ dependencies = [
"wasm-timer",
]
[[package]]
name = "polkadot-network-bridge"
version = "0.1.0"
dependencies = [
"assert_matches",
"futures 0.3.5",
"futures-timer 3.0.2",
"log 0.4.8",
"parity-scale-codec",
"parking_lot 0.10.2",
"polkadot-node-primitives",
"polkadot-node-subsystem",
"polkadot-primitives",
"polkadot-subsystem-test-helpers",
"sc-network",
"sp-runtime",
"streamunordered",
]
[[package]]
name = "polkadot-network-test"
version = "0.8.13"
@@ -4370,9 +4400,21 @@ dependencies = [
]
[[package]]
name = "polkadot-node-messages"
name = "polkadot-node-primitives"
version = "0.1.0"
dependencies = [
"async-trait",
"parity-scale-codec",
"polkadot-primitives",
"polkadot-statement-table",
"sp-runtime",
]
[[package]]
name = "polkadot-node-subsystem"
version = "0.1.0"
dependencies = [
"async-trait",
"futures 0.3.5",
"polkadot-node-primitives",
"polkadot-primitives",
@@ -4380,26 +4422,17 @@ dependencies = [
"sc-network",
]
[[package]]
name = "polkadot-node-primitives"
version = "0.1.0"
dependencies = [
"parity-scale-codec",
"polkadot-primitives",
"polkadot-statement-table",
"sp-runtime",
]
[[package]]
name = "polkadot-overseer"
version = "0.1.0"
dependencies = [
"async-trait",
"femme",
"futures 0.3.5",
"futures-timer 3.0.2",
"kv-log-macro",
"log 0.4.8",
"polkadot-node-messages",
"polkadot-node-subsystem",
"polkadot-primitives",
"sc-client-api",
"streamunordered",
@@ -4711,6 +4744,7 @@ dependencies = [
"parity-scale-codec",
"parking_lot 0.9.0",
"polkadot-network",
"polkadot-node-subsystem",
"polkadot-overseer",
"polkadot-primitives",
"polkadot-rpc",
@@ -4760,6 +4794,16 @@ dependencies = [
"sp-core",
]
[[package]]
name = "polkadot-subsystem-test-helpers"
version = "0.1.0"
dependencies = [
"async-trait",
"futures 0.3.5",
"parking_lot 0.10.2",
"polkadot-node-subsystem",
]
[[package]]
name = "polkadot-test-runtime"
version = "0.8.13"