Remove usage of stew/shim/net (#670)

* Remove usage of stew/shim/net and replace with std/net where needed

* Remove chronosStrictException compile flag
This commit is contained in:
Kim De Mey 2024-01-24 09:09:11 +01:00 committed by GitHub
parent 19965bab95
commit 21f3014f54
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 74 additions and 36 deletions

View File

@ -30,7 +30,7 @@ let cfg =
(if verbose: "" else: " --verbosity:0 --hints:off") & (if verbose: "" else: " --verbosity:0 --hints:off") &
" --skipUserCfg --nimcache:build/nimcache -f" & " --skipUserCfg --nimcache:build/nimcache -f" &
" --warning[ObservableStores]:off -d:nimOldCaseObjects" & " --warning[ObservableStores]:off -d:nimOldCaseObjects" &
" -d:chronosStrictException -d:chronicles_log_level=TRACE" & " -d:chronicles_log_level=TRACE" &
" --threads:on" " --threads:on"
# Windows CI releaseMode="-d:debug" or releaseMode="" # Windows CI releaseMode="-d:debug" or releaseMode=""

View File

@ -1,5 +1,5 @@
# nim-eth # nim-eth
# Copyright (c) 2020-2023 Status Research & Development GmbH # Copyright (c) 2020-2024 Status Research & Development GmbH
# Licensed and distributed under either of # Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT). # * 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). # * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
@ -8,8 +8,10 @@
{.push raises: [].} {.push raises: [].}
import import
std/[tables, hashes], std/[tables, hashes, net],
stew/results, stew/shims/net as stewNet, chronos, chronicles stew/results, chronos, chronicles
export net.IpAddress
type type
IpLimits* = object IpLimits* = object
@ -64,3 +66,9 @@ proc getRouteIpv4*(): Result[IpAddress, cstring] =
error "Address conversion error", exception = e.name, msg = e.msg error "Address conversion error", exception = e.name, msg = e.msg
return err("Invalid IP address") return err("Invalid IP address")
ok(ip) ok(ip)
func ipv4*(address: array[4, byte]): IpAddress =
IpAddress(family: IPv4, address_v4: address)
func ipv6*(address: array[16, byte]): IpAddress =
IpAddress(family: IPv6, address_v6: address)

View File

@ -1,5 +1,5 @@
# nim-eth - Node Discovery Protocol v5 # nim-eth - Node Discovery Protocol v5
# Copyright (c) 2020-2023 Status Research & Development GmbH # Copyright (c) 2020-2024 Status Research & Development GmbH
# Licensed and distributed under either of # Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT). # * 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). # * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
@ -11,10 +11,12 @@
{.push raises: [].} {.push raises: [].}
import import
std/[strutils, macros, algorithm, options], std/[strutils, macros, algorithm, options, net],
nimcrypto/[keccak, utils], stew/shims/net, stew/[base64, results], nimcrypto/[keccak, utils],
stew/[base64, results],
chronicles, chronicles,
".."/../[rlp, keys] ".."/../[rlp, keys],
../../net/utils
export options, results, keys export options, results, keys

View File

@ -1,5 +1,5 @@
# nim-eth - Node Discovery Protocol v5 # nim-eth - Node Discovery Protocol v5
# Copyright (c) 2020-2023 Status Research & Development GmbH # Copyright (c) 2020-2024 Status Research & Development GmbH
# Licensed and distributed under either of # Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT). # * 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). # * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
@ -8,8 +8,8 @@
{.push raises: [].} {.push raises: [].}
import import
std/hashes, std/[hashes, net],
nimcrypto/[keccak], stint, chronos, stew/shims/net, chronicles, nimcrypto/keccak, stint, chronos, chronicles,
../../keys, ../../net/utils, ../../keys, ../../net/utils,
./enr ./enr

View File

@ -1,4 +1,4 @@
# Copyright (c) 2022-2023 Status Research & Development GmbH # Copyright (c) 2022-2024 Status Research & Development GmbH
# Licensed under either of # Licensed under either of
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) # * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
# * MIT license ([LICENSE-MIT](LICENSE-MIT)) # * MIT license ([LICENSE-MIT](LICENSE-MIT))
@ -9,8 +9,8 @@
{.push raises: [].} {.push raises: [].}
import import
std/[sets, options], std/[sets, options, net],
stew/results, stew/shims/net, chronicles, chronos, stew/results, chronicles, chronos,
../../net/utils, ../../net/utils,
"."/[node, enr, routing_table] "."/[node, enr, routing_table]

View File

