Skip to content

feat(p2p): expose peer protocol version for backward compatibilities - #5539

Merged
janos merged 2 commits into
masterfrom
expose-p2p-peer-protocol-version
Jul 21, 2026
Merged

feat(p2p): expose peer protocol version for backward compatibilities#5539
janos merged 2 commits into
masterfrom
expose-p2p-peer-protocol-version

Conversation

@janos

@janos janos commented Jul 17, 2026

Copy link
Copy Markdown
Member

Checklist

  • I have read the coding guide.
  • My change requires a documentation update, and I have done it.
  • I have added tests to cover my changes.
  • I have filled out the description and linked the related issues.

Description

This PR adds a new method to p2p.Stream: Version() that exposes the protocol version of the peer as already parsed semver.Version for easier validations. It can be used in p2p Handlers for backward compatibility checks. Since libp2p is configured to follow semver in a semantic way, not only formal, it is possilbe to have the backward compatibility with only increasing Minor or Patch numbers in the version string.

It looked to me that exposing the more granular versioning on protocols can provide greater isolation on compatibility checks compared to the bee version check. And libp2p is validating the protocol version making it more reliable compared to the version of the bee in the user-agent. Since every protocol has its version, and the validation is scoped to the p2p layer, protocol versions are covering the same scope as p2p connection user-agent string.

Open API Spec Version Changes (if applicable)

Motivation and Context (Optional)

Related Issue (Optional)

Screenshots (if appropriate):

AI Disclosure

  • This PR contains code that has been generated by an LLM.
  • I have reviewed the AI generated code thoroughly.
  • I possess the technical expertise to responsibly review the code generated in this PR.

@janos
janos merged commit fddc49e into master Jul 21, 2026
15 checks passed
@janos
janos deleted the expose-p2p-peer-protocol-version branch July 21, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants