Skip to content

Drop the protocol version-negotiation runtime; condense ADR 013 #1433

Closed

Description

@alpergundogdu

Decision (2026-07 ADR simplification audit). Filed under the Protocol simplifications milestone — sibling to #1396, #1394, #1419. Verdict: DROP the low-risk YAGNI (ALPN negotiation prose, multi-version support, deprecation timeline) and heavily condense ADR 013. KEEP the GossipEnvelope.version sentinel byte and all framing/enum/signed-field sections.

Proposal: drop the speculative protocol-version-negotiation runtime (ADR 013)

Status: proposal for discussion, not a decision.

Summary

ADR 013's framing layer is load-bearing and stays. What this proposal cuts is
the version-transition apparatus layered on top of it — the machinery for
running two protocol versions at once, which has no v2 to run against and no
code behind it. Concretely, remove from adr/013-schema-evolution.md:

  • § ALPN Version Negotiation — the descending-order ALPN proposal
    convention ("clients propose newest-first, server selects highest shared"),
    the two negotiation sequence diagrams, and the no_application_protocol
    fallback narrative. This describes a QUIC/TLS feature we do not invoke; no
    code proposes more than one ALPN.
  • § Multi-version support — the rule that "a node MUST support at least the
    current and previous major version simultaneously," running both as
    independent protocol handlers on one iroh::Endpoint. No such dual-handler
    wiring exists.
  • § Deprecation Timeline — the T+0 / T+4wk / T+12wk table and the
    governance-announced-deprecation flow. Pure schedule; nothing consumes it.
  • The GossipEnvelope.version byte (the marginal, debatable piece — see
    Counter-argument)
    — the version: u8 field, the GOSSIP_VERSION == 1
    constant, and the two version-guard checks that reject anything != 1. It is
    checked on every inbound gossip frame and is only ever 1.

Keep everything in What we keep below. The net effect is that ADR 013
becomes a framing + enum-discipline + signed-field-freezing ADR, and the
"how we transition to v2" story moves to a future ADR written when the first
real breaking change actually lands.

