feat(federation): add multi-node peer registration, cross-node envelope replication, and gossip broadcast
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 12/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- rust
- Domain
- backend, distributed-systems, networking
Research direction
Start with src/p2p.rs (lines 51-98, add_peer and peer_count), src/udp_gossip.rs, and the routes in src/http_server.rs (lines 149-235), then read tests/milestone10_node_test.rs. Done means two nodes peer through POST /v1/p2p/peers, replicate the signed tree head and relay envelopes without loops, and reject conflicting roots with 409 EQUIVOCATION_DETECTED. This is multi-part design work, so agree on scope with the maintainer before writing code.
Written by the indexing model from the issue text.
Description
Description
sonaraim-node/src/p2p.rs:51-98 and src/udp_gossip.rs:1-141 implement P2pMeshNode equivocation detection and POST /v1/p2p/gossip ingestion, but lack live HTTP/UDP multi-node federation so independent enterprise and community nodes can dynamically peer (POST /v1/p2p/peers, GET /v1/p2p/peers), automatically replicate SignedTreeHead Merkle roots on POST /v1/identity, and gossip/replicate store-and-forward envelopes across registered peer nodes for censorship resistance.
Affected Files
src/p2p.rs:51-98src/udp_gossip.rs:93-141src/http_server.rs:149-235
Evidence (Current Code Snippet)
// src/p2p.rs:71-81
/// Registers or updates a peer's QUIC multiaddr.
pub fn add_peer(&mut self, peer_id: &str, multiaddr: &str) {
self.peers
.insert(peer_id.to_string(), multiaddr.to_string());
}
/// Returns the number of connected peers.
#[must_use]
pub fn peer_count(&self) -> usize {
self.peers.len()
}
Impact & Historical Context
- Impact: Without
POST /v1/p2p/peers,GET /v1/p2p/peers, and cross-node replication ofSignedTreeHead+ relay envelopes (replicated: trueflag to prevent infinite loops), multiplesonaraim-nodeinstances cannot form a decentralized censorship-resistant mesh where enterprises and users connect to different nodes and still exchange messages and verify a unified Merkle identity log. - Historical Context: Parent Meta-Issue
alfonsodg/sonaraim#14. Extendsalfonsodg/sonaraim-node#2and#7(5354708).
Proposed Solution
- Expose
POST /v1/p2p/peers({"peer_id": "...", "rpc_url": "http://...", "multiaddr": "..."}) andGET /v1/p2p/peersonsonaraim-node. - When
POST /v1/identityappends a DID key leaf, broadcast the newSignedTreeHead(POST /v1/p2p/gossip) to all registered HTTP peerrpc_urls so every peer validates the Merkle root and immediately detects split-view equivocation. - When
POST /v1/relay/envelopesqueues an envelope without"replicated": true, replicate it ("replicated": true) to registered peers so a recipient polling any node in the federation can retrieve their sealed envelopes even if the origin node is censored or offline. - Add a multi-node integration test in
tests/milestone10_node_test.rsspinning up Node A (Enterprise Node) and Node B (User/Community Node), peering them, posting an identity + envelope on Node A, and verifying both theSignedTreeHeadand envelope are available on Node B (and that conflicting Merkle roots trigger409 ConflictEQUIVOCATION_DETECTED).
Acceptance Criteria
- Functional: Two or more
sonaraim-nodeinstances peer viaPOST /v1/p2p/peers, replicateSignedTreeHeadroots on identity registration, and replicate relay envelopes across nodes without infinite loops. - Code Quality: All files in
src/strictly< 300lines;cargo fmt --checkandcargo clippy -- -D warningspass. - Tests: Multi-node integration test in
tests/milestone10_node_test.rsverifiesNode A -> Node Benvelope delivery and Merkle equivocation rejection. - Regression: All 13 existing tests and GHCR CI/CD builds pass.
- Dominant language
- Rust
- Stars
- 0
- Forks
- 0
- Avg merge
- 4m
- Merged PRs (30d)
- 1
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from alfonsodg/sonaraim-node
-
bug(node): SigV4 presign date applies the epoch offset twice — media uploads can never validateOpenarea::node effort::s impact::medium priority::medium source::auto status::review type::bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
alfonsodg/sonaraim-node#29 · 1 comment ·
-
area::node effort::xs impact::low priority::low source::auto status::review type::docs
Difficulty 1/5 1-3 hours Newbie friendliness 78/100
alfonsodg/sonaraim-node#28 · 1 comment ·
-
area::node effort::s impact::medium priority::low source::auto status::review type::docs
Difficulty 3/5 1-2 days Newbie friendliness 72/100
alfonsodg/sonaraim-node#27 · 1 comment ·
-
area::node effort::m impact::medium priority::medium source::user status::review type::refactor
Difficulty 1/5 Under an hour Newbie friendliness 20/100
alfonsodg/sonaraim-node#26 · 1 comment ·
-
area::node effort::m impact::high priority::medium source::auto status::review type::bug
Difficulty 4/5 3-5 days Newbie friendliness 48/100
alfonsodg/sonaraim-node#25 · 2 comments ·
All issues in alfonsodg/sonaraim-node
Similar issues
-
O-windows relnotes relnotes-needs-review relnotes-tracking-issue T-libs
Difficulty 1/5 Under an hour Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
marketing
Difficulty 1/5 1-3 hours Newbie friendliness 95/100
Maintainers usually reply within 1 day
-
num_ode_rk4_adaptive rejects atol = 0 while accepting rtol = 0 and while num_ode_dopri5 accepts bothOpenarea/ode-pde good first issue help wanted kind/contract severity/4-minor
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Apich-Organization/rssn#383 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 69/100
Maintainers usually reply within 1 day
-
KT-2245 e2e specs that call the backend directly fall back to the developer's own Kronn on :3140Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day