Skip to content

feat: Kitsune P2P Phase 2 — Hardening & REST endpoints#57

Merged
ApiliumDevTeam merged 4 commits intodevfrom
feat/kitsune-p2p-fase2
Mar 8, 2026
Merged

feat: Kitsune P2P Phase 2 — Hardening & REST endpoints#57
ApiliumDevTeam merged 4 commits intodevfrom
feat/kitsune-p2p-fase2

Conversation

@ApiliumDevTeam
Copy link
Copy Markdown
Contributor

Summary

  • Add 7 production hardening features to the P2P subsystem: tombstone-based deletion sync, manual peer reconnection with exponential backoff, persistent peer list (JSON file), ping/pong health checks, channel-based recv (replacing 50ms polling), per-peer ingress rate limiting, and periodic cleanup
  • Add REST endpoints for P2P status, peer management, and discovery (/api/v1/p2p/*)
  • Fix 4 critical bugs found during E2E testing: lock-free accept loop for incoming QUIC connections, ALPN protocol mismatch on client config, sync peer registration at all connection points, and helper methods for external accept pattern
  • Bump all product crate versions to 0.3.8

Test plan

  • 42 new unit tests for all 7 hardening features (94 total P2P tests)
  • cargo test -p aingle_cortex --features p2p — all pass
  • Manual 2-node E2E: create → replicate via gossip → delete → tombstone propagation
  • aingle-cortex --version reports 0.3.8

…d hardening

Implements the full P2P stack behind the `p2p` feature flag:
- QUIC transport with seed-based handshake and Ed25519 identity
- Bloom filter gossip for efficient triple announcement
- mDNS peer discovery via mdns-sd
- Sync manager with tombstone-based deletion propagation (24h TTL)
- Persistent peer store (JSON-backed known_peers.json)
- Manual peer reconnection with exponential backoff (5s-300s, max 10 retries)
- Ping/pong health checks (30s interval, 10s timeout)
- Ingress rate limiting per-peer (1000/min) and global (10000/min)
- Periodic cleanup of inactive peers, expired tombstones, and stale store entries
- CLI flags: --p2p, --p2p-port, --p2p-seed, --p2p-peer, --p2p-mdns
Adds /api/v1/p2p/ routes (behind `p2p` feature):
- GET /status — node ID, port, connected peers, gossip/sync stats
- GET /peers — list connected P2P peers
- POST /peers — connect to a new peer by address
- DELETE /peers/:addr — disconnect a peer
Add lock-free accept loop for incoming QUIC connections (Task 0),
fix ALPN protocol mismatch on client config, register peers in
sync_manager at all connection points, and expose helper methods
on P2pTransport for external accept pattern.
@ApiliumDevTeam ApiliumDevTeam merged commit d2f381c into dev Mar 8, 2026
5 checks passed
@ApiliumDevTeam ApiliumDevTeam deleted the feat/kitsune-p2p-fase2 branch March 9, 2026 09:09
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