From f34431e2d4ab91986656cf13c27c1c1bc8250432 Mon Sep 17 00:00:00 2001 From: kdeme Date: Fri, 2 Apr 2021 18:45:09 +0200 Subject: [PATCH] Bump nim-eth and nim-chronos and fix exception effects --- nimbus/nimbus.nim | 4 +++- vendor/nim-chronos | 2 +- vendor/nim-eth | 2 +- wrappers/libnimbus.nim | 14 ++++++++------ 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/nimbus/nimbus.nim b/nimbus/nimbus.nim index b761f57fd..18dbac016 100644 --- a/nimbus/nimbus.nim +++ b/nimbus/nimbus.nim @@ -65,7 +65,9 @@ proc start(nimbus: NimbusNode) = # metrics logging if conf.debug.logMetrics: - proc logMetrics(udata: pointer) {.closure, gcsafe.} = + # https://github.com/nim-lang/Nim/issues/17369 + var logMetrics: proc(udata: pointer) {.gcsafe, raises: [Defect].} + logMetrics = proc(udata: pointer) = {.gcsafe.}: let registry = defaultRegistry info "metrics", registry diff --git a/vendor/nim-chronos b/vendor/nim-chronos index c8eefb938..e5d3ecdd0 160000 --- a/vendor/nim-chronos +++ b/vendor/nim-chronos @@ -1 +1 @@ -Subproject commit c8eefb9382a786993fc703386b0bd446ecf9c037 +Subproject commit e5d3ecdd01866d39be1320426b478cb2fd02effd diff --git a/vendor/nim-eth b/vendor/nim-eth index be5e088b2..c5dace27c 160000 --- a/vendor/nim-eth +++ b/vendor/nim-eth @@ -1 +1 @@ -Subproject commit be5e088b21e06a85cac4826454412db8459ed4f1 +Subproject commit c5dace27cad9f3f832f40f0e37b8063125cc9871 diff --git a/wrappers/libnimbus.nim b/wrappers/libnimbus.nim index ea4b4edf6..0537d05c7 100644 --- a/wrappers/libnimbus.nim +++ b/wrappers/libnimbus.nim @@ -331,7 +331,8 @@ proc nimbus_post(message: ptr CPostMessage): bool {.exportc, dynlib.} = powTarget = message.powTarget) proc nimbus_subscribe_filter(options: ptr CFilterOptions, - handler: proc (msg: ptr CReceivedMessage, udata: pointer) {.gcsafe, cdecl.}, + handler: proc (msg: ptr CReceivedMessage, udata: pointer) + {.gcsafe, cdecl, raises: [Defect].}, udata: pointer = nil, id: var Identifier): bool {.exportc, dynlib.} = ## Encryption is mandatory. ## A symmetric key or an asymmetric key must be provided. Both is not allowed. @@ -373,7 +374,7 @@ proc nimbus_subscribe_filter(options: ptr CFilterOptions, let filter = initFilter(src, privateKey, symKey, @[options.topic], options.minPow, options.allowP2P) - proc c_handler(msg: ReceivedMessage) {.gcsafe.} = + proc c_handler(msg: ReceivedMessage) {.gcsafe, raises: [Defect].} = var cmsg = CReceivedMessage( decoded: unsafeAddr msg.decoded.payload[0], decodedLen: msg.decoded.payload.len(), @@ -429,7 +430,8 @@ proc nimbus_get_bloom_filter(bloom: var Bloom) {.exportc, dynlib, raises: [].} = # TODO: Return filter ID if we ever want to unsubscribe proc subscribeChannel( - channel: string, handler: proc (msg: ReceivedMessage) {.gcsafe.}) = + channel: string, handler: proc (msg: ReceivedMessage) + {.gcsafe, raises: [Defect].}) = var ctx: HMAC[sha256] var symKey: SymKey discard ctx.pbkdf2(channel, "", 65356, symKey) @@ -446,12 +448,12 @@ proc subscribeChannel( handler) proc nimbus_join_public_chat(channel: cstring, - handler: proc (msg: ptr CReceivedMessage) - {.gcsafe, cdecl.}) {.exportc, dynlib.} = + handler: proc (msg: ptr CReceivedMessage) + {.gcsafe, cdecl, raises: [Defect].}) {.exportc, dynlib.} = if handler.isNil: subscribeChannel($channel, nil) else: - proc c_handler(msg: ReceivedMessage) = + proc c_handler(msg: ReceivedMessage) {.raises: [Defect].} = var cmsg = CReceivedMessage( decoded: unsafeAddr msg.decoded.payload[0], decodedLen: msg.decoded.payload.len(),