diff --git a/eth/keys.nim b/eth/keys.nim index ed5a005..617a8d6 100644 --- a/eth/keys.nim +++ b/eth/keys.nim @@ -1,5 +1,5 @@ # Nim Ethereum Keys -# Copyright (c) 2020-2023 Status Research & Development GmbH +# Copyright (c) 2020-2024 Status Research & Development GmbH # Licensed under either of # - Apache License, version 2.0, (LICENSE-APACHEv2) # - MIT license (LICENSE-MIT) @@ -17,7 +17,8 @@ import std/strformat, secp256k1, bearssl/hash as bhash, bearssl/rand, - stew/[byteutils, objects, results, ptrops], + stew/[byteutils, objects, ptrops], + results, ./common/eth_hash from nimcrypto/utils import burnMem diff --git a/eth/p2p/discoveryv5/encoding.nim b/eth/p2p/discoveryv5/encoding.nim index 2a71568..e4da104 100644 --- a/eth/p2p/discoveryv5/encoding.nim +++ b/eth/p2p/discoveryv5/encoding.nim @@ -16,7 +16,8 @@ import std/[tables, options, hashes, net], nimcrypto/[bcmode, rijndael, sha2], stint, chronicles, - stew/[results, byteutils, endians2], metrics, + stew/[byteutils, endians2], metrics, + results, ".."/../[rlp, keys], "."/[messages_encoding, node, enr, hkdf, sessions] diff --git a/eth/p2p/discoveryv5/enr.nim b/eth/p2p/discoveryv5/enr.nim index 91dd356..cdc6d41 100644 --- a/eth/p2p/discoveryv5/enr.nim +++ b/eth/p2p/discoveryv5/enr.nim @@ -13,7 +13,8 @@ import std/[strutils, macros, algorithm, options, net], nimcrypto/[keccak, utils], - stew/[base64, results], + stew/base64, + results, chronicles, ".."/../[rlp, keys], ../../net/utils diff --git a/eth/p2p/discoveryv5/messages_encoding.nim b/eth/p2p/discoveryv5/messages_encoding.nim index 3fa1c67..a06c092 100644 --- a/eth/p2p/discoveryv5/messages_encoding.nim +++ b/eth/p2p/discoveryv5/messages_encoding.nim @@ -11,7 +11,8 @@ import std/net, - stew/[arrayops, results], + stew/arrayops, + results, ../../rlp, "."/[messages, enr] diff --git a/eth/p2p/discoveryv5/protocol.nim b/eth/p2p/discoveryv5/protocol.nim index 0e40152..ec4bd92 100644 --- a/eth/p2p/discoveryv5/protocol.nim +++ b/eth/p2p/discoveryv5/protocol.nim @@ -504,15 +504,15 @@ proc registerRequest(d: Protocol, n: Node, message: seq[byte], d.pendingRequests.del(nonce) proc waitMessage(d: Protocol, fromNode: Node, reqId: RequestId): - Future[Option[Message]] {.async: (raw: true, raises: []).} = - result = newFuture[Option[Message]]("waitMessage") - let res = result + Future[Option[Message]] {.async: (raw: true, raises: [CancelledError]).} = + let retFuture = Future[Option[Message]].Raising([CancelledError]).init("discv5.waitMessage") let key = (fromNode.id, reqId) sleepAsync(d.responseTimeout).addCallback() do(data: pointer): d.awaitedMessages.del(key) - if not res.finished: - res.complete(none(Message)) - d.awaitedMessages[key] = result + if not retFuture.finished: + retFuture.complete(none(Message)) + d.awaitedMessages[key] = retFuture + retFuture proc waitNodes(d: Protocol, fromNode: Node, reqId: RequestId): Future[DiscResult[seq[Record]]] {.async: (raises: [CancelledError]).} = diff --git a/eth/rlp.nim b/eth/rlp.nim index a9d643a..d52d493 100644 --- a/eth/rlp.nim +++ b/eth/rlp.nim @@ -4,7 +4,8 @@ import std/[strutils, options], - stew/[byteutils, shims/macros, results], + stew/[byteutils, shims/macros], + results, ./rlp/[writer, object_serialization], ./rlp/priv/defs diff --git a/eth/utp/packets.nim b/eth/utp/packets.nim index 92f072f..af3e3ee 100644 --- a/eth/utp/packets.nim +++ b/eth/utp/packets.nim @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2023 Status Research & Development GmbH +# Copyright (c) 2020-2024 Status Research & Development GmbH # Licensed and distributed under either of # * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT). # * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0). @@ -12,7 +12,8 @@ import faststreams, chronos, - stew/[endians2, results, objects], + stew/[endians2, objects], + results, ../p2p/discoveryv5/random2 export results, random2 diff --git a/eth/utp/utp_socket.nim b/eth/utp/utp_socket.nim index 8223323..c7a3a6e 100644 --- a/eth/utp/utp_socket.nim +++ b/eth/utp/utp_socket.nim @@ -9,7 +9,8 @@ import std/[sugar, deques], chronos, chronicles, metrics, - stew/[results, bitops2], + stew/bitops2, + results, ./growable_buffer, ./packets, ./ledbat_congestion_control, @@ -18,7 +19,7 @@ import ./clock_drift_calculator export - chronicles + chronicles, results logScope: topics = "eth utp utp_socket"