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
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.
In the process of removing the legacy protocol, there is a problem: we need to report, in
sc_network::Event::NotificationsStreamOpened
, what theRole
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 theRole
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 theRoles
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.