allmende-sim: latency and connection loss, attackers, seeds down, anti-entropy repair, 300 nodes
Findings: default libp2p connection limits strand nodes on a bootstrap node beyond ~190 peers, there is no peer scoring, and newcomers cannot find their region without DHT servers when their remembered peers are elsewhere. Documented in docs/PROTOCOL.md and SPECS.md. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
This commit is contained in:
+36
-4
@@ -606,10 +606,42 @@ reached its owner (p95 0.4 s), a report reached all 99 other nodes (p95 0.17 s),
|
||||
returning nodes caught up in under 3 s, and all nodes agreed afterwards.
|
||||
About 165 KB of traffic per node in total.
|
||||
|
||||
It shows protocol behaviour and cost, **not** internet conditions: loopback has
|
||||
no latency, packet loss, NATs or hostile peers, and nodes are always reachable.
|
||||
Treat the times as a lower bound and the agreement and cost figures as the
|
||||
useful part.
|
||||
More scenarios, each a flag: `-latency 60ms -lifetime 30s` (delay on every
|
||||
write of dialed connections, ±50%, and connections cut at random; this is what
|
||||
packet loss looks like above TCP), `-hostile` (an attacker with no validators),
|
||||
`-kill-seeds`, `-repair` (with `-anti-entropy 5s`), `-seed-conns N`. Ran on
|
||||
2026-11-18 (100 nodes, 5 regions unless noted):
|
||||
|
||||
| Scenario | Result |
|
||||
|---|---|
|
||||
| 60 ms latency, 1130 connections cut in the run | 100% delivered; listings p95 67 ms, messages p95 0.4 s; returning nodes 6 s; all nodes agreed |
|
||||
| 500 junk, forged, under-worked and wrong-region listings at one region | **0 stored**; honest listings during the attack 100% (p95 31 ms) |
|
||||
| 400 valid envelopes flooding one listing | queue stayed under the limit (138 of 200 at the owner); the price rose from 6 to 7 bits; a buyer paying its own gateway's price still got through (43 ms) |
|
||||
| listing only one node's store has (no gossip) | anti-entropy every 5 s delivered all 105: p50 18 s, p95 38 s, max 63 s. At the default 30 min that is a median of about 2 hours |
|
||||
| all seeds shut down | the network keeps working (329 of 329 listings); newcomers that remember two live peers of their own region got everything (160 of 160) |
|
||||
| 300 nodes, 8 regions | 100% delivered (listings p95 75 ms, messages p95 0.8 s, reports p95 0.5 s), all agreed; 1.3 GB heap, 100k goroutines, 137 KB per node |
|
||||
|
||||
Findings (nothing here is fixed yet; see "What is left" in SPECS.md):
|
||||
|
||||
1. **Connection limit on the bootstrap node.** libp2p's resource manager caps
|
||||
inbound connections in proportion to memory (about 190 on 16 GB). With 200
|
||||
nodes, 12 never got a single peer; with the limit lifted the mesh formed in
|
||||
6 s. A bootstrap node in a pod with a small memory limit would cap out much
|
||||
sooner. Needs explicit limits on `--public` nodes.
|
||||
2. **No peer scoring.** The attacker stayed connected to all 10 nodes it
|
||||
dialed after sending 500 bad messages. Nothing was stored, but each message
|
||||
still cost every node its validation work.
|
||||
3. **The DHT is only as good as its servers.** Only publicly reachable nodes
|
||||
serve it. With every seed gone, a newcomer whose remembered peers are all in
|
||||
another region found nobody (0 of 114 listings), and one that remembers no
|
||||
live peer found no peer at all. A node that remembers peers of its own
|
||||
region (the usual case) is fine.
|
||||
4. **Repair is slow at the default interval** (see the table).
|
||||
|
||||
It shows protocol behaviour and cost, **not** the internet: no real packet
|
||||
loss, NATs, clock skew or bandwidth limits, and all nodes share one machine, so
|
||||
CPU and memory figures are totals for all of them. Treat the times as a lower
|
||||
bound and the agreement and cost figures as the useful part.
|
||||
|
||||
## Open
|
||||
|
||||
|
||||
Reference in New Issue
Block a user