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

Pass an encoded Roles as the notifications protocols handshakes #5665

Merged
merged 5 commits into from
Apr 21, 2020

Conversation

tomaka
Copy link
Contributor

@tomaka tomaka commented Apr 16, 2020

In the process of removing the legacy protocol, there is a problem: we need to report, in sc_network::Event::NotificationsStreamOpened, what the Role of the remote is.

This is normally why the notification protocols have a handshake. The idea is that you send your Roles during the substream opening handshake, which is then received by the remote, which can report it at the API layer.

However, for backwards-compatibility reason, the notification substreams are still tied to the legacy substream, and thus we directly pick the Roles that was sent through the legacy "status" message on the legacy substream. But we eventually want to untie them and directly determine the Role from the substream handshake.

This PR is the first step towards this. At the moment, the handshake is always empty and ignored. After this PR, it will now send an encoded Roles. The handshake is still totally ignored, but at least the way is now paved towards being able to know the Roles without relying on the legacy substream.

About bumping the protocol version

Theoretically this is a change in notification protocols and should lead to modifying the protocol version. In practice, though, this would be a bit tedious.

This PR doesn't break any backwards compatibility, since the handshake is at the moment ignored.

One problem is that in the future, when we will actually expect all remotes to send us their Role, then nodes that do not include this PR will no longer be able to connect.
However, there is no miracle solution to this: no matter what this PR does, it will mandatory to have it in the future in order to be able to connect.

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

tomaka commented Apr 16, 2020

I've successfully tested this PR on my Google Cloud node.

@tomaka tomaka added A8-mergeoncegreen and removed A0-please_review Pull request needs code review. labels Apr 20, 2020
@gnunicorn gnunicorn merged commit 50c969f into master Apr 21, 2020
@gnunicorn gnunicorn deleted the tka-roles-initial-handshake branch April 21, 2020 08:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
B0-silent Changes should not be mentioned in any release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants