Skip to content

Conversation

@Winter-Soren
Copy link
Contributor

@Winter-Soren Winter-Soren commented Jan 18, 2026

Implements comprehensive examples showcasing Gossipsub protocol evolution (v1.0-v2.0) with interactive demonstrations of peer scoring, adaptive gossip, and security features.

What was wrong?

Issue #1130

The py-libp2p did not have comprehensive examples demonstrating the differences between Gossipsub protocol versions and showcasing the advanced features of Gossipsub 2.0.

How was it fixed?

Created a complete example suite in examples/pubsub/gossipsub/ with three main components:

1. Multi-Version Comparison Demo (version_comparison.py)

  • Side-by-side testing of Gossipsub v1.0, v1.1, v1.2, and v2.0
  • Four realistic scenarios: normal operation, high churn, spam attacks, network partitions
  • Performance metrics comparison (delivery rates, latency, security effectiveness)
  • JSON output for analysis and visualization

2. Gossipsub 2.0 Feature Showcase (v2_showcase.py)

  • Interactive demonstrations of advanced v2.0 features
  • Real-time peer scoring visualization (P1-P7 parameters)
  • Adaptive gossip monitoring with network health metrics
  • Security features demo with spam protection and rate limiting
  • Multiple node roles: honest, spammer, eclipse_attacker, validator

3. Convenient Runner Script (run_examples.py)

  • Automated test execution with progress reporting
  • Quick comparison across all scenarios
  • File management and cleanup utilities
  • Comprehensive help system

Key Technical Fixes:

  • Proper trio nursery management for concurrent network simulation
  • Robust peer connection logic with ring topology
  • Timeout handling and graceful cancellation
  • Comprehensive error handling and logging

To-Do

  • Clean up commit history
  • Add or update documentation related to these changes
  • Add entry to the release notes

Cute Animal Picture

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant