Skip to content

Commit

Permalink
fix(test): fix flaky rln test (#1923)
Browse files Browse the repository at this point in the history
  • Loading branch information
alrevuelta authored Aug 22, 2023
1 parent f08315c commit 0ac8a7f
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions tests/waku_rln_relay/test_wakunode_rln_relay.nim
Original file line number Diff line number Diff line change
Expand Up @@ -150,22 +150,23 @@ procSuite "WakuNode - RLN relay":
nodes[2].subscribe(pubsubTopics[1], relayHandler)
await sleepAsync(1000.millis)

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

# publish 3 messages from node[1] (last 2 are spam, window is 10 secs)
for i in 0..<3:
var message2 = WakuMessage(payload: ("Payload_" & $i).toBytes(), contentTopic: contentTopics[1])
doAssert(nodes[1].wakuRlnRelay.appendRLNProof(message2, epochTime()))

await nodes[0].publish(pubsubTopics[0], message1)
await nodes[1].publish(pubsubTopics[1], message2)

# wait for gossip to propagate
await sleepAsync(2000.millis)
await sleepAsync(5000.millis)

# check that node[2] got messages from both topics
# and that rln was applied (4+4 messages were spam)
# and that rln was applied (just 1 msg is rx, rest are spam)
check:
rxMessagesTopic1 == 1
rxMessagesTopic2 == 1
Expand Down

0 comments on commit 0ac8a7f

Please sign in to comment.