Open lexnv opened 23 hours ago
Warp request protocols and state requests protocols are initializing their handler supporting 2 protocol names:
They are supporting both /{}/{}/sync/2
(new genesis-based format) and /{}/sync/2
(legacy format).
We are only checking the new genesis-based format in chain sync
We are only checking the new genesis-based format in chain sync
This is fine, as the main protocol name is always used by substrate to refer to the protocol. Legacy protocol name is only used on the wire.
Oki doki, thanks for the info 🙏
I believe in that case this is the proper fix:
Looking over the litep2p code, we always provide the negotiated protocol (regardless if it is fallback or main):
let handle1 = ConfigBuilder::new(ProtocolName::from("/protocol/1/improved"))
.with_max_size(1024usize)
.with_fallback_names(vec![ProtocolName::from("/protocol/1")])
.build();
let handle2 = handle2) = RequestResponseConfig::new(
ProtocolName::from("/protocol/1") ...;
handle1
.send_request(peer2, vec![1, 3, 3, 7], DialOptions::Reject);
handle2.next().await.unwrap(),
RequestResponseEvent::RequestReceived {
peer: peer1,
fallback: None, ...):
handle2.send_response(request_id, vec![1, 3, 3, 8]);
assert_eq!(
handle1.next().await.unwrap(),
RequestResponseEvent::ResponseReceived {
peer: peer2,
request_id,
response: vec![1, 3, 3, 8],
fallback: Some(ProtocolName::from("/protocol/1")),
}
);
/protocol/1/improved
and fallback /protocol/1
/protocol/1
/protocol/1
/protocol/1
Then into substrate, we parse the received requests as follows:
And we forward the protocol fallback if any: https://github.com/paritytech/polkadot-sdk/blob/7c5224cb01710d0c14c87bf3463cc79e49b3e7b5/substrate/client/network/src/litep2p/shim/request_response/mod.rs#L342
Kusama validator is panics on:
https://github.com/paritytech/polkadot-sdk/blob/3906c578c96d97a8a099a4bdac4685acbe375a7c/substrate/client/network/sync/src/strategy/chain_sync.rs#L640-L646
From the log line it looks like the sync engine no longer takes into account the legacy request-response protocol name.
Related PR:
Version deployed: version 1.16.1-ca8beaed148
Logs
Grafana link.
cc @paritytech/networking