Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protocol message versioning #1140

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

ameba23
Copy link
Contributor

@ameba23 ameba23 commented Nov 1, 2024

This adds a version number to the SubscribeMessage sent at the beginning of each protocol session, and checks that it matches the current version (or a list of supported backward compatible versions which currently only contains the current version).

Whether we use this version number to indicate changes in only the protocol message format, or also changes in the protocols themselves is unclear. Both would work, and i don't think we need separate version numbers for each.

We could also add a version number to ProtocolMessage, but i decided not to. I think it is enough to check the version once at the beginning of each protocol session - i don't think we need to check individual messages during a session as well.

As for the type, i went with u32 - but could switch to something else for example people want semantic versioning.

*SUPPORTED_PROTOCOL_MESSAGE_VERSIONS
.iter()
.min()
.expect("At least one protocol message version must be supported"),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think expect is ok here because it will only fail if SUPPORTED_PROTOCOL_MESSAGE_VERSIONS, which is a const, is empty.

@ameba23 ameba23 self-assigned this Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🏗 In progress
Development

Successfully merging this pull request may close these issues.

2 participants