Unverified Commit dcb81807 authored by Robert Klotzner's avatar Robert Klotzner Committed by GitHub
Browse files

Silence some alerts due to overly verbose warnings. (#3946)

* statement-distribution: Only warn on relevant stuff.

* Silence warnings in availability-distribution.

* Demote more warnings.

* More consistency.

* info -> debug
parent a14bdf13
Pipeline #160905 canceled with stages
in 5 minutes and 54 seconds
...@@ -117,7 +117,18 @@ pub fn log_error(result: Result<()>, ctx: &'static str) -> std::result::Result<( ...@@ -117,7 +117,18 @@ pub fn log_error(result: Result<()>, ctx: &'static str) -> std::result::Result<(
match result { match result {
Err(Error::Fatal(f)) => Err(f), Err(Error::Fatal(f)) => Err(f),
Err(Error::NonFatal(error)) => { Err(Error::NonFatal(error)) => {
tracing::warn!(target: LOG_TARGET, error = ?error, ctx); match error {
NonFatal::UnexpectedPoV |
NonFatal::InvalidValidatorIndex |
NonFatal::NoSuchCachedSession |
NonFatal::QueryAvailableDataResponseChannel(_) |
NonFatal::QueryChunkResponseChannel(_) =>
tracing::warn!(target: LOG_TARGET, error = %error, ctx),
NonFatal::FetchPoV(_) |
NonFatal::SendResponse |
NonFatal::NoSuchPoV |
NonFatal::Runtime(_) => tracing::debug!(target: LOG_TARGET, error = ?error, ctx),
}
Ok(()) Ok(())
}, },
Ok(()) => Ok(()), Ok(()) => Ok(()),
......
...@@ -344,7 +344,7 @@ impl RunningTask { ...@@ -344,7 +344,7 @@ impl RunningTask {
Err(TaskError::PeerError) Err(TaskError::PeerError)
}, },
Err(RequestError::NetworkError(err)) => { Err(RequestError::NetworkError(err)) => {
tracing::warn!( tracing::debug!(
target: LOG_TARGET, target: LOG_TARGET,
origin= ?validator, origin= ?validator,
err= ?err, err= ?err,
...@@ -353,7 +353,7 @@ impl RunningTask { ...@@ -353,7 +353,7 @@ impl RunningTask {
Err(TaskError::PeerError) Err(TaskError::PeerError)
}, },
Err(RequestError::Canceled(oneshot::Canceled)) => { Err(RequestError::Canceled(oneshot::Canceled)) => {
tracing::warn!(target: LOG_TARGET, tracing::debug!(target: LOG_TARGET,
origin= ?validator, origin= ?validator,
"Erasure chunk request got canceled"); "Erasure chunk request got canceled");
Err(TaskError::PeerError) Err(TaskError::PeerError)
......
...@@ -1362,7 +1362,7 @@ where ...@@ -1362,7 +1362,7 @@ where
.await; .await;
}, },
Err(RequestError::NetworkError(err)) => { Err(RequestError::NetworkError(err)) => {
tracing::warn!( tracing::debug!(
target: LOG_TARGET, target: LOG_TARGET,
hash = ?pending_collation.relay_parent, hash = ?pending_collation.relay_parent,
para_id = ?pending_collation.para_id, para_id = ?pending_collation.para_id,
...@@ -1377,7 +1377,7 @@ where ...@@ -1377,7 +1377,7 @@ where
modify_reputation(ctx, pending_collation.peer_id.clone(), COST_NETWORK_ERROR).await; modify_reputation(ctx, pending_collation.peer_id.clone(), COST_NETWORK_ERROR).await;
}, },
Err(RequestError::Canceled(_)) => { Err(RequestError::Canceled(_)) => {
tracing::warn!( tracing::debug!(
target: LOG_TARGET, target: LOG_TARGET,
hash = ?pending_collation.relay_parent, hash = ?pending_collation.relay_parent,
para_id = ?pending_collation.para_id, para_id = ?pending_collation.para_id,
......
...@@ -87,8 +87,12 @@ pub enum NonFatal { ...@@ -87,8 +87,12 @@ pub enum NonFatal {
#[error("Relay parent could not be found in active heads")] #[error("Relay parent could not be found in active heads")]
NoSuchHead(Hash), NoSuchHead(Hash),
/// Received message from actually disconnected peer.
#[error("Message from not connected peer")]
NoSuchPeer(PeerId),
/// Peer requested statement data for candidate that was never announced to it. /// Peer requested statement data for candidate that was never announced to it.
#[error("Peer requested data for candidate it never received a notification for")] #[error("Peer requested data for candidate it never received a notification for (malicious?)")]
RequestedUnannouncedCandidate(PeerId, CandidateHash), RequestedUnannouncedCandidate(PeerId, CandidateHash),
/// A large statement status was requested, which could not be found. /// A large statement status was requested, which could not be found.
...@@ -112,7 +116,11 @@ pub fn log_error(result: Result<()>, ctx: &'static str) -> std::result::Result<( ...@@ -112,7 +116,11 @@ pub fn log_error(result: Result<()>, ctx: &'static str) -> std::result::Result<(
match result { match result {
Err(Error::Fatal(f)) => Err(f), Err(Error::Fatal(f)) => Err(f),
Err(Error::NonFatal(error)) => { Err(Error::NonFatal(error)) => {
tracing::warn!(target: LOG_TARGET, error = ?error, ctx); match error {
NonFatal::RequestedUnannouncedCandidate(_, _) =>
tracing::warn!(target: LOG_TARGET, error = %error, ctx),
_ => tracing::debug!(target: LOG_TARGET, error = %error, ctx),
}
Ok(()) Ok(())
}, },
Ok(()) => Ok(()), Ok(()) => Ok(()),
......
...@@ -1625,7 +1625,7 @@ impl StatementDistribution { ...@@ -1625,7 +1625,7 @@ impl StatementDistribution {
&requesting_peer, &requesting_peer,
&relay_parent, &relay_parent,
&candidate_hash, &candidate_hash,
) { )? {
return Err(NonFatal::RequestedUnannouncedCandidate( return Err(NonFatal::RequestedUnannouncedCandidate(
requesting_peer, requesting_peer,
candidate_hash, candidate_hash,
...@@ -1896,27 +1896,15 @@ fn requesting_peer_knows_about_candidate( ...@@ -1896,27 +1896,15 @@ fn requesting_peer_knows_about_candidate(
requesting_peer: &PeerId, requesting_peer: &PeerId,
relay_parent: &Hash, relay_parent: &Hash,
candidate_hash: &CandidateHash, candidate_hash: &CandidateHash,
) -> bool { ) -> NonFatalResult<bool> {
requesting_peer_knows_about_candidate_inner( let peer_data = peers
peers, .get(requesting_peer)
requesting_peer, .ok_or_else(|| NonFatal::NoSuchPeer(*requesting_peer))?;
relay_parent, let knowledge = peer_data
candidate_hash, .view_knowledge
) .get(relay_parent)
.is_some() .ok_or_else(|| NonFatal::NoSuchHead(*relay_parent))?;
} Ok(knowledge.sent_candidates.get(&candidate_hash).is_some())
/// Helper function for `requesting_peer_knows_about_statement`.
fn requesting_peer_knows_about_candidate_inner(
peers: &HashMap<PeerId, PeerData>,
requesting_peer: &PeerId,
relay_parent: &Hash,
candidate_hash: &CandidateHash,
) -> Option<()> {
let peer_data = peers.get(requesting_peer)?;
let knowledge = peer_data.view_knowledge.get(relay_parent)?;
knowledge.sent_candidates.get(&candidate_hash)?;
Some(())
} }
#[derive(Clone)] #[derive(Clone)]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment