Skip to content

p2p/discover/v5wire: shift DISC-NG message IDs to 0x07-0x0a#67

Open
srene wants to merge 1 commit into
topdiscfrom
feat/discv5-wire-shift-disc-ng
Open

p2p/discover/v5wire: shift DISC-NG message IDs to 0x07-0x0a#67
srene wants to merge 1 commit into
topdiscfrom
feat/discv5-wire-shift-disc-ng

Conversation

@srene
Copy link
Copy Markdown
Member

@srene srene commented May 15, 2026

Summary

Aligns the DISC-NG message IDs in v5wire/msg.go with the wire-protocol spec by removing the vestigial REQUEST_TICKET / TICKET (0x07 / 0x08) placeholders and shifting REGTOPIC / REGCONFIRMATION / TOPICQUERY / TOPICNODES down by two.

Companion to datahop/devp2p#2 (the wire-spec update).

Change

// Before                              // After
RequestTicketMsg     // 0x07           PingMsg byte = iota + 1   // 0x01
TicketMsg            // 0x08           PongMsg                   // 0x02
RegtopicMsg          // 0x09           FindnodeMsg               // 0x03
RegconfirmationMsg   // 0x0a           NodesMsg                  // 0x04
TopicQueryMsg        // 0x0b           TalkRequestMsg            // 0x05
TopicNodesMsg        // 0x0c           TalkResponseMsg           // 0x06
                                       RegtopicMsg               // 0x07
                                       RegconfirmationMsg        // 0x08
                                       TopicQueryMsg             // 0x09
                                       TopicNodesMsg             // 0x0a

Sequence is now dense (no gaps), matching the spec at https://github.com/datahop/devp2p/blob/master/discv5/discv5-wire.md (after datahop/devp2p#2).

Why

The RequestTicketMsg and TicketMsg slots existed only as iota constants — there are no struct types RequestTicket or Ticket, no encoders, no decoders, no handlers. They were inherited from earlier discv5 spec drafts that envisaged a separate two-step REGTOPIC → TICKET → REGCONFIRMATION flow. The current DISC-NG protocol merges that into a single REGCONFIRMATION response (carrying the ticket + wait-time, or empty-ticket on admission), so the placeholder slots are pure dead code that shift the live messages off the spec's sequence.

Compatibility

This is a wire-format change. Peers using the old (0x09–0x0c) allocation cannot interoperate with peers using the new (0x07–0x0a) allocation on these messages.

There are no shipped deployments of the old IDs:

Disruption is contained to in-development implementations.

Test plan

  • go test ./p2p/discover/v5wire/... passes
  • go test ./p2p/discover/... passes (full topic test suite)
  • go vet ./p2p/discover/... clean

Drops the unused REQUEST_TICKET (0x07) and TICKET (0x08) message-type
placeholders that were never finalised in the discv5 wire spec and were
never wired up in the implementation (no struct types, no handlers, no
encoders, no senders — only the iota constants existed).

After the shift:

  REGTOPIC          0x07  (was 0x09)
  REGCONFIRMATION   0x08  (was 0x0a)
  TOPICQUERY        0x09  (was 0x0b)
  TOPICNODES        0x0a  (was 0x0c)

Sequence is now dense (no gaps) and matches the wire-protocol spec at
datahop/devp2p discv5/discv5-wire.md.

This is a wire-format change. Any peer using the old (0x09-0x0c)
allocation cannot interoperate with one using the new (0x07-0x0a)
allocation on these messages. There are no shipped deployments of the
old IDs and the DISC-NG messages were still flagged as not-final in the
spec, so the disruption is contained to in-development implementations.
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.

1 participant