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: node restart test issue #2576

Merged
merged 5 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
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
20 changes: 12 additions & 8 deletions tests/waku_relay/test_protocol.nim
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ suite "Waku Relay":
pubsubTopicSeq = @[pubsubTopic]
wakuMessage = fakeWakuMessage(testMessage, pubsubTopic)

await allFutures(switch.start(), node.start())
await allFutures(switch.start())

remotePeerInfo = switch.peerInfo.toRemotePeerInfo()
peerId = remotePeerInfo.peerId

asyncTeardown:
await allFutures(switch.stop(), node.stop())
await allFutures(switch.stop())

suite "Subscribe":
asyncTest "Publish without Subscription":
Expand Down Expand Up @@ -1210,14 +1210,14 @@ suite "Waku Relay":
await allFutures(otherSwitch.stop(), otherNode.stop())

suite "Security and Privacy":
xasyncTest "Relay can receive messages after reboot and reconnect":
asyncTest "Relay can receive messages after reboot and reconnect":
# Given a second node connected to the first one
let
otherSwitch = newTestSwitch()
otherPeerManager = PeerManager.new(otherSwitch)
otherNode = await newTestWakuRelay(otherSwitch)

await allFutures(otherSwitch.start(), otherNode.start())
await otherSwitch.start()
let
otherRemotePeerInfo = otherSwitch.peerInfo.toRemotePeerInfo()
otherPeerId = otherRemotePeerInfo.peerId
Expand All @@ -1239,8 +1239,11 @@ suite "Waku Relay":
await sleepAsync(500.millis)

# Given other node is stopped and restarted
await allFutures(otherSwitch.stop(), otherNode.stop())
await allFutures(otherSwitch.start(), otherNode.start())
await otherSwitch.stop()
await otherSwitch.start()

check await peerManager.connectRelay(otherRemotePeerInfo)

# FIXME: Once stopped and started, nodes are not considered connected, nor do they reconnect after running connectRelay, as below
# check await otherPeerManager.connectRelay(otherRemotePeerInfo)

Expand Down Expand Up @@ -1269,8 +1272,9 @@ suite "Waku Relay":
(pubsubTopic, msg2) == otherHandlerFuture.read()

# Given node is stopped and restarted
await allFutures(switch.stop(), node.stop())
await allFutures(switch.start(), node.start())
await switch.stop()
await switch.start()
check await peerManager.connectRelay(otherRemotePeerInfo)

# When sending a message from node
handlerFuture = newPushHandlerFuture()
Expand Down
1 change: 0 additions & 1 deletion tests/waku_relay/utils.nim
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ proc noopRawHandler*(): WakuRelayHandler =

proc newTestWakuRelay*(switch = newTestSwitch()): Future[WakuRelay] {.async.} =
let proto = WakuRelay.new(switch).tryGet()
await proto.start()

let protocolMatcher = proc(proto: string): bool {.gcsafe.} =
return proto.startsWith(WakuRelayCodec)
Expand Down
1 change: 0 additions & 1 deletion waku/waku_relay/protocol.nim
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ const TopicParameters = TopicParams(

# see: https://rfc.vac.dev/spec/29/#gossipsub-v10-parameters
const GossipsubParameters = GossipSubParams.init(
explicit = true,
gabrielmer marked this conversation as resolved.
Show resolved Hide resolved
pruneBackoff = chronos.minutes(1),
unsubscribeBackoff = chronos.seconds(5),
floodPublish = true,
Expand Down
Loading