Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(test): fix flaky rln test #1923

Merged
merged 3 commits into from
Aug 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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