Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: generic change to reduce the number of compilation warnings #2696

Merged
merged 7 commits into from
May 16, 2024
3 changes: 1 addition & 2 deletions apps/wakunode2/wakunode2.nim
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ else:
{.push raises: [].}

import
std/[options, strutils, os, sequtils],
stew/shims/net as stewNet,
std/[options, strutils, os, sequtils, net],
chronicles,
chronos,
metrics,
Expand Down
2 changes: 1 addition & 1 deletion tests/waku_store_legacy/test_wakunode_store.nim
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import
../testlib/wakucore,
../testlib/wakunode

procSuite "WakuNode - Store":
procSuite "WakuNode - Store Legacy":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah thanks I totally forgot about renaming tests!

## Fixtures
let timeOrigin = now()
let msgListA =
Expand Down
6 changes: 5 additions & 1 deletion tests/wakunode2/test_app.nim
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ import
libp2p/crypto/secp,
libp2p/multiaddress,
libp2p/switch
import ../testlib/common, ../testlib/wakucore, ../testlib/wakunode
import
../testlib/common,
../testlib/wakucore,
../testlib/wakunode,
../../waku/node/waku_metrics

include ../../waku/factory/waku

Expand Down
2 changes: 1 addition & 1 deletion waku/common/confutils/envvar/std/net.nim
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ when (NimMajor, NimMinor) < (1, 4):
else:
{.push raises: [].}

import std/strutils, stew/shims/net
import std/[strutils, net]
import ../../../envvar_serialization

export net, envvar_serialization
Expand Down
2 changes: 1 addition & 1 deletion waku/common/databases/db_postgres/dbconn.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import std/[times, strutils, strformat], stew/results, chronos
import std/[times, strutils], stew/results, chronos

include db_postgres

Expand Down
2 changes: 1 addition & 1 deletion waku/common/databases/dburl.nim
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import std/strutils, regex, stew/results
proc validateDbUrl*(dbUrl: string): Result[string, string] =
## dbUrl mimics SQLAlchemy Database URL schema
## See: https://docs.sqlalchemy.org/en/14/core/engines.html#database-urls
let regex = re"^\w+:\/\/.+:.+@[\w*-.]+:[0-9]+\/[\w*-.]+$"
let regex = re2"^\w+:\/\/.+:.+@[\w*-.]+:[0-9]+\/[\w*-.]+$"
let dbUrl = dbUrl.strip()
if "sqlite" in dbUrl or dbUrl == "" or dbUrl == "none" or dbUrl.match(regex):
return ok(dbUrl)
Expand Down
3 changes: 1 addition & 2 deletions waku/common/enr/builder.nim
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ else:
{.push raises: [].}

import
std/options,
std/[options, net],
stew/results,
stew/shims/net,
eth/keys as eth_keys,
eth/p2p/discoveryv5/enr,
libp2p/crypto/crypto as libp2p_crypto
Expand Down
6 changes: 1 addition & 5 deletions waku/common/logging.nim
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
## This code has been copied and addapted from `status-im/nimbu-eth2` project.
## Link: https://github.com/status-im/nimbus-eth2/blob/c585b0a5b1ae4d55af38ad7f4715ad455e791552/beacon_chain/nimbus_binary_common.nim
import
std/[strutils, typetraits],
chronicles,
chronicles/log_output,
chronicles/topics_registry
import std/typetraits, chronicles, chronicles/log_output, chronicles/topics_registry

export chronicles.LogLevel

Expand Down
4 changes: 2 additions & 2 deletions waku/common/utils/nat.nim
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ when (NimMajor, NimMinor) < (1, 4):
else:
{.push raises: [].}

import std/[options, strutils]
import chronicles, eth/net/nat, stew/results, stew/shims/net, nativesockets
import std/[options, strutils, net]
import chronicles, eth/net/nat, stew/results, nativesockets

logScope:
topics = "nat"
Expand Down
2 changes: 0 additions & 2 deletions waku/common/utils/sequence.nim
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ when (NimMajor, NimMinor) < (1, 4):
else:
{.push raises: [].}

import std/sequtils

