Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
bedc7b0
Updates to the attestation propagation sim
bharath-123 Oct 21, 2025
db57688
Merge branch 'main' into attsim-updates
bharath-123 Oct 21, 2025
5fc4d7d
use cumulative percentages as y axis
bharath-123 Oct 22, 2025
5029132
allow to specify the number of nodes which only subscribe but do not …
bharath-123 Oct 22, 2025
96dc0cd
segregate nodes into mesh nodes, mesh attester nodes and non-mesh att…
bharath-123 Oct 24, 2025
17bf9aa
remove TODO
bharath-123 Oct 24, 2025
7b6806b
uncomment conditional in VisualizeTopology
bharath-123 Oct 24, 2025
5d836ac
Merge pull request #10 from ethp2p/give-nodes-role
bharath-123 Oct 24, 2025
620b230
clean up the CustomTracer
bharath-123 Oct 24, 2025
91a6039
add 100ms sleep before starting up process
bharath-123 Oct 26, 2025
84bd354
Add a simulation config
bharath-123 Oct 27, 2025
032ee81
add slot ticker
bharath-123 Oct 27, 2025
5c44a79
add subscribers to slot ticker
bharath-123 Oct 28, 2025
0e8254d
save the relative slot instead of current slot
bharath-123 Oct 28, 2025
f674842
Merge pull request #12 from ethp2p/allow-multiple-simulation-runs
bharath-123 Oct 28, 2025
78de097
add lightohuse
bharath-123 Oct 30, 2025
996a4d7
include client split in simconfig
bharath-123 Oct 30, 2025
8d6313d
pass in simconfig file to topology generator
bharath-123 Oct 30, 2025
23c4428
add logs
bharath-123 Oct 30, 2025
7c3deae
fix simconfig parsing
bharath-123 Oct 30, 2025
41bc831
Merge pull request #13 from ethp2p/add-lighthouse-client
bharath-123 Oct 30, 2025
09300e8
reduce sleep time for lighthouse to 4.5ms
bharath-123 Oct 31, 2025
93504b1
updates
bharath-123 Nov 3, 2025
ae623c9
Merge pull request #14 from ethp2p/plot-updates
bharath-123 Nov 3, 2025
f53ee09
updates
bharath-123 Nov 5, 2025
d9adfb0
remove some plots
bharath-123 Nov 5, 2025
c19e2d0
Merge pull request #15 from ethp2p/plot-updates
bharath-123 Nov 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Binaries
*-sim
gossipsub
# gossipsub
gossipsub/gossipsub
topology-gen
topology/gen/topology-gen
Expand All @@ -11,7 +11,6 @@ shadow.data/
topology.json
gossipsub/topology.json
shadow-gossipsub.yaml
message_propagation.png

# Go build artifacts
*.out
Expand Down
48 changes: 33 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@

# Default parameters
NODE_COUNT ?= 10
MSG_SIZE ?= 256
MESH_NODE_COUNT ?= 6
MESH_ATTESTER_COUNT ?= 2
NON_MESH_ATTESTER_COUNT ?= 2
TOPOLOGY_TYPE ?= random-regular
PEER_COUNT ?= 4
NON_MESH_NODE_PEER_COUNT ?= 4
BRANCHING ?= 2
PROGRESS ?= false
LOG_LEVEL ?= info
Expand All @@ -15,6 +18,7 @@ LOG_LEVEL ?= info
TOPOLOGY_GEN_DIR = topology/gen
GOSSIPSUB_DIR = gossipsub
TOPOLOGY_FILE = topology.json
SIMCONFIG_FILE = simconfig.yaml

