Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Allow fallback names for protocols #8682

Merged
7 commits merged into from
May 6, 2021
Merged

Conversation

tomaka
Copy link
Contributor

@tomaka tomaka commented Apr 28, 2021

Close #6605

There are some protocols in the networking stack that we would like to rename.
In order to do so while maintaining backwards compatibility, this PR introduces the possibility to pass a list of fallback names when configuring a protocol.
When the substream actually gets opened, a new negotiated_fallback field indicates which names has actually been used during the negotiation.

Most of the changes in this PR are small refactorings. Before this PR, we would pass information as a tuple of three elements. Adding a fourth element would be a bit too much, so I turned them into structs.

Important note: the negotiated_fallback field indicates the protocol used to negotiate the outbound substream. The one used for the inbound substream is not reported. If you don't do anything stupid, then the protocol names for the outbound and inbound substreams should always be the same. However, if between two versions you swap the legacy protocol name and the new protocol name, or if you have multiple legacy names and you change their order, then there will be a mismatch.

polkadot companion: paritytech/polkadot#2958

@tomaka tomaka added A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. labels Apr 28, 2021
@tomaka tomaka requested a review from kpp April 28, 2021 09:04
@tomaka tomaka requested a review from andresilva as a code owner April 28, 2021 09:04
@tomaka
Copy link
Contributor Author

tomaka commented May 6, 2021

bot merge

@ghost
Copy link

ghost commented May 6, 2021

Trying merge.

@ghost
Copy link

ghost commented May 6, 2021

Bot will approve on the behalf of @tomaka, since they are a team lead, in an attempt to reach the minimum approval count

@ghost ghost merged commit 4626536 into paritytech:master May 6, 2021
@tomaka tomaka deleted the multi-proto-names branch May 6, 2021 14:01
nazar-pc pushed a commit to autonomys/substrate that referenced this pull request Aug 8, 2021
* Allow fallback names for protocols

* Apply suggestions from code review

Co-authored-by: Roman Proskuryakov <humbug@deeptown.org>

* Fix some issues

* Fix compilation after merging master

Co-authored-by: Roman Proskuryakov <humbug@deeptown.org>
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow registering multiple versions of a single notifications protocol
2 participants