proc flatten*[T](a: seq[seq[T]]): seq[T] =
var aFlat = newSeq[T](0)
for subseq in a:
Expand Down
3 changes: 1 addition & 2 deletions waku/discovery/waku_discv5.nim
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ else:
{.push raises: [].}

import
std/[sequtils, strutils, options, sets],
std/[sequtils, strutils, options, sets, net],
stew/results,
stew/shims/net,
chronos,
chronicles,
metrics,
Expand Down
3 changes: 1 addition & 2 deletions waku/discovery/waku_dnsdisc.nim
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ else:
## EIP-1459 is defined in https://eips.ethereum.org/EIPS/eip-1459

import
std/options,
stew/shims/net,
std/[options, net],
chronicles,
chronos,
metrics,
Expand Down
3 changes: 1 addition & 2 deletions waku/factory/builder.nim
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ else:
{.push raises: [].}

import
std/options,
std/[options, net],
stew/results,
stew/shims/net,
chronicles,
libp2p/crypto/crypto,
libp2p/builders,
Expand Down
4 changes: 0 additions & 4 deletions waku/factory/external_config.nim
Original file line number Diff line number Diff line change
Expand Up @@ -764,8 +764,6 @@ proc readValue*(
except CatchableError:
raise newException(SerializationError, getCurrentExceptionMsg())

{.push warning[ProveInit]: off.}

proc load*(T: type WakuNodeConf, version = ""): ConfResult[T] =
try:
let conf = WakuNodeConf.load(
Expand All @@ -789,5 +787,3 @@ proc defaultWakuNodeConf*(): ConfResult[WakuNodeConf] =
return ok(conf)
except CatchableError:
return err("exception in defaultWakuNodeConf: " & getCurrentExceptionMsg())

{.pop.}
5 changes: 2 additions & 3 deletions waku/factory/internal_config.nim
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import
libp2p/crypto/crypto,
libp2p/multiaddress,
libp2p/nameresolving/dnsresolver,
std/[options, sequtils],
stew/results,
stew/shims/net
std/[options, sequtils, net],
stew/results
import
./external_config,
../common/utils/nat,
Expand Down
2 changes: 0 additions & 2 deletions waku/factory/validator_signed.nim
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ else:
{.push raises: [].}

import
std/math,
chronicles,
chronos,
metrics,
stew/byteutils,
stew/endians2,
libp2p/protocols/pubsub/gossipsub,
libp2p/protocols/pubsub/rpc/messages,
libp2p/protocols/pubsub/errors,
nimcrypto/sha2,
secp256k1
Expand Down
12 changes: 1 addition & 11 deletions waku/factory/waku.nim
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ else:
{.push raises: [].}

import
std/[options, strutils, sequtils],
std/[options, sequtils],
stew/results,
chronicles,
chronos,
Expand All @@ -21,20 +21,10 @@ import
../../waku/common/logging,
../../waku/waku_core,
../../waku/waku_node,
../../waku/node/waku_metrics,
../../waku/node/peer_manager,
../../waku/node/health_monitor,
../../waku/waku_api/message_cache,
../../waku/waku_api/handlers,
../../waku/waku_api/rest/server,
../../waku/waku_api/rest/debug/handlers as rest_debug_api,
../../waku/waku_api/rest/relay/handlers as rest_relay_api,
../../waku/waku_api/rest/filter/handlers as rest_filter_api,
../../waku/waku_api/rest/lightpush/handlers as rest_lightpush_api,
../../waku/waku_api/rest/store/handlers as rest_store_api,
../../waku/waku_api/rest/legacy_store/handlers as rest_legacy_store_api,
../../waku/waku_api/rest/health/handlers as rest_health_api,
../../waku/waku_api/rest/admin/handlers as rest_admin_api,
../../waku/waku_archive,
../../waku/discovery/waku_dnsdisc,
../../waku/discovery/waku_discv5,
Expand Down
3 changes: 1 addition & 2 deletions waku/node/config.nim
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ else:
{.push raises: [].}

import
std/[options, sequtils, strutils],
std/[options, sequtils, strutils, net],
stew/results,
stew/shims/net,
libp2p/[multiaddress, multicodec]
import ../../waku/waku_core/peers
import ../waku_enr
Expand Down
Loading
Loading