core/priority: add leading slash to protocol ID - #4605
Open
pinebit wants to merge 1 commit into
Open
Conversation
Normalise the priority protocol ID to /charon/priority/2.0.0, matching every other charon libp2p protocol. The wire format is unchanged, so the version stays at 2.0.0 and the old spelling is kept as a legacy alias so that patched and unpatched nodes interoperate. Nodes now offer both IDs when dialling, preferring the slash-prefixed one, and serve both via separate exact-match handler registrations. The two IDs share no common prefix, so registering them in a single RegisterHandler call would collapse protocolPrefix to the bare wildcard "*" and advertise that to peers via libp2p identify instead of the real protocol IDs. category: refactor ticket: none Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4605 +/- ##
==========================================
+ Coverage 57.58% 57.61% +0.02%
==========================================
Files 246 246
Lines 33675 33678 +3
==========================================
+ Hits 19392 19402 +10
+ Misses 11845 11836 -9
- Partials 2438 2440 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



Normalises the priority protocol ID to
/charon/priority/2.0.0, matching every other charon libp2p protocol. It was the only one registered without a leading slash, which defeats/charon/-prefix matching.The wire format does not change, so the version stays at
2.0.0and the old spellingcharon/priority/2.0.0is kept as a legacy alias. Nodes offer both IDs when dialling, preferring the slash-prefixed one, and serve both. This keeps patched and unpatched nodes interoperable in all four combinations:/charon/priority/2.0.0charon/priority/2.0.0charon/priority/2.0.0charon/priority/2.0.0The two IDs are registered as separate exact-match handlers rather than via a single
RegisterHandlercall withWithDelimitedProtocol. They share no common prefix, so one call would collapseprotocolPrefixto the bare wildcard"*", and that string is what gets advertised to peers through libp2p identify — peers would be told we support"*"and neither real ID. A code comment, aprotocolPrefixdoc comment, and a test assertion all pin this down.TODO(v1.14)markers on the alias, the dual registration, and the send-side fallback mark them for removal once no supported version dials the legacy ID.Tests:
TestProtocolspins the wire-visible strings and their precedence,TestProtocolNegotiationcovers what each peer type advertises and negotiates, andTestPrioritiserLegacyPeerruns a full exchange between a patched and an unpatched node. The latter isolates one dial direction per case — with both nodes dialling, either can reach quorum off its peer's inbound request and mask a broken outbound dial.category: refactor
ticket: none