From 2194b957081efc9102f87abfede2da635a346d49 Mon Sep 17 00:00:00 2001
From: Aaro Altonen <48052676+altonen@users.noreply.github.com>
Date: Mon, 14 Aug 2023 17:34:38 +0300
Subject: [PATCH] Disable validation/collation protocols for normal full nodes
 (#7601)

If authority discovery is not enabled, `Overseer` is not enabled,
meaning `NetworkBridge` is not started. Validation/collation protocols
are, however, enabled even if the `NetworkBridge` is not started.

Currently this results in normal Polkadot full nodes advertising these
protocols, accepting inbound substreams and even establishing outbound
substreams for the validation protocol. Since the `NetworkBridge` is
not started and no protocol in Substrate is interested in these
protocol events, the events are relayed to all protocol handlers but
are getting discarded because no installed protocol is interested in them.

Co-authored-by: parity-processbot <>
---
 polkadot/node/service/src/lib.rs | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/polkadot/node/service/src/lib.rs b/polkadot/node/service/src/lib.rs
index 4dda5711082..d0b6db17ed0 100644
--- a/polkadot/node/service/src/lib.rs
+++ b/polkadot/node/service/src/lib.rs
@@ -828,10 +828,11 @@ pub fn new_full<OverseerGenerator: OverseerGen>(
 		net_config.add_request_response_protocol(beefy_req_resp_cfg);
 	}
 
+	// validation/collation protocols are enabled only if `Overseer` is enabled
 	let peerset_protocol_names =
 		PeerSetProtocolNames::new(genesis_hash, config.chain_spec.fork_id());
 
-	{
+	if auth_or_collator || overseer_enable_anyways {
 		use polkadot_network_bridge::{peer_sets_info, IsAuthority};
 		let is_authority = if role.is_authority() { IsAuthority::Yes } else { IsAuthority::No };
 		for config in peer_sets_info(is_authority, &peerset_protocol_names) {
-- 
GitLab