allmende-sim: run 100 real nodes in one process and measure spread, churn and cost

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
This commit is contained in:
2026-11-18 21:31:43 +01:00
co-authored by Claude Sonnet 5.5
parent 93921c14e8
commit 85e8b6cbd5
3 changed files with 615 additions and 0 deletions
+20
View File
@@ -591,6 +591,26 @@ listing: report as the reason a visitor gave, or dismiss.
now), signed blocklists you subscribe to by curator key, an owner's signed
reply to a report, and reputation for reporters whose reports are overruled.
## Simulation (`cmd/allmende-sim`)
`go run ./cmd/allmende-sim -nodes 100` runs many real nodes (libp2p, gossipsub,
DHT, store, sync, each with its own identity) in one process over loopback and
reports how long listings, messages and reports take to reach everyone, what
happens when 20% of the nodes go offline and come back, whether all nodes end
with identical data, and the memory, CPU and traffic it cost. Flags: `-regions`,
`-listings`, `-messages`, `-reports`, `-churn`, `-seed` (repeatable run).
Reference run (100 nodes, 3 seeds, 5 regions, 60 listings at 5/s, 20% churn):
every listing reached all 1300 followers (p50 14 ms, p99 61 ms), every message
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.
## Open
Abuse reporting for messages (reports cover listings only so far), vouching