Repository navigation
Labels
Description
Unit W5.4 of docs/PLAN.md.
The Muxer values: Mux.yamux over the session of net/yamux under /yamux/1.0.0, and the fixed-key test value. mplex is P2 (§8) and can follow any time after this unit: go-compatible (id, initiator) identity and half-close.
Where the spec lives
- The unit row: root
docs/PLAN.md— the deliverable, the dependencies, the priority. - The frozen interfaces: root
docs/ARCHITECTURE.md, §3 (the mechanisms) and §4.9 (this package). - The package's own docs:
packages/libp2p/mux/docs/ARCHITECTURE.mdand itsPLAN.md— read them first; they refine the root docs and never contradict them. - The reference: the
spikebranch,Conn/Mux.lean(the yamux value),Conn/Mplex.lean(mplex, P2) (ARCHITECTURE §7). Read it before you implement. Port its tests, keep the wire bytes; the code shape follows §3, not the spike's internals (§7 preamble, §9).
Your freedom, and its cost
The docs govern, and they are yours to change. Where a better design exists, change it — and change the documents in the same pull request. A contract change starts at the root docs/ARCHITECTURE.md; the package docs follow it in the same change. Code that disagrees with the docs, or package docs that disagree with the root, does not merge.
Definition of done
- The public surface follows ARCHITECTURE §4; the owned contracts hold.
- The muxer values over the sim transport end to end through the host seams, and the half-close contract (§5.3): a response after our FIN still arrives.
- The carried vector and property tests pass through the
Testssuite. lake build,lake test, andlake test -- +RTS -N1 -RTSare green;scripts/lint-imports.shis green.- No
sorry, no build warnings (CLAUDE.md, "Strict checking"). - First submodule under your leaf? Widen the lib's
globsinlakefile.tomlin the same commit.
Depends on
- [W4.3] net/yamux: the stream muxer #14 (
W4.3) — blocking. - [W5.2] libp2p/core: the types and the seams #15 (
W5.2) — blocking.
Every issue is claimable from day one; you build ahead of open dependencies against mocks of their frozen interfaces (RULES.md, "Working ahead of the tree").
Ground rules
- Comment
claimto take the issue; an organiser assigns it. One issue at a time. - A pull request within 8 hours of the assignment; drafts count. Link the issue (
Closes #N). Miss the window, lose the claim. - Target the
hackathon26branch. - The license-acceptance line of the PR description stays ticked; commits carry no AI co-author trailers. Two guards fail the PR otherwise.
- Prose register everywhere: CLAUDE.md, "Writing Style".
- A contract question the docs do not settle: ask on this issue before you code past it.
Activity
Mouzayan commentedon Nov 4, 2026
claim
IvanAnishchuk commentedon Nov 4, 2026
W1.1 (#27) changed frozen signatures this unit builds on. RULES.md ("Working ahead of the tree") asks for a comment on every dependent issue, and this one is late: it belonged here before the merge. The change is approved on the PR: #27 (comment)
Everything that can park now runs in
Conc.Async. The reason is threads: 5000 receivers parked inAsynccost 12 OS threads, and 5005 with a blockingIO.wait(scripts/park-threads.lean).For the muxer values:
Mux.yamuxcarriesopen : Role → Connection → ByteArray → ExceptT Core.Error Async MuxSession(root ARCHITECTURE §4.9).MuxSessionit returns hasaccept : Async (Option Stream)andopenStreamthroughExceptT Core.Error Async.close : IO Unitstays inIO, since a close never parks.AsyncwithChan,TaskSetandOnceReffrombase/conc, as the package ARCHITECTURE lists.#27 is merged, so the package builds on
Concdirectly.Mouzayan commentedon Nov 4, 2026
Thanks.
I'll build directly on
Conc.Asyncand keep close inIOas specified.IvanAnishchuk commentedon Nov 4, 2026
The W4.2 pull request (#47) changes the TCP close discipline of root ARCHITECTURE §4.7, which the
Connectionofnet/streamscarries to every layer above it.closesends a FIN when no write is in flight, and an RST when one is. On v4.34, a write to a peer that stops reading never completes. libuv'sshutdownwaits behind it, and the write request holds the socket and its descriptor. A C shim innet/streamsends such a connection, and the peer gets an RST. A failed write follows the same rule.none, the end-of-stream channel of §3.5. go-libp2p closes every TCP connection with an RST (linger 0,vendor/go-libp2p/p2p/transport/tcp/tcp.go, lines 278 to 281), so a session with a go node ends this way.The
Connectiontype and its fields stay the same. Thenet/streamsARCHITECTURE, "Decisions", records both rules with their sources.IvanAnishchuk commentedon Nov 5, 2026
#61 (W5.6) touches the docs of two packages this unit builds on, through the chain of root PLAN.
packages/libp2p/core/docs/ARCHITECTURE.mdfixes the policy shapes, which the core surface left to the host: the gater'sallowDial,allowInbound, andallowSecured;ResourceManager.openConnectionwith itsConnectionScope; andAddressRanker.rankover go-libp2p'sAddrDelayschedule. No seam ofSecurityProtocol,Muxer,MuxSession, orStreamHandlerchanges.packages/libp2p/negotiate/docs/ARCHITECTURE.mdgainsupgradeWith, the upgrade with a checkpoint after the handshake, andnegotiateStream, multistream-select over one muxed stream.upgradekeeps its signature.The host surface also has
newStream(#60 posted it). A unit that holds aHostopens its streams through it, and one that serves streams registers aStreamHandler, unchanged.IvanAnishchuk commentedon Nov 5, 2026
#62 (W4.3, yamux) touches docs this unit builds on. No existing signature changes.
base/bytesgainsBytes.take?(withsliceAt?), which moves out ofStreams.Framing, andBytes.Blob, the wrapper that gives core data aReprfor its bytes.net/streamsgainsStreams.readLoop, the reader task of a session: a credit from the loop before each read, a post per chunk, and a post for the end of the connection.net/yamuxlands its session:Session.new role conn leftover clock keepalive,openStream,acceptStream,close, andjoin, serving theStreamseam.Mouzayan commentedon Nov 5, 2026
Thanks, noted.
W4.2’s TCP close behavior from #47 is already in this branch’s upstream baseline. The test session treats a peer RST as connection end and keeps it distinct from a mux stream reset. The W5.6 changes in #61 do not alter the mux-facing seams.
W5.4 is completing the independent test-mux lifecycle coverage. After #62 merges, I’ll rebase and connect
Mux.yamuxtoYamux.Session.new.During that integration, I’ll check whether
Streams.readLoopand the new byte helpers should replace any package-local machinery without changing the test-mux contract.IvanAnishchuk commentedon Nov 5, 2026
#63 (W5.1) lands
libp2p/identityand touches docs and types this unit builds on. No existing signature changes.Libp2p.IdentityexportsKeyType,PubKey,PrivKey,PeerId, andIdentity.Error. The entry points arePubKey.unmarshal?,PrivKey.unmarshal?,PubKey.marshal,PubKey.verify,PrivKey.sign : ByteArray → ExceptT Error IO ByteArray,PrivKey.toPublic,PeerId.ofPubKey,PeerId.ofBytes?,PeerId.toBytes, andPeerId.ofString?.PeerIdderivesBEq,DecidableEq,Hashable,Ord, andRepr, as root §3.2 asks.ToStringprints the parsed text form. The derived==also compares that form, so code that asks "same peer?" comparesa.hash == b.hash.Multiformats.Multihashnow derivesHashableandOrd, and the generated multiformats enums (HashCode,ContentCodec,Protocol,Multibase.Base) deriveOrd.Multiformats.Multiaddr.validPeerHash;PeerIdcarries its proof.Mouzayan commentedon Nov 5, 2026
Progress update:
The independent, repo-only
Mux.testimplementation is complete in PR #49, including its bounded framing/session machinery and lifecycle, concurrency, resource-boundary, and hostile-input coverage.The PR is now paused at the dependency boundary.
Once W5.2 (#15 / PR #64) and W4.3 (#14 / PR #62) land, I’ll rebase and replace the temporary Core seam and connect the thin
Mux.yamuxadapter.leolara commentedon Nov 7, 2026
Unit 1b stays open: PR #49 merged with
Mux.yamuxmoved to a seam issue, per the organiser ruling of today. The muxer seam values and the test value landed; the production yamux value over the W4.3 session closes this issue.Mouzayan commentedon Nov 9, 2026
PR #84 is ready for review with the production Mux.yamux value over the landed net/yamux session. Mux.test remains the independent repository test muxer, and the adapter’s role mapping, leftover forwarding, error boundary, and public session behavior are covered. Mplex remains deferred P2 work.
leolara commentedon Nov 9, 2026
Unit 1b landed through PR #84: Mux.yamux fills the real core seam over the net/yamux session, with the adapter suite over the sim pair. The issue closes.