Skip to content

docs: specify the Zakura p2p connection, discovery, and service-discovery stack#454

Draft
evan-forbes wants to merge 1 commit into
ironwood-mainfrom
evan/zakura-p2p-spec
Draft

docs: specify the Zakura p2p connection, discovery, and service-discovery stack#454
evan-forbes wants to merge 1 commit into
ironwood-mainfrom
evan/zakura-p2p-spec

Conversation

@evan-forbes

Copy link
Copy Markdown

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 nothing
comparable 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):

  • README.md — overview, an architecture diagram, and the shared vocabulary:
    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.
  • connections.md — the iroh/QUIC transport: connection lifecycle, the
    generation-guarded per-peer registry and transcript-hash duplicate
    resolution, framing/streams, timeouts/keepalive/freshness reaping,
    backpressure, rate limiting & DoS bounds, and identity/auth.
  • peer_discovery.md — the address book and its four sources, the
    signed-record discovery protocol, the dial-slot-limit formula, the two backoff
    mechanisms, connection targets, and candidate lifecycle/scoring/eviction.
  • service_discovery.md — capability negotiation (handshake intersection),
    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 errors
  • codespell docs/specs/p2p/*.md → clean

Specifications & References

  • Sibling spec: docs/specs/blocksync/congestion_control.md
  • Related: book/src/dev/private-zakura-network.md (dev-network cohort scoping)

Follow-up Work

  • Optionally wire these into the mdBook nav (book/src/SUMMARY.md); the existing
    block-sync spec is likewise a standalone reference doc, so they're left out of
    the book nav for now.

AI Disclosure

  • AI tools were used: Claude Code — explored the zebra-network/src/zakura
    transport/discovery/handshake modules and drafted the specs from that reading;
    all claims were cross-checked against the source. Reviewed by the author.

PR Checklist

  • The PR title follows conventional commits format.
  • The documentation is up to date (this PR is documentation).

…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
evan-forbes marked this pull request as draft July 3, 2026 23:43
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