Skip to content

Commit

Permalink
BACKPORT-CONFLICT
Browse files Browse the repository at this point in the history
  • Loading branch information
lexnv authored and github-actions[bot] committed Nov 28, 2024
1 parent f5245c8 commit 2934414
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 1 deletion.
6 changes: 6 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -815,8 +815,13 @@ linked-hash-map = { version = "0.5.4" }
linked_hash_set = { version = "0.1.4" }
linregress = { version = "0.5.1" }
lite-json = { version = "0.2.0", default-features = false }
<<<<<<< HEAD
litep2p = { version = "0.6.2" }
log = { version = "0.4.21", default-features = false }
=======
litep2p = { version = "0.8.2", features = ["websocket"] }
log = { version = "0.4.22", default-features = false }
>>>>>>> 51c3e95 (chore: Update litep2p to v0.8.2 (#6677))
macro_magic = { version = "0.5.1" }
maplit = { version = "1.0.2" }
memmap2 = { version = "0.9.3" }
Expand Down
11 changes: 11 additions & 0 deletions prdoc/pr_6677.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
title: 'chore: Update litep2p to v0.8.2'
doc:
- audience: Node Dev
description: |-
This includes a critical fix for debug release versions of litep2p (which are running in Kusama as validators).

While at it, have stopped the oncall pain of alerts around `incoming_connections_total`. We can rethink the metric expose of litep2p in Q1.

crates:
- name: sc-network
bump: minor
40 changes: 39 additions & 1 deletion substrate/client/network/src/litep2p/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,15 @@ impl<B: BlockT + 'static, H: ExHashT> NetworkBackend<B, H> for Litep2pNetworkBac

let direction = match endpoint {
Endpoint::Dialer { .. } => "out",
Endpoint::Listener { .. } => "in",
Endpoint::Listener { .. } => {
// Increment incoming connections counter.
//
// Note: For litep2p these are represented by established negotiated connections,
// while for libp2p (legacy) these represent not-yet-negotiated connections.
metrics.incoming_connections_total.inc();

"in"
},
};
metrics.connections_opened_total.with_label_values(&[direction]).inc();

Expand Down Expand Up @@ -1006,12 +1014,42 @@ impl<B: BlockT + 'static, H: ExHashT> NetworkBackend<B, H> for Litep2pNetworkBac
"failed to dial peer at {address:?}: {error:?}",
);

<<<<<<< HEAD
let reason = match error {
Litep2pError::PeerIdMismatch(_, _) => "invalid-peer-id",
Litep2pError::Timeout | Litep2pError::TransportError(_) |
Litep2pError::IoError(_) | Litep2pError::WebSocket(_) => "transport-error",
_ => "other",
};
=======
if let Some(metrics) = &self.metrics {
let reason = match error {
DialError::Timeout => "timeout",
DialError::AddressError(_) => "invalid-address",
DialError::DnsError(_) => "cannot-resolve-dns",
DialError::NegotiationError(error) => match error {
NegotiationError::Timeout => "timeout",
NegotiationError::PeerIdMissing => "missing-peer-id",
NegotiationError::StateMismatch => "state-mismatch",
NegotiationError::PeerIdMismatch(_,_) => "peer-id-missmatch",
NegotiationError::MultistreamSelectError(_) => "multistream-select-error",
NegotiationError::SnowError(_) => "noise-error",
NegotiationError::ParseError(_) => "parse-error",
NegotiationError::IoError(_) => "io-error",
NegotiationError::WebSocket(_) => "webscoket-error",
NegotiationError::BadSignature => "bad-signature",
}
};

metrics.pending_connections_errors_total.with_label_values(&[&reason]).inc();
}
}
Some(Litep2pEvent::ListDialFailures { errors }) => {
log::debug!(
target: LOG_TARGET,
"failed to dial peer on multiple addresses {errors:?}",
);
>>>>>>> 51c3e95 (chore: Update litep2p to v0.8.2 (#6677))

if let Some(metrics) = &self.metrics {
metrics.pending_connections_errors_total.with_label_values(&[reason]).inc();
Expand Down

0 comments on commit 2934414

Please sign in to comment.