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

Remove backwards-compatibility networking hack #8068

Merged
3 commits merged into from
Feb 8, 2021

Conversation

tomaka
Copy link
Contributor

@tomaka tomaka commented Feb 8, 2021

Fix #7852

After this PR, Polkadot 0.8.26 and below will be unable to open the transactions and GrandPa substreams with clients that have this PR in.

It is a noticable breakage, because so far even old versions of Polkadot (even maybe 0.8.0) were capable of connecting to recent versions. Only the other way around (recent connecting to older) was known to be broken.

Detailed explanations

In Polkadot 0.8.26 and below, we consider that either all substreams (block announces, transactions, and GrandPa) are open with a given peer, or none. As long as the block announces substream (i.e. the "main" one) is open, we silently ignore situations where the transactions and/or GrandPa has failed to open. If the rest of the client tries to send a transaction or a GrandPa message with a peer where it failed to open, the message is silently discarded.

In Polkadot 0.8.27 and later (since #7700), however, we properly separate substreams individually from each other. As part of #7700, nodes now open the block announces substream first, then, only if it is open, opens the transactions substreams and GrandPa.
Similarly, if a 0.8.27 node receives an open request for transactions without the block announces being already open, it will be refused. Later, this receiving node will then send back an open request on their own for a transactions substream.

Unfortunately, this causes some compatibility issue between 0.8.26- and 0.8.27+. Nodes on 0.8.26- try to open everything at once, and only the block announces will successfully open. Nodes on 0.8.26- then silently ignore the situation. Even though nodes on 0.8.27+, after refusing a transactions/grandpa substream, will later try to open an outgoing transactions/grandpa substream, this re-opening will be ignored by nodes on 0.8.26-.

In order to solve this problem, a backwards-compatibility hack was added by allowing a certain number of nodes to open transactions and GrandPa substreams despite having no block announces substream open.
This PR removes this hack.

@tomaka tomaka added A0-please_review Pull request needs code review. B5-clientnoteworthy C1-low PR touches the given topic and has a low impact on builders. labels Feb 8, 2021
@tomaka tomaka requested review from romanb and mxinden February 8, 2021 09:10
@tomaka tomaka requested a review from andresilva as a code owner February 8, 2021 09:10
Copy link
Contributor

@romanb romanb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the test_sync integration test rely on this hack being present or do you think the timeouts are unrelated?

@tomaka
Copy link
Contributor Author

tomaka commented Feb 8, 2021

It definitely shouldn't rely on the hack.

@tomaka
Copy link
Contributor Author

tomaka commented Feb 8, 2021

On my machine, the nodes of the sync test can't even establish TCP connections between each other, which is not something that this PR could break.

I'm investigating.

@tomaka
Copy link
Contributor Author

tomaka commented Feb 8, 2021

We were missing the same fix as #7985 but for transactions.

Copy link
Contributor

@mxinden mxinden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For what my review is worth, the changes look good to me.

Copy link
Contributor

@mxinden mxinden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For what my review is worth, the changes look good to me.

@tomaka
Copy link
Contributor Author

tomaka commented Feb 8, 2021

bot merge

@ghost
Copy link

ghost commented Feb 8, 2021

Trying merge.

@ghost ghost merged commit 29aca98 into paritytech:master Feb 8, 2021
@tomaka tomaka deleted the remove-back-compat-hack branch February 8, 2021 14:47
s3krit added a commit to paritytech/polkadot that referenced this pull request Feb 8, 2021
bump substrate to include fix for paritytech/substrate#8068 (comment)
s3krit added a commit to paritytech/polkadot that referenced this pull request Feb 9, 2021
* Bump substrate

bump substrate to include fix for paritytech/substrate#8068 (comment)

* bump version

* bump impl_version for polkadot, kusama, westend

* Blank commit to kick github
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. 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.

Remove backwards-compatibility hack in networking
3 participants