docs: specify the Zakura p2p connection, discovery, and service-discovery stack#454
Draft
evan-forbes wants to merge 1 commit into
Draft
docs: specify the Zakura p2p connection, discovery, and service-discovery stack#454evan-forbes wants to merge 1 commit into
evan-forbes wants to merge 1 commit into
Conversation
…very stack
Add a docs/specs/p2p/ specification set, in the same style as
docs/specs/blocksync/congestion_control.md, covering the parts of the
Zakura (P2P v2 over iroh/QUIC) stack that are common to every service:
- README.md — overview, architecture, and the shared vocabulary
(stream kinds, capability bits, network/chain scoping,
wire magics)
- connections.md — transport lifecycle, the generation-guarded per-peer
registry and duplicate resolution, framing, streams,
timeouts, backpressure, rate limiting, and identity
- peer_discovery.md — address sourcing, the signed-record discovery protocol,
candidate selection, dialing, redial/backoff, and
connection targets
- service_discovery.md — capability negotiation, stream routing, per-service
peer acquisition/admission, and the symmetric
block-sync collision tiebreak
Reference-only documentation; no code changes.
evan-forbes
marked this pull request as draft
July 3, 2026 23:43
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
The Zakura (P2P v2, over iroh/QUIC) stack has a detailed spec for block-sync
congestion control (
docs/specs/blocksync/congestion_control.md) but nothingcomparable for the layers underneath it. This adds a spec set for the parts of
the stack common to every service — how peers connect, how they find each
other, and how they learn which services each other speak — so the
invariants (bounded resources, authenticated/scoped identity, the connection
generation guard, per-IP admission, capability negotiation) are written down and
reviewable independently of the code.
No linked issue; documentation-only.
Solution
New
docs/specs/p2p/, same house style as the block-sync spec (Overview →Glossary → MUST/SHOULD → Edge cases and bounds → Defaults table):
the three service namespaces (stream kind / capability bit / service id), the
stream-kinds and capability-bits tables, network/chain (cohort) scoping, and
the wire magics.
generation-guarded per-peer registry and transcript-hash duplicate
resolution, framing/streams, timeouts/keepalive/freshness reaping,
backpressure, rate limiting & DoS bounds, and identity/auth.
signed-record discovery protocol, the dial-slot-limit formula, the two backoff
mechanisms, connection targets, and candidate lifecycle/scoring/eviction.
stream-kind routing/admission, how each service acquires and admits peers, and
the symmetric block-sync collision tiebreak.
The spec reflects current behavior including the generation-guarded connection
registration (WS-1) and the native per-IP connection default of 3 (WS-4); WS-5
(block-sync parking) is flagged as out-of-scope future work where relevant.
Tests
Documentation only — no code paths changed.
markdownlint-cli2 --config .trunk/configs/.markdownlint.yaml docs/specs/p2p/*.md→ 0 errorscodespell docs/specs/p2p/*.md→ cleanSpecifications & References
docs/specs/blocksync/congestion_control.mdbook/src/dev/private-zakura-network.md(dev-network cohort scoping)Follow-up Work
book/src/SUMMARY.md); the existingblock-sync spec is likewise a standalone reference doc, so they're left out of
the book nav for now.
AI Disclosure
zebra-network/src/zakuratransport/discovery/handshake modules and drafted the specs from that reading;
all claims were cross-checked against the source. Reviewed by the author.
PR Checklist