# Check dependencies
check-deps:
Expand All @@ -33,7 +37,7 @@ build-topology-gen:
# Generate topology file
generate-topology: build-topology-gen
@echo "Generating $(TOPOLOGY_TYPE) topology with $(NODE_COUNT) nodes..."
$(TOPOLOGY_GEN_DIR)/topology-gen -type $(TOPOLOGY_TYPE) -nodes $(NODE_COUNT) -degree $(PEER_COUNT) -branching $(BRANCHING) -output $(TOPOLOGY_FILE)
$(TOPOLOGY_GEN_DIR)/topology-gen -type $(TOPOLOGY_TYPE) -nodes $(NODE_COUNT) -degree $(PEER_COUNT) -non-mesh-node-degree $(NON_MESH_NODE_PEER_COUNT) -branching $(BRANCHING) -mesh-nodes $(MESH_NODE_COUNT) -mesh-attester-count $(MESH_ATTESTER_COUNT) -non-mesh-attester-count $(NON_MESH_ATTESTER_COUNT) -output $(TOPOLOGY_FILE) --simconfig-file $(SIMCONFIG_FILE)
@test -f $(TOPOLOGY_FILE) || (echo "Topology generation failed" && exit 1)
@echo "Topology generated: $(TOPOLOGY_FILE)"

Expand All @@ -46,28 +50,34 @@ build: check-deps

# Generate network graph and Shadow configuration
generate-config: generate-topology
@echo "Generating Shadow network configuration for $(NODE_COUNT) nodes..."
uv run network_graph.py $(NODE_COUNT) $(MSG_SIZE) $(TOPOLOGY_FILE)
@echo "Generating Shadow network configuration for $(NODE_COUNT) nodes with $(MESH_NODE_COUNT) mesh nodes, $(MESH_ATTESTER_COUNT) mesh attesters nodes, $(NON_MESH_ATTESTER_COUNT) non mesh attesters nodes..."
uv run network_graph.py $(NODE_COUNT) $(TOPOLOGY_FILE) $(SIMCONFIG_FILE)
@test -f shadow-gossipsub.yaml && test -f graph.gml || (echo "Config generation failed" && exit 1)
@echo "Configuration generated"

generate-config-only:
@echo "Generating Shadow network configuration for $(NODE_COUNT) nodes with $(MESH_NODE_COUNT) mesh nodes, $(MESH_ATTESTER_COUNT) mesh attesters nodes, $(NON_MESH_ATTESTER_COUNT) non mesh attesters nodes..."
uv run network_graph.py $(NODE_COUNT) $(TOPOLOGY_FILE) $(SIMCONFIG_FILE)
@test -f shadow-gossipsub.yaml && test -f graph.gml || (echo "Config generation failed" && exit 1)
@echo "Configuration generated"

# Run the complete Shadow simulation
run-sim: build generate-config
@echo "Starting GossipSub Shadow simulation ($(NODE_COUNT) nodes, $(MSG_SIZE) byte message)..."
@echo "Starting GossipSub Shadow simulation ($(NODE_COUNT) nodes, $(MESH_NODE_COUNT) mesh nodes, $(MESH_ATTESTER_COUNT) mesh attesters nodes, $(NON_MESH_ATTESTER_COUNT) non mesh attesters nodes, $(MSG_SIZE) byte message)..."
@rm -rf shadow.data/
shadow --progress $(PROGRESS) shadow-gossipsub.yaml
@echo "GossipSub simulation completed"

# Test simulation results
test:
@echo "Testing GossipSub simulation results..."
uv run test_results.py $(NODE_COUNT)
uv run test_results.py $(NODE_COUNT) $(TOPOLOGY_FILE)

# Plot message propagation
plot:
@echo "Plotting message propagation..."
uv run plot_propagation.py $(NODE_COUNT)
@test -f message_propagation.png && echo "Plot generated: message_propagation.png" || echo "Plot generation failed"
uv run plot_propagation.py $(NODE_COUNT) --topology-file $(TOPOLOGY_FILE) --peer-count $(PEER_COUNT) --non-mesh-node-peer-count $(NON_MESH_NODE_PEER_COUNT) --simconfig-file $(SIMCONFIG_FILE) -o new-latencies-plots/30slots_batch_50ms_node$(NODE_COUNT)_mesh_nodes$(MESH_NODE_COUNT)_mesh_attesters$(MESH_ATTESTER_COUNT)_non_mesh_attesters$(NON_MESH_ATTESTER_COUNT).png
@test -f new-latencies-plots/30slots_batch_50ms_node$(NODE_COUNT)_mesh_nodes$(MESH_NODE_COUNT)_mesh_attesters$(MESH_ATTESTER_COUNT)_non_mesh_attesters$(NON_MESH_ATTESTER_COUNT).png && echo "Plot generated: new-latencies-plots/30slots_batch_50ms_node$(NODE_COUNT)_mesh_nodes$(MESH_NODE_COUNT)_mesh_attesters$(MESH_ATTESTER_COUNT)_non_mesh_attesters$(NON_MESH_ATTESTER_COUNT).png" || echo "Plot generation failed"

