Downgrades a valid log (#2057)
## Issue Addressed #2046 ## Proposed Changes The log was originally intended to verify the correct logic and ordering of events when scoring peers. The queued tasks can be structured in such a way that peers can be banned after they are disconnected. Therefore the error log is now downgraded to debug log.
This commit is contained in:
parent
57489e620f
commit
4f85371ce8
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -4373,6 +4373,7 @@ dependencies = [
|
|||||||
"itertools 0.9.0",
|
"itertools 0.9.0",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"lighthouse_metrics",
|
"lighthouse_metrics",
|
||||||
|
"logging",
|
||||||
"lru_cache",
|
"lru_cache",
|
||||||
"matches",
|
"matches",
|
||||||
"num_cpus",
|
"num_cpus",
|
||||||
|
@ -474,8 +474,9 @@ impl<TSpec: EthSpec> PeerDB<TSpec> {
|
|||||||
// Check and verify all the connection states
|
// Check and verify all the connection states
|
||||||
match info.connection_status() {
|
match info.connection_status() {
|
||||||
PeerConnectionStatus::Disconnected { .. } => {
|
PeerConnectionStatus::Disconnected { .. } => {
|
||||||
// It should not be possible to ban a peer that is already disconnected.
|
// It is possible to ban a peer that has a disconnected score, if there are many
|
||||||
error!(log_ref, "Banning a disconnected peer"; "peer_id" => %peer_id);
|
// events that score it poorly and are processed after it has disconnected.
|
||||||
|
debug!(log_ref, "Banning a disconnected peer"; "peer_id" => %peer_id);
|
||||||
self.disconnected_peers = self.disconnected_peers.saturating_sub(1);
|
self.disconnected_peers = self.disconnected_peers.saturating_sub(1);
|
||||||
info.ban();
|
info.ban();
|
||||||
self.banned_peers_count
|
self.banned_peers_count
|
||||||
|
@ -13,6 +13,7 @@ tempfile = "3.1.0"
|
|||||||
exit-future = "0.2.0"
|
exit-future = "0.2.0"
|
||||||
slog-term = "2.6.0"
|
slog-term = "2.6.0"
|
||||||
slog-async = "2.5.0"
|
slog-async = "2.5.0"
|
||||||
|
logging = { path = "../../common/logging" }
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
beacon_chain = { path = "../beacon_chain" }
|
beacon_chain = { path = "../beacon_chain" }
|
||||||
|
@ -5,8 +5,7 @@ mod tests {
|
|||||||
use crate::{NetworkConfig, NetworkService};
|
use crate::{NetworkConfig, NetworkService};
|
||||||
use beacon_chain::test_utils::BeaconChainHarness;
|
use beacon_chain::test_utils::BeaconChainHarness;
|
||||||
use eth2_libp2p::Enr;
|
use eth2_libp2p::Enr;
|
||||||
//use slog::{o, Drain, Level, Logger};
|
use slog::{o, Drain, Level, Logger};
|
||||||
use slog::Logger;
|
|
||||||
use sloggers::{null::NullLoggerBuilder, Build};
|
use sloggers::{null::NullLoggerBuilder, Build};
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
@ -14,8 +13,8 @@ mod tests {
|
|||||||
use tokio::runtime::Runtime;
|
use tokio::runtime::Runtime;
|
||||||
use types::{test_utils::generate_deterministic_keypairs, MinimalEthSpec};
|
use types::{test_utils::generate_deterministic_keypairs, MinimalEthSpec};
|
||||||
|
|
||||||
fn get_logger() -> Logger {
|
fn get_logger(actual_log: bool) -> Logger {
|
||||||
/* For emitting logs during the tests
|
if actual_log {
|
||||||
let drain = {
|
let drain = {
|
||||||
let decorator = slog_term::TermDecorator::new().build();
|
let decorator = slog_term::TermDecorator::new().build();
|
||||||
let decorator =
|
let decorator =
|
||||||
@ -26,14 +25,15 @@ mod tests {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Logger::root(drain.fuse(), o!())
|
Logger::root(drain.fuse(), o!())
|
||||||
*/
|
} else {
|
||||||
let builder = NullLoggerBuilder;
|
let builder = NullLoggerBuilder;
|
||||||
builder.build().expect("should build logger")
|
builder.build().expect("should build logger")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_dht_persistence() {
|
fn test_dht_persistence() {
|
||||||
let log = get_logger();
|
let log = get_logger(false);
|
||||||
|
|
||||||
let beacon_chain = Arc::new(
|
let beacon_chain = Arc::new(
|
||||||
BeaconChainHarness::new_with_store_config(
|
BeaconChainHarness::new_with_store_config(
|
||||||
@ -73,6 +73,8 @@ mod tests {
|
|||||||
let _ = NetworkService::start(beacon_chain.clone(), &config, executor)
|
let _ = NetworkService::start(beacon_chain.clone(), &config, executor)
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
// Allow the network task to spawn on the executor before shutting down.
|
||||||
|
tokio::time::sleep(std::time::Duration::from_secs(1)).await;
|
||||||
drop(signal);
|
drop(signal);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user