chore: Updating nim-chronicles, nim-chronos, nim-presto, nimcrypto, nim-libp2p, and nim-nat-transversal (#2043)

This commit is contained in:
Ivan Folgueira Bande 2023-09-18 18:51:49 +02:00 committed by GitHub
parent 72f90663cd
commit f617cd9750
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 36 additions and 34 deletions

@ -1 +1 @@
Subproject commit 1e6350870855541b381d77d4659688bc0d2c4227
Subproject commit 1922045dbaa34c2fae86a32dda0e2ac56f1cf435

2
vendor/nim-chronos vendored

@ -1 +1 @@
Subproject commit ab5a8c2e0f6941fe3debd61dff0293790079d1b0
Subproject commit 2e8551b0d973cfbebfab3be7f3329e11b9049007

2
vendor/nim-libp2p vendored

@ -1 +1 @@
Subproject commit 74c402ed9db4652a455c00c8d1713b222e3ef3d5
Subproject commit 41649f099979e0320a46b013744e5c3d2b6eb9c7

@ -1 +1 @@
Subproject commit 27d314d65c9078924b3239fe4e2f5af0c512b28c
Subproject commit 14e016503fe6488230e6d0e59396efde96bd9252

2
vendor/nim-presto vendored

@ -1 +1 @@
Subproject commit 2b440a443f3fc29197f267879e16bb8057ccc0ed
Subproject commit 2ae448ff5b0808c8f562c6f0a70bbd7a05407a37

2
vendor/nimcrypto vendored

@ -1 +1 @@
Subproject commit 4014ef939b51e02053c2e16dd3481d47bc9267dd
Subproject commit 1c8d6e3caf3abc572136ae9a1da81730c4eb4288

View File

@ -7,6 +7,7 @@ import
std/strformat,
stew/results,
chronicles,
uri,
json_serialization,
presto/route
import

View File

@ -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)

View File

@ -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()

View File

@ -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.} =
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()
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)
)
discard setTimer(Moment.fromNow(interval), executeRetentionPolicy)

View File

@ -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)