# Clean build artifacts and simulation results
clean:
Expand Down Expand Up @@ -103,20 +113,28 @@ help:
@echo " help - Show this help message"
@echo ""
@echo "Configuration variables:"
@echo " NODE_COUNT - Number of nodes (default: $(NODE_COUNT))"
@echo " MSG_SIZE - Message size in bytes (default: $(MSG_SIZE))"
@echo " TOPOLOGY_TYPE - Topology type: mesh, tree, random-regular (default: $(TOPOLOGY_TYPE))"
@echo " PEER_COUNT - Peer count for random-regular (default: $(PEER_COUNT))"
@echo " BRANCHING - Branching factor for tree (default: $(BRANCHING))"
@echo " PROGRESS - Show Shadow progress bar (default: $(PROGRESS))"
@echo " LOG_LEVEL - Log level (default: $(LOG_LEVEL))"
@echo " NODE_COUNT - Number of nodes (default: $(NODE_COUNT))"
@echo " MESH_NODE_COUNT - Number of mesh nodes (default: $(MESH_NODE_COUNT))"
@echo " MESH_ATTESTER_COUNT - Number of mesh attesters nodes (default: $(MESH_ATTESTER_COUNT))"
@echo " NON_MESH_ATTESTER_COUNT - Number of non mesh attesters nodes (default: $(NON_MESH_ATTESTER_COUNT))"
@echo " MSG_SIZE - Message size in bytes (default: $(MSG_SIZE))"
@echo " TOPOLOGY_TYPE - Topology type: mesh, tree, random-regular (default: $(TOPOLOGY_TYPE))"
@echo " PEER_COUNT - Peer count for random-regular (default: $(PEER_COUNT))"
@echo " BRANCHING - Branching factor for tree (default: $(BRANCHING))"
@echo " PROGRESS - Show Shadow progress bar (default: $(PROGRESS))"
@echo " LOG_LEVEL - Log level (default: $(LOG_LEVEL))"
@echo " BATCH_INTERVAL - BLS batch interval in milliseconds (default: $(BATCH_INTERVAL))"
@echo " BATCH_VERIFIER_TIME - BLS batch verifier time in microseconds (default: $(BATCH_VERIFIER_TIME))"
@echo ""
@echo "Examples:"
@echo " make all # Run simulation, test, and plot (random-regular)"
@echo " make run-sim NODE_COUNT=20 MSG_SIZE=512 # Custom parameters"
@echo " make run-sim NODE_COUNT=20 NODES_TO_PUBLISH=5 # 20 nodes, only 5 publish"
@echo " make run-sim NODE_COUNT=20 NODES_TO_PUBLISH=5 NODES_TO_SUBSCRIBE=15 # 5 publishers, 15 subscribers"
@echo " make run-sim TOPOLOGY_TYPE=mesh NODE_COUNT=10 # Mesh topology"
@echo " make run-sim TOPOLOGY_TYPE=tree NODE_COUNT=31 BRANCHING=2 # Tree topology"
@echo " make run-sim TOPOLOGY_TYPE=random-regular PEER_COUNT=6 # Random-regular with 6 peers"
@echo " make run-sim PROGRESS=true # Run with progress bar"
@echo " make run-sim BATCH_INTERVAL=2 BATCH_VERIFIER_TIME=2000 # Custom batch parameters"
@echo " make test # Test existing simulation results"
@echo " make plot NODE_COUNT=10 # Plot message propagation"
7 changes: 7 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,18 @@ require (
github.com/libp2p/go-libp2p v0.41.1
github.com/libp2p/go-libp2p-pubsub v0.15.0
github.com/multiformats/go-multiaddr v0.15.0
github.com/stretchr/testify v1.10.0
)

