Skip to content

[W5.10] libp2p/mux: the mplex Muxer value #90

Open

Description

@IvanAnishchuk

Unit W5.10 of docs/PLAN.md. The row lands with this unit's pull request (see "The docs this unit corrects").

The mplex Muxer value, Mux.mplex under /mplex/6.7.0: the message codec, the go-compatible (id, initiator) stream identity, the half-close rules, and the 1 MiB message cap. It is unit 2 of packages/libp2p/mux/docs/PLAN.md, which #17 (W5.4) left open.

Why this unit exists

The consensus networking spec makes mplex a requirement for every TCP client. vendor/consensus-specs/specs/phase0/p2p-interface.md, lines 210 to 215, at the pin 0216d01:

Clients that support the TCP transport MUST support mplex and MAY support yamux. If both are supported by the client, yamux MUST take precedence during negotiation.

The node speaks TCP, so it must speak mplex, and it must offer yamux first.

The docs this unit corrects

The root docs say the spec removed mplex, and they defer it on that ground. The pinned spec says otherwise, and the spec wins (CLAUDE.md, "Spec is the source of truth"). The pull request corrects, root first:

  • root docs/ARCHITECTURE.md: §1 (line 30, "TLS and mplex beyond their seams"), the §8 transport table (line 1004, "the spec removed mplex"), and the §8 deferred list (line 1032, "mplex. The eth2 networking spec removed it.");
  • root docs/PLAN.md: the graph note (line 41), the W5.4 row (line 103), the "Deferred" list (line 123), and a new W5.10 row;
  • CLAUDE.md, "Scope": mplex moves from the deferred list into the v1 list;
  • packages/libp2p/mux/docs/: unit 2 stops being P2.

go-libp2p v0.50.0 removed mplex from its defaults (the cli PLAN records this for the matrix). That is a difference with go, not with the spec, and it is recorded as one (PRINCIPLES 2.1).

Where the spec lives

  • The wire format: vendor/specs/mplex/README.md.
  • The package docs: packages/libp2p/mux/docs/ARCHITECTURE.md (the Mux.mplex surface, contracts 4 and 5, the 1 MiB cap) and PLAN.md (unit 2 and its milestones).
  • The root contract: docs/ARCHITECTURE.md §4.9 (the identity rule) and §5.1 (the mplex framing cap).
  • The references: the spike branch, Conn/Mplex.lean; go-mplex, rust-libp2p's muxers/mplex, js-libp2p's stream-multiplexer-mplex, and nim-libp2p's muxers/mplex.

Definition of done

  • Mux.mplex : Core.Muxer follows the mux ARCHITECTURE's public surface, and its owned contracts hold.
  • The unit 2 test milestones of the mux PLAN pass: the identity rule, the 1 MiB cap before allocation, the 9-byte header varint bound, the three half-close cases, and reset in both directions.
  • Mux.mplex interoperates with go-mplex over loopback TCP in both directions. go-libp2p v0.50 has no mplex, so the go side is go-mplex itself.
  • Every host the repo assembles offers [Mux.yamux, Mux.mplex], in that order (the spec's precedence rule). The interop harness takes Mux.mplex for muxer=mplex.
  • lake build --wfail, lake test, the suite with LEAN_NUM_THREADS=1, and scripts/lint-imports.sh are green.
  • No sorry, no build warnings (CLAUDE.md, "Strict checking").

Depends on

Ground rules

  • Comment claim to take the issue.
  • Target the hackathon26 branch.
  • The license-acceptance line of the PR description stays ticked; commits carry no AI co-author trailers.
  • Prose register everywhere: CLAUDE.md, "Writing Style".

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions