Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
use never!
Browse files Browse the repository at this point in the history
  • Loading branch information
rphmeier committed Apr 21, 2022
1 parent 382e45e commit ac07199
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions node/network/bridge/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ authors = ["Parity Technologies <[email protected]>"]
edition = "2021"

[dependencies]
always-assert = "0.1"
async-trait = "0.1.53"
futures = "0.3.21"
gum = { package = "tracing-gum", path = "../../gum" }
Expand Down
25 changes: 23 additions & 2 deletions node/network/bridge/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use parity_scale_codec::{Decode, DecodeAll, Encode};
use parking_lot::Mutex;
use sc_network::Event as NetworkEvent;
use sp_consensus::SyncOracle;
use always_assert::never;

use polkadot_node_network_protocol::{
self as net_protocol,
Expand Down Expand Up @@ -964,7 +965,17 @@ async fn handle_network_messages<AD: validator_discovery::AuthorityDiscovery>(
&metrics,
)
} else {
unreachable!("Only version 1 is supported; peer set connection checked above; qed");
gum::warn!(
target: LOG_TARGET,
version = ?expected_versions[PeerSet::Validation],
"Major logic bug. Peer somehow has unsupported validation protocol version."
);

never!("Only version 1 is supported; peer set connection checked above; qed");

// If a peer somehow triggers this, we'll disconnect them
// eventually.
(Vec::new(), vec![UNCONNECTED_PEERSET_COST])
};

for report in reports {
Expand All @@ -985,7 +996,17 @@ async fn handle_network_messages<AD: validator_discovery::AuthorityDiscovery>(
&metrics,
)
} else {
unreachable!("Only version 1 is supported; peer set connection checked above; qed");
gum::warn!(
target: LOG_TARGET,
version = ?expected_versions[PeerSet::Collation],
"Major logic bug. Peer somehow has unsupported collation protocol version."
);

never!("Only version 1 is supported; peer set connection checked above; qed");

// If a peer somehow triggers this, we'll disconnect them
// eventually.
(Vec::new(), vec![UNCONNECTED_PEERSET_COST])
};

for report in reports {
Expand Down

0 comments on commit ac07199

Please sign in to comment.