From e7304a5b0a4511a12442c68c2df8913c235fe6a9 Mon Sep 17 00:00:00 2001 From: Aaro Altonen Date: Mon, 31 Jul 2023 17:29:49 +0300 Subject: [PATCH] Temporarily stop using `V1Lazy` Parachain collators support the `/block-announces/1` notification protocol but do not support the `/sync/2` request-response protocol. These peers are right now treated as any other full node and they can be selected for a block request. Normally the block request would be sent and since the peer doesn't support the request-response protocol, libp2p would fail to negotiate the protocol and this failure would be propagated to `SyncingEngine`, causing it to remove the peer and send the block request to some other peer. A recent change in libp2p has modified how negotiation works for streams using `V1Lazy` and for Polkadot it means that the negotiation failure is not detected and `SyncingEngine` is not notified. If a parachain collator is selected for a block request, this will cause syncing to stall because after `MAX_AHEAD_BLOCKS` have been downloaded, the syncing will stop itself from downloading more blocks until all in-flight requests have been completed and since the collator cannot answer block requests and `SyncingEngine` is not notified of the negotiation failure, syncing halts at 0.0 bps and the node has to be restarted. --- client/network/src/service.rs | 2 +- client/network/src/transport.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/network/src/service.rs b/client/network/src/service.rs index 28ad85074c466..92c5b73b7f6f1 100644 --- a/client/network/src/service.rs +++ b/client/network/src/service.rs @@ -378,7 +378,7 @@ where ) }; let builder = builder - .substream_upgrade_protocol_override(upgrade::Version::V1Lazy) + .substream_upgrade_protocol_override(upgrade::Version::V1) .notify_handler_buffer_size(NonZeroUsize::new(32).expect("32 != 0; qed")) // NOTE: 24 is somewhat arbitrary and should be tuned in the future if necessary. // See diff --git a/client/network/src/transport.rs b/client/network/src/transport.rs index 4136b34fc0e8e..47de8ac999333 100644 --- a/client/network/src/transport.rs +++ b/client/network/src/transport.rs @@ -96,7 +96,7 @@ pub fn build_transport( }; let transport = transport - .upgrade(upgrade::Version::V1Lazy) + .upgrade(upgrade::Version::V1) .authenticate(authentication_config) .multiplex(multiplexing_config) .timeout(Duration::from_secs(20))