diff --git a/vendor/nim-eth b/vendor/nim-eth index 601fa7ff6..a8d11dd30 160000 --- a/vendor/nim-eth +++ b/vendor/nim-eth @@ -1 +1 @@ -Subproject commit 601fa7ff667431b05d18579af0e43bf4d8dafa61 +Subproject commit a8d11dd30bf0b844e049702353addbbca803845c diff --git a/vendor/nim-web3 b/vendor/nim-web3 index b985323d6..97e05aea6 160000 --- a/vendor/nim-web3 +++ b/vendor/nim-web3 @@ -1 +1 @@ -Subproject commit b985323d6418a738aa2b9e0b819efe169f00b078 +Subproject commit 97e05aea6573d2630e318e7777a54d95db6ec40e diff --git a/waku/v1/protocol/waku_bridge.nim b/waku/v1/protocol/waku_bridge.nim index 3227c242d..50a6bad2d 100644 --- a/waku/v1/protocol/waku_bridge.nim +++ b/waku/v1/protocol/waku_bridge.nim @@ -1,6 +1,6 @@ # # Waku - Whisper Bridge -# (c) Copyright 2019 +# (c) Copyright 2018-2021 # Status Research & Development GmbH # # Licensed under either of @@ -8,6 +8,8 @@ # MIT license (LICENSE-MIT) # +{.push raises: [Defect].} + import eth/p2p, eth/p2p/rlpx_protocols/whisper_protocol, diff --git a/waku/v1/protocol/waku_mail.nim b/waku/v1/protocol/waku_mail.nim index aea073465..3bad0d2b4 100644 --- a/waku/v1/protocol/waku_mail.nim +++ b/waku/v1/protocol/waku_mail.nim @@ -1,12 +1,15 @@ # # Waku Mail Client & Server -# (c) Copyright 2019 +# (c) Copyright 2018-2021 # Status Research & Development GmbH # # Licensed under either of -# Apache License, version 2.0, (LICENSE-APACHEv2) +# Apache License, version 2.0, (LICENSE-APACHEv2)F # MIT license (LICENSE-MIT) # + +{.push raises: [Defect].} + import chronos, eth/[p2p, async_utils], diff --git a/waku/v1/protocol/waku_protocol.nim b/waku/v1/protocol/waku_protocol.nim index 9e073c0f2..6ad456ff9 100644 --- a/waku/v1/protocol/waku_protocol.nim +++ b/waku/v1/protocol/waku_protocol.nim @@ -1,6 +1,6 @@ # # Waku -# (c) Copyright 2018-2019 +# (c) Copyright 2018-2021 # Status Research & Development GmbH # # Licensed under either of @@ -37,6 +37,8 @@ ## However, they only make real sense after ``connectToNetwork`` was started. As ## else there will be no peers to send and receive messages from. +{.push raises: [Defect].} + import options, tables, times, chronos, chronicles, metrics, eth/[keys, async_utils, p2p], eth/p2p/rlpx_protocols/whisper/whisper_types, @@ -143,9 +145,14 @@ proc append*(rlpWriter: var RlpWriter, value: StatusOptions) = let bytes = list.finish() - rlpWriter.append(rlpFromBytes(bytes)) + try: + rlpWriter.append(rlpFromBytes(bytes)) + except RlpError as e: + # bytes is valid rlp just created here, rlpFromBytes should thus never fail + raiseAssert e.msg -proc read*(rlp: var Rlp, T: typedesc[StatusOptions]): T = +proc read*(rlp: var Rlp, T: typedesc[StatusOptions]): + T {.raises: [RlpError, Defect].}= if not rlp.isList(): raise newException(RlpTypeMismatch, "List expected, but the source RLP is not a list.") @@ -433,7 +440,7 @@ proc run(peer: Peer) {.async, raises: [Defect].} = peer.processQueue() await sleepAsync(messageInterval) -proc pruneReceived(node: EthereumNode) {.raises: [].} = +proc pruneReceived(node: EthereumNode) = if node.peerPool != nil: # XXX: a bit dirty to need to check for this here ... var wakuNet = node.protocolState(Waku) @@ -561,7 +568,8 @@ proc unsubscribeFilter*(node: EthereumNode, filterId: string): bool = var filter: Filter return node.protocolState(Waku).filters.take(filterId, filter) -proc getFilterMessages*(node: EthereumNode, filterId: string): seq[ReceivedMessage] = +proc getFilterMessages*(node: EthereumNode, filterId: string): + seq[ReceivedMessage] {.raises: [KeyError, Defect].} = ## Get all the messages currently in the filter queue. This will reset the ## filter message queue. return node.protocolState(Waku).filters.getFilterMessages(filterId)