Skip to content

Conversation

@gacevicljubisa
Copy link
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

The bee260BackwardCompatibility function was incorrectly treating pre-release versions (e.g., 2.7.0-rc12) as less than their stable counterparts (2.7.0) due to semver spec behavior. This caused nodes running 2.7.0-rc versions to incorrectly enable backward compatibility mode, stripping WSS addresses and limiting connections to TCP only.

Changes:

  • Modified bee260BackwardCompatibility to compare only major.minor.patch by creating a clean version without pre-release metadata
  • Added debug logging for version compatibility decisions
  • Extracted bee260Compat variable in Connect and handleIncoming for clarity
  • Added comprehensive test coverage with 17 test cases including:
    • Legacy versions (< 2.7.0) requiring backward compat
    • Current/future versions (>= 2.7.0) not requiring backward compat
    • Pre-release versions (2.7.0-rcX) correctly treated as >= 2.7.0
    • Edge cases (empty, malformed, non-bee user agents)

Fixes browser node connectivity issues where they only received TCP addresses instead of both TCP and WSS addresses from peers running pre-release versions.

Open API Spec Version Changes (if applicable)

Motivation and Context (Optional)

Related Issue (Optional)

Screenshots (if appropriate):

…y check

The bee260BackwardCompatibility function was incorrectly treating
pre-release versions (e.g., 2.7.0-rc12) as less than their stable
counterparts (2.7.0) due to semver spec behavior. This caused nodes
running 2.7.0-rc versions to incorrectly enable backward compatibility
mode, stripping WSS addresses and limiting connections to TCP only.

Changes:
- Modified bee260BackwardCompatibility to compare only major.minor.patch
  by creating a clean version without pre-release metadata
- Added debug logging for version compatibility decisions
- Extracted bee260Compat variable in Connect and handleIncoming for clarity
- Added comprehensive test coverage with 17 test cases including:
  * Legacy versions (< 2.7.0) requiring backward compat
  * Current/future versions (>= 2.7.0) not requiring backward compat
  * Pre-release versions (2.7.0-rcX) correctly treated as >= 2.7.0
  * Edge cases (empty, malformed, non-bee user agents)

Fixes browser node connectivity issues where they only received TCP
addresses instead of both TCP and WSS addresses from peers running
pre-release versions.
@gacevicljubisa gacevicljubisa marked this pull request as ready for review January 23, 2026 17:03
@@ -0,0 +1,165 @@
// Copyright 2020 The Swarm Authors. All rights reserved.
Copy link
Member

Choose a reason for hiding this comment

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

2020-> 2026

return false
}
result := vCore.LessThan(version270)
s.logger.Debug("bee version compatibility check", "peer_id", peerID, "version", version, "backward_compat", result)
Copy link
Member

Choose a reason for hiding this comment

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

This log is great fro debugging, but would it be too frequent? Just guessing, maybe it is just fine to have it here especially for validating after the release on the mainnet.

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.

5 participants