Adds ENR "eth2" field and Fork logic to networking (#953)

* Merge #913

* Correct release tests

* Completed release test corrections

* Initial work on upgrading discovery

* Updates discovery to latest version

* Update ENR initialisation logic

* Remove debug statements

* Shifts timing units to slots

* Initial work

* Add initial fork versioning and EnrForkId

* Correct linking for EnrForkId

* Adds eth2 field to local ENR

* Initial work to eth2 field integration

* Integrate eth2 field into discovery

* temp commit

* Add a timer to adjust fork versions during a hard fork for the ENR
This commit is contained in:
Age Manning
2020-03-24 21:45:53 +11:00
committed by GitHub
parent af1c5c326c
commit 58111cddb2
17 changed files with 431 additions and 235 deletions

55
Cargo.lock generated
View File

@@ -234,6 +234,7 @@ dependencies = [
"eth2_ssz",
"eth2_ssz_derive",
"eth2_ssz_types",
"fork",
"futures",
"genesis",
"integer-sqrt",
@@ -1089,7 +1090,7 @@ dependencies = [
[[package]]
name = "enr"
version = "0.1.0-alpha.3"
source = "git+https://github.com/SigP/rust-libp2p?rev=0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6#0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6"
source = "git+https://github.com/SigP/rust-libp2p?rev=8c272a9a4d115d9a1d33791479527cdcba781829#8c272a9a4d115d9a1d33791479527cdcba781829"
dependencies = [
"base64 0.12.0",
"bs58 0.3.0",
@@ -2057,7 +2058,7 @@ dependencies = [
[[package]]
name = "libp2p"
version = "0.13.2"
source = "git+https://github.com/SigP/rust-libp2p?rev=0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6#0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6"
source = "git+https://github.com/SigP/rust-libp2p?rev=8c272a9a4d115d9a1d33791479527cdcba781829#8c272a9a4d115d9a1d33791479527cdcba781829"
dependencies = [
"bytes",
"futures",
@@ -2096,7 +2097,7 @@ dependencies = [
[[package]]
name = "libp2p-core"
version = "0.13.2"
source = "git+https://github.com/SigP/rust-libp2p?rev=0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6#0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6"
source = "git+https://github.com/SigP/rust-libp2p?rev=8c272a9a4d115d9a1d33791479527cdcba781829#8c272a9a4d115d9a1d33791479527cdcba781829"
dependencies = [
"asn1_der",
"bs58 0.3.0",
@@ -2131,7 +2132,7 @@ dependencies = [
[[package]]
name = "libp2p-core-derive"
version = "0.13.0"
source = "git+https://github.com/SigP/rust-libp2p?rev=0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6#0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6"
source = "git+https://github.com/SigP/rust-libp2p?rev=8c272a9a4d115d9a1d33791479527cdcba781829#8c272a9a4d115d9a1d33791479527cdcba781829"
dependencies = [
"quote 1.0.3",
"syn 1.0.16",
@@ -2140,7 +2141,7 @@ dependencies = [
[[package]]
name = "libp2p-deflate"
version = "0.5.0"
source = "git+https://github.com/SigP/rust-libp2p?rev=0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6#0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6"
source = "git+https://github.com/SigP/rust-libp2p?rev=8c272a9a4d115d9a1d33791479527cdcba781829#8c272a9a4d115d9a1d33791479527cdcba781829"
dependencies = [
"flate2",
"futures",
@@ -2151,7 +2152,7 @@ dependencies = [
[[package]]
name = "libp2p-discv5"
version = "0.1.0"
source = "git+https://github.com/SigP/rust-libp2p?rev=0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6#0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6"
source = "git+https://github.com/SigP/rust-libp2p?rev=8c272a9a4d115d9a1d33791479527cdcba781829#8c272a9a4d115d9a1d33791479527cdcba781829"
dependencies = [
"arrayvec 0.4.12",
"bigint",
@@ -2182,7 +2183,7 @@ dependencies = [
[[package]]
name = "libp2p-dns"
version = "0.13.0"
source = "git+https://github.com/SigP/rust-libp2p?rev=0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6#0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6"
source = "git+https://github.com/SigP/rust-libp2p?rev=8c272a9a4d115d9a1d33791479527cdcba781829#8c272a9a4d115d9a1d33791479527cdcba781829"
dependencies = [
"futures",
"libp2p-core",
@@ -2193,7 +2194,7 @@ dependencies = [
[[package]]
name = "libp2p-floodsub"
version = "0.13.1"
source = "git+https://github.com/SigP/rust-libp2p?rev=0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6#0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6"
source = "git+https://github.com/SigP/rust-libp2p?rev=8c272a9a4d115d9a1d33791479527cdcba781829#8c272a9a4d115d9a1d33791479527cdcba781829"
dependencies = [
"bs58 0.3.0",
"bytes",
@@ -2211,7 +2212,7 @@ dependencies = [
[[package]]
name = "libp2p-gossipsub"
version = "0.1.0"
source = "git+https://github.com/SigP/rust-libp2p?rev=0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6#0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6"
source = "git+https://github.com/SigP/rust-libp2p?rev=8c272a9a4d115d9a1d33791479527cdcba781829#8c272a9a4d115d9a1d33791479527cdcba781829"
dependencies = [
"base64 0.10.1",
"bs58 0.2.5",
@@ -2236,7 +2237,7 @@ dependencies = [
[[package]]
name = "libp2p-identify"
version = "0.13.2"
source = "git+https://github.com/SigP/rust-libp2p?rev=0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6#0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6"
source = "git+https://github.com/SigP/rust-libp2p?rev=8c272a9a4d115d9a1d33791479527cdcba781829#8c272a9a4d115d9a1d33791479527cdcba781829"
dependencies = [
"bytes",
"futures",
@@ -2255,7 +2256,7 @@ dependencies = [
[[package]]
name = "libp2p-kad"
version = "0.13.2"
source = "git+https://github.com/SigP/rust-libp2p?rev=0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6#0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6"
source = "git+https://github.com/SigP/rust-libp2p?rev=8c272a9a4d115d9a1d33791479527cdcba781829#8c272a9a4d115d9a1d33791479527cdcba781829"
dependencies = [
"arrayvec 0.5.1",
"bytes",
@@ -2282,7 +2283,7 @@ dependencies = [
[[package]]
name = "libp2p-mdns"
version = "0.13.1"
source = "git+https://github.com/SigP/rust-libp2p?rev=0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6#0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6"
source = "git+https://github.com/SigP/rust-libp2p?rev=8c272a9a4d115d9a1d33791479527cdcba781829#8c272a9a4d115d9a1d33791479527cdcba781829"
dependencies = [
"data-encoding",
"dns-parser",
@@ -2304,7 +2305,7 @@ dependencies = [
[[package]]
name = "libp2p-mplex"
version = "0.13.0"
source = "git+https://github.com/SigP/rust-libp2p?rev=0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6#0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6"
source = "git+https://github.com/SigP/rust-libp2p?rev=8c272a9a4d115d9a1d33791479527cdcba781829#8c272a9a4d115d9a1d33791479527cdcba781829"
dependencies = [
"bytes",
"fnv",
@@ -2320,7 +2321,7 @@ dependencies = [
[[package]]
name = "libp2p-noise"
version = "0.11.1"
source = "git+https://github.com/SigP/rust-libp2p?rev=0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6#0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6"
source = "git+https://github.com/SigP/rust-libp2p?rev=8c272a9a4d115d9a1d33791479527cdcba781829#8c272a9a4d115d9a1d33791479527cdcba781829"
dependencies = [
"bytes",
"curve25519-dalek 1.2.3",
@@ -2340,7 +2341,7 @@ dependencies = [
[[package]]
name = "libp2p-ping"
version = "0.13.1"
source = "git+https://github.com/SigP/rust-libp2p?rev=0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6#0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6"
source = "git+https://github.com/SigP/rust-libp2p?rev=8c272a9a4d115d9a1d33791479527cdcba781829#8c272a9a4d115d9a1d33791479527cdcba781829"
dependencies = [
"bytes",
"futures",
@@ -2357,7 +2358,7 @@ dependencies = [
[[package]]
name = "libp2p-plaintext"
version = "0.13.1"
source = "git+https://github.com/SigP/rust-libp2p?rev=0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6#0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6"
source = "git+https://github.com/SigP/rust-libp2p?rev=8c272a9a4d115d9a1d33791479527cdcba781829#8c272a9a4d115d9a1d33791479527cdcba781829"
dependencies = [
"bytes",
"futures",
@@ -2372,7 +2373,7 @@ dependencies = [
[[package]]
name = "libp2p-secio"
version = "0.13.1"
source = "git+https://github.com/SigP/rust-libp2p?rev=0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6#0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6"
source = "git+https://github.com/SigP/rust-libp2p?rev=8c272a9a4d115d9a1d33791479527cdcba781829#8c272a9a4d115d9a1d33791479527cdcba781829"
dependencies = [
"aes-ctr",
"bytes",
@@ -2401,7 +2402,7 @@ dependencies = [
[[package]]
name = "libp2p-swarm"
version = "0.3.0"
source = "git+https://github.com/SigP/rust-libp2p?rev=0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6#0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6"
source = "git+https://github.com/SigP/rust-libp2p?rev=8c272a9a4d115d9a1d33791479527cdcba781829#8c272a9a4d115d9a1d33791479527cdcba781829"
dependencies = [
"futures",
"libp2p-core",
@@ -2414,7 +2415,7 @@ dependencies = [
[[package]]
name = "libp2p-tcp"
version = "0.13.0"
source = "git+https://github.com/SigP/rust-libp2p?rev=0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6#0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6"
source = "git+https://github.com/SigP/rust-libp2p?rev=8c272a9a4d115d9a1d33791479527cdcba781829#8c272a9a4d115d9a1d33791479527cdcba781829"
dependencies = [
"bytes",
"futures",
@@ -2430,7 +2431,7 @@ dependencies = [
[[package]]
name = "libp2p-uds"
version = "0.13.0"
source = "git+https://github.com/SigP/rust-libp2p?rev=0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6#0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6"
source = "git+https://github.com/SigP/rust-libp2p?rev=8c272a9a4d115d9a1d33791479527cdcba781829#8c272a9a4d115d9a1d33791479527cdcba781829"
dependencies = [
"futures",
"libp2p-core",
@@ -2441,7 +2442,7 @@ dependencies = [
[[package]]
name = "libp2p-wasm-ext"
version = "0.6.0"
source = "git+https://github.com/SigP/rust-libp2p?rev=0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6#0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6"
source = "git+https://github.com/SigP/rust-libp2p?rev=8c272a9a4d115d9a1d33791479527cdcba781829#8c272a9a4d115d9a1d33791479527cdcba781829"
dependencies = [
"futures",
"js-sys",
@@ -2455,7 +2456,7 @@ dependencies = [
[[package]]
name = "libp2p-websocket"
version = "0.13.0"
source = "git+https://github.com/SigP/rust-libp2p?rev=0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6#0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6"
source = "git+https://github.com/SigP/rust-libp2p?rev=8c272a9a4d115d9a1d33791479527cdcba781829#8c272a9a4d115d9a1d33791479527cdcba781829"
dependencies = [
"bytes",
"futures",
@@ -2473,7 +2474,7 @@ dependencies = [
[[package]]
name = "libp2p-yamux"
version = "0.13.0"
source = "git+https://github.com/SigP/rust-libp2p?rev=0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6#0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6"
source = "git+https://github.com/SigP/rust-libp2p?rev=8c272a9a4d115d9a1d33791479527cdcba781829#8c272a9a4d115d9a1d33791479527cdcba781829"
dependencies = [
"futures",
"libp2p-core",
@@ -2773,7 +2774,7 @@ dependencies = [
[[package]]
name = "multistream-select"
version = "0.6.1"
source = "git+https://github.com/SigP/rust-libp2p?rev=0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6#0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6"
source = "git+https://github.com/SigP/rust-libp2p?rev=8c272a9a4d115d9a1d33791479527cdcba781829#8c272a9a4d115d9a1d33791479527cdcba781829"
dependencies = [
"bytes",
"futures",
@@ -3006,7 +3007,7 @@ dependencies = [
[[package]]
name = "parity-multiaddr"
version = "0.6.0"
source = "git+https://github.com/SigP/rust-libp2p?rev=0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6#0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6"
source = "git+https://github.com/SigP/rust-libp2p?rev=8c272a9a4d115d9a1d33791479527cdcba781829#8c272a9a4d115d9a1d33791479527cdcba781829"
dependencies = [
"arrayref",
"bs58 0.3.0",
@@ -3023,7 +3024,7 @@ dependencies = [
[[package]]
name = "parity-multihash"
version = "0.2.0"
source = "git+https://github.com/SigP/rust-libp2p?rev=0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6#0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6"
source = "git+https://github.com/SigP/rust-libp2p?rev=8c272a9a4d115d9a1d33791479527cdcba781829#8c272a9a4d115d9a1d33791479527cdcba781829"
dependencies = [
"blake2",
"bytes",
@@ -3799,7 +3800,7 @@ dependencies = [
[[package]]
name = "rw-stream-sink"
version = "0.1.2"
source = "git+https://github.com/SigP/rust-libp2p?rev=0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6#0cb9d504c7be6a7bcfc87feeafdb6847d8083fc6"
source = "git+https://github.com/SigP/rust-libp2p?rev=8c272a9a4d115d9a1d33791479527cdcba781829#8c272a9a4d115d9a1d33791479527cdcba781829"
dependencies = [
"bytes",
"futures",