diff --git a/vendor/nim-chronicles b/vendor/nim-chronicles index 1e63508708..1922045dba 160000 --- a/vendor/nim-chronicles +++ b/vendor/nim-chronicles @@ -1 +1 @@ -Subproject commit 1e6350870855541b381d77d4659688bc0d2c4227 +Subproject commit 1922045dbaa34c2fae86a32dda0e2ac56f1cf435 diff --git a/vendor/nim-chronos b/vendor/nim-chronos index ab5a8c2e0f..2e8551b0d9 160000 --- a/vendor/nim-chronos +++ b/vendor/nim-chronos @@ -1 +1 @@ -Subproject commit ab5a8c2e0f6941fe3debd61dff0293790079d1b0 +Subproject commit 2e8551b0d973cfbebfab3be7f3329e11b9049007 diff --git a/vendor/nim-libp2p b/vendor/nim-libp2p index 74c402ed9d..41649f0999 160000 --- a/vendor/nim-libp2p +++ b/vendor/nim-libp2p @@ -1 +1 @@ -Subproject commit 74c402ed9db4652a455c00c8d1713b222e3ef3d5 +Subproject commit 41649f099979e0320a46b013744e5c3d2b6eb9c7 diff --git a/vendor/nim-nat-traversal b/vendor/nim-nat-traversal index 27d314d65c..14e016503f 160000 --- a/vendor/nim-nat-traversal +++ b/vendor/nim-nat-traversal @@ -1 +1 @@ -Subproject commit 27d314d65c9078924b3239fe4e2f5af0c512b28c +Subproject commit 14e016503fe6488230e6d0e59396efde96bd9252 diff --git a/vendor/nim-presto b/vendor/nim-presto index 2b440a443f..2ae448ff5b 160000 --- a/vendor/nim-presto +++ b/vendor/nim-presto @@ -1 +1 @@ -Subproject commit 2b440a443f3fc29197f267879e16bb8057ccc0ed +Subproject commit 2ae448ff5b0808c8f562c6f0a70bbd7a05407a37 diff --git a/vendor/nimcrypto b/vendor/nimcrypto index 4014ef939b..1c8d6e3caf 160000 --- a/vendor/nimcrypto +++ b/vendor/nimcrypto @@ -1 +1 @@ -Subproject commit 4014ef939b51e02053c2e16dd3481d47bc9267dd +Subproject commit 1c8d6e3caf3abc572136ae9a1da81730c4eb4288 diff --git a/waku/node/rest/store/handlers.nim b/waku/node/rest/store/handlers.nim index 04f47c9b94..3a4acf3c29 100644 --- a/waku/node/rest/store/handlers.nim +++ b/waku/node/rest/store/handlers.nim @@ -7,6 +7,7 @@ import std/strformat, stew/results, chronicles, + uri, json_serialization, presto/route import diff --git a/waku/node/waku_metrics.nim b/waku/node/waku_metrics.nim index 93c98ba576..140b55e7a2 100644 --- a/waku/node/waku_metrics.nim +++ b/waku/node/waku_metrics.nim @@ -21,21 +21,17 @@ const LogInterval = 30.seconds logScope: topics = "waku node metrics" - -type - # https://github.com/nim-lang/Nim/issues/17369 - MetricsLogger = proc(udata: pointer) {.gcsafe, raises: [Defect].} - proc startMetricsLog*() = - var logMetrics: MetricsLogger + var logMetrics: CallbackFunc var cumulativeErrors = 0.float64 var cumulativeConns = 0.float64 let logRlnMetrics = getRlnMetricsLogger() - logMetrics = proc(udata: pointer) = - {.gcsafe.}: + logMetrics = CallbackFunc( + proc(udata: pointer) {.gcsafe.} = + # TODO: libp2p_pubsub_peers is not public, so we need to make this either # public in libp2p or do our own peer counting after all. @@ -62,6 +58,7 @@ proc startMetricsLog*() = # Start protocol specific metrics logging logRlnMetrics() - discard setTimer(Moment.fromNow(LogInterval), logMetrics) + discard setTimer(Moment.fromNow(LogInterval), logMetrics) + ) discard setTimer(Moment.fromNow(LogInterval), logMetrics) diff --git a/waku/node/waku_node.nim b/waku/node/waku_node.nim index 2be13113eb..01396bbedf 100644 --- a/waku/node/waku_node.nim +++ b/waku/node/waku_node.nim @@ -114,14 +114,14 @@ proc getAutonatService*(rng: ref HmacDrbgContext): AutonatService = let autonatService = AutonatService.new( autonatClient = AutonatClient.new(), rng = rng, - scheduleInterval = Opt.some(chronos.seconds(120)), + scheduleInterval = some(chronos.seconds(120)), askNewConnectedPeers = false, numPeersToAsk = 3, maxQueueSize = 3, minConfidence = 0.7) proc statusAndConfidenceHandler(networkReachability: NetworkReachability, - confidence: Opt[float]): + confidence: Option[float]): Future[void] {.gcsafe, async.} = if confidence.isSome(): info "Peer reachability status", networkReachability=networkReachability, confidence=confidence.get() diff --git a/waku/waku_archive/archive.nim b/waku/waku_archive/archive.nim index c8ffb7715b..b6e8aad3fa 100644 --- a/waku/waku_archive/archive.nim +++ b/waku/waku_archive/archive.nim @@ -221,19 +221,21 @@ proc startMessageRetentionPolicyPeriodicTask*(w: WakuArchive, # Start the periodic message retention policy task # https://github.com/nim-lang/Nim/issues/17369 - var executeRetentionPolicy: proc(udata: pointer) {.gcsafe, raises: [Defect].} - executeRetentionPolicy = proc(udata: pointer) {.gcsafe.} = - - try: - let retPolRes = waitFor w.executeMessageRetentionPolicy() - if retPolRes.isErr(): - waku_archive_errors.inc(labelValues = [retPolicyFailure]) - error "error in periodic retention policy", error = retPolRes.error - except CatchableError: - waku_archive_errors.inc(labelValues = [retPolicyFailure]) - error "exception in periodic retention policy", - error = getCurrentExceptionMsg() - - discard setTimer(Moment.fromNow(interval), executeRetentionPolicy) + var executeRetentionPolicy: CallbackFunc + executeRetentionPolicy = + CallbackFunc( + proc (arg: pointer) {.gcsafe, raises: [].} = + try: + let retPolRes = waitFor w.executeMessageRetentionPolicy() + if retPolRes.isErr(): + waku_archive_errors.inc(labelValues = [retPolicyFailure]) + error "error in periodic retention policy", error = retPolRes.error + except CatchableError: + waku_archive_errors.inc(labelValues = [retPolicyFailure]) + error "exception in periodic retention policy", + error = getCurrentExceptionMsg() + + discard setTimer(Moment.fromNow(interval), executeRetentionPolicy) + ) discard setTimer(Moment.fromNow(interval), executeRetentionPolicy) diff --git a/waku/waku_filter_v2/protocol.nim b/waku/waku_filter_v2/protocol.nim index 36c488e06a..3dc7a9ae10 100644 --- a/waku/waku_filter_v2/protocol.nim +++ b/waku/waku_filter_v2/protocol.nim @@ -255,10 +255,12 @@ const MaintainSubscriptionsInterval* = 1.minutes proc startMaintainingSubscriptions*(wf: WakuFilter, interval: Duration) = trace "starting to maintain subscriptions" - var maintainSubs: proc(udata: pointer) {.gcsafe, raises: [Defect].} - maintainSubs = proc(udata: pointer) {.gcsafe.} = - maintainSubscriptions(wf) - wf.maintenanceTask = setTimer(Moment.fromNow(interval), maintainSubs) + var maintainSubs: CallbackFunc + maintainSubs = CallbackFunc( + proc(udata: pointer) {.gcsafe.} = + maintainSubscriptions(wf) + wf.maintenanceTask = setTimer(Moment.fromNow(interval), maintainSubs) + ) wf.maintenanceTask = setTimer(Moment.fromNow(interval), maintainSubs)