diff --git a/Cargo.lock b/Cargo.lock index cae910fa6..aa2053003 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1523,7 +1523,7 @@ dependencies = [ "hex", "hkdf", "lazy_static", - "libp2p-core 0.29.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core", "lru", "lru_time_cache", "parking_lot", @@ -3273,14 +3273,15 @@ dependencies = [ [[package]] name = "libp2p" -version = "0.39.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c1ef4bffd225a78cefe8fa43dc8ee18e03ff4f93#c1ef4bffd225a78cefe8fa43dc8ee18e03ff4f93" +version = "0.39.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9004c06878ef8f3b4b4067e69a140d87ed20bf777287f82223e49713b36ee433" dependencies = [ "atomic", "bytes 1.0.1", "futures", "lazy_static", - "libp2p-core 0.29.0 (git+https://github.com/libp2p/rust-libp2p?rev=c1ef4bffd225a78cefe8fa43dc8ee18e03ff4f93)", + "libp2p-core", "libp2p-dns", "libp2p-gossipsub", "libp2p-identify", @@ -3291,7 +3292,7 @@ dependencies = [ "libp2p-tcp", "libp2p-websocket", "libp2p-yamux", - "multiaddr 0.12.0", + "multiaddr", "parking_lot", "pin-project 1.0.7", "smallvec", @@ -3314,46 +3315,13 @@ dependencies = [ "lazy_static", "libsecp256k1", "log", - "multiaddr 0.13.0", - "multihash 0.14.0", - "multistream-select 0.10.2", + "multiaddr", + "multihash", + "multistream-select", "parking_lot", "pin-project 1.0.7", - "prost 0.8.0", - "prost-build 0.8.0", - "rand 0.7.3", - "ring", - "rw-stream-sink", - "sha2", - "smallvec", - "thiserror", - "unsigned-varint 0.7.0", - "void", - "zeroize", -] - -[[package]] -name = "libp2p-core" -version = "0.29.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c1ef4bffd225a78cefe8fa43dc8ee18e03ff4f93#c1ef4bffd225a78cefe8fa43dc8ee18e03ff4f93" -dependencies = [ - "asn1_der", - "bs58", - "ed25519-dalek", - "either", - "fnv", - "futures", - "futures-timer", - "lazy_static", - "libsecp256k1", - "log", - "multiaddr 0.12.0", - "multihash 0.13.2", - "multistream-select 0.10.3", - "parking_lot", - "pin-project 1.0.7", - "prost 0.7.0", - "prost-build 0.7.0", + "prost", + "prost-build", "rand 0.7.3", "ring", "rw-stream-sink", @@ -3368,10 +3336,11 @@ dependencies = [ [[package]] name = "libp2p-dns" version = "0.29.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c1ef4bffd225a78cefe8fa43dc8ee18e03ff4f93#c1ef4bffd225a78cefe8fa43dc8ee18e03ff4f93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58ff08b3196b85a17f202d80589e93b1660a574af67275706657fdc762e42c32" dependencies = [ "futures", - "libp2p-core 0.29.0 (git+https://github.com/libp2p/rust-libp2p?rev=c1ef4bffd225a78cefe8fa43dc8ee18e03ff4f93)", + "libp2p-core", "log", "smallvec", "trust-dns-resolver", @@ -3380,7 +3349,8 @@ dependencies = [ [[package]] name = "libp2p-gossipsub" version = "0.32.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c1ef4bffd225a78cefe8fa43dc8ee18e03ff4f93#c1ef4bffd225a78cefe8fa43dc8ee18e03ff4f93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1cc48709bcbc3a3321f08a73560b4bbb4166a7d56f6fdb615bc775f4f91058e" dependencies = [ "asynchronous-codec", "base64 0.13.0", @@ -3389,11 +3359,11 @@ dependencies = [ "fnv", "futures", "hex_fmt", - "libp2p-core 0.29.0 (git+https://github.com/libp2p/rust-libp2p?rev=c1ef4bffd225a78cefe8fa43dc8ee18e03ff4f93)", + "libp2p-core", "libp2p-swarm", "log", - "prost 0.7.0", - "prost-build 0.7.0", + "prost", + "prost-build", "rand 0.7.3", "regex", "sha2", @@ -3405,14 +3375,15 @@ dependencies = [ [[package]] name = "libp2p-identify" version = "0.30.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c1ef4bffd225a78cefe8fa43dc8ee18e03ff4f93#c1ef4bffd225a78cefe8fa43dc8ee18e03ff4f93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7b61f6cf07664fb97016c318c4d4512b3dd4cc07238607f3f0163245f99008e" dependencies = [ "futures", - "libp2p-core 0.29.0 (git+https://github.com/libp2p/rust-libp2p?rev=c1ef4bffd225a78cefe8fa43dc8ee18e03ff4f93)", + "libp2p-core", "libp2p-swarm", "log", - "prost 0.7.0", - "prost-build 0.7.0", + "prost", + "prost-build", "smallvec", "wasm-timer", ] @@ -3420,12 +3391,13 @@ dependencies = [ [[package]] name = "libp2p-mplex" version = "0.29.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c1ef4bffd225a78cefe8fa43dc8ee18e03ff4f93#c1ef4bffd225a78cefe8fa43dc8ee18e03ff4f93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "313d9ea526c68df4425f580024e67a9d3ffd49f2c33de5154b1f5019816f7a99" dependencies = [ "asynchronous-codec", "bytes 1.0.1", "futures", - "libp2p-core 0.29.0 (git+https://github.com/libp2p/rust-libp2p?rev=c1ef4bffd225a78cefe8fa43dc8ee18e03ff4f93)", + "libp2p-core", "log", "nohash-hasher", "parking_lot", @@ -3437,16 +3409,17 @@ dependencies = [ [[package]] name = "libp2p-noise" version = "0.32.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c1ef4bffd225a78cefe8fa43dc8ee18e03ff4f93#c1ef4bffd225a78cefe8fa43dc8ee18e03ff4f93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f1db7212f342b6ba7c981cc40e31f76e9e56cb48e65fa4c142ecaca5839523e" dependencies = [ "bytes 1.0.1", "curve25519-dalek", "futures", "lazy_static", - "libp2p-core 0.29.0 (git+https://github.com/libp2p/rust-libp2p?rev=c1ef4bffd225a78cefe8fa43dc8ee18e03ff4f93)", + "libp2p-core", "log", - "prost 0.7.0", - "prost-build 0.7.0", + "prost", + "prost-build", "rand 0.8.4", "sha2", "snow", @@ -3458,11 +3431,12 @@ dependencies = [ [[package]] name = "libp2p-swarm" version = "0.30.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c1ef4bffd225a78cefe8fa43dc8ee18e03ff4f93#c1ef4bffd225a78cefe8fa43dc8ee18e03ff4f93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7083861341e1555467863b4cd802bea1e8c4787c0f7b5110097d0f1f3248f9a9" dependencies = [ "either", "futures", - "libp2p-core 0.29.0 (git+https://github.com/libp2p/rust-libp2p?rev=c1ef4bffd225a78cefe8fa43dc8ee18e03ff4f93)", + "libp2p-core", "log", "rand 0.7.3", "smallvec", @@ -3472,8 +3446,9 @@ dependencies = [ [[package]] name = "libp2p-swarm-derive" -version = "0.23.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c1ef4bffd225a78cefe8fa43dc8ee18e03ff4f93#c1ef4bffd225a78cefe8fa43dc8ee18e03ff4f93" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab8cb308d4fc854869f5abb54fdab0833d2cf670d407c745849dc47e6e08d79c" dependencies = [ "quote", "syn", @@ -3482,14 +3457,15 @@ dependencies = [ [[package]] name = "libp2p-tcp" version = "0.29.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c1ef4bffd225a78cefe8fa43dc8ee18e03ff4f93#c1ef4bffd225a78cefe8fa43dc8ee18e03ff4f93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79edd26b6b4bb5feee210dcda562dca186940dfecb0024b979c3f50824b3bf28" dependencies = [ "futures", "futures-timer", "if-addrs", "ipnet", "libc", - "libp2p-core 0.29.0 (git+https://github.com/libp2p/rust-libp2p?rev=c1ef4bffd225a78cefe8fa43dc8ee18e03ff4f93)", + "libp2p-core", "log", "socket2 0.4.0", "tokio 1.8.1", @@ -3498,12 +3474,13 @@ dependencies = [ [[package]] name = "libp2p-websocket" version = "0.30.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c1ef4bffd225a78cefe8fa43dc8ee18e03ff4f93#c1ef4bffd225a78cefe8fa43dc8ee18e03ff4f93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddf99dcbf5063e9d59087f61b1e85c686ceab2f5abedb472d32288065c0e5e27" dependencies = [ "either", "futures", "futures-rustls", - "libp2p-core 0.29.0 (git+https://github.com/libp2p/rust-libp2p?rev=c1ef4bffd225a78cefe8fa43dc8ee18e03ff4f93)", + "libp2p-core", "log", "quicksink", "rw-stream-sink", @@ -3515,10 +3492,11 @@ dependencies = [ [[package]] name = "libp2p-yamux" version = "0.33.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c1ef4bffd225a78cefe8fa43dc8ee18e03ff4f93#c1ef4bffd225a78cefe8fa43dc8ee18e03ff4f93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "214cc0dd9c37cbed27f0bb1eba0c41bbafdb93a8be5e9d6ae1e6b4b42cd044bf" dependencies = [ "futures", - "libp2p-core 0.29.0 (git+https://github.com/libp2p/rust-libp2p?rev=c1ef4bffd225a78cefe8fa43dc8ee18e03ff4f93)", + "libp2p-core", "parking_lot", "thiserror", "yamux", @@ -3901,24 +3879,6 @@ dependencies = [ "tokio 1.8.1", ] -[[package]] -name = "multiaddr" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7139982f583d7e53879d9f611fe48ced18e77d684309484f2252c76bcd39f549" -dependencies = [ - "arrayref", - "bs58", - "byteorder", - "data-encoding", - "multihash 0.13.2", - "percent-encoding", - "serde", - "static_assertions", - "unsigned-varint 0.7.0", - "url", -] - [[package]] name = "multiaddr" version = "0.13.0" @@ -3929,7 +3889,7 @@ dependencies = [ "bs58", "byteorder", "data-encoding", - "multihash 0.14.0", + "multihash", "percent-encoding", "serde", "static_assertions", @@ -3937,19 +3897,6 @@ dependencies = [ "url", ] -[[package]] -name = "multihash" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dac63698b887d2d929306ea48b63760431ff8a24fac40ddb22f9c7f49fb7cab" -dependencies = [ - "digest", - "generic-array", - "multihash-derive", - "sha2", - "unsigned-varint 0.5.1", -] - [[package]] name = "multihash" version = "0.14.0" @@ -4015,19 +3962,6 @@ dependencies = [ "unsigned-varint 0.7.0", ] -[[package]] -name = "multistream-select" -version = "0.10.3" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c1ef4bffd225a78cefe8fa43dc8ee18e03ff4f93#c1ef4bffd225a78cefe8fa43dc8ee18e03ff4f93" -dependencies = [ - "bytes 1.0.1", - "futures", - "log", - "pin-project 1.0.7", - "smallvec", - "unsigned-varint 0.7.0", -] - [[package]] name = "native-tls" version = "0.2.7" @@ -4721,16 +4655,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "prost" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e6984d2f1a23009bd270b8bb56d0926810a3d483f59c987d77969e9d8e840b2" -dependencies = [ - "bytes 1.0.1", - "prost-derive 0.7.0", -] - [[package]] name = "prost" version = "0.8.0" @@ -4738,25 +4662,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de5e2533f59d08fcf364fd374ebda0692a70bd6d7e66ef97f306f45c6c5d8020" dependencies = [ "bytes 1.0.1", - "prost-derive 0.8.0", -] - -[[package]] -name = "prost-build" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32d3ebd75ac2679c2af3a92246639f9fcc8a442ee420719cc4fe195b98dd5fa3" -dependencies = [ - "bytes 1.0.1", - "heck", - "itertools 0.9.0", - "log", - "multimap", - "petgraph", - "prost 0.7.0", - "prost-types 0.7.0", - "tempfile", - "which", + "prost-derive", ] [[package]] @@ -4771,25 +4677,12 @@ dependencies = [ "log", "multimap", "petgraph", - "prost 0.8.0", - "prost-types 0.8.0", + "prost", + "prost-types", "tempfile", "which", ] -[[package]] -name = "prost-derive" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "169a15f3008ecb5160cba7d37bcd690a7601b6d30cfb87a117d45e59d52af5d4" -dependencies = [ - "anyhow", - "itertools 0.9.0", - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "prost-derive" version = "0.8.0" @@ -4803,16 +4696,6 @@ dependencies = [ "syn", ] -[[package]] -name = "prost-types" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b518d7cdd93dab1d1122cf07fa9a60771836c668dde9d9e2a139f957f0d9f1bb" -dependencies = [ - "bytes 1.0.1", - "prost 0.7.0", -] - [[package]] name = "prost-types" version = "0.8.0" @@ -4820,7 +4703,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "603bbd6394701d13f3f25aada59c7de9d35a6a5887cfc156181234a44002771b" dependencies = [ "bytes 1.0.1", - "prost 0.8.0", + "prost", ] [[package]] @@ -7031,12 +6914,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "unsigned-varint" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7fdeedbf205afadfe39ae559b75c3240f24e257d0ca27e85f85cb82aa19ac35" - [[package]] name = "unsigned-varint" version = "0.6.0" diff --git a/beacon_node/eth2_libp2p/Cargo.toml b/beacon_node/eth2_libp2p/Cargo.toml index 0d4fbf76f..52210c009 100644 --- a/beacon_node/eth2_libp2p/Cargo.toml +++ b/beacon_node/eth2_libp2p/Cargo.toml @@ -42,10 +42,7 @@ regex = "1.3.9" strum = { version = "0.20", features = ["derive"] } [dependencies.libp2p] -#version = "0.38.0" -# Bleeding edge, while we wait for 0.39.0 -git = "https://github.com/libp2p/rust-libp2p" -rev = "c1ef4bffd225a78cefe8fa43dc8ee18e03ff4f93" +version = "0.39.1" default-features = false features = ["websocket", "identify", "mplex", "yamux", "noise", "gossipsub", "dns-tokio", "tcp-tokio"] diff --git a/beacon_node/eth2_libp2p/src/behaviour/mod.rs b/beacon_node/eth2_libp2p/src/behaviour/mod.rs index 50936e251..f680c0a6c 100644 --- a/beacon_node/eth2_libp2p/src/behaviour/mod.rs +++ b/beacon_node/eth2_libp2p/src/behaviour/mod.rs @@ -840,7 +840,6 @@ impl NetworkBehaviourEventProcess> for Behavio let peer_id = event.peer_id; if !self.peer_manager.is_connected(&peer_id) { - // NOTE: Upgraded to log to test occurrences debug!( self.log, "Ignoring rpc message of disconnecting peer"; diff --git a/beacon_node/eth2_libp2p/src/peer_manager/score.rs b/beacon_node/eth2_libp2p/src/peer_manager/score.rs index 02479bef0..4ea1b2621 100644 --- a/beacon_node/eth2_libp2p/src/peer_manager/score.rs +++ b/beacon_node/eth2_libp2p/src/peer_manager/score.rs @@ -31,7 +31,7 @@ const MIN_SCORE: f64 = -100.0; /// The halflife of a peer's score. I.e the number of seconds it takes for the score to decay to half its value. const SCORE_HALFLIFE: f64 = 600.0; /// The number of seconds we ban a peer for before their score begins to decay. -const BANNED_BEFORE_DECAY: Duration = Duration::from_secs(1800); +const BANNED_BEFORE_DECAY: Duration = Duration::from_secs(12 * 3600); // 12 hours /// We weight negative gossipsub scores in such a way that they never result in a disconnect by /// themselves. This "solves" the problem of non-decaying gossipsub scores for disconnected peers. diff --git a/beacon_node/eth2_libp2p/src/service.rs b/beacon_node/eth2_libp2p/src/service.rs index 9eb0e067b..c3183ed2c 100644 --- a/beacon_node/eth2_libp2p/src/service.rs +++ b/beacon_node/eth2_libp2p/src/service.rs @@ -329,8 +329,8 @@ impl Service { .peer_manager_mut() .inject_connection_closed(peer_id, endpoint, num_established); } - SwarmEvent::NewListenAddr(multiaddr) => { - return Libp2pEvent::NewListenAddr(multiaddr) + SwarmEvent::NewListenAddr { address, .. } => { + return Libp2pEvent::NewListenAddr(address) } SwarmEvent::IncomingConnection { local_addr, @@ -363,16 +363,18 @@ impl Service { SwarmEvent::UnknownPeerUnreachableAddr { address, error } => { debug!(self.log, "Peer not known at dialed address"; "address" => %address, "error" => %error); } - SwarmEvent::ExpiredListenAddr(multiaddr) => { - debug!(self.log, "Listen address expired"; "multiaddr" => %multiaddr) + SwarmEvent::ExpiredListenAddr { address, .. } => { + debug!(self.log, "Listen address expired"; "address" => %address) } - SwarmEvent::ListenerClosed { addresses, reason } => { + SwarmEvent::ListenerClosed { + addresses, reason, .. + } => { crit!(self.log, "Listener closed"; "addresses" => ?addresses, "reason" => ?reason); if Swarm::listeners(&self.swarm).count() == 0 { return Libp2pEvent::ZeroListeners; } } - SwarmEvent::ListenerError { error } => { + SwarmEvent::ListenerError { error, .. } => { // this is non fatal, but we still check warn!(self.log, "Listener error"; "error" => ?error); if Swarm::listeners(&self.swarm).count() == 0 {