Skip to content

feat: update relay protocol to iroh-relay-v2, add new Health frame, test protocol update mechanism#3955

Open
Frando wants to merge 41 commits intomainfrom
Frando/relay-protocol-v2
Open

feat: update relay protocol to iroh-relay-v2, add new Health frame, test protocol update mechanism#3955
Frando wants to merge 41 commits intomainfrom
Frando/relay-protocol-v2

Conversation

@Frando
Copy link
Member

@Frando Frando commented Feb 18, 2026

Description

This branch add a iroh-relay-v2 protocol. The only changes to the iroh-relay-v1 protocol are:

  • removed Health frame (id 11) with string payload
  • added Status frame (id 13) with binary-encoded enum payload that can be extended with further variants or payloads
  • From now on, unknown frames will be ignored in iroh (instead of erroring out)

I wrote this mostly as a test case if and how we can update the relay protocol in a backwards-compatible way. Not sure if the new Health frame is worth it. But also, maybe it's a good idea to actually put the version negotiation and upgrade mechanism to test before we release 1.0?

The PR likely needs some more cleanups. But would be interested in a high-level review/discussion if this is roughly how we intend to support backwards-compatible relay protocol changes during 1.0.

Breaking Changes

Notes & open questions

Change checklist

  • Self-review.
  • Documentation updates following the style guide, if relevant.
  • Tests if relevant.
  • All breaking changes documented.
    • List all breaking changes in the above "Breaking Changes" section.
    • Open an issue or PR on any number0 repos that are affected by this breaking change. Give guidance on how the updates should be handled or do the actual updates themselves. The major ones are:
@Frando Frando force-pushed the Frando/relay-protocol-v2 branch 2 times, most recently from dbda584 to 89da514 Compare February 18, 2026 09:47
@Frando Frando force-pushed the Frando/refactor-relay-close branch from b420ff2 to 7cf0ed9 Compare February 18, 2026 09:48
@Frando Frando force-pushed the Frando/relay-protocol-v2 branch from 89da514 to 52a4783 Compare February 18, 2026 09:50
@dignifiedquire dignifiedquire moved this from 🚑 Needs Triage to 👍 Ready in iroh Feb 23, 2026
#[default]
V2,
/// Deprecated version 1 (before iroh 0.97.0)
V1,
Copy link
Member

@ramfox ramfox Mar 2, 2026

Choose a reason for hiding this comment

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

doesn't declaring them in this order would mean calls to max would return V1 rather than V2 (which we call in handle_relay_ws_upgrade) (since we derive Ord)

Copy link
Member Author

Choose a reason for hiding this comment

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

good observation, thanks. changed and added a test for the protocol negotiation.

@ramfox
Copy link
Member

ramfox commented Mar 2, 2026

only addition I might add here something on the client side that acknowledges we negotiated the protocol. Maybe just a debug line at this point, since it's not used anywhere on the client side yet?

@matheus23
Copy link
Member

I wrote this as feedback in discord, but that's quickly lost to the archives, so just repeating some higher-level feedback here:

My thinking was that we should separate our protocol versions by module. So e.g. now, we'd introduce two modules: iroh-relay/src/protos/{v1,v2}/proto.rs, etc. There's probably some thinking needed to figure out if we want to duplicate common.rs as well/if there's a way of extracting only the useful stuff from it, but otherwise that's roughly what I'm thinking.

If we do this, it is much easier to look at one protocol and see how it works rather than mixing multiple versions in the same code. I think that can become quite messy.

It's also nice to be able to have a bunch of #[cfg(feature = "iroh-relay-v1")] pub mod v1; and similar in protos.rs. This would then eventually make it possible to reduce code size if that becomes a concern.

@Frando Frando changed the base branch from Frando/refactor-relay-close to main March 3, 2026 12:44
@Frando Frando changed the title (draft) feat: update relay protocol to iroh-relay-v2, add new Health frame, test protocol update mechanism feat: update relay protocol to iroh-relay-v2, add new Health frame, test protocol update mechanism Mar 3, 2026
@github-actions
Copy link

github-actions bot commented Mar 3, 2026

Netsim report & logs for this PR have been generated and is available at: LOGS
This report will remain available for 3 days.

Last updated for commit: 82d2df9

@dignifiedquire dignifiedquire added this to the iroh: v0.97 milestone Mar 3, 2026
@Frando Frando marked this pull request as ready for review March 6, 2026 18:56
@Frando Frando requested a review from matheus23 March 6, 2026 18:56
Copy link
Member

@matheus23 matheus23 left a comment

Choose a reason for hiding this comment

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

Let's ship this - at the very least for the important bugfix.

Let's discuss changes to code structure later and open another PR for those if need be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants