-
Notifications
You must be signed in to change notification settings - Fork 710
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
litep2p/req-resp: Always provide main protocol name in responses #6603
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
1dccdb3
litep2p/req-resp: Always provide main protocol name in responses
lexnv 658154b
Add PR doc
lexnv 99a8d1b
Merge remote-tracking branch 'origin/master' into lexnv/fix-sync-panic2
lexnv 7085c3a
Merge branch 'master' into lexnv/fix-sync-panic2
dmitry-markin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0 | ||
# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json | ||
|
||
title: Always provide main protocol name in litep2p responses | ||
|
||
doc: | ||
- audience: [ Node Dev, Node Operator ] | ||
description: | | ||
This PR aligns litep2p behavior with libp2p. Previously, litep2p network backend | ||
would provide the actual negotiated request-response protocol that produced a | ||
response message. After this PR, only the main protocol name is reported to other | ||
subsystems. | ||
|
||
crates: | ||
- name: sc-network | ||
bump: patch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, this is not a fix for our issue because the fallback mentioned here is actually a fallback protocol, and not a fallback name. Here we need to pass the actual name of the fallback protocol for the client code to correctly implement protocol backward-compatibility (e.g., correctly process a different protobuf schema).
I have created an issue in litep2p for adding support for actual fallback names:
paritytech/litep2p#289
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To sum up the difference in operation of libp2p & litep2p network backends:
libp2p network backend
litep2p network backend
litep2p sends the fallback request internally and it is the one responsible for actually performing the fallback request, not the network backend.
Surprisingly enough, litep2p network backend also has the logic of handling fallback requests in case litep2p returned
UnsupportedProtocol
for some reason.If only the fallback protocol name was used on the wire and no fallback request happened, the fallback protocol name is returned to the client code. This is what makes litep2p different and leads to panics in network/sync: Panic on unexpected generic response protocol #6581.
If the fallback request was sent, the name of the fallback request protocol is returned to the client code (the same as libp2p).
I will create a PR to make litep2p/backend behave in a way libp2p backend behaves.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This turned out to be not the case: litep2p network backend does not use the litep2p's
try_send_request_with_fallback
and usestry_send_request
instead. This means fallback requests are handled completely by the backend in substrate, and not by litep2p.So, we can be sure that a fallback reported by litep2p is just the fallback name of the main protocol and safely override it with the main protocol name in substrate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oki doki, thanks a lot for the detailed info and for confirming, this helps a lot🙏