Skip to content

Commit 0a66e5c

Browse files
kixelatedclaude
andauthored
moq-lite-05: encode Hop ID as fixed-width 64-bit integer (#33)
* moq-lite-05: encode Hop ID as fixed-width 64-bit integer Hop IDs are random, so a varint would almost never be shorter than its fixed-width equivalent. Switch Hop ID (ANNOUNCE, ANNOUNCE_OK) and Exclude Hop (ANNOUNCE_INTEREST) from varint to a fixed 64-bit encoding, which also recovers the 2 bits a 62-bit varint would have cost. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * moq-relay-hops: note Hop ID varint spans the full 64-bit range Keep Hop ID as a varint (moqt KVPs are varint-native and support the full 64-bit range), correcting the stale "62-bit varint maximum" wording. No wire or IANA change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * CLAUDE.md: note to add wire/semantic changes to the changelog appendix Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 3e36aa8 commit 0a66e5c

3 files changed

Lines changed: 10 additions & 7 deletions

File tree

CLAUDE.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,5 @@ This is a standards documentation project, not a software implementation. Key co
7373
- Follow IETF contribution guidelines (BCP 78/79)
7474
- Draft format uses kramdown-rfc with YAML frontmatter
7575
- References are managed via bibxml includes
76-
- Do not edit generated files (*.html, *.txt)
76+
- Do not edit generated files (*.html, *.txt)
77+
- When making a wire-format or semantic change to a draft, add a bullet to its changelog appendix (e.g. `# Appendix A: Changelog`) under the in-progress version's section. Drafts without a changelog section (typically unreleased ones) don't need one.

draft-lcurley-moq-lite.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ A subscriber sends an ANNOUNCE_INTEREST message to indicate it wants to receive
631631
ANNOUNCE_INTEREST Message {
632632
Message Length (i)
633633
Broadcast Path Prefix (s),
634-
Exclude Hop (i),
634+
Exclude Hop (64),
635635
}
636636
~~~
637637

@@ -653,13 +653,14 @@ It carries metadata that is constant for the lifetime of the stream and applies
653653
~~~
654654
ANNOUNCE_OK Message {
655655
Message Length (i)
656-
Hop ID (i)
656+
Hop ID (64)
657657
Active Count (i)
658658
}
659659
~~~
660660

661661
**Hop ID**:
662-
The publisher's own Hop ID.
662+
The publisher's own Hop ID, encoded as a 64-bit integer.
663+
Hop IDs are randomly assigned, so they are carried as fixed-width 64 bits rather than a variable-length integer: a varint would almost never be shorter, and the fixed width buys the full 64-bit space (a varint caps at 62 bits).
663664
This is treated as the implicit trailing entry of every ANNOUNCE's Hop ID list on this stream; ANNOUNCE messages MUST NOT repeat this value as the last entry of their `Hop ID` list.
664665
A value of 0 indicates the publisher does not assign Hop IDs (e.g. when bridging from an older protocol version).
665666
Receivers reconstruct the full path as `ANNOUNCE.Hop IDs ++ [ANNOUNCE_OK.Hop ID]`.
@@ -686,7 +687,7 @@ ANNOUNCE Message {
686687
Announce Status (i),
687688
Broadcast Path Suffix (s),
688689
Hop Count (i),
689-
Hop ID (i) ...,
690+
Hop ID (64) ...,
690691
}
691692
~~~
692693

@@ -705,7 +706,7 @@ A value of 0 means no Hop ID entries are present, indicating either that the ann
705706
A receiver MUST close the stream with a PROTOCOL_VIOLATION if the Hop Count does not match the number of subsequent Hop ID entries.
706707

707708
**Hop ID**:
708-
A unique identifier for each relay in the path from the origin publisher, ordered from origin to the upstream of the responding publisher.
709+
A unique identifier for each relay in the path from the origin publisher, ordered from origin to the upstream of the responding publisher, each encoded as a 64-bit integer (see ANNOUNCE_OK's `Hop ID` for the rationale).
709710
The responding publisher's own Hop ID is NOT included in this list; it is carried once in ANNOUNCE_OK as `Hop ID`.
710711
When forwarding an announcement received from an upstream peer, a relay MUST append the upstream peer's ANNOUNCE_OK `Hop ID` to this list (since that ID is no longer implicit downstream) and then send its own `Hop ID` in the ANNOUNCE_OK it sends to the downstream subscriber.
711712
The total path length is `Hop Count + 1` (including the implicit ANNOUNCE_OK `Hop ID`); this total is used as a tiebreaker when there are multiple paths to the same broadcast.
@@ -1074,6 +1075,7 @@ A generic library or relay MUST NOT inspect or modify the decompressed contents
10741075
- Renamed `Start Group`/`End Group` to `Group Start`/`Group End` in SUBSCRIBE, SUBSCRIBE_UPDATE, and SUBSCRIBE_DROP for consistency with the entity-first naming used elsewhere (e.g. `Group Sequence`). Wire format unchanged.
10751076
- Allowed a duplicate `active` ANNOUNCE to atomically replace the prior advertisement (equivalent to UNANNOUNCE+ANNOUNCE). Used when only the origin or hop path changes (e.g. relay failover) without interrupting the broadcast. No new wire enum value — the existing `active` status carries the new metadata.
10761077
- Added ANNOUNCE_OK message, sent once at the head of the Announce Stream response. Carries the publisher's `Hop ID` (hoisted out of every ANNOUNCE's Hop ID list) and an `Active Count` so subscribers can batch the initial set instead of reporting each ANNOUNCE as it trickles in.
1078+
- Encoded `Hop ID` (in ANNOUNCE and ANNOUNCE_OK) and `Exclude Hop` (in ANNOUNCE_INTEREST) as fixed-width 64-bit integers instead of varints. Hop IDs are random, so a varint would almost never be shorter, and the fixed width restores the 2 bits a 62-bit varint would have cost.
10771079
- Added `Publisher Timescale` to TRACK_INFO for per-track timestamp negotiation. When `Publisher Timescale` is 0, the per-frame timestamp field is omitted entirely from FRAME and datagram bodies.
10781080
- Added `Timestamp Delta` to FRAME, a zigzag-encoded signed varint (present only when timescale is non-zero).
10791081
- Added `Timestamp` to the QUIC datagram body (absolute, present only when timescale is non-zero).

draft-lcurley-moq-relay-hops.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ An endpoint that did not negotiate the extension simply omits these parameters;
7575
A **Hop ID** is a variable-length integer that identifies a single relay (or the origin publisher) within the path of an advertisement.
7676

7777
Each relay and each origin publisher chooses its Hop ID **randomly**.
78-
An endpoint SHOULD draw a full-width random value (up to the 62-bit varint maximum) so that the probability of two endpoints choosing the same Hop ID is negligible.
78+
An endpoint SHOULD draw a full-width random value (up to the 64-bit varint maximum) so that the probability of two endpoints choosing the same Hop ID is negligible.
7979
Random assignment means there is no registry, no coordination, and no reserved values: a Hop ID is simply an opaque identifier that is, with overwhelming probability, unique.
8080

8181
An endpoint SHOULD keep its Hop ID stable for the lifetime of a session (and MAY reuse it across sessions) so that loop detection and path comparison are consistent.

0 commit comments

Comments
 (0)