From dcb4c8b74e9c61b2dd065d7e6619f04b7b6fa7c3 Mon Sep 17 00:00:00 2001 From: Ivan Folgueira Bande <128452529+Ivansete-status@users.noreply.github.com> Date: Thu, 13 Jul 2023 18:00:55 +0200 Subject: [PATCH] fix(libp2p): Updating nim-libp2p to fix the `wss` connectivity issue (#1848) * Updating nim-libp2p to fix the `wss` connectivity issue * The `nim-libp2p` adds many changes although we are actually interested in the latest commit: > wstransport.nim: avoid re-raising 'TransportOsError' to avoid stopping `switch.accept` (#929) * The `nim-stew` bump is needed so that the `nim-libp2p` can compile. * The changes in `waku_node.nim` are needed due to the changes in `nim-stew`. * waku_node.nim: returning a "completed" future within 'statusAndConfidenceHandler' This is aimed to avoid the next exception happening in the wakunode: ``` Unhandled defect: Async procedure (service.nim(74) callHandler) yielded `nil`, are you await'ing a `nil` Future? [AssertionDefect] ``` * Adding 'async' to 'statusAndConfidenceHandler' so that it properly returns a Future[void] --- vendor/nim-libp2p | 2 +- vendor/nim-stew | 2 +- waku/v2/node/waku_node.nim | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/vendor/nim-libp2p b/vendor/nim-libp2p index 224f92e17..74c402ed9 160000 --- a/vendor/nim-libp2p +++ b/vendor/nim-libp2p @@ -1 +1 @@ -Subproject commit 224f92e17251464984d6906316c54d2e1108ae43 +Subproject commit 74c402ed9db4652a455c00c8d1713b222e3ef3d5 diff --git a/vendor/nim-stew b/vendor/nim-stew index e18f5a62a..6c97f11c7 160000 --- a/vendor/nim-stew +++ b/vendor/nim-stew @@ -1 +1 @@ -Subproject commit e18f5a62af2ade7a1fd1d39635d4e04d944def08 +Subproject commit 6c97f11c7cb59eadf91b124b92d2ec035f7251fa diff --git a/waku/v2/node/waku_node.nim b/waku/v2/node/waku_node.nim index 5e0d7dce4..df8b3b0a5 100644 --- a/waku/v2/node/waku_node.nim +++ b/waku/v2/node/waku_node.nim @@ -113,13 +113,15 @@ proc getAutonatService*(rng: ref HmacDrbgContext): AutonatService = let autonatService = AutonatService.new( autonatClient = AutonatClient.new(), rng = rng, - scheduleInterval = some(chronos.seconds(120)), + scheduleInterval = Opt.some(chronos.seconds(120)), askNewConnectedPeers = false, numPeersToAsk = 3, maxQueueSize = 3, minConfidence = 0.7) - proc statusAndConfidenceHandler(networkReachability: NetworkReachability, confidence: Option[float]) {.gcsafe, async.} = + proc statusAndConfidenceHandler(networkReachability: NetworkReachability, + confidence: Opt[float]): + Future[void] {.gcsafe, async.} = if confidence.isSome(): info "Peer reachability status", networkReachability=networkReachability, confidence=confidence.get()