From 6c6302f9e1ccb32fdaa82c6fe5973c583fa9bf28 Mon Sep 17 00:00:00 2001 From: Aaryamann Challani <43716372+rymnc@users.noreply.github.com> Date: Tue, 22 Aug 2023 17:47:06 +0530 Subject: [PATCH] fix(rln-relay): waitFor startup, otherwise valid proofs will be marked invalid (#1920) --- apps/chat2/chat2.nim | 2 +- apps/wakunode2/app.nim | 2 +- waku/node/waku_node.nim | 5 +---- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/apps/chat2/chat2.nim b/apps/chat2/chat2.nim index 98081754ed..dd01e81e82 100644 --- a/apps/chat2/chat2.nim +++ b/apps/chat2/chat2.nim @@ -515,7 +515,7 @@ proc processInput(rfd: AsyncFD, rng: ref HmacDrbgContext) {.async.} = rlnRelayCredentialsPassword: conf.rlnRelayCredentialsPassword ) - await node.mountRlnRelay(rlnConf, + waitFor node.mountRlnRelay(rlnConf, spamHandler=some(spamHandler)) let membershipIndex = node.wakuRlnRelay.groupManager.membershipIndex.get() diff --git a/apps/wakunode2/app.nim b/apps/wakunode2/app.nim index 60fd5f3947..91863cc359 100644 --- a/apps/wakunode2/app.nim +++ b/apps/wakunode2/app.nim @@ -408,7 +408,7 @@ proc setupProtocols(node: WakuNode, ) try: - await node.mountRlnRelay(rlnConf) + waitFor node.mountRlnRelay(rlnConf) except CatchableError: return err("failed to mount waku RLN relay protocol: " & getCurrentExceptionMsg()) diff --git a/waku/node/waku_node.nim b/waku/node/waku_node.nim index 170a2dcf20..ade92de41d 100644 --- a/waku/node/waku_node.nim +++ b/waku/node/waku_node.nim @@ -731,11 +731,8 @@ when defined(rln): if node.wakuRelay.isNil(): raise newException(CatchableError, "WakuRelay protocol is not mounted, cannot mount WakuRlnRelay") - # TODO: check whether the pubsub topic is supported at the relay level - # if rlnConf.rlnRelayPubsubTopic notin node.wakuRelay.defaultPubsubTopics: - # error "The relay protocol does not support the configured pubsub topic for WakuRlnRelay" - let rlnRelayRes = await WakuRlnRelay.new(rlnConf, + let rlnRelayRes = waitFor WakuRlnRelay.new(rlnConf, registrationHandler) if rlnRelayRes.isErr(): raise newException(CatchableError, "failed to mount WakuRlnRelay: " & rlnRelayRes.error)