Skip to content

Commit 0ac8a7f

Browse files
authored
fix(test): fix flaky rln test (#1923)
1 parent f08315c commit 0ac8a7f

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

tests/waku_rln_relay/test_wakunode_rln_relay.nim

+7-6
Original file line numberDiff line numberDiff line change
@@ -150,22 +150,23 @@ procSuite "WakuNode - RLN relay":
150150
nodes[2].subscribe(pubsubTopics[1], relayHandler)
151151
await sleepAsync(1000.millis)
152152

153-
# publish 5+5 messages to both pubsub topics and content topics
154-
for i in 0..<5:
153+
# publish 3 messages from node[0] (last 2 are spam, window is 10 secs)
154+
for i in 0..<3:
155155
var message1 = WakuMessage(payload: ("Payload_" & $i).toBytes(), contentTopic: contentTopics[0])
156156
doAssert(nodes[0].wakuRlnRelay.appendRLNProof(message1, epochTime()))
157+
await nodes[0].publish(pubsubTopics[0], message1)
157158

159+
# publish 3 messages from node[1] (last 2 are spam, window is 10 secs)
160+
for i in 0..<3:
158161
var message2 = WakuMessage(payload: ("Payload_" & $i).toBytes(), contentTopic: contentTopics[1])
159162
doAssert(nodes[1].wakuRlnRelay.appendRLNProof(message2, epochTime()))
160-
161-
await nodes[0].publish(pubsubTopics[0], message1)
162163
await nodes[1].publish(pubsubTopics[1], message2)
163164

164165
# wait for gossip to propagate
165-
await sleepAsync(2000.millis)
166+
await sleepAsync(5000.millis)
166167

167168
# check that node[2] got messages from both topics
168-
# and that rln was applied (4+4 messages were spam)
169+
# and that rln was applied (just 1 msg is rx, rest are spam)
169170
check:
170171
rxMessagesTopic1 == 1
171172
rxMessagesTopic2 == 1

0 commit comments

Comments
 (0)