allmende-sim: record runs as JSON (samples, phases, arrival times); sweep script and graph data; scaling results

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 22:23:33 +01:00
co-authored by Claude Sonnet 5.5
parent 5db90c2720
commit 130ba5dc65
6 changed files with 321 additions and 3 deletions
+5
View File
@@ -162,6 +162,7 @@ func (s *sim) totalListings() int {
// that honest traffic still gets through, and what the flood costs a sender.
func (s *sim) hostile(regions []string, rep *reportTable) {
region := regions[0]
rep.phase("attack")
fmt.Printf("attacking region %s: forged listings and a message flood ...\n", region)
pool := s.followers(region)
targets := pool[:min(10, len(pool))]
@@ -318,6 +319,7 @@ func (s *sim) hostile(regions []string, rep *reportTable) {
// repair puts listings into one node's store and tells nobody. Only
// anti-entropy (or a new connection's sync) can carry them to the region.
func (s *sim) repair(rep *reportTable) {
rep.phase("repair")
fmt.Println("anti-entropy: listings only one node has ...")
var pairs []*pair
for i := 0; i < 5; i++ {
@@ -340,6 +342,7 @@ func (s *sim) repair(rep *reportTable) {
// --- the seeds go away -----------------------------------------------------------------------
func (s *sim) killSeeds(regions []string, rep *reportTable) {
rep.phase("seeds down")
fmt.Println("shutting down the seeds ...")
for _, n := range s.nodes {
if n.seed && n.node != nil {
@@ -421,7 +424,9 @@ func (s *sim) killSeeds(regions []string, rep *reportTable) {
func (s *sim) spawn(regions, bootstrap []string) *simNode {
n := &simNode{idx: len(s.nodes), regions: regions, bootstrap: bootstrap}
s.must(s.makeIdentity(n))
s.mu.Lock()
s.nodes = append(s.nodes, n)
s.mu.Unlock()
s.must(s.start(n))
return n
}