From d609a3f6391b61dd219899f3dfbcb75068d0a158 Mon Sep 17 00:00:00 2001 From: Pawan Dhananjay Date: Fri, 29 May 2020 07:33:30 +0530 Subject: [PATCH] Upgrade to spec compliant noise protocol (#1221) --- Cargo.lock | 113 +++++++++++++++++++++++++ beacon_node/eth2-libp2p/src/service.rs | 4 +- 2 files changed, 115 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b30cf4003..eefda513c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -917,6 +917,26 @@ dependencies = [ "zeroize", ] +[[package]] +name = "darwin-libproc" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb90051930c9a0f09e585762152048e23ac74d20c10590ef7cf01c0343c3046" +dependencies = [ + "darwin-libproc-sys", + "libc", + "memchr", +] + +[[package]] +name = "darwin-libproc-sys" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57cebb5bde66eecdd30ddc4b9cd208238b15db4982ccc72db59d699ea10867c1" +dependencies = [ + "libc", +] + [[package]] name = "data-encoding" version = "2.2.1" @@ -1036,6 +1056,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "doc-comment" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" + [[package]] name = "dtoa" version = "0.4.5" @@ -1747,6 +1773,12 @@ version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bcc8e0c9bce37868955864dbecd2b1ab2bdf967e6f28066d65aaac620444b65c" +[[package]] +name = "glob" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" + [[package]] name = "h2" version = "0.1.26" @@ -2661,6 +2693,15 @@ dependencies = [ "linked-hash-map", ] +[[package]] +name = "mach" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" +dependencies = [ + "libc", +] + [[package]] name = "matches" version = "0.1.8" @@ -2961,6 +3002,12 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" +[[package]] +name = "nom" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf51a729ecf40266a2368ad335a5fdde43471f545a967109cd62146ecf8b66ff" + [[package]] name = "num-bigint" version = "0.2.6" @@ -3263,6 +3310,12 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677" +[[package]] +name = "platforms" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "feb3b2b1033b8a60b4da6ee470325f887758c95d5320f52f9ce0df055a55940e" + [[package]] name = "plotters" version = "0.2.14" @@ -3315,6 +3368,18 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "procinfo" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ab1427f3d2635891f842892dda177883dca0639e05fe66796a62c9d2f23b49c" +dependencies = [ + "byteorder", + "libc", + "nom", + "rustc_version", +] + [[package]] name = "prometheus" version = "0.8.0" @@ -3400,6 +3465,25 @@ version = "2.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e86d370532557ae7573551a1ec8235a0f8d6cb276c7c9e6aa490b511c447485" +[[package]] +name = "psutil" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "094d0f0f32f77f62cd7d137d9b9599ef257d5c1323b36b25746679de2806f547" +dependencies = [ + "cfg-if", + "darwin-libproc", + "derive_more", + "glob", + "mach", + "nix", + "num_cpus", + "once_cell", + "platforms", + "snafu", + "unescape", +] + [[package]] name = "quick-error" version = "1.2.3" @@ -3765,6 +3849,8 @@ dependencies = [ "eth2_hashing", "eth2_ssz", "eth2_ssz_derive", + "procinfo", + "psutil", "rayon", "serde", "state_processing", @@ -4336,6 +4422,27 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7cb5678e1615754284ec264d9bb5b4c27d2018577fd90ac0ceb578591ed5ee4" +[[package]] +name = "snafu" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7f5aed652511f5c9123cf2afbe9c244c29db6effa2abb05c866e965c82405ce" +dependencies = [ + "doc-comment", + "snafu-derive", +] + +[[package]] +name = "snafu-derive" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebf8f7d5720104a9df0f7076a8682024e958bba0fe9848767bb44f251f3648e9" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "snap" version = "1.0.0" @@ -5262,6 +5369,12 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "unescape" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccb97dac3243214f8d8507998906ca3e2e0b900bf9bf4870477f125b82e68f6e" + [[package]] name = "unicase" version = "1.4.2" diff --git a/beacon_node/eth2-libp2p/src/service.rs b/beacon_node/eth2-libp2p/src/service.rs index 0d98d9df1..efb2c062a 100644 --- a/beacon_node/eth2-libp2p/src/service.rs +++ b/beacon_node/eth2-libp2p/src/service.rs @@ -474,8 +474,8 @@ fn load_private_key(config: &NetworkConfig, log: &slog::Logger) -> Keypair { /// Generate authenticated XX Noise config from identity keys fn generate_noise_config( identity_keypair: &Keypair, -) -> noise::NoiseAuthenticated { - let static_dh_keys = noise::Keypair::::new() +) -> noise::NoiseAuthenticated { + let static_dh_keys = noise::Keypair::::new() .into_authentic(identity_keypair) .expect("signing can fail only once during starting a node"); noise::NoiseConfig::xx(static_dh_keys).into_authenticated()