feat(p2p): implement libp2p QUIC transport mesh and Gossipsub Merkle head sync

Aperta
#2 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
12/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
rust

Direzione di ricerca

Start by reading the p2p_listen_addr and bootstrap_peers fields in src/config.rs, then KeyTransparencyLog in src/merkle.rs and MailboxStore in src/relay.rs. The new src/p2p.rs must handle peer tables, SignedTreeHead gossip and equivocation rejection, and HealthStatus in src/health.rs needs peer count and sync state. Done means the 3-node convergence and equivocation tests in tests/node_test.rs pass with the existing 5 tests unchanged.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

area::node effort::l impact::critical priority::critical source::user status::review type::feature

Part of Meta-Issue alfonsodg/sonaraim#2
Ref alfonsodg/sonaraim-protocol#2

Problem

sonaraim-node parses p2p_listen_addr and bootstrap_peers in src/config.rs:17-148 and computes Merkle tree heads in src/merkle.rs:42-269, but does not yet establish P2P peer-to-peer mesh sessions or gossip signed Merkle tree heads (SignedTreeHead) and SealedEnvelope frames across relay peers.

Affected Files & Locations

  • src/config.rs:17-148 (NodeConfig)
  • src/merkle.rs:42-269 (KeyTransparencyLog)
  • src/relay.rs:34-127 (MailboxStore)
  • src/p2p.rs (new P2P mesh & gossip synchronization module, < 300 lines)
  • tests/node_test.rs:1-167

Evidence

// src/config.rs:24-28
pub p2p_listen_addr: String,
pub bootstrap_peers: Vec<String>,

Impact and Blast Radius

Enables multi-node federation, Sovereign Node peering for regulated enterprises, and decentralized synchronization of the Key Transparency DID log across relay nodes.

Historical Context and Anti-Regression

Builds on e62fca0 / 6eda03b (Issue #1). The 5 existing tests in tests/node_test.rs:1-167 must remain unmodified and 100% green.

Proposed Solution

  1. Implement src/p2p.rs managing peer routing tables, SignedTreeHead epoch gossip verification, split-view detection (rejecting diverging Merkle roots at the same tree size), and peer-to-peer envelope forwarding.
  2. Integrate p2p peer count and Merkle sync state into HealthStatus (src/health.rs:1-75).

Acceptance Criteria

  • Two or more P2pNode instances synchronize KeyTransparencyLog entries and detect equivocation (conflicting roots for the same epoch).
  • SealedEnvelope routed to a remote peer's mailbox is forwarded and delivered with < 50ms local hop latency.
  • All source files stay strictly under 300 lines and pass cargo fmt --check, cargo clippy -- -D warnings, and cargo test.

Validation Criteria

Level Applies Test Scenario Pass
Unit Yes tests/node_test.rs Peer table management, SignedTreeHead verification, equivocation rejection 100% pass (cargo test)
Integration Yes tests/node_test.rs 3-node mesh gossiping DID registrations and forwarding SealedEnvelope All 3 nodes converge on identical Merkle root
Contract Yes docs/API.md SignedTreeHead and MerkleProof JSON serialization matches documented schema Validated in contract test
E2E Yes Multi-node process test in Sandbox (REMOTE.md) Two node processes exchange envelopes and sync Merkle epochs Exit code 0 and matching /health epoch
Lingua principale
Rust
Stelle
0
Fork
0
Merge medio
4m
PR unite (30g)
1

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di alfonsodg/sonaraim-node

Tutte le issue di alfonsodg/sonaraim-node

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.