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") &
" --skipUserCfg --nimcache:build/nimcache -f" &
" --warning[ObservableStores]:off -d:nimOldCaseObjects" &
" -d:chronosStrictException -d:chronicles_log_level=TRACE" &
" -d:chronicles_log_level=TRACE" &
" --threads:on"
# Windows CI releaseMode="-d:debug" or releaseMode=""

View File

@ -1,5 +1,5 @@
# nim-eth
# 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).
@ -8,8 +8,10 @@
{.push raises: [].}
import
std/[tables, hashes],
stew/results, stew/shims/net as stewNet, chronos, chronicles
std/[tables, hashes, net],
stew/results, chronos, chronicles
export net.IpAddress
type
IpLimits* = object
@ -64,3 +66,9 @@ proc getRouteIpv4*(): Result[IpAddress, cstring] =
error "Address conversion error", exception = e.name, msg = e.msg
return err("Invalid IP address")
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
# 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).
@ -11,10 +11,12 @@
{.push raises: [].}
import
std/[strutils, macros, algorithm, options],
nimcrypto/[keccak, utils], stew/shims/net, stew/[base64, results],
std/[strutils, macros, algorithm, options, net],
nimcrypto/[keccak, utils],
stew/[base64, results],
chronicles,
".."/../[rlp, keys]
".."/../[rlp, keys],
../../net/utils
export options, results, keys

View File

@ -1,5 +1,5 @@
# 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
# * 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).
@ -8,8 +8,8 @@
{.push raises: [].}
import
std/hashes,
nimcrypto/[keccak], stint, chronos, stew/shims/net, chronicles,
std/[hashes, net],
nimcrypto/keccak, stint, chronos, chronicles,
../../keys, ../../net/utils,
./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
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
# * MIT license ([LICENSE-MIT](LICENSE-MIT))
@ -9,8 +9,8 @@
{.push raises: [].}
import
std/[sets, options],
stew/results, stew/shims/net, chronicles, chronos,
std/[sets, options, net],
stew/results, chronicles, chronos,
../../net/utils,
"."/[node, enr, routing_table]

View File

@ -1,5 +1,5 @@
# 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
# * 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).
@ -82,7 +82,7 @@
import
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,
".."/../[rlp, keys],
"."/[messages_encoding, encoding, node, routing_table, enr, random2, sessions,

View File

@ -1,5 +1,5 @@
# 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
# * 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).
@ -9,9 +9,9 @@
import
std/[algorithm, times, sequtils, bitops, sets],
bearssl/rand,
stint, chronicles, metrics, chronos, stew/shims/net as stewNet,
../../net/utils, stew/results,
bearssl/rand, stew/results,
stint, chronicles, metrics, chronos,
../../net/utils,
"."/[node, random2, enr]
export results

View File

@ -1,5 +1,5 @@
# 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
# * 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,8 +12,8 @@
{.push raises: [].}
import
std/options,
stint, stew/endians2, stew/shims/net,
std/[options, net],
stint, stew/endians2,
node, lru
export lru

View File

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

View File

@ -1,6 +1,5 @@
import
std/[os, strutils, options],
stew/shims/net,
std/[os, strutils, options, net],
../../../eth/keys, ../../../eth/p2p/discoveryv5/enr,
../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
stew/shims/net, chronos,
std/net,
chronos,
../../eth/keys,
../../eth/p2p/discoveryv5/[enr, node, routing_table],
../../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.}
import
std/[tables, sequtils],
chronos, chronicles, stint, testutils/unittests, stew/shims/net,
std/[tables, sequtils, net],
chronos, chronicles, stint, testutils/unittests,
stew/byteutils,
../../eth/keys,
../../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.}
import
std/[options, sequtils, tables],
std/[options, sequtils, tables, net],
unittest2,
stint, stew/byteutils, stew/shims/net,
stint, stew/byteutils,
../../eth/keys,
../../eth/p2p/discoveryv5/[messages_encoding, encoding, enr, node, sessions],
../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
# * 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).
@ -7,9 +7,8 @@
{.used.}
import
std/[options, sequtils],
std/[options, sequtils, net],
unittest2,
stew/shims/net,
../../eth/p2p/discoveryv5/enr, ../../eth/[keys, rlp]
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.}
import
std/net,
unittest2,
stew/shims/net,
../../eth/keys, ../../eth/p2p/discoveryv5/[node, ip_vote]
suite "IP vote":

View File

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