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

Abierto
#2 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
12/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
rust

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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
Lenguaje dominante
Rust
Estrellas
0
Forks
0
Merge medio
4 min
PR fusionados (30 d)
1

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de alfonsodg/sonaraim-node

Todos los issues de alfonsodg/sonaraim-node

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.