From d590960375a0dbbc587f3d03f5b32c5018264404 Mon Sep 17 00:00:00 2001 From: samliok Date: Thu, 15 Oct 2026 12:25:30 -0400 Subject: [PATCH 1/2] test flake --- simplex/replication_test.go | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/simplex/replication_test.go b/simplex/replication_test.go index 998cb240..33ad84ae 100644 --- a/simplex/replication_test.go +++ b/simplex/replication_test.go @@ -743,12 +743,20 @@ func TestReplicationNodeDiverges(t *testing.T) { // we disconnect lagging node first so that it doesn't send the notarized block to any other nodes net.Disconnect(laggingNode.E.ID) - net.SetAllNodesMessageFilter( - // block sending votes from round 0 to ensure all nodes will timeout - func(msg *common.Message, _, to common.NodeID) bool { - return msg.VoteMessage == nil || msg.VoteMessage.Vote.Round != 0 - }, - ) + + // block sending votes from round 0 to ensure all nodes will timeout + blockRoundZeroVotes := func(msg *common.Message, _, to common.NodeID) bool { + return msg.VoteMessage == nil || msg.VoteMessage.Vote.Round != 0 + } + + // the lagging node keeps its filter until it reconnects, since a broadcast + // already in flight could otherwise leak its notarization + for _, n := range net.Instances { + if n.E.ID.Equals(laggingNode.E.ID) { + continue + } + net.SetNodeMessageFilter(n.E.ID, blockRoundZeroVotes) + } // This function call ensures all nodes will timeout, and // receive an empty notarization for round 0(except for lagging). @@ -783,6 +791,7 @@ func TestReplicationNodeDiverges(t *testing.T) { } } + net.SetNodeMessageFilter(laggingNode.E.ID, blockRoundZeroVotes) net.Connect(laggingNode.E.ID) for _, n := range net.Instances { From 1debdf2905b96c21d38dc1e80b720f8d5fcb71ea Mon Sep 17 00:00:00 2001 From: samliok Date: Mon, 19 Oct 2026 12:41:38 -0400 Subject: [PATCH 2/2] check is disconnected everytime --- simplex/replication_test.go | 21 ++++++--------------- testutil/comm.go | 6 +----- 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/simplex/replication_test.go b/simplex/replication_test.go index 33ad84ae..998cb240 100644 --- a/simplex/replication_test.go +++ b/simplex/replication_test.go @@ -743,20 +743,12 @@ func TestReplicationNodeDiverges(t *testing.T) { // we disconnect lagging node first so that it doesn't send the notarized block to any other nodes net.Disconnect(laggingNode.E.ID) - - // block sending votes from round 0 to ensure all nodes will timeout - blockRoundZeroVotes := func(msg *common.Message, _, to common.NodeID) bool { - return msg.VoteMessage == nil || msg.VoteMessage.Vote.Round != 0 - } - - // the lagging node keeps its filter until it reconnects, since a broadcast - // already in flight could otherwise leak its notarization - for _, n := range net.Instances { - if n.E.ID.Equals(laggingNode.E.ID) { - continue - } - net.SetNodeMessageFilter(n.E.ID, blockRoundZeroVotes) - } + net.SetAllNodesMessageFilter( + // block sending votes from round 0 to ensure all nodes will timeout + func(msg *common.Message, _, to common.NodeID) bool { + return msg.VoteMessage == nil || msg.VoteMessage.Vote.Round != 0 + }, + ) // This function call ensures all nodes will timeout, and // receive an empty notarization for round 0(except for lagging). @@ -791,7 +783,6 @@ func TestReplicationNodeDiverges(t *testing.T) { } } - net.SetNodeMessageFilter(laggingNode.E.ID, blockRoundZeroVotes) net.Connect(laggingNode.E.ID) for _, n := range net.Instances { diff --git a/testutil/comm.go b/testutil/comm.go index 8c0dc6b0..a80b5057 100644 --- a/testutil/comm.go +++ b/testutil/comm.go @@ -167,10 +167,6 @@ func (c *TestComm) isMessagePermitted(msg *common.Message, destination common.No } func (c *TestComm) Broadcast(msg *common.Message) { - if c.net.IsDisconnected(c.from) { - return - } - c.maybeTranslateOutgoingToIncomingMessageTypes(msg) for _, instance := range c.net.GetInstances() { @@ -178,7 +174,7 @@ func (c *TestComm) Broadcast(msg *common.Message) { continue } // Skip sending the message to yourself or disconnected nodeWeights - if bytes.Equal(c.from, instance.E.ID) || c.net.IsDisconnected(instance.E.ID) { + if bytes.Equal(c.from, instance.E.ID) || c.net.IsDisconnected(instance.E.ID) || c.net.IsDisconnected(c.from) { continue }