Bump nim-eth and nim-chronos and fix exception effects

This commit is contained in:
kdeme 2021-04-02 18:45:09 +02:00
parent ebb65e9c20
commit f34431e2d4
No known key found for this signature in database
GPG Key ID: 4E8DD21420AF43F5
4 changed files with 13 additions and 9 deletions

View File

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

2
vendor/nim-chronos vendored

@ -1 +1 @@
Subproject commit c8eefb9382a786993fc703386b0bd446ecf9c037
Subproject commit e5d3ecdd01866d39be1320426b478cb2fd02effd

2
vendor/nim-eth vendored

@ -1 +1 @@
Subproject commit be5e088b21e06a85cac4826454412db8459ed4f1
Subproject commit c5dace27cad9f3f832f40f0e37b8063125cc9871

View File

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