mirror of https://github.com/status-im/nim-eth.git
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:
parent
19965bab95
commit
21f3014f54
|
@ -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=""
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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]
|
||||||
|
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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:
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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()
|
||||||
|
|
|
@ -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":
|
||||||
|
|
|
@ -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,
|
||||||
|
|
Loading…
Reference in New Issue