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

Fix #5516 #5560

Merged
merged 11 commits into from
Apr 8, 2020
Merged

Fix #5516 #5560

merged 11 commits into from
Apr 8, 2020

Conversation

tomaka
Copy link
Contributor

@tomaka tomaka commented Apr 7, 2020

Fix #5516

#5516 happens when node A writes its status message on the legacy substream followed by writing a notification on the notification substream. Because messages are temporarily buffered and because we always poll the notifications substreams first, we effectively send the notification before sending the status message.

The fix is therefore to change the order of polling.

Note that there is clearly a design issue here, as we should not rely on the ordering of messages being sent between substreams. This design is done so because of backwards compatibility reasons, and it will be fixed in the future by removing the legacy code altogether.

While I agree that the fix isn't super robust, the test I added should guarantee that we don't have any regression in the future.

cc @bkchr

polkadot companion: paritytech/polkadot#982

@tomaka tomaka added A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes labels Apr 7, 2020
@tomaka tomaka requested a review from twittner April 7, 2020 12:09
@tomaka tomaka added this to the 2.0 milestone Apr 7, 2020
@tomaka
Copy link
Contributor Author

tomaka commented Apr 7, 2020

I also added as part of this PR:

  • A NetworkService::local_peer_id() method. Right now you need to import a trait to grab the PeerId, which is rather annoying.
  • A list of initial notifications protocols in the NetworkConfiguration. This is actually how notifications protocols are supposed to be registered.

I did that to save efforts, but if these changes are invasive or debatable, I can split the PR.

client/network/src/service/tests.rs Outdated Show resolved Hide resolved
client/network/src/service/tests.rs Show resolved Hide resolved
client/network/src/service/tests.rs Outdated Show resolved Hide resolved
client/network/src/service/tests.rs Outdated Show resolved Hide resolved
client/network/src/service/tests.rs Outdated Show resolved Hide resolved
@tomaka tomaka requested a review from cecton as a code owner April 7, 2020 15:05
@gnunicorn gnunicorn requested a review from twittner April 8, 2020 09:24
@tomaka
Copy link
Contributor Author

tomaka commented Apr 8, 2020

@gnunicorn How does that work? Do I merge this now?
Unless there is a Polkadot PR that updates Substrate, Polkadot will be broken. Should I also open that PR?

@tomaka tomaka merged commit 017b054 into paritytech:master Apr 8, 2020
@tomaka tomaka deleted the fix-notifs-thing branch April 8, 2020 11:32
lamafab pushed a commit to lamafab/substrate that referenced this pull request Jun 16, 2020
…adot#986 (paritytech#982)

* Companion PR to paritytech#5560

* Set priorities.

* Update substrate.

* Fix tests.

* Update Substrate

* Companion of SignedExtension refactor (paritytech#5540)

Co-authored-by: Tomasz Drwięga <tomasz@parity.io>
Co-authored-by: Alexander Theißen <alexander.theissen@parity.io>
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NotificationReceived received before NotificationsStreamOpen
2 participants