libp2p / libp2p/py-libp2p

Add Gossipsub Version Comparison Demo and Standalone Examples

Open
#1,130 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
624
Forks
256
Avg merge
1d 34m
Merged PRs (30d)
47

Description

Overview

Create comprehensive examples showcasing the differences between Gossipsub 1.1, 1.2, and 2.0, along with a standalone demo highlighting the new v2.0 features including peer scoring, adaptive gossip, and validation behavior.

Background

With the recent implementation of Gossipsub 2.0 support in py-libp2p (PR #1066), we now have full protocol version support spanning:

  • Gossipsub 1.0 (/meshsub/1.0.0) - Basic mesh-based pubsub
  • Gossipsub 1.1 (/meshsub/1.1.0) - Added peer scoring and behavioral penalties
  • Gossipsub 1.2 (/meshsub/1.2.0) - Added IDONTWANT message filtering
  • Gossipsub 2.0 (/meshsub/2.0.0) - Enhanced security, adaptive gossip, and advanced peer scoring

These examples will help users understand the evolution of the protocol and demonstrate the practical benefits of upgrading to newer versions.

Proposed Examples

1. Multi-Version Comparison Demo

Objective: Side-by-side demonstration of how different Gossipsub versions handle the same network scenarios.

Key Features:

  • Network Simulation: Create identical network topologies running different protocol versions
  • Scenario Testing: Test various network conditions (high churn, malicious peers, network partitions)
  • Performance Metrics: Compare message delivery rates, latency, and network overhead
  • Visual Output: Real-time comparison charts and statistics
  • Interactive Mode: Allow users to inject different types of network events

Scenarios to Demonstrate:

  • Normal operation with honest peers
  • Network with high peer churn
  • Presence of spamming/flooding peers
  • Network partition and recovery
  • Eclipse attack simulation
  • Message validation failures
2. Gossipsub 2.0 Feature Showcase

Objective: Interactive demonstration of Gossipsub 2.0's advanced features.

Key Components:

Peer Scoring Visualization
  • Real-time Score Display: Show peer scores (P1-P7 parameters) updating in real-time
  • Score Component Breakdown: Visualize individual scoring components
  • Behavioral Penalties: Demonstrate how misbehavior affects peer scores
  • IP Colocation Penalties: Show P7 penalties for peers from same IP ranges
  • Application Scoring: Demonstrate P6 custom application-defined scoring
Adaptive Gossip Demonstration
  • Network Health Monitoring: Display network health score calculation
  • Dynamic Parameter Adjustment: Show how gossip parameters adapt to network conditions
  • Mesh Quality Maintenance: Visualize mesh degree adjustments
  • Opportunistic Grafting: Demonstrate score-based peer selection
Security Features
  • Spam Protection: Show rate limiting in action
  • Eclipse Attack Protection: Demonstrate IP diversity enforcement
  • Equivocation Detection: Show detection and penalties for duplicate messages
  • Message Validation: Demonstrate validation hooks and caching

Technical Architecture

graph TB
    subgraph "Version Comparison Demo"
        A[Network Simulator] --> B[v1.1 Network]
        A --> C[v1.2 Network] 
        A --> D[v2.0 Network]
        B --> E[Metrics Collector]
        C --> E
        D --> E
        E --> F[Comparison Dashboard]
    end
    
    subgraph "v2.0 Features Demo"
        G[Feature Controller] --> H[Peer Scoring Monitor]
        G --> I[Adaptive Gossip Monitor]
        G --> J[Security Features Monitor]
        H --> K[Real-time Visualization]
        I --> K
        J --> K
    end
 

Implements from

  • Gossipsub 1.1 #871
  • Gossipsub 1.2 #806
  • Gossipsub 2.0 #920

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files, tests, or executable entry points are named. Start by reviewing PR #1066 and the existing Gossipsub 1.1, 1.2, and 2.0 support, then define the demo scope; done would require the proposed version comparison scenarios and the v2.0 scoring, adaptive gossip, and security showcases.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
distributed-systems, networking
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.