feat(p2p): add live UDP gossip socket and did:web document verifier

Aperta
#7 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
30/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
rust

Direzione di ricerca

Start with MeshGossipState in src/p2p.rs (lines 51-64) to see how peer tree heads are stored, then review the HTTP handler area in src/http_server.rs (lines 120-177) where POST /v1/p2p/gossip and identity checks would be wired. The new module src/udp_gossip.rs would hold the std::net::UdpSocket code. Done means cargo test passes, a loopback test in tests/milestone6_test.rs detects equivocation between two sockets, and conflicting roots for the same tree_size are rejected.

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

Descrizione

area::node effort::m impact::high priority::high source::user status::review type::feature

Problem

Tracked under Coordinator Meta-Issue alfonsodg/sonaraim#9 (Milestone 7).
src/p2p.rs:1-98 (692a933) implements MeshGossipState in memory, but does not bind a real UDP socket to exchange SignedTreeHead datagrams between peers or validate did:web JSON documents (/.well-known/did.json) before marking enterprise identities as verified_b2b: true.

Affected Files & Locations

  • src/p2p.rs:1-98
  • src/udp_gossip.rs (new, < 170 lines)
  • src/http_server.rs:120-177
  • tests/milestone6_test.rs

Evidence

// src/p2p.rs:51-64
pub struct MeshGossipState {
    local_node_id: String,
    peer_heads: HashMap<String, SignedTreeHead>,
    epoch_roots: HashMap<usize, String>,
}

Impact and Blast Radius

Allows real UDP datagram gossip between sonaraim-node instances on port 9031/udp (NODE_P2P_LISTEN_ADDR) and enforces cryptographic did:web verification on POST /v1/identity.

Historical Context and Anti-Regression

Builds on sonaraim-node commit 692a933. Must keep src/http_server.rs under 300 lines (extracting helpers into src/udp_gossip.rs).

Proposed Solution

  1. Create src/udp_gossip.rs providing UdpGossipNode (bind, send_tree_head, recv_tree_head_nonblocking) over std::net::UdpSocket, plus verify_did_web_document(did, doc_json) validating id and verificationMethod fields.
  2. Wire POST /v1/p2p/gossip and did:web verification in src/http_server.rs.

Acceptance Criteria

  • L1 (Unit TDD): cargo fmt --check && cargo clippy -- -D warnings && cargo test passes with zero warnings.
  • L2 (Integration): Two local UdpGossipNode sockets exchange SignedTreeHead packets over loopback UDP and detect equivocation.
  • L3 (Container / GHCR): Container image publishes to GHCR and runs on sandbox-ud-ord.
  • L4 (E2E Sandbox): POST /v1/p2p/gossip on sandbox-ud-ord ingests peer SignedTreeHead and rejects conflicting roots for the same tree_size (409 Conflict).
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.