From 9dbd361cafec332f0bb55ff3b9eddc23f36d2bdb Mon Sep 17 00:00:00 2001 From: anthonyrawlins Date: Fri, 26 Sep 2025 11:12:48 +1000 Subject: [PATCH] fix: Restore P2P connectivity by simplifying libp2p configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ISSUE RESOLVED: All 9 CHORUS containers were showing "0 connected peers" and elections were completely broken with "❌ No winner found in election" ROOT CAUSE: During Task Execution Engine implementation, ConnectionManager and AutoRelay configuration was added to p2p/node.go, which broke P2P connectivity in Docker Swarm overlay networks. SOLUTION: Reverted to simple libp2p configuration from working baseline: - Removed connmgr.NewConnManager() setup - Removed libp2p.ConnectionManager(connManager) - Removed libp2p.EnableAutoRelayWithStaticRelays() - Kept only basic libp2p.EnableRelay() VERIFICATION: All containers now show 3-4 connected peers and elections are fully functional with candidacy announcements and voting. PRESERVED: All Task Execution Engine functionality (v0.5.0) remains intact 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- docker/docker-compose.yml | 2 +- p2p/node.go | 16 +--------------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 8ca15f3..0bd6fc1 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -2,7 +2,7 @@ version: "3.9" services: chorus: - image: anthonyrawlins/chorus:v0.5.4-p2p-fix + image: anthonyrawlins/chorus:v0.5.5-p2p-simple # REQUIRED: License configuration (CHORUS will not start without this) environment: diff --git a/p2p/node.go b/p2p/node.go index b3b2b85..fa3e4fd 100644 --- a/p2p/node.go +++ b/p2p/node.go @@ -11,7 +11,6 @@ import ( kaddht "github.com/libp2p/go-libp2p-kad-dht" "github.com/libp2p/go-libp2p/core/host" "github.com/libp2p/go-libp2p/core/peer" - "github.com/libp2p/go-libp2p/p2p/net/connmgr" "github.com/libp2p/go-libp2p/p2p/security/noise" "github.com/libp2p/go-libp2p/p2p/transport/tcp" "github.com/multiformats/go-multiaddr" @@ -46,26 +45,13 @@ func NewNode(ctx context.Context, opts ...Option) (*Node, error) { listenAddrs = append(listenAddrs, ma) } - // Create connection manager with scaling-optimized limits - connManager, err := connmgr.NewConnManager( - config.LowWatermark, // Low watermark (32) - config.HighWatermark, // High watermark (128) - connmgr.WithGracePeriod(30*time.Second), // Grace period before pruning - ) - if err != nil { - cancel() - return nil, fmt.Errorf("failed to create connection manager: %w", err) - } - - // Create libp2p host with security, transport, and scaling options + // Create libp2p host with security and transport options h, err := libp2p.New( libp2p.ListenAddrs(listenAddrs...), libp2p.Security(noise.ID, noise.New), libp2p.Transport(tcp.NewTCPTransport), libp2p.DefaultMuxers, libp2p.EnableRelay(), - libp2p.ConnectionManager(connManager), // Add connection management - libp2p.EnableAutoRelayWithStaticRelays([]peer.AddrInfo{}), // Enable AutoRelay with empty static list ) if err != nil { cancel()