Motivation

  1. There is no v2 to negotiate against. Every ALPN is a single frozen
    constant — ALPN_PROBE = b"cdn/probe/v1", ALPN_CLIENT = b"cdn/client/v1",
    ALPN_DHT = b"cdn/dht/v1" (crates/protocol/src/lib.rs:41,44,47). Every
    dial passes exactly one ALPN (connect(target, ALPN_CLIENT) in
    client-pull/src/lib.rs:1104, cooperative_close.rs:97; connect_with_opts (target, ALPN_PROBE, …) in probe.rs:95). There is no descending list, no
    second handler registered, no into_0rtt-style fallback branch. The entire
    negotiation section documents the behavior of machinery that does not exist.

  2. The version byte is a guard that can never fire. GOSSIP_VERSION is a
    compile-time 1 (protocol/src/gossip.rs:24); every producer stamps it
    (gossip/src/service.rs:767,961, reputation.rs:334). The two receive-side
    checks — if *version != GOSSIP_VERSION { return Err(UnknownVersion) }
    (gossip/src/validation.rs:232, reputation.rs:149) — therefore reject
    only inputs no honest peer emits and no v2 exists to emit. It is a sentinel
    for a transition that has not been designed. Forward-compat for payload
    growth is already handled by two-phase deserialization and unknown-variant
    drop (both kept); the version byte adds a second, redundant evolution axis.

  3. The apparatus generalizes ahead of a single data point. ADR 013 §"Rule
    for choosing between envelope evolution and topic bump" spends its length
    arbitrating a decision — envelope-version bump vs. GossipPayload append vs.
    cdn/global/v2 topic bump — that no change has ever had to make. We are
    maintaining a three-way taxonomy for transitions when the count of
    transitions to date is zero.

  4. The ADR itself already prefers "add it when the break lands." Two
    precedents inside ADR 013 point the same way this proposal does. First, the
    on-chain ProtocolVersions registry is explicitly deferred: "out of scope…
    If a future scale or trust profile changes the calculus, the registry
    warrants its own ADR" (§ Deprecation Timeline). Second — and more telling —
    ADR 005 repeatedly makes real message changes as straight in-place
    additions with no version bump
    precisely because cdn/*/v1 is
    pre-finalisation: namespace_id and byte_len were added to base
    StreamRequest with "no version bump and no compatibility shim"
    (005-protocol.md:170,186). The project's actual practice is already
    version-negotiation-free. The runtime apparatus is prescribing a discipline
    the codebase does not use.

  5. This is temporal YAGNI, not scale-deferral. The valid cut here is not
    "unneeded at tens of nodes." Negotiation is scale-independent — it is needed
    the day a breaking change ships, whether the network is 10 nodes or 10,000.
    The point is that no breaking change has shipped, no v2 is drafted, and
    when the first one lands, negotiation is one focused ADR that can be written
    against the concrete shape of that break — descending-order proposal,
    dual-handler window, and a deprecation schedule sized to the real migration.
    Writing it now, in the abstract, produces prose we will likely revise once
    we know what actually breaks.

What removal touches

Blast radius is real but overwhelmingly documentation and convention — this
is closer to condensing an ADR than deleting a subsystem. Honesty demands
saying so up front: the code footprint is a few lines, not a module.

ADRs / cross-refs

  • adr/013-schema-evolution.md — delete § ALPN Version Negotiation (incl. both
    sequence diagrams), § Multi-version support, and § Deprecation Timeline;
    remove the § Gossip Envelope version field from the struct and the
    Deserialization rule's version != 1 clause; drop the version-byte row from
    the Consequences (the "2–3 bytes… version byte + enum discriminant" and the
    "two protocol handler codepaths simultaneously" negatives). Keep the Tier
    1/2/3 taxonomy, framing, and signed-field-freezing sections intact.
  • ADR 005 cross-refs — no wording change required. Its "no version bump because
    pre-finalisation" statements (005:170,186,395) are consistent with this
    proposal and arguably become cleaner; its Tier-2/Tier-3 references
    (005:314,316) point at sections we keep.
  • adr/appendix-operator-upgrade-path.md — the ADR 013 §"See also" points here
    for the Tier-3 rolling-upgrade runbook and the deprecation-window operator
    steps. Those subsections lose their upstream and should be trimmed to the
    Tier 1/2 checklists (which survive).
  • adr/architecture.md — check the schema-evolution entry for a deprecation-
    timeline mention; downgrade to "framing + evolution tiers."

Wire

  • GossipEnvelope.version: u8 removed. This is a wire-format change to the
    gossip envelope, so it is only free because gossip is pre-finalisation (no
    testnet swarm to coordinate) — the same window ADR 005 leans on. After
    removal the envelope is { payload: GossipPayload }; forward-compat rests
    entirely on take_from_bytes trailing-byte tolerance (kept) and unknown-
    variant drop (kept). The ALPN wire strings are unchanged (still …/v1).

Rust framing / version handling (small, grep-confirmed)

  • crates/protocol/src/gossip.rs — delete GOSSIP_VERSION const and the
    version field on GossipEnvelope; update the three roundtrip/discriminant
    tests (gossip_payload_*_is_{zero,one} currently assert bytes.first() == GOSSIP_VERSION then discriminant at index 1 — they shift to index 0).
  • crates/gossip/src/validation.rs:232 — remove the version-byte pre-check
    block; the take_from_bytes decode + MAX_TRAILING_BYTES bound stay.
  • crates/gossip/src/reputation.rs:84-85,117,148-150,405-411 —
    remove ReputationReject::UnknownVersion, its metric label
    reputation_unknown_version, the version pre-check, and the
    unknown_version_rejected test.
  • crates/gossip/src/service.rs:767,961 — drop version: GOSSIP_VERSION from
    the two envelope constructions.
  • crates/protocol/tests/snapshots/public_api__public_api.snap — re-bless:
    removes GossipEnvelope::version and GOSSIP_VERSION (4 snapshot lines).

Tests

  • The gossip/reputation roundtrip and reject tests above. No integration or
    e2e test drives version negotiation or a deprecation window (there is nothing
    to drive), so nothing there breaks.

Rough magnitude: 1 ADR heavily trimmed + 2–3 doc edits; ~4 Rust files with
small deletions; 1 wire field; 1 public-API snapshot re-bless; a handful of
tests. No operator migration (no deployed swarm; no handler wiring existed to
unthread).

What we keep

  • Length-prefixed varint framing — read_frame/write_frame,
    MAX_MESSAGE_SIZE = 16 MiB, MAX_STREAMS/DoS bounds, the ChunkData
    framing exemption, and GOSSIP_MAX_FRAME = 16 KiB. This is the load-bearing
    spine of ADR 013 and is used on every stream.
  • Protocol enums per ALPN — ProbeMessage, ClientMessage, GossipPayload,
    the DHT enum, their frozen declaration-order discriminants, and the
    unknown-variant handling (stream close 0x01 UNSUPPORTED_MESSAGE on QUIC,
    silent drop on gossip). Tier-2 evolution (append a variant) is untouched.
  • Two-phase deserialization as the standard minor-evolution mechanism —
    and it is implemented, not just documented: StreamRequestExt travels as
    separate trailing bytes parsed by parse_stream_request_ext
    (protocol/src/client.rs:251 ff.), carrying ethereum_address,
    binding_signature, voucher_interval_mb. take_from_bytes trailing-byte
    tolerance and MAX_TRAILING_BYTES stay. This is the real, working forward-
    compat path — it does not need the version byte.
  • Signed-field freezing — NodeAnnounceBody/ReputationReportBody signed-
    body split, signing_bytes(), and the Tier-3 rule that changing a signed set
    requires a new ALPN. Untouched.
  • The …/v1 ALPN strings and topic names — including the framing/enum
    discipline that makes a future cdn/client/v2 a clean, single-focused ADR
    when a real break lands. We keep the load-bearing framing/enums exactly so
    that negotiation can be added cheaply later.

Counter-argument

The strongest honest case for keeping it:

  • The version byte is one byte and a genuine forward-compat guard for a
    channel that has no ALPN. [your call]
    ALPN-based negotiation protects the
    QUIC protocols, but gossip travels on iroh-gossip topics with no ALPN
    handshake — the GossipEnvelope.version byte is the only place a receiver
    can cheaply reject a wholesale envelope-format change (as opposed to a
    payload-shape change, which trailing-byte tolerance absorbs). Removing it
    means a future incompatible envelope layout can only be distinguished by a
    topic-name bump (cdn/global/v2), which is the expensive dual-subscription
    path ADR 013 explicitly tries to reserve for trust-contract changes. A
    defensible middle path is to keep the version byte as a dumb reserved
    sentinel
    (drop the negotiation prose and the ALPN/deprecation apparatus,
    but leave the 1-byte guard in place) — it costs ~4 lines and preserves the
    one cheap gossip-format kill-switch. This is why the verdict is
    DROP-BUT-MARGINAL: the negotiation prose is clean YAGNI, but the version
    byte specifically is cheap insurance on a channel that genuinely lacks the
    ALPN backstop.

  • Most of what we cut is documentation, and documentation is cheap to keep.
    Unlike the three features just deleted (Proposal: remove speculative prefetch #1396 prefetch, Redesign origin addressing: namespace-as-address, drop per-hash claims and the default-open allow-list #1394 namespace,
    Drop aggregated reputation; make ADR 008 reputation local-only #1419 — real code with real maintenance surface), the ALPN-negotiation and
    deprecation-timeline sections impose no runtime cost: QUIC ALPN negotiation
    is a free TLS 1.3 feature, and the timeline is a table. "Delete it now, write
    it later" trades a stable, correct description of how a future transition
    will work for the risk of re-deriving it under time pressure when the first
    break lands mid-deployment. The pre-implementation window is exactly when
    writing this down is cheapest and rework-free.

  • The apparatus is the pre-commitment that makes v1 safe to freeze. ADR
    013's whole premise (§ Context) is that defining evolution conventions
    before v1 avoids retrofitting — itself a breaking change. The negotiation +
    deprecation sections are the "major change" leg of that three-tier promise;
    cutting them leaves the ADR able to describe Tier 1/2 but silent on how Tier 3
    actually rolls out. Some reviewers will read that as leaving the story
    half-told rather than as removing dead weight.

Open questions

  1. Keep the version byte as a reserved sentinel, or remove it? This is the
    crux. Removing the prose (negotiation, multi-version, deprecation timeline)
    is low-risk YAGNI. Removing the wire byte is a real gossip-format change
    that only the pre-finalisation window makes free, and it deletes the one
    cheap gossip envelope-format guard. [your call] — the two decisions are
    separable and could land independently.
  2. Does dropping § Deprecation Timeline strand
    appendix-operator-upgrade-path.md's Tier-3 rolling-upgrade runbook, and is
    that runbook load-bearing for the testnet operator story, or is it also
    speculative (no v2 to upgrade to)?
  3. When the first real breaking change lands, is a focused "ADR NNN: cdn/client
    v1→v2 migration" genuinely cheaper to write against a concrete break than
    editing today's abstract sections back into shape? If yes, deletion wins; if
    the abstract version is 90% reusable, condensing-in-place beats deleting.
  4. Is there any near-term change already in flight (a mandatory field, a signed-
    set change, a topic trust-contract change) that would need Tier-3 negotiation
    soon? If one is imminent, this apparatus is about to acquire its first
    consumer and should not be cut.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

Priority

None yet

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions