From 6ebb49a14bc59aed03054b1d9f7bf79efbeb195a Mon Sep 17 00:00:00 2001 From: Miran Date: Fri, 11 Apr 2025 17:20:23 +0200 Subject: [PATCH] chore: fix unused and deprecated imports (#3368) --- tests/common/test_base64_codec.nim | 2 +- tests/common/test_confutils_envvar.nim | 2 +- tests/common/test_enr_builder.nim | 2 +- tests/common/test_parse_size.nim | 2 +- tests/common/test_ratelimit_setting.nim | 2 +- tests/common/test_requestratelimiter.nim | 2 +- tests/common/test_sqlite_migrations.nim | 2 +- .../incentivization/test_poc_eligibility.nim | 12 ++--------- tests/incentivization/test_poc_reputation.nim | 15 ++----------- tests/node/peer_manager/peer_store/utils.nim | 2 +- tests/node/test_wakunode_filter.nim | 1 - tests/node/test_wakunode_legacy_lightpush.nim | 13 +++--------- tests/node/test_wakunode_legacy_store.nim | 5 +---- tests/node/test_wakunode_lightpush.nim | 19 ++++------------- tests/node/test_wakunode_peer_exchange.nim | 10 ++------- tests/node/test_wakunode_peer_manager.nim | 7 ++----- tests/node/test_wakunode_store.nim | 7 ++----- tests/test_message_cache.nim | 2 +- tests/test_peer_manager.nim | 3 +-- tests/test_peer_store_extended.nim | 8 ++----- tests/test_relay_peer_exchange.nim | 2 -- tests/test_waku_dnsdisc.nim | 3 ++- tests/test_waku_enr.nim | 2 +- tests/test_waku_keepalive.nim | 1 - tests/test_waku_noise_sessions.nim | 2 +- tests/test_wakunode.nim | 4 +--- tests/testlib/simple_mock.nim | 4 ++-- tests/testlib/wakucore.nim | 3 ++- tests/testlib/wakunode.nim | 2 +- tests/waku_archive/archive_utils.nim | 3 +-- tests/waku_archive/test_driver_queue.nim | 2 +- .../waku_archive/test_driver_queue_index.nim | 2 +- .../test_driver_queue_pagination.nim | 1 - tests/waku_archive/test_driver_sqlite.nim | 7 +------ .../waku_archive/test_driver_sqlite_query.nim | 8 +------ tests/waku_archive/test_retention_policy.nim | 4 +--- tests/waku_archive/test_waku_archive.nim | 2 -- .../waku_archive_legacy/test_driver_queue.nim | 2 +- .../test_driver_sqlite.nim | 2 -- .../test_driver_sqlite_query.nim | 2 -- .../waku_archive_legacy/test_waku_archive.nim | 10 +-------- tests/waku_core/test_peers.nim | 2 +- tests/waku_discv5/test_waku_discv5.nim | 2 +- tests/waku_discv5/utils.nim | 1 - tests/waku_enr/utils.nim | 6 ++---- tests/waku_filter_v2/test_waku_client.nim | 9 +------- .../test_waku_filter_dos_protection.nim | 19 ++++++----------- tests/waku_filter_v2/waku_filter_utils.nim | 2 +- tests/waku_lightpush/lightpush_utils.nim | 2 +- tests/waku_lightpush/test_client.nim | 9 ++------ tests/waku_lightpush/test_ratelimit.nim | 21 ++++--------------- .../waku_lightpush_legacy/lightpush_utils.nim | 3 +-- tests/waku_lightpush_legacy/test_client.nim | 10 ++------- .../waku_lightpush_legacy/test_ratelimit.nim | 16 +++----------- tests/waku_peer_exchange/test_protocol.nim | 10 +++------ tests/waku_relay/test_message_id.nim | 5 +++-- tests/waku_relay/test_protocol.nim | 7 +++---- tests/waku_relay/utils.nim | 4 +--- .../test_rln_group_manager_onchain.nim | 13 +++++------- .../test_rln_group_manager_static.nim | 2 +- tests/waku_rln_relay/test_rln_serde.nim | 2 +- tests/waku_rln_relay/test_waku_rln_relay.nim | 1 - tests/waku_rln_relay/utils.nim | 2 +- tests/waku_rln_relay/utils_onchain.nim | 5 +++-- tests/waku_store/store_utils.nim | 5 ++--- tests/waku_store/test_client.nim | 4 ++-- tests/waku_store/test_waku_store.nim | 4 ++-- tests/waku_store/test_wakunode_store.nim | 2 -- tests/waku_store_legacy/store_utils.nim | 2 +- tests/waku_store_legacy/test_client.nim | 4 ++-- tests/waku_store_legacy/test_rpc_codec.nim | 1 - tests/waku_store_legacy/test_waku_store.nim | 4 ++-- .../waku_store_legacy/test_wakunode_store.nim | 1 - tests/waku_store_sync/sync_utils.nim | 2 +- tests/waku_store_sync/test_protocol.nim | 6 +----- tests/waku_store_sync/test_storage.nim | 1 - tests/wakunode_rest/test_rest_admin.nim | 2 +- tests/wakunode_rest/test_rest_cors.nim | 3 --- .../wakunode_rest/test_rest_debug_serdes.nim | 2 +- tests/wakunode_rest/test_rest_filter.nim | 1 - tests/wakunode_rest/test_rest_health.nim | 1 - .../test_rest_lightpush_legacy.nim | 3 +-- .../wakunode_rest/test_rest_relay_serdes.nim | 2 +- tests/wakunode_rest/test_rest_serdes.nim | 2 +- waku.nimble | 1 + waku/common/databases/db_postgres/dbconn.nim | 3 +-- waku/factory/builder.nim | 1 - waku/factory/waku.nim | 1 - waku/incentivization/common.nim | 2 +- waku/incentivization/eligibility_manager.nim | 2 +- waku/incentivization/rpc_codec.nim | 2 +- waku/node/waku_node.nim | 5 +---- waku/waku_api/rest/admin/client.nim | 9 ++------ waku/waku_api/rest/debug/client.nim | 2 +- waku/waku_api/rest/filter/client.nim | 10 +-------- waku/waku_api/rest/health/client.nim | 5 ++--- .../waku_api/rest/legacy_lightpush/client.nim | 12 ++--------- waku/waku_api/rest/relay/client.nim | 10 ++------- .../driver/queue_driver/index.nim | 1 - waku/waku_filter_v2/subscriptions.nim | 7 +------ waku/waku_lightpush/callbacks.nim | 3 +-- waku/waku_lightpush/common.nim | 2 -- waku/waku_lightpush/self_req_handler.nim | 11 ++-------- waku/waku_noise/noise_types.nim | 2 +- waku/waku_noise/noise_utils.nim | 5 +++-- 105 files changed, 136 insertions(+), 351 deletions(-) diff --git a/tests/common/test_base64_codec.nim b/tests/common/test_base64_codec.nim index fd3b23c76..1c2d04c45 100644 --- a/tests/common/test_base64_codec.nim +++ b/tests/common/test_base64_codec.nim @@ -1,6 +1,6 @@ {.used.} -import std/strutils, stew/[results, byteutils], testutils/unittests +import std/strutils, results, stew/byteutils, testutils/unittests import waku/common/base64 suite "Waku Common - stew base64 wrapper": diff --git a/tests/common/test_confutils_envvar.nim b/tests/common/test_confutils_envvar.nim index 6916f52a8..676a35ae1 100644 --- a/tests/common/test_confutils_envvar.nim +++ b/tests/common/test_confutils_envvar.nim @@ -2,7 +2,7 @@ import std/[os, options], - stew/results, + results, stew/shims/net as stewNet, testutils/unittests, confutils, diff --git a/tests/common/test_enr_builder.nim b/tests/common/test_enr_builder.nim index b95828bb4..9fe8f6807 100644 --- a/tests/common/test_enr_builder.nim +++ b/tests/common/test_enr_builder.nim @@ -1,6 +1,6 @@ {.used.} -import std/options, stew/results, stew/shims/net, testutils/unittests +import std/options, results, stew/shims/net, testutils/unittests import waku/common/enr, ../testlib/wakucore suite "nim-eth ENR - builder and typed record": diff --git a/tests/common/test_parse_size.nim b/tests/common/test_parse_size.nim index dd1f2c7af..009cb9637 100644 --- a/tests/common/test_parse_size.nim +++ b/tests/common/test_parse_size.nim @@ -1,6 +1,6 @@ {.used.} -import testutils/unittests, stew/results +import testutils/unittests, results import waku/common/utils/parse_size_units suite "Size serialization test": diff --git a/tests/common/test_ratelimit_setting.nim b/tests/common/test_ratelimit_setting.nim index 6f6ac8d38..97d69e06a 100644 --- a/tests/common/test_ratelimit_setting.nim +++ b/tests/common/test_ratelimit_setting.nim @@ -10,7 +10,7 @@ import testutils/unittests import chronos, libp2p/stream/connection -import std/[sequtils, options, tables] +import std/[options, tables] import ../../waku/common/rate_limit/request_limiter import ../../waku/common/rate_limit/timed_map diff --git a/tests/common/test_requestratelimiter.nim b/tests/common/test_requestratelimiter.nim index 0b494c1be..be910b38e 100644 --- a/tests/common/test_requestratelimiter.nim +++ b/tests/common/test_requestratelimiter.nim @@ -10,7 +10,7 @@ import testutils/unittests import chronos, libp2p/stream/connection -import std/[sequtils, options] +import std/options import ../../waku/common/rate_limit/request_limiter import ../../waku/common/rate_limit/timed_map diff --git a/tests/common/test_sqlite_migrations.nim b/tests/common/test_sqlite_migrations.nim index 58708ce21..9e67fb9c8 100644 --- a/tests/common/test_sqlite_migrations.nim +++ b/tests/common/test_sqlite_migrations.nim @@ -1,6 +1,6 @@ {.used.} -import std/[strutils, os], stew/results, testutils/unittests +import std/[strutils, os], results, testutils/unittests import waku/common/databases/db_sqlite {.all.}, ../waku_archive/archive_utils template sourceDir(): string = diff --git a/tests/incentivization/test_poc_eligibility.nim b/tests/incentivization/test_poc_eligibility.nim index 7490c2304..be9018898 100644 --- a/tests/incentivization/test_poc_eligibility.nim +++ b/tests/incentivization/test_poc_eligibility.nim @@ -1,17 +1,9 @@ {.used.} -import - std/options, - testutils/unittests, - chronos, - web3, - stew/byteutils, - stint, - strutils, - tests/testlib/testasync +import std/options, testutils/unittests, chronos, web3, stint, tests/testlib/testasync import - waku/[node/peer_manager, waku_core], + waku/node/peer_manager, waku/incentivization/[rpc, eligibility_manager], ../waku_rln_relay/[utils_onchain, utils] diff --git a/tests/incentivization/test_poc_reputation.nim b/tests/incentivization/test_poc_reputation.nim index d601d1e24..0547b9744 100644 --- a/tests/incentivization/test_poc_reputation.nim +++ b/tests/incentivization/test_poc_reputation.nim @@ -1,17 +1,6 @@ -import - std/options, - testutils/unittests, - chronos, - web3, - stew/byteutils, - stint, - strutils, - tests/testlib/testasync +import std/options, testutils/unittests, chronos, web3 -import - waku/[node/peer_manager, waku_core], - waku/incentivization/[rpc, reputation_manager], - waku/waku_lightpush_legacy/rpc +import waku/incentivization/reputation_manager, waku/waku_lightpush_legacy/rpc suite "Waku Incentivization PoC Reputation": var manager {.threadvar.}: ReputationManager diff --git a/tests/node/peer_manager/peer_store/utils.nim b/tests/node/peer_manager/peer_store/utils.nim index b087dc471..891c5fdab 100644 --- a/tests/node/peer_manager/peer_store/utils.nim +++ b/tests/node/peer_manager/peer_store/utils.nim @@ -1,4 +1,4 @@ -import std/options, stew/results, libp2p/peerstore +import std/options, results import waku/node/peer_manager/[waku_peer_store, peer_store/waku_peer_storage], diff --git a/tests/node/test_wakunode_filter.nim b/tests/node/test_wakunode_filter.nim index c9ea12f17..83c486a7e 100644 --- a/tests/node/test_wakunode_filter.nim +++ b/tests/node/test_wakunode_filter.nim @@ -6,7 +6,6 @@ import testutils/unittests, chronos, chronicles, - os, libp2p/[peerstore, crypto/crypto] import diff --git a/tests/node/test_wakunode_legacy_lightpush.nim b/tests/node/test_wakunode_legacy_lightpush.nim index ab23921a0..4ff9c7f00 100644 --- a/tests/node/test_wakunode_legacy_lightpush.nim +++ b/tests/node/test_wakunode_legacy_lightpush.nim @@ -1,31 +1,24 @@ {.used.} import - std/[options, tables, sequtils, tempfiles, strutils], + std/[options, tempfiles], stew/shims/net as stewNet, testutils/unittests, chronos, - chronicles, std/strformat, - os, - libp2p/[peerstore, crypto/crypto] + libp2p/crypto/crypto import waku/[ waku_core, node/peer_manager, node/waku_node, - waku_filter_v2, - waku_filter_v2/client, - waku_filter_v2/subscriptions, waku_lightpush_legacy, waku_lightpush_legacy/common, - waku_lightpush_legacy/client, waku_lightpush_legacy/protocol_metrics, - waku_lightpush_legacy/rpc, waku_rln_relay, ], - ../testlib/[assertions, common, wakucore, wakunode, testasync, futures, testutils], + ../testlib/[wakucore, wakunode, testasync, futures], ../resources/payloads suite "Waku Legacy Lightpush - End To End": diff --git a/tests/node/test_wakunode_legacy_store.nim b/tests/node/test_wakunode_legacy_store.nim index 5b0409d86..8ede3f6f2 100644 --- a/tests/node/test_wakunode_legacy_store.nim +++ b/tests/node/test_wakunode_legacy_store.nim @@ -14,14 +14,11 @@ import node/peer_manager, waku_core, waku_store_legacy, - waku_store_legacy/client, waku_archive_legacy, - waku_archive_legacy/driver/sqlite_driver, - common/databases/db_sqlite, ], ../waku_store_legacy/store_utils, ../waku_archive_legacy/archive_utils, - ../testlib/[common, wakucore, wakunode, testasync, futures, testutils] + ../testlib/[wakucore, wakunode, testasync, testutils] suite "Waku Store - End to End - Sorted Archive": var pubsubTopic {.threadvar.}: PubsubTopic diff --git a/tests/node/test_wakunode_lightpush.nim b/tests/node/test_wakunode_lightpush.nim index 865fb38ff..2e785e368 100644 --- a/tests/node/test_wakunode_lightpush.nim +++ b/tests/node/test_wakunode_lightpush.nim @@ -1,27 +1,16 @@ {.used.} import - std/[options, tables, sequtils, tempfiles, strutils], + std/[options, tempfiles], stew/shims/net as stewNet, testutils/unittests, chronos, - chronicles, std/strformat, - os, - libp2p/[peerstore, crypto/crypto] + libp2p/crypto/crypto import - waku/[ - waku_core, - node/peer_manager, - node/waku_node, - waku_filter_v2, - waku_filter_v2/client, - waku_filter_v2/subscriptions, - waku_lightpush, - waku_rln_relay, - ], - ../testlib/[assertions, common, wakucore, wakunode, testasync, futures, testutils], + waku/[waku_core, node/peer_manager, node/waku_node, waku_lightpush, waku_rln_relay], + ../testlib/[wakucore, wakunode, testasync, futures], ../resources/payloads const PublishedToOnePeer = 1 diff --git a/tests/node/test_wakunode_peer_exchange.nim b/tests/node/test_wakunode_peer_exchange.nim index afd808a2c..26837869d 100644 --- a/tests/node/test_wakunode_peer_exchange.nim +++ b/tests/node/test_wakunode_peer_exchange.nim @@ -13,14 +13,8 @@ import eth/p2p/discoveryv5/enr import - waku/[ - waku_node, - discovery/waku_discv5, - waku_peer_exchange, - node/peer_manager, - waku_relay/protocol, - waku_core, - ], + waku/ + [waku_node, discovery/waku_discv5, waku_peer_exchange, node/peer_manager, waku_core], ../waku_peer_exchange/utils, ../testlib/[wakucore, wakunode, testasync] diff --git a/tests/node/test_wakunode_peer_manager.nim b/tests/node/test_wakunode_peer_manager.nim index 6b8fb2fa6..e37b3e108 100644 --- a/tests/node/test_wakunode_peer_manager.nim +++ b/tests/node/test_wakunode_peer_manager.nim @@ -18,18 +18,15 @@ import waku_core, node/peer_manager, node/waku_node, - waku_enr/sharding, discovery/waku_discv5, waku_filter_v2/common, waku_relay/protocol, ], - ../testlib/ - [wakucore, wakunode, testasync, testutils, assertions, comparisons, futures], + ../testlib/[wakucore, wakunode, testasync, testutils, comparisons], ../waku_enr/utils, ../waku_archive/archive_utils, ../waku_discv5/utils, - ./peer_manager/peer_store/utils, - ./utils + ./peer_manager/peer_store/utils const DEFAULT_PROTOCOLS: seq[string] = @["/ipfs/id/1.0.0", "/libp2p/autonat/1.0.0", "/libp2p/circuit/relay/0.2.0/hop"] diff --git a/tests/node/test_wakunode_store.nim b/tests/node/test_wakunode_store.nim index 49c24c6d8..622322d92 100644 --- a/tests/node/test_wakunode_store.nim +++ b/tests/node/test_wakunode_store.nim @@ -1,7 +1,7 @@ {.used.} import - std/[options, sequtils, algorithm, sets], + std/[options, sequtils, sets], stew/shims/net as stewNet, testutils/unittests, chronos, @@ -15,14 +15,11 @@ import waku_core, waku_core/message/digest, waku_store, - waku_store/client, waku_archive, - waku_archive/driver/sqlite_driver, - common/databases/db_sqlite, ], ../waku_store/store_utils, ../waku_archive/archive_utils, - ../testlib/[common, wakucore, wakunode, testasync, futures, testutils] + ../testlib/[wakucore, wakunode, testasync, testutils] suite "Waku Store - End to End - Sorted Archive": var pubsubTopic {.threadvar.}: PubsubTopic diff --git a/tests/test_message_cache.nim b/tests/test_message_cache.nim index b6bb91b86..cd2e882c1 100644 --- a/tests/test_message_cache.nim +++ b/tests/test_message_cache.nim @@ -1,6 +1,6 @@ {.used.} -import std/[sets, random], stew/[results, byteutils], testutils/unittests +import std/[sets, random], results, stew/byteutils, testutils/unittests import waku/waku_core, waku/waku_api/message_cache, ./testlib/wakucore randomize() diff --git a/tests/test_peer_manager.nim b/tests/test_peer_manager.nim index 4ca08e46f..d79c6b991 100644 --- a/tests/test_peer_manager.nim +++ b/tests/test_peer_manager.nim @@ -1,7 +1,7 @@ {.used.} import - std/[options, sequtils, times, sugar, net], + std/[sequtils, times, sugar, net], stew/shims/net as stewNet, testutils/unittests, chronos, @@ -27,7 +27,6 @@ import waku_relay/protocol, waku_filter_v2/common, waku_store/common, - waku_lightpush/common, waku_peer_exchange, waku_metadata, ], diff --git a/tests/test_peer_store_extended.nim b/tests/test_peer_store_extended.nim index aa5947181..16926c7c2 100644 --- a/tests/test_peer_store_extended.nim +++ b/tests/test_peer_store_extended.nim @@ -9,12 +9,8 @@ import libp2p/multiaddress, testutils/unittests import - waku/[ - node/peer_manager/peer_manager, - node/peer_manager/waku_peer_store, - waku_node, - waku_core/peers, - ], + waku/ + [node/peer_manager/peer_manager, node/peer_manager/waku_peer_store, waku_core/peers], ./testlib/wakucore suite "Extended nim-libp2p Peer Store": diff --git a/tests/test_relay_peer_exchange.nim b/tests/test_relay_peer_exchange.nim index 0be3c9193..e950cb015 100644 --- a/tests/test_relay_peer_exchange.nim +++ b/tests/test_relay_peer_exchange.nim @@ -4,10 +4,8 @@ import std/[sequtils, options], stew/shims/net, testutils/unittests, - chronicles, chronos, libp2p/peerid, - libp2p/crypto/crypto, libp2p/protocols/pubsub/gossipsub import waku/waku_core, waku/waku_node, ./testlib/wakucore, ./testlib/wakunode diff --git a/tests/test_waku_dnsdisc.nim b/tests/test_waku_dnsdisc.nim index cf0fd4007..fe29627d4 100644 --- a/tests/test_waku_dnsdisc.nim +++ b/tests/test_waku_dnsdisc.nim @@ -3,7 +3,8 @@ import std/[sequtils, tables], stew/shims/net, - stew/[base32, results], + results, + stew/base32, testutils/unittests, chronicles, chronos, diff --git a/tests/test_waku_enr.nim b/tests/test_waku_enr.nim index b6571b09f..2ffff5e57 100644 --- a/tests/test_waku_enr.nim +++ b/tests/test_waku_enr.nim @@ -1,6 +1,6 @@ {.used.} -import std/[options, sequtils], stew/results, testutils/unittests +import std/[options, sequtils], results, testutils/unittests import waku/waku_core, waku/waku_enr, ./testlib/wakucore suite "Waku ENR - Capabilities bitfield": diff --git a/tests/test_waku_keepalive.nim b/tests/test_waku_keepalive.nim index aebee13dc..c961773e5 100644 --- a/tests/test_waku_keepalive.nim +++ b/tests/test_waku_keepalive.nim @@ -1,7 +1,6 @@ {.used.} import - std/options, stew/shims/net as stewNet, testutils/unittests, chronos, diff --git a/tests/test_waku_noise_sessions.nim b/tests/test_waku_noise_sessions.nim index a02407e63..543653982 100644 --- a/tests/test_waku_noise_sessions.nim +++ b/tests/test_waku_noise_sessions.nim @@ -1,6 +1,6 @@ {.used.} -import std/tables, stew/[results, byteutils], testutils/unittests +import std/tables, results, stew/byteutils, testutils/unittests import waku/[ common/protobuf, diff --git a/tests/test_wakunode.nim b/tests/test_wakunode.nim index 2213b7f8e..df4b442d6 100644 --- a/tests/test_wakunode.nim +++ b/tests/test_wakunode.nim @@ -17,9 +17,7 @@ import libp2p/nameresolving/mockresolver, eth/p2p/discoveryv5/enr import - waku/[waku_core, waku_node, node/peer_manager, waku_relay, waku_peer_exchange], - ./testlib/wakucore, - ./testlib/wakunode + waku/[waku_core, waku_node, node/peer_manager], ./testlib/wakucore, ./testlib/wakunode suite "WakuNode": asyncTest "Protocol matcher works as expected": diff --git a/tests/testlib/simple_mock.nim b/tests/testlib/simple_mock.nim index 234647d33..91ec19261 100644 --- a/tests/testlib/simple_mock.nim +++ b/tests/testlib/simple_mock.nim @@ -9,9 +9,9 @@ type Instr {.union.} = object proc mockImpl*(target, replacement: pointer) = # YOLO who needs alignment #doAssert (cast[ByteAddress](target) and ByteAddress(0x07)) == 0 - var page = cast[pointer](cast[ByteAddress](target) and (not 0xfff)) + var page = cast[pointer](cast[uint](target) and (not 0xfff)) doAssert mprotect(page, 4096, PROT_WRITE or PROT_EXEC) == 0 - let rel = cast[ByteAddress](replacement) - cast[ByteAddress](target) - 5 + let rel = cast[uint](replacement) - cast[uint](target) - 5 var instr = Instr( bytes: [ 0xe9.byte, diff --git a/tests/testlib/wakucore.nim b/tests/testlib/wakucore.nim index d18a87e7d..c68a69deb 100644 --- a/tests/testlib/wakucore.nim +++ b/tests/testlib/wakucore.nim @@ -1,6 +1,7 @@ import std/[options, times], - stew/[results, byteutils], + results, + stew/byteutils, stew/shims/net, chronos, libp2p/switch, diff --git a/tests/testlib/wakunode.nim b/tests/testlib/wakunode.nim index 1c9b8ec83..d1df39b6b 100644 --- a/tests/testlib/wakunode.nim +++ b/tests/testlib/wakunode.nim @@ -1,6 +1,6 @@ import std/options, - stew/results, + results, stew/shims/net, chronos, libp2p/switch, diff --git a/tests/waku_archive/archive_utils.nim b/tests/waku_archive/archive_utils.nim index 48e23f41d..498855075 100644 --- a/tests/waku_archive/archive_utils.nim +++ b/tests/waku_archive/archive_utils.nim @@ -1,13 +1,12 @@ {.used.} -import std/options, stew/results, chronos, libp2p/crypto/crypto +import std/options, results, chronos, libp2p/crypto/crypto import waku/[ node/peer_manager, waku_core, waku_archive, - waku_archive/common, waku_archive/driver/sqlite_driver, waku_archive/driver/sqlite_driver/migrations, common/databases/db_sqlite, diff --git a/tests/waku_archive/test_driver_queue.nim b/tests/waku_archive/test_driver_queue.nim index 16c0163c7..584ea9d7e 100644 --- a/tests/waku_archive/test_driver_queue.nim +++ b/tests/waku_archive/test_driver_queue.nim @@ -1,6 +1,6 @@ {.used.} -import std/options, stew/results, testutils/unittests +import std/options, results, testutils/unittests import waku/[ waku_archive, diff --git a/tests/waku_archive/test_driver_queue_index.nim b/tests/waku_archive/test_driver_queue_index.nim index c383a676c..f34e181af 100644 --- a/tests/waku_archive/test_driver_queue_index.nim +++ b/tests/waku_archive/test_driver_queue_index.nim @@ -1,6 +1,6 @@ {.used.} -import std/[times, random], stew/byteutils, testutils/unittests, nimcrypto +import std/random, testutils/unittests import waku/waku_core, waku/waku_archive/driver/queue_driver/index var rng = initRand() diff --git a/tests/waku_archive/test_driver_queue_pagination.nim b/tests/waku_archive/test_driver_queue_pagination.nim index dec3ccdee..45543c570 100644 --- a/tests/waku_archive/test_driver_queue_pagination.nim +++ b/tests/waku_archive/test_driver_queue_pagination.nim @@ -9,7 +9,6 @@ import waku_archive/driver/queue_driver/index, waku_core, ], - ../testlib/common, ../testlib/wakucore proc getTestQueueDriver(numMessages: int): QueueDriver = diff --git a/tests/waku_archive/test_driver_sqlite.nim b/tests/waku_archive/test_driver_sqlite.nim index 3ceae595d..5809a8492 100644 --- a/tests/waku_archive/test_driver_sqlite.nim +++ b/tests/waku_archive/test_driver_sqlite.nim @@ -2,12 +2,7 @@ import std/sequtils, testutils/unittests, chronos import - waku/[ - common/databases/db_sqlite, - waku_archive, - waku_archive/driver/sqlite_driver, - waku_core, - ], + waku/[waku_archive, waku_archive/driver/sqlite_driver, waku_core], ../waku_archive/archive_utils, ../testlib/wakucore diff --git a/tests/waku_archive/test_driver_sqlite_query.nim b/tests/waku_archive/test_driver_sqlite_query.nim index fc00a3be8..327ae17bb 100644 --- a/tests/waku_archive/test_driver_sqlite_query.nim +++ b/tests/waku_archive/test_driver_sqlite_query.nim @@ -4,13 +4,7 @@ import std/[options, sequtils, random, algorithm], testutils/unittests, chronos, chronicles import - waku/[ - common/databases/db_sqlite, - waku_archive, - waku_archive/driver/sqlite_driver, - waku_core, - waku_core/message/digest, - ], + waku/[waku_archive, waku_core, waku_core/message/digest], ../testlib/common, ../testlib/wakucore, ../waku_archive/archive_utils diff --git a/tests/waku_archive/test_retention_policy.nim b/tests/waku_archive/test_retention_policy.nim index 4686dda7e..ea86e1d69 100644 --- a/tests/waku_archive/test_retention_policy.nim +++ b/tests/waku_archive/test_retention_policy.nim @@ -1,13 +1,11 @@ {.used.} -import std/[sequtils, times], stew/results, testutils/unittests, chronos +import std/[sequtils, times], results, testutils/unittests, chronos import waku/[ - common/databases/db_sqlite, waku_core, waku_core/message/digest, waku_archive, - waku_archive/driver/sqlite_driver, waku_archive/retention_policy, waku_archive/retention_policy/retention_policy_capacity, waku_archive/retention_policy/retention_policy_size, diff --git a/tests/waku_archive/test_waku_archive.nim b/tests/waku_archive/test_waku_archive.nim index 9211b15e9..802473d64 100644 --- a/tests/waku_archive/test_waku_archive.nim +++ b/tests/waku_archive/test_waku_archive.nim @@ -4,12 +4,10 @@ import std/[options, sequtils], testutils/unittests, chronos, libp2p/crypto/cryp import waku/[ - common/databases/db_sqlite, common/databases/db_postgres/dbconn, common/paging, waku_core, waku_core/message/digest, - waku_archive/driver/sqlite_driver, waku_archive, ], ../waku_archive/archive_utils, diff --git a/tests/waku_archive_legacy/test_driver_queue.nim b/tests/waku_archive_legacy/test_driver_queue.nim index c69e5aa6a..aec9ad65d 100644 --- a/tests/waku_archive_legacy/test_driver_queue.nim +++ b/tests/waku_archive_legacy/test_driver_queue.nim @@ -1,6 +1,6 @@ {.used.} -import std/options, stew/results, testutils/unittests +import std/options, results, testutils/unittests import waku/waku_archive_legacy, waku/waku_archive_legacy/driver/queue_driver/queue_driver {.all.}, diff --git a/tests/waku_archive_legacy/test_driver_sqlite.nim b/tests/waku_archive_legacy/test_driver_sqlite.nim index af043116f..9d8c4d14b 100644 --- a/tests/waku_archive_legacy/test_driver_sqlite.nim +++ b/tests/waku_archive_legacy/test_driver_sqlite.nim @@ -2,12 +2,10 @@ import std/sequtils, testutils/unittests, chronos import - waku/common/databases/db_sqlite, waku/waku_archive_legacy, waku/waku_archive_legacy/driver/sqlite_driver, waku/waku_core, ../waku_archive_legacy/archive_utils, - ../testlib/common, ../testlib/wakucore suite "SQLite driver": diff --git a/tests/waku_archive_legacy/test_driver_sqlite_query.nim b/tests/waku_archive_legacy/test_driver_sqlite_query.nim index ecf88e7c0..42f394891 100644 --- a/tests/waku_archive_legacy/test_driver_sqlite_query.nim +++ b/tests/waku_archive_legacy/test_driver_sqlite_query.nim @@ -4,9 +4,7 @@ import std/[options, sequtils, random, algorithm], testutils/unittests, chronos, chronicles import - waku/common/databases/db_sqlite, waku/waku_archive_legacy, - waku/waku_archive_legacy/driver/sqlite_driver, waku/waku_core, waku/waku_core/message/digest, ../testlib/common, diff --git a/tests/waku_archive_legacy/test_waku_archive.nim b/tests/waku_archive_legacy/test_waku_archive.nim index 181560a28..e58b2cfc9 100644 --- a/tests/waku_archive_legacy/test_waku_archive.nim +++ b/tests/waku_archive_legacy/test_waku_archive.nim @@ -1,21 +1,13 @@ {.used.} -import - std/[options, sequtils], - testutils/unittests, - chronicles, - chronos, - libp2p/crypto/crypto +import std/[options, sequtils], testutils/unittests, chronos, libp2p/crypto/crypto import - waku/common/databases/db_sqlite, waku/common/paging, waku/waku_core, waku/waku_core/message/digest, - waku/waku_archive_legacy/driver/sqlite_driver, waku/waku_archive_legacy, ../waku_archive_legacy/archive_utils, - ../testlib/common, ../testlib/wakucore suite "Waku Archive - message handling": diff --git a/tests/waku_core/test_peers.nim b/tests/waku_core/test_peers.nim index 3dc68fa1a..59ae2e2f3 100644 --- a/tests/waku_core/test_peers.nim +++ b/tests/waku_core/test_peers.nim @@ -1,7 +1,7 @@ {.used.} import - stew/results, + results, testutils/unittests, libp2p/multiaddress, libp2p/peerid, diff --git a/tests/waku_discv5/test_waku_discv5.nim b/tests/waku_discv5/test_waku_discv5.nim index edde80ab3..b2d59813a 100644 --- a/tests/waku_discv5/test_waku_discv5.nim +++ b/tests/waku_discv5/test_waku_discv5.nim @@ -2,7 +2,7 @@ import std/[sequtils, algorithm], - stew/results, + results, stew/shims/net, chronos, chronicles, diff --git a/tests/waku_discv5/utils.nim b/tests/waku_discv5/utils.nim index 679d206ea..422e13fd9 100644 --- a/tests/waku_discv5/utils.nim +++ b/tests/waku_discv5/utils.nim @@ -1,6 +1,5 @@ import std/options, - stew/results, stew/shims/net, chronos, libp2p/crypto/crypto as libp2p_keys, diff --git a/tests/waku_enr/utils.nim b/tests/waku_enr/utils.nim index 6dd017add..8f79b1d8f 100644 --- a/tests/waku_enr/utils.nim +++ b/tests/waku_enr/utils.nim @@ -1,15 +1,13 @@ import std/options, sequtils, - stew/results, + results, stew/shims/net, chronos, libp2p/crypto/crypto as libp2p_keys, eth/keys as eth_keys -import - waku/[waku_core/topics, waku_enr, discovery/waku_discv5, waku_enr/sharding], - ../testlib/[common, wakucore] +import waku/[waku_enr, discovery/waku_discv5, waku_enr/sharding], ../testlib/wakucore proc newTestEnrRecord*( privKey: libp2p_keys.PrivateKey, diff --git a/tests/waku_filter_v2/test_waku_client.nim b/tests/waku_filter_v2/test_waku_client.nim index dbfcd1c51..2c3e2f4ec 100644 --- a/tests/waku_filter_v2/test_waku_client.nim +++ b/tests/waku_filter_v2/test_waku_client.nim @@ -1,13 +1,6 @@ {.used.} -import - std/[options, tables, sequtils, strutils, json], - testutils/unittests, - stew/[results, byteutils], - chronos, - chronicles, - os, - libp2p/peerstore +import std/[options, sequtils, json], testutils/unittests, results, chronos import waku/node/[peer_manager, waku_node], diff --git a/tests/waku_filter_v2/test_waku_filter_dos_protection.nim b/tests/waku_filter_v2/test_waku_filter_dos_protection.nim index c751114c1..7c8c640ba 100644 --- a/tests/waku_filter_v2/test_waku_filter_dos_protection.nim +++ b/tests/waku_filter_v2/test_waku_filter_dos_protection.nim @@ -1,25 +1,18 @@ {.used.} import - std/[options, tables, sequtils, strutils, json], + std/[options, tables, json], testutils/unittests, - stew/[results, byteutils], + results, chronos, chronicles, - os, libp2p/peerstore import - waku/[ - node/peer_manager, - waku_core, - common/rate_limit/setting, - common/rate_limit/token_bucket, - ], - waku/waku_filter_v2/[common, client, subscriptions, protocol, rpc_codec], - ../testlib/[wakucore, testasync, testutils, futures, sequtils], - ./waku_filter_utils, - ../resources/payloads + waku/[node/peer_manager, waku_core], + waku/waku_filter_v2/[common, client, subscriptions, protocol], + ../testlib/[wakucore, testasync, futures], + ./waku_filter_utils type AFilterClient = ref object of RootObj clientSwitch*: Switch diff --git a/tests/waku_filter_v2/waku_filter_utils.nim b/tests/waku_filter_v2/waku_filter_utils.nim index 5698949c5..2f04ceb36 100644 --- a/tests/waku_filter_v2/waku_filter_utils.nim +++ b/tests/waku_filter_v2/waku_filter_utils.nim @@ -1,4 +1,4 @@ -import std/[options, tables, sets, sequtils, algorithm], chronos, chronicles, os +import std/[options, tables, sets, algorithm], chronos, chronicles, os import waku/[ diff --git a/tests/waku_lightpush/lightpush_utils.nim b/tests/waku_lightpush/lightpush_utils.nim index f3e94cb47..b334f043a 100644 --- a/tests/waku_lightpush/lightpush_utils.nim +++ b/tests/waku_lightpush/lightpush_utils.nim @@ -1,6 +1,6 @@ {.used.} -import std/options, chronicles, chronos, libp2p/crypto/crypto +import std/options, chronos, libp2p/crypto/crypto import waku/node/peer_manager, diff --git a/tests/waku_lightpush/test_client.nim b/tests/waku_lightpush/test_client.nim index 060a8c22b..d1a7ba57e 100644 --- a/tests/waku_lightpush/test_client.nim +++ b/tests/waku_lightpush/test_client.nim @@ -1,11 +1,6 @@ {.used.} -import - std/[options, strscans], - testutils/unittests, - chronicles, - chronos, - libp2p/crypto/crypto +import std/[options, strscans], testutils/unittests, chronos, libp2p/crypto/crypto import waku/[ @@ -15,7 +10,7 @@ import waku_lightpush/client, waku_lightpush/protocol_metrics, ], - ../testlib/[assertions, wakucore, testasync, futures, testutils], + ../testlib/[assertions, wakucore, testasync, futures], ./lightpush_utils, ../resources/[pubsub_topics, content_topics, payloads] diff --git a/tests/waku_lightpush/test_ratelimit.nim b/tests/waku_lightpush/test_ratelimit.nim index 7148be37a..0dd7913d1 100644 --- a/tests/waku_lightpush/test_ratelimit.nim +++ b/tests/waku_lightpush/test_ratelimit.nim @@ -1,24 +1,11 @@ {.used.} -import - std/[options, strscans], - testutils/unittests, - chronicles, - chronos, - libp2p/crypto/crypto +import std/options, testutils/unittests, chronos, libp2p/crypto/crypto import - waku/[ - node/peer_manager, - common/rate_limit/setting, - waku_core, - waku_lightpush, - waku_lightpush/client, - waku_lightpush/protocol_metrics, - ], - ../testlib/[assertions, wakucore, testasync, futures, testutils], - ./lightpush_utils, - ../resources/[pubsub_topics, content_topics, payloads] + waku/[node/peer_manager, waku_core, waku_lightpush, waku_lightpush/client], + ../testlib/wakucore, + ./lightpush_utils suite "Rate limited push service": asyncTest "push message with rate limit not violated": diff --git a/tests/waku_lightpush_legacy/lightpush_utils.nim b/tests/waku_lightpush_legacy/lightpush_utils.nim index 733fbc8b1..11c4bf929 100644 --- a/tests/waku_lightpush_legacy/lightpush_utils.nim +++ b/tests/waku_lightpush_legacy/lightpush_utils.nim @@ -1,10 +1,9 @@ {.used.} -import std/options, chronicles, chronos, libp2p/crypto/crypto +import std/options, chronos, libp2p/crypto/crypto import waku/node/peer_manager, - waku/waku_core, waku/waku_lightpush_legacy, waku/waku_lightpush_legacy/[client, common], waku/common/rate_limit/setting, diff --git a/tests/waku_lightpush_legacy/test_client.nim b/tests/waku_lightpush_legacy/test_client.nim index b71b7d5c3..1dcb466c9 100644 --- a/tests/waku_lightpush_legacy/test_client.nim +++ b/tests/waku_lightpush_legacy/test_client.nim @@ -1,11 +1,6 @@ {.used.} -import - std/[options, strscans], - testutils/unittests, - chronicles, - chronos, - libp2p/crypto/crypto +import std/[options, strscans], testutils/unittests, chronos, libp2p/crypto/crypto import waku/[ @@ -16,9 +11,8 @@ import waku_lightpush_legacy/common, waku_lightpush_legacy/protocol_metrics, waku_lightpush_legacy/rpc, - waku_lightpush_legacy/rpc_codec, ], - ../testlib/[assertions, wakucore, testasync, futures, testutils], + ../testlib/[assertions, wakucore, testasync, futures], ./lightpush_utils, ../resources/[pubsub_topics, content_topics, payloads] diff --git a/tests/waku_lightpush_legacy/test_ratelimit.nim b/tests/waku_lightpush_legacy/test_ratelimit.nim index 1d033302f..3df8d369d 100644 --- a/tests/waku_lightpush_legacy/test_ratelimit.nim +++ b/tests/waku_lightpush_legacy/test_ratelimit.nim @@ -1,27 +1,17 @@ {.used.} -import - std/[options, strscans], - testutils/unittests, - chronicles, - chronos, - libp2p/crypto/crypto +import std/options, testutils/unittests, chronos, libp2p/crypto/crypto import waku/[ node/peer_manager, - common/rate_limit/setting, waku_core, waku_lightpush_legacy, waku_lightpush_legacy/client, waku_lightpush_legacy/common, - waku_lightpush_legacy/protocol_metrics, - waku_lightpush_legacy/rpc, - waku_lightpush_legacy/rpc_codec, ], - ../testlib/[assertions, wakucore, testasync, futures, testutils], - ./lightpush_utils, - ../resources/[pubsub_topics, content_topics, payloads] + ../testlib/wakucore, + ./lightpush_utils suite "Rate limited push service": asyncTest "push message with rate limit not violated": diff --git a/tests/waku_peer_exchange/test_protocol.nim b/tests/waku_peer_exchange/test_protocol.nim index 11a61c4dc..8f7f20574 100644 --- a/tests/waku_peer_exchange/test_protocol.nim +++ b/tests/waku_peer_exchange/test_protocol.nim @@ -1,11 +1,10 @@ {.used.} import - std/[options, sequtils, tables, net], + std/[options, sequtils, net], testutils/unittests, chronos, - chronicles, - libp2p/[switch, peerId, crypto/crypto, multistream, muxers/muxer], + libp2p/[switch, peerId, crypto/crypto], eth/[keys, p2p/discoveryv5/enr] import @@ -18,14 +17,11 @@ import waku_peer_exchange/rpc_codec, waku_peer_exchange/protocol, node/peer_manager, - waku_relay/protocol, - waku_relay, waku_core, - waku_core/message/codec, common/enr/builder, waku_enr/sharding, ], - ../testlib/[wakucore, wakunode, simple_mock, assertions], + ../testlib/[wakucore, wakunode, assertions], ./utils.nim suite "Waku Peer Exchange": diff --git a/tests/waku_relay/test_message_id.nim b/tests/waku_relay/test_message_id.nim index b46554d17..633303120 100644 --- a/tests/waku_relay/test_message_id.nim +++ b/tests/waku_relay/test_message_id.nim @@ -1,10 +1,11 @@ import unittest, - stew/[shims/net, results, byteutils], + results, + stew/[shims/net, byteutils], nimcrypto/sha2, libp2p/protocols/pubsub/rpc/messages -import waku/waku_relay/message_id, ../testlib/sequtils +import waku/waku_relay/message_id suite "Message ID Provider": test "Non-empty string": diff --git a/tests/waku_relay/test_protocol.nim b/tests/waku_relay/test_protocol.nim index 399b55ea8..d0e8a7ed6 100644 --- a/tests/waku_relay/test_protocol.nim +++ b/tests/waku_relay/test_protocol.nim @@ -1,13 +1,12 @@ {.used.} import - std/[options, sequtils, strutils, strformat], + std/[options, strformat], stew/shims/net as stewNet, testutils/unittests, - chronicles, chronos, libp2p/protocols/pubsub/[pubsub, gossipsub], - libp2p/[multihash, stream/connection, switch], + libp2p/[stream/connection, switch], ./crypto_utils, std/json @@ -19,7 +18,7 @@ import waku_core, waku_core/message/codec, ], - ../testlib/[wakucore, testasync, testutils, futures, sequtils], + ../testlib/[wakucore, testasync, futures, sequtils], ./utils, ../resources/payloads diff --git a/tests/waku_relay/utils.nim b/tests/waku_relay/utils.nim index c1a085b10..3e39294a1 100644 --- a/tests/waku_relay/utils.nim +++ b/tests/waku_relay/utils.nim @@ -4,7 +4,6 @@ import std/[strutils, sequtils, tempfiles], stew/byteutils, stew/shims/net as stewNet, - testutils/unittests, chronos, libp2p/switch, libp2p/protocols/pubsub/pubsub @@ -23,8 +22,7 @@ import ], ../waku_store/store_utils, ../waku_archive/archive_utils, - ../testlib/[wakucore, wakunode, testasync, futures], - ../resources/payloads + ../testlib/[wakucore, futures] proc noopRawHandler*(): WakuRelayHandler = var handler: WakuRelayHandler diff --git a/tests/waku_rln_relay/test_rln_group_manager_onchain.nim b/tests/waku_rln_relay/test_rln_group_manager_onchain.nim index 3d7be7220..b6fc44e27 100644 --- a/tests/waku_rln_relay/test_rln_group_manager_onchain.nim +++ b/tests/waku_rln_relay/test_rln_group_manager_onchain.nim @@ -3,8 +3,9 @@ {.push raises: [].} import - std/[options, os, osproc, sequtils, deques, streams, strutils, tempfiles, strformat], - stew/[results, byteutils], + std/[options, sequtils, deques], + results, + stew/byteutils, testutils/unittests, chronos, chronicles, @@ -16,19 +17,15 @@ import import waku/[ - waku_node, - node/waku_node, waku_rln_relay, waku_rln_relay/protocol_types, waku_rln_relay/constants, - waku_rln_relay/contract, waku_rln_relay/rln, waku_rln_relay/conversion_utils, waku_rln_relay/group_manager/on_chain/group_manager, ], - ../testlib/[wakucore, wakunode, common], - ./utils_onchain, - ./utils + ../testlib/wakucore, + ./utils_onchain suite "Onchain group manager": # We run Anvil diff --git a/tests/waku_rln_relay/test_rln_group_manager_static.nim b/tests/waku_rln_relay/test_rln_group_manager_static.nim index 56b5e8df1..5d1916f63 100644 --- a/tests/waku_rln_relay/test_rln_group_manager_static.nim +++ b/tests/waku_rln_relay/test_rln_group_manager_static.nim @@ -4,7 +4,7 @@ import testutils/unittests, - stew/results, + results, options, waku/[ waku_rln_relay/protocol_types, diff --git a/tests/waku_rln_relay/test_rln_serde.nim b/tests/waku_rln_relay/test_rln_serde.nim index 88badce97..1b1d8cd5f 100644 --- a/tests/waku_rln_relay/test_rln_serde.nim +++ b/tests/waku_rln_relay/test_rln_serde.nim @@ -2,7 +2,7 @@ {.push raises: [].} -import stew/results, stint +import results import ./rln/waku_rln_relay_utils, diff --git a/tests/waku_rln_relay/test_waku_rln_relay.nim b/tests/waku_rln_relay/test_waku_rln_relay.nim index 6768cd782..bc1c3f640 100644 --- a/tests/waku_rln_relay/test_waku_rln_relay.nim +++ b/tests/waku_rln_relay/test_waku_rln_relay.nim @@ -17,7 +17,6 @@ import waku_rln_relay/protocol_metrics, waku_keystore, ], - ../testlib/common, ./rln/waku_rln_relay_utils suite "Waku rln relay": diff --git a/tests/waku_rln_relay/utils.nim b/tests/waku_rln_relay/utils.nim index 7dfeffe65..a4247ab44 100644 --- a/tests/waku_rln_relay/utils.nim +++ b/tests/waku_rln_relay/utils.nim @@ -1,4 +1,4 @@ -import web3, chronos, options, stint, stew/byteutils +import web3, chronos, stew/byteutils proc deployContract*( web3: Web3, code: string, gasPrice = 0, contractInput = "" diff --git a/tests/waku_rln_relay/utils_onchain.nim b/tests/waku_rln_relay/utils_onchain.nim index 788d6742e..82eaf085e 100644 --- a/tests/waku_rln_relay/utils_onchain.nim +++ b/tests/waku_rln_relay/utils_onchain.nim @@ -3,8 +3,9 @@ {.push raises: [].} import - std/[options, os, osproc, sequtils, deques, streams, strutils, tempfiles, strformat], - stew/[results, byteutils], + std/[options, os, osproc, deques, streams, strutils, tempfiles, strformat], + results, + stew/byteutils, testutils/unittests, chronos, chronicles, diff --git a/tests/waku_store/store_utils.nim b/tests/waku_store/store_utils.nim index f652f24b6..779074d7e 100644 --- a/tests/waku_store/store_utils.nim +++ b/tests/waku_store/store_utils.nim @@ -1,10 +1,9 @@ {.used.} -import std/options, chronos, chronicles, libp2p/crypto/crypto +import std/options, chronos import - waku/[node/peer_manager, waku_core, waku_store, waku_store/client], - ../testlib/[common, wakucore] + waku/[node/peer_manager, waku_store, waku_store/client], ../testlib/[common, wakucore] proc newTestWakuStore*( switch: Switch, handler: StoreQueryRequestHandler diff --git a/tests/waku_store/test_client.nim b/tests/waku_store/test_client.nim index 53e95b83e..38b07bdf4 100644 --- a/tests/waku_store/test_client.nim +++ b/tests/waku_store/test_client.nim @@ -1,10 +1,10 @@ {.used.} -import std/options, testutils/unittests, chronos, chronicles, libp2p/crypto/crypto +import std/options, testutils/unittests, chronos, libp2p/crypto/crypto import waku/[node/peer_manager, waku_core, waku_store, waku_store/client, common/paging], - ../testlib/[common, wakucore, testasync, futures], + ../testlib/[wakucore, testasync, futures], ./store_utils suite "Store Client": diff --git a/tests/waku_store/test_waku_store.nim b/tests/waku_store/test_waku_store.nim index b21c66be0..815b3ac7d 100644 --- a/tests/waku_store/test_waku_store.nim +++ b/tests/waku_store/test_waku_store.nim @@ -1,6 +1,6 @@ {.used.} -import std/options, testutils/unittests, chronos, chronicles, libp2p/crypto/crypto +import std/options, testutils/unittests, chronos, libp2p/crypto/crypto import waku/[ @@ -12,7 +12,7 @@ import waku_store/client, waku_store/common, ], - ../testlib/[common, wakucore], + ../testlib/wakucore, ./store_utils suite "Waku Store - query handler": diff --git a/tests/waku_store/test_wakunode_store.nim b/tests/waku_store/test_wakunode_store.nim index 1f48d18f2..1d5e4dcfd 100644 --- a/tests/waku_store/test_wakunode_store.nim +++ b/tests/waku_store/test_wakunode_store.nim @@ -18,10 +18,8 @@ import common/paging, waku_core, waku_core/message/digest, - waku_core/subscription, node/peer_manager, waku_archive, - waku_archive/driver/sqlite_driver, waku_filter_v2, waku_filter_v2/client, waku_store, diff --git a/tests/waku_store_legacy/store_utils.nim b/tests/waku_store_legacy/store_utils.nim index cd6236928..a70ca9376 100644 --- a/tests/waku_store_legacy/store_utils.nim +++ b/tests/waku_store_legacy/store_utils.nim @@ -1,6 +1,6 @@ {.used.} -import std/options, chronos, chronicles, libp2p/crypto/crypto +import std/options, chronos import waku/[node/peer_manager, waku_core, waku_store_legacy, waku_store_legacy/client], diff --git a/tests/waku_store_legacy/test_client.nim b/tests/waku_store_legacy/test_client.nim index 9e403dc21..2a8616375 100644 --- a/tests/waku_store_legacy/test_client.nim +++ b/tests/waku_store_legacy/test_client.nim @@ -1,6 +1,6 @@ {.used.} -import std/options, testutils/unittests, chronos, chronicles, libp2p/crypto/crypto +import std/options, testutils/unittests, chronos, libp2p/crypto/crypto import waku/[ @@ -10,7 +10,7 @@ import waku_store_legacy/client, common/paging, ], - ../testlib/[common, wakucore, testasync, futures], + ../testlib/[wakucore, testasync, futures], ./store_utils suite "Store Client": diff --git a/tests/waku_store_legacy/test_rpc_codec.nim b/tests/waku_store_legacy/test_rpc_codec.nim index dae738d01..6897bab41 100644 --- a/tests/waku_store_legacy/test_rpc_codec.nim +++ b/tests/waku_store_legacy/test_rpc_codec.nim @@ -9,7 +9,6 @@ import waku_store_legacy/rpc, waku_store_legacy/rpc_codec, ], - ../testlib/common, ../testlib/wakucore procSuite "Waku Store - RPC codec": diff --git a/tests/waku_store_legacy/test_waku_store.nim b/tests/waku_store_legacy/test_waku_store.nim index e5e38b208..b8dc835c8 100644 --- a/tests/waku_store_legacy/test_waku_store.nim +++ b/tests/waku_store_legacy/test_waku_store.nim @@ -1,6 +1,6 @@ {.used.} -import std/options, testutils/unittests, chronos, chronicles, libp2p/crypto/crypto +import testutils/unittests, chronos, libp2p/crypto/crypto import waku/[ @@ -10,7 +10,7 @@ import waku_store_legacy, waku_store_legacy/client, ], - ../testlib/[common, wakucore], + ../testlib/wakucore, ./store_utils suite "Waku Store - query handler legacy": diff --git a/tests/waku_store_legacy/test_wakunode_store.nim b/tests/waku_store_legacy/test_wakunode_store.nim index 496ab753e..549033e98 100644 --- a/tests/waku_store_legacy/test_wakunode_store.nim +++ b/tests/waku_store_legacy/test_wakunode_store.nim @@ -3,7 +3,6 @@ import std/net, testutils/unittests, - chronicles, chronos, libp2p/crypto/crypto, libp2p/peerid, diff --git a/tests/waku_store_sync/sync_utils.nim b/tests/waku_store_sync/sync_utils.nim index 20a6bdfb1..a81ad6e2f 100644 --- a/tests/waku_store_sync/sync_utils.nim +++ b/tests/waku_store_sync/sync_utils.nim @@ -1,4 +1,4 @@ -import std/[options, random], chronos, chronicles +import std/[options, random], chronos import waku/[ diff --git a/tests/waku_store_sync/test_protocol.nim b/tests/waku_store_sync/test_protocol.nim index f507ad95b..df14de6a1 100644 --- a/tests/waku_store_sync/test_protocol.nim +++ b/tests/waku_store_sync/test_protocol.nim @@ -1,11 +1,7 @@ {.used.} import - std/[options, sets, random, math], - testutils/unittests, - chronos, - libp2p/crypto/crypto, - stew/byteutils + std/[options, sets, random, math], testutils/unittests, chronos, libp2p/crypto/crypto import ../../waku/[ diff --git a/tests/waku_store_sync/test_storage.nim b/tests/waku_store_sync/test_storage.nim index 034eb260e..9e9a80b29 100644 --- a/tests/waku_store_sync/test_storage.nim +++ b/tests/waku_store_sync/test_storage.nim @@ -4,7 +4,6 @@ import std/[options, random], testutils/unittests, chronos import ../../waku/waku_core, - ../../waku/waku_core/message/digest, ../../waku/waku_store_sync/common, ../../waku/waku_store_sync/storage/seq_storage, ./sync_utils diff --git a/tests/wakunode_rest/test_rest_admin.nim b/tests/wakunode_rest/test_rest_admin.nim index fdb0cbc41..99ddacd8c 100644 --- a/tests/wakunode_rest/test_rest_admin.nim +++ b/tests/wakunode_rest/test_rest_admin.nim @@ -1,7 +1,7 @@ {.used.} import - std/[sequtils, strformat, net], + std/[sequtils, net], stew/shims/net, testutils/unittests, presto, diff --git a/tests/wakunode_rest/test_rest_cors.nim b/tests/wakunode_rest/test_rest_cors.nim index 49b05df16..fc32440d7 100644 --- a/tests/wakunode_rest/test_rest_cors.nim +++ b/tests/wakunode_rest/test_rest_cors.nim @@ -13,10 +13,7 @@ import waku_node, node/waku_node as waku_node2, waku_api/rest/server, - waku_api/rest/client, - waku_api/rest/responses, waku_api/rest/debug/handlers as debug_api, - waku_api/rest/debug/client as debug_api_client, ], ../testlib/common, ../testlib/wakucore, diff --git a/tests/wakunode_rest/test_rest_debug_serdes.nim b/tests/wakunode_rest/test_rest_debug_serdes.nim index bf007b8d2..13b791dc9 100644 --- a/tests/wakunode_rest/test_rest_debug_serdes.nim +++ b/tests/wakunode_rest/test_rest_debug_serdes.nim @@ -1,6 +1,6 @@ {.used.} -import stew/results, stew/byteutils, testutils/unittests, json_serialization +import results, stew/byteutils, testutils/unittests, json_serialization import waku/waku_api/rest/serdes, waku/waku_api/rest/debug/types suite "Waku v2 REST API - Debug - serialization": diff --git a/tests/wakunode_rest/test_rest_filter.nim b/tests/wakunode_rest/test_rest_filter.nim index 60252f92a..358872769 100644 --- a/tests/wakunode_rest/test_rest_filter.nim +++ b/tests/wakunode_rest/test_rest_filter.nim @@ -1,7 +1,6 @@ {.used.} import - std/os, chronos/timer, stew/byteutils, stew/shims/net, diff --git a/tests/wakunode_rest/test_rest_health.nim b/tests/wakunode_rest/test_rest_health.nim index f3b27906e..7d842a3eb 100644 --- a/tests/wakunode_rest/test_rest_health.nim +++ b/tests/wakunode_rest/test_rest_health.nim @@ -23,7 +23,6 @@ import node/health_monitor, ], ../testlib/common, - ../testlib/testutils, ../testlib/wakucore, ../testlib/wakunode diff --git a/tests/wakunode_rest/test_rest_lightpush_legacy.nim b/tests/wakunode_rest/test_rest_lightpush_legacy.nim index 3490a5f80..61d1de88d 100644 --- a/tests/wakunode_rest/test_rest_lightpush_legacy.nim +++ b/tests/wakunode_rest/test_rest_lightpush_legacy.nim @@ -26,8 +26,7 @@ import common/rate_limit/setting, ], ../testlib/wakucore, - ../testlib/wakunode, - ../testlib/testutils + ../testlib/wakunode proc testWakuNode(): WakuNode = let diff --git a/tests/wakunode_rest/test_rest_relay_serdes.nim b/tests/wakunode_rest/test_rest_relay_serdes.nim index 8cc5835f0..086aba22b 100644 --- a/tests/wakunode_rest/test_rest_relay_serdes.nim +++ b/tests/wakunode_rest/test_rest_relay_serdes.nim @@ -1,6 +1,6 @@ {.used.} -import stew/[results, byteutils], chronicles, unittest2, json_serialization +import results, stew/byteutils, unittest2, json_serialization import waku/[common/base64, waku_api/rest/serdes, waku_api/rest/relay/types, waku_core] suite "Waku v2 Rest API - Relay - serialization": diff --git a/tests/wakunode_rest/test_rest_serdes.nim b/tests/wakunode_rest/test_rest_serdes.nim index c50bba983..719742bf8 100644 --- a/tests/wakunode_rest/test_rest_serdes.nim +++ b/tests/wakunode_rest/test_rest_serdes.nim @@ -1,6 +1,6 @@ {.used.} -import stew/[results, byteutils], chronicles, unittest2, json_serialization +import results, stew/byteutils, chronicles, unittest2, json_serialization import waku/waku_api/rest/serdes, waku/waku_api/rest/debug/types # TODO: Decouple this test suite from the `debug_api` module by defining diff --git a/waku.nimble b/waku.nimble index 9c0e819fb..9cf73295f 100644 --- a/waku.nimble +++ b/waku.nimble @@ -23,6 +23,7 @@ requires "nim >= 2.0.8", "web3", "presto", "regex", + "results", "db_connector", "minilru", "quic" diff --git a/waku/common/databases/db_postgres/dbconn.nim b/waku/common/databases/db_postgres/dbconn.nim index 0edb74ede..317cc3003 100644 --- a/waku/common/databases/db_postgres/dbconn.nim +++ b/waku/common/databases/db_postgres/dbconn.nim @@ -1,6 +1,5 @@ import - std/[times, strutils, asyncnet, os, sequtils, sets, strformat], - regex, + std/[times, strutils, os, sets, strformat], results, chronos, chronos/threadsync, diff --git a/waku/factory/builder.nim b/waku/factory/builder.nim index e896ecdbb..caa84db63 100644 --- a/waku/factory/builder.nim +++ b/waku/factory/builder.nim @@ -8,7 +8,6 @@ import libp2p/builders, libp2p/nameresolving/nameresolver, libp2p/transports/wstransport, - libp2p/protocols/connectivity/relay/client, libp2p/protocols/connectivity/relay/relay import ../waku_enr, diff --git a/waku/factory/waku.nim b/waku/factory/waku.nim index 91f3cee2e..9760d1580 100644 --- a/waku/factory/waku.nim +++ b/waku/factory/waku.nim @@ -38,7 +38,6 @@ import ../waku_rln_relay, ../waku_store, ../waku_filter_v2, - ../factory/networks_config, ../factory/node_factory, ../factory/internal_config, ../factory/external_config, diff --git a/waku/incentivization/common.nim b/waku/incentivization/common.nim index 79fcf1645..071b4c18f 100644 --- a/waku/incentivization/common.nim +++ b/waku/incentivization/common.nim @@ -1,6 +1,6 @@ import std/options -import waku/incentivization/[rpc, eligibility_manager] +import waku/incentivization/rpc proc init*(T: type EligibilityStatus, isEligible: bool): T = if isEligible: diff --git a/waku/incentivization/eligibility_manager.nim b/waku/incentivization/eligibility_manager.nim index da8280da3..b10b293e1 100644 --- a/waku/incentivization/eligibility_manager.nim +++ b/waku/incentivization/eligibility_manager.nim @@ -1,6 +1,6 @@ import std/[options, sets], chronos, web3, stew/byteutils, stint, results, chronicles -import waku/incentivization/rpc, tests/waku_rln_relay/[utils_onchain, utils] +import waku/incentivization/rpc, tests/waku_rln_relay/utils_onchain const SimpleTransferGasUsed = Quantity(21000) const TxReceiptQueryTimeout = 3.seconds diff --git a/waku/incentivization/rpc_codec.nim b/waku/incentivization/rpc_codec.nim index 5d3ce48d5..9529ddffe 100644 --- a/waku/incentivization/rpc_codec.nim +++ b/waku/incentivization/rpc_codec.nim @@ -1,5 +1,5 @@ import std/options -import ../common/protobuf, ../waku_core, ./rpc +import ../common/protobuf, ./rpc # Codec for EligibilityProof diff --git a/waku/node/waku_node.nim b/waku/node/waku_node.nim index ae08b503a..18986d5c0 100644 --- a/waku/node/waku_node.nim +++ b/waku/node/waku_node.nim @@ -15,8 +15,6 @@ import libp2p/protocols/ping, libp2p/protocols/pubsub/gossipsub, libp2p/protocols/pubsub/rpc/messages, - libp2p/protocols/connectivity/autonat/client, - libp2p/protocols/connectivity/autonat/service, libp2p/builders, libp2p/transports/transport, libp2p/transports/tcptransport, @@ -50,8 +48,7 @@ import ../waku_rln_relay, ./config, ./peer_manager, - ../common/rate_limit/setting, - ../discovery/autonat_service + ../common/rate_limit/setting declarePublicCounter waku_node_messages, "number of messages received", ["type"] declarePublicHistogram waku_histogram_message_size, diff --git a/waku/waku_api/rest/admin/client.nim b/waku/waku_api/rest/admin/client.nim index 1fd9fdfc8..ebcebe965 100644 --- a/waku/waku_api/rest/admin/client.nim +++ b/waku/waku_api/rest/admin/client.nim @@ -1,13 +1,8 @@ {.push raises: [].} -import - chronicles, - json_serialization, - json_serialization/std/options, - presto/[route, client], - stew/byteutils +import chronicles, json_serialization, presto/[route, client], stew/byteutils -import ../serdes, ../responses, ../rest_serdes, ./types +import ../serdes, ../rest_serdes, ./types export types diff --git a/waku/waku_api/rest/debug/client.nim b/waku/waku_api/rest/debug/client.nim index 7048ae98f..c2d588197 100644 --- a/waku/waku_api/rest/debug/client.nim +++ b/waku/waku_api/rest/debug/client.nim @@ -2,7 +2,7 @@ import chronicles, json_serialization, json_serialization/std/options, presto/[route, client] -import ../serdes, ../responses, ../rest_serdes, ./types +import ../serdes, ../rest_serdes, ./types export types diff --git a/waku/waku_api/rest/filter/client.nim b/waku/waku_api/rest/filter/client.nim index b674bc594..db1a6895e 100644 --- a/waku/waku_api/rest/filter/client.nim +++ b/waku/waku_api/rest/filter/client.nim @@ -2,20 +2,12 @@ import json, - std/sets, stew/byteutils, - strformat, chronicles, json_serialization, json_serialization/std/options, presto/[route, client, common] -import - ../../../common/base64, - ../../../waku_core, - ../serdes, - ../responses, - ../rest_serdes, - ./types +import ../../../common/base64, ../serdes, ../rest_serdes, ./types export types diff --git a/waku/waku_api/rest/health/client.nim b/waku/waku_api/rest/health/client.nim index c6f339006..97f4a2c6d 100644 --- a/waku/waku_api/rest/health/client.nim +++ b/waku/waku_api/rest/health/client.nim @@ -1,8 +1,7 @@ {.push raises: [].} -import - chronicles, json_serialization, json_serialization/std/options, presto/[route, client] -import ./types, ../serdes, ../responses, ../rest_serdes, waku/node/health_monitor +import chronicles, json_serialization, presto/[route, client] +import ./types, ../serdes, ../rest_serdes, waku/node/health_monitor logScope: topics = "waku node rest health_api" diff --git a/waku/waku_api/rest/legacy_lightpush/client.nim b/waku/waku_api/rest/legacy_lightpush/client.nim index f0932e99f..a1e442857 100644 --- a/waku/waku_api/rest/legacy_lightpush/client.nim +++ b/waku/waku_api/rest/legacy_lightpush/client.nim @@ -1,15 +1,7 @@ {.push raises: [].} -import - json, - std/sets, - stew/byteutils, - strformat, - chronicles, - json_serialization, - json_serialization/std/options, - presto/[route, client, common] -import ../../../waku_core, ../serdes, ../responses, ../rest_serdes, ./types +import chronicles, json_serialization, presto/[route, client, common] +import ../serdes, ../rest_serdes, ./types export types diff --git a/waku/waku_api/rest/relay/client.nim b/waku/waku_api/rest/relay/client.nim index 5e72bb609..6956a956d 100644 --- a/waku/waku_api/rest/relay/client.nim +++ b/waku/waku_api/rest/relay/client.nim @@ -1,13 +1,7 @@ {.push raises: [].} -import - std/sets, - stew/byteutils, - chronicles, - json_serialization, - json_serialization/std/options, - presto/[route, client, common] -import ../../../waku_core, ../serdes, ../responses, ../rest_serdes, ./types +import stew/byteutils, chronicles, json_serialization, presto/[route, client, common] +import ../../../waku_core, ../serdes, ../rest_serdes, ./types export types diff --git a/waku/waku_archive/driver/queue_driver/index.nim b/waku/waku_archive/driver/queue_driver/index.nim index 113d426d4..17783ebcc 100644 --- a/waku/waku_archive/driver/queue_driver/index.nim +++ b/waku/waku_archive/driver/queue_driver/index.nim @@ -1,6 +1,5 @@ {.push raises: [].} -import stew/byteutils import ../../../waku_core type Index* = object diff --git a/waku/waku_filter_v2/subscriptions.nim b/waku/waku_filter_v2/subscriptions.nim index 6b22a94b9..8d3b8084f 100644 --- a/waku/waku_filter_v2/subscriptions.nim +++ b/waku/waku_filter_v2/subscriptions.nim @@ -7,12 +7,7 @@ import libp2p/peerid, libp2p/stream/connection, stew/shims/sets -import - ../waku_core, - ../utils/tableutils, - ../common/rate_limit/setting, - ../node/peer_manager, - ./common +import ../waku_core, ../utils/tableutils, ../node/peer_manager logScope: topics = "waku filter subscriptions" diff --git a/waku/waku_lightpush/callbacks.nim b/waku/waku_lightpush/callbacks.nim index d6700412f..3cfc3fe90 100644 --- a/waku/waku_lightpush/callbacks.nim +++ b/waku/waku_lightpush/callbacks.nim @@ -1,12 +1,11 @@ {.push raises: [].} -import stew/results +import results import ../waku_core, ../waku_relay, ./common, - ./protocol_metrics, ../waku_rln_relay, ../waku_rln_relay/protocol_types diff --git a/waku/waku_lightpush/common.nim b/waku/waku_lightpush/common.nim index c9f39cca2..356ccf8f2 100644 --- a/waku/waku_lightpush/common.nim +++ b/waku/waku_lightpush/common.nim @@ -78,5 +78,3 @@ func mapPubishingErrorToPushResult*( some("Error generating message id, skipping publish"), ) ) - else: - return err((LightpushStatusCode.INTERNAL_SERVER_ERROR, none[string]())) diff --git a/waku/waku_lightpush/self_req_handler.nim b/waku/waku_lightpush/self_req_handler.nim index fffced40a..06a0d3715 100644 --- a/waku/waku_lightpush/self_req_handler.nim +++ b/waku/waku_lightpush/self_req_handler.nim @@ -9,15 +9,8 @@ ## which spawn a full service Waku node ## that could be used also as a lightpush client, helping testing and development. -import results, chronos, chronicles, std/options, metrics, stew/byteutils -import - ../waku_core, - ./protocol, - ./common, - ./rpc, - ./rpc_codec, - ./protocol_metrics, - ../utils/requests +import results, chronos, std/options, metrics +import ../waku_core, ./protocol, ./common, ./rpc, ./rpc_codec, ../utils/requests proc handleSelfLightPushRequest*( self: WakuLightPush, pubSubTopic: Option[PubsubTopic], message: WakuMessage diff --git a/waku/waku_noise/noise_types.nim b/waku/waku_noise/noise_types.nim index 3d288a242..3b88c43e8 100644 --- a/waku/waku_noise/noise_types.nim +++ b/waku/waku_noise/noise_types.nim @@ -11,7 +11,7 @@ import std/[options, tables] import chronos import chronicles import bearssl -import nimcrypto/[sha2, hmac] +import nimcrypto/sha2 import libp2p/errors import libp2p/crypto/[crypto, chacha20poly1305, curve25519] diff --git a/waku/waku_noise/noise_utils.nim b/waku/waku_noise/noise_utils.nim index a612c0728..babab1ca4 100644 --- a/waku/waku_noise/noise_utils.nim +++ b/waku/waku_noise/noise_utils.nim @@ -9,8 +9,9 @@ import std/[algorithm, base64, oids, options, strutils, tables, sequtils] import chronos import chronicles import bearssl/rand -import stew/[results, endians2, byteutils] -import nimcrypto/[sha2, hmac] +import results +import stew/[endians2, byteutils] +import nimcrypto/sha2 import libp2p/crypto/[chacha20poly1305, curve25519, hkdf]