From 5a1758c8edc4c83def364d1fa1a8ffa724d91630 Mon Sep 17 00:00:00 2001 From: Jun Song Date: Sat, 15 Aug 2026 00:38:07 +0900 Subject: [PATCH] Connect hosts before creating gossipsub routers in `TestTwoNodePartialColumnExchange` Make this test deterministic even in a single CPU. Pubsub attaches already-connected peers at startup, while it is triggered by identify event which can be delivered unreliably in our "blank host" setting (`UseBlankHost: true`). Currently go test always fails with: ``` go test ./beacon-chain/p2p/partialdatacolumnbroadcaster/integrationtest/ \ -run TestTwoNodePartialColumnExchange -count=200 -cpu 1 ``` --- .../integrationtest/two_node_test.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/beacon-chain/p2p/partialdatacolumnbroadcaster/integrationtest/two_node_test.go b/beacon-chain/p2p/partialdatacolumnbroadcaster/integrationtest/two_node_test.go index f3fc2f812b88..210ef61ea094 100644 --- a/beacon-chain/p2p/partialdatacolumnbroadcaster/integrationtest/two_node_test.go +++ b/beacon-chain/p2p/partialdatacolumnbroadcaster/integrationtest/two_node_test.go @@ -94,6 +94,14 @@ func TestTwoNodePartialColumnExchange(t *testing.T) { h1 := meta.Nodes[0] h2 := meta.Nodes[1] + // Connect hosts + err = h1.Connect(context.Background(), peer.AddrInfo{ + ID: h2.ID(), + Addrs: h2.Addrs(), + }) + require.NoError(t, err) + time.Sleep(300 * time.Millisecond) + logger := logrus.New() logger.SetLevel(logrus.DebugLevel) bcastCtx1, cancelBcast1 := context.WithCancel(t.Context()) @@ -210,14 +218,6 @@ func TestTwoNodePartialColumnExchange(t *testing.T) { } } - // Connect hosts - err = h1.Connect(context.Background(), peer.AddrInfo{ - ID: h2.ID(), - Addrs: h2.Addrs(), - }) - require.NoError(t, err) - time.Sleep(300 * time.Millisecond) - // Subscribe to regular GossipSub (critical for partial message RPC exchange!) sub1, err := topic1.Subscribe() require.NoError(t, err)