Skip to content
Snippets Groups Projects
Commit e9bbbeea authored by Alexandru Vasile's avatar Alexandru Vasile Committed by github-actions[bot]
Browse files

litep2p/req-resp: Always provide main protocol name in responses (#6603)

Request responses are initialized with a main protocol name, and
optional protocol names as a fallback.

Running litep2p in kusama as a validator has surfaced a `debug_asserts`
coming from the sync component:

https://github.com/paritytech/polkadot-sdk/blob/3906c578

/substrate/client/network/sync/src/strategy/chain_sync.rs#L640-L646

The issue is that we initiate a request-response over the main protocol
name `/genesis/sync/2` but receive a response over the legacy procotol
`ksm/sync/2`. This behavior is correct because litep2p propagates to the
higher levels the protocol that responded.

In contrast, libp2p provides the main protocol name regardless of
negotiating a legacy protocol.

Because of this, higher level components assume that only the main
protocol name will respond.
To not break this assumption, this PR alings litep2p shim layer with the
libp2p behavior.

Closes: https://github.com/paritytech/polkadot-sdk/issues/6581

---------

Signed-off-by: default avatarAlexandru Vasile <alexandru.vasile@parity.io>
Co-authored-by: default avatarDmitry Markin <dmitry@markin.tech>
(cherry picked from commit 2a0b2680)
parent f5245c89
No related merge requests found
Pipeline #507197 waiting for manual action with stages
in 1 hour, 33 minutes, and 27 seconds