require github.com/libp2p/go-mplex v0.7.0 // indirect

require (
github.com/benbjohnson/clock v1.3.5 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/containerd/cgroups v1.1.0 // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
Expand All @@ -41,6 +45,7 @@ require (
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
github.com/libp2p/go-flow-metrics v0.2.0 // indirect
github.com/libp2p/go-libp2p-asn-util v0.4.1 // indirect
github.com/libp2p/go-libp2p-mplex v0.11.0
github.com/libp2p/go-msgio v0.3.0 // indirect
github.com/libp2p/go-netroute v0.2.2 // indirect
github.com/libp2p/go-reuseport v0.4.0 // indirect
Expand Down Expand Up @@ -85,6 +90,7 @@ require (
github.com/pion/turn/v4 v4.0.0 // indirect
github.com/pion/webrtc/v4 v4.0.10 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.21.1 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.62.0 // indirect
Expand All @@ -109,5 +115,6 @@ require (
golang.org/x/text v0.22.0 // indirect
golang.org/x/tools v0.30.0 // indirect
google.golang.org/protobuf v1.36.5 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
lukechampine.com/blake3 v1.4.0 // indirect
)
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,14 @@ github.com/libp2p/go-libp2p v0.41.1 h1:8ecNQVT5ev/jqALTvisSJeVNvXYJyK4NhQx1nNRXQ
github.com/libp2p/go-libp2p v0.41.1/go.mod h1:DcGTovJzQl/I7HMrby5ZRjeD0kQkGiy+9w6aEkSZpRI=
github.com/libp2p/go-libp2p-asn-util v0.4.1 h1:xqL7++IKD9TBFMgnLPZR6/6iYhawHKHl950SO9L6n94=
github.com/libp2p/go-libp2p-asn-util v0.4.1/go.mod h1:d/NI6XZ9qxw67b4e+NgpQexCIiFYJjErASrYW4PFDN8=
github.com/libp2p/go-libp2p-mplex v0.11.0 h1:0vwpLXRSfkTzshEjETIEgJaVxXvg+orbxYoIb3Ty5qM=
github.com/libp2p/go-libp2p-mplex v0.11.0/go.mod h1:QrsdNY3lzjpdo9V1goJfPb0O65Nms0sUR8CDAO18f6k=
github.com/libp2p/go-libp2p-pubsub v0.15.0 h1:cG7Cng2BT82WttmPFMi50gDNV+58K626m/wR00vGL1o=
github.com/libp2p/go-libp2p-pubsub v0.15.0/go.mod h1:lr4oE8bFgQaifRcoc2uWhWWiK6tPdOEKpUuR408GFN4=
github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUIK5WDu6iPUA=
github.com/libp2p/go-libp2p-testing v0.12.0/go.mod h1:KcGDRXyN7sQCllucn1cOOS+Dmm7ujhfEyXQL5lvkcPg=
github.com/libp2p/go-mplex v0.7.0 h1:BDhFZdlk5tbr0oyFq/xv/NPGfjbnrsDam1EvutpBDbY=
github.com/libp2p/go-mplex v0.7.0/go.mod h1:rW8ThnRcYWft/Jb2jeORBmPd6xuG3dGxWN/W168L9EU=
github.com/libp2p/go-msgio v0.3.0 h1:mf3Z8B1xcFN314sWX+2vOTShIE0Mmn2TXn3YCUQGNj0=
github.com/libp2p/go-msgio v0.3.0/go.mod h1:nyRM819GmVaF9LX3l03RMh10QdOroF++NBbxAb0mmDM=
github.com/libp2p/go-netroute v0.2.2 h1:Dejd8cQ47Qx2kRABg6lPwknU7+nBnFRpko45/fFPuZ8=
Expand Down
Loading
Loading