@ -1,5 +1,5 @@
# nim-eth - Node Discovery Protocol v5 # nim-eth - Node Discovery Protocol v5
# Copyright (c) 2020-2023 Status Research & Development GmbH # Copyright (c) 2020-2024 Status Research & Development GmbH
# Licensed and distributed under either of # Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT). # * 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). # * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
@ -82,7 +82,7 @@
import import
std/[tables, sets, options, math, sequtils, algorithm], std/[tables, sets, options, math, sequtils, algorithm],
stew/shims/net as stewNet, json_serialization/std/net, json_serialization/std/net,
stew/results, chronicles, chronos, stint, metrics, stew/results, chronicles, chronos, stint, metrics,
".."/../[rlp, keys], ".."/../[rlp, keys],
"."/[messages_encoding, encoding, node, routing_table, enr, random2, sessions, "."/[messages_encoding, encoding, node, routing_table, enr, random2, sessions,

View File

@ -1,5 +1,5 @@
# nim-eth - Node Discovery Protocol v5 # nim-eth - Node Discovery Protocol v5
# Copyright (c) 2020-2023 Status Research & Development GmbH # Copyright (c) 2020-2024 Status Research & Development GmbH
# Licensed and distributed under either of # Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT). # * 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). # * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
@ -9,9 +9,9 @@
import import
std/[algorithm, times, sequtils, bitops, sets], std/[algorithm, times, sequtils, bitops, sets],
bearssl/rand, bearssl/rand, stew/results,
stint, chronicles, metrics, chronos, stew/shims/net as stewNet, stint, chronicles, metrics, chronos,
../../net/utils, stew/results, ../../net/utils,
"."/[node, random2, enr] "."/[node, random2, enr]
export results export results

View File

@ -1,5 +1,5 @@
# nim-eth - Node Discovery Protocol v5 # nim-eth - Node Discovery Protocol v5
# Copyright (c) 2020-2023 Status Research & Development GmbH # Copyright (c) 2020-2024 Status Research & Development GmbH
# Licensed and distributed under either of # Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT). # * 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). # * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
@ -12,8 +12,8 @@
{.push raises: [].} {.push raises: [].}
import import
std/options, std/[options, net],
stint, stew/endians2, stew/shims/net, stint, stew/endians2,
node, lru node, lru
export lru export lru

View File

@ -1,5 +1,6 @@
import import
testutils/fuzzing, stew/shims/net, std/net,
testutils/fuzzing,
../../../eth/p2p/discoveryv5/[encoding, enr, sessions, node] ../../../eth/p2p/discoveryv5/[encoding, enr, sessions, node]
init: init:

View File

@ -1,6 +1,5 @@
import import
std/[os, strutils, options], std/[os, strutils, options, net],
stew/shims/net,
../../../eth/keys, ../../../eth/p2p/discoveryv5/enr, ../../../eth/keys, ../../../eth/p2p/discoveryv5/enr,
../fuzzing_helpers ../fuzzing_helpers

View File

@ -1,5 +1,13 @@
# nim-eth
# 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).
# at your option. This file may not be copied, modified, or distributed except according to those terms.
import import
stew/shims/net, chronos, std/net,
chronos,
../../eth/keys, ../../eth/keys,
../../eth/p2p/discoveryv5/[enr, node, routing_table], ../../eth/p2p/discoveryv5/[enr, node, routing_table],
../../eth/p2p/discoveryv5/protocol as discv5_protocol ../../eth/p2p/discoveryv5/protocol as discv5_protocol

View File

@ -1,8 +1,15 @@
# nim-eth
# 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).
# at your option. This file may not be copied, modified, or distributed except according to those terms.
{.used.} {.used.}
import import
std/[tables, sequtils], std/[tables, sequtils, net],
chronos, chronicles, stint, testutils/unittests, stew/shims/net, chronos, chronicles, stint, testutils/unittests,
stew/byteutils, stew/byteutils,
../../eth/keys, ../../eth/keys,
../../eth/p2p/discoveryv5/[enr, node, routing_table, encoding, sessions, ../../eth/p2p/discoveryv5/[enr, node, routing_table, encoding, sessions,

View File

@ -1,9 +1,16 @@
# nim-eth
# 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).
# at your option. This file may not be copied, modified, or distributed except according to those terms.
{.used.} {.used.}
import import
std/[options, sequtils, tables], std/[options, sequtils, tables, net],
unittest2, unittest2,
stint, stew/byteutils, stew/shims/net, stint, stew/byteutils,
../../eth/keys, ../../eth/keys,
../../eth/p2p/discoveryv5/[messages_encoding, encoding, enr, node, sessions], ../../eth/p2p/discoveryv5/[messages_encoding, encoding, enr, node, sessions],
../stubloglevel ../stubloglevel

View File

@ -1,4 +1,4 @@
# Copyright (c) 2019-2022 Status Research & Development GmbH # Copyright (c) 2019-2024 Status Research & Development GmbH
# Licensed and distributed under either of # Licensed and distributed under either of
# * MIT license (license terms in the root directory or at http://opensource.org/licenses/MIT). # * MIT license (license terms in the root directory or at http://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0). # * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0).
@ -7,9 +7,8 @@
{.used.} {.used.}
import import
std/[options, sequtils], std/[options, sequtils, net],
unittest2, unittest2,
stew/shims/net,
../../eth/p2p/discoveryv5/enr, ../../eth/[keys, rlp] ../../eth/p2p/discoveryv5/enr, ../../eth/[keys, rlp]
let rng = newRng() let rng = newRng()

View File

@ -1,8 +1,15 @@
# nim-eth
# Copyright (c) 2021-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).
# at your option. This file may not be copied, modified, or distributed except according to those terms.
{.used.} {.used.}
import import
std/net,
unittest2, unittest2,
stew/shims/net,
../../eth/keys, ../../eth/p2p/discoveryv5/[node, ip_vote] ../../eth/keys, ../../eth/p2p/discoveryv5/[node, ip_vote]
suite "IP vote": suite "IP vote":

View File

@ -9,7 +9,7 @@
import import
std/[options, sequtils], std/[options, sequtils],
chronos, chronos,
stew/shims/net, stew/byteutils, stew/byteutils,
testutils/unittests, testutils/unittests,
../../eth/p2p/discoveryv5/[enr, node, routing_table], ../../eth/p2p/discoveryv5/[enr, node, routing_table],
../../eth/p2p/discoveryv5/protocol as discv5_protocol, ../../eth/p2p/discoveryv5/protocol as discv5_protocol,