From 8bfad3ab453f96ac545c7cb0af06d0c0f34d1356 Mon Sep 17 00:00:00 2001 From: Darshan K <35736874+darshankabariya@users.noreply.github.com> Date: Sat, 6 Jul 2024 03:33:38 +0530 Subject: [PATCH] chore: refactor relative path to better absolute (#2861) --- apps/benchmarks/benchmarks.nim | 12 +++-- apps/chat2/chat2.nim | 26 ++++----- apps/chat2/config_chat2.nim | 2 +- apps/chat2/nim.cfg | 1 + apps/chat2bridge/chat2bridge.nim | 19 ++++--- apps/chat2bridge/nim.cfg | 1 + apps/liteprotocoltester/filter_subscriber.nim | 6 +-- .../lightpush_publisher.nim | 6 +-- .../liteprotocoltester/liteprotocoltester.nim | 14 ++--- apps/liteprotocoltester/tester_config.nim | 12 +++-- apps/networkmonitor/networkmonitor.nim | 22 ++++---- apps/networkmonitor/nim.cfg | 3 +- apps/wakucanary/nim.cfg | 1 + apps/wakucanary/wakucanary.nim | 6 +-- apps/wakunode2/nim.cfg | 1 + apps/wakunode2/wakunode2.nim | 14 ++--- examples/filter_subscriber.nim | 6 +-- examples/lightpush_publisher.nim | 6 +-- examples/nim.cfg | 1 + examples/publisher.nim | 16 +++--- examples/subscriber.nim | 18 ++++--- examples/wakustealthcommitments/nim.cfg | 1 + examples/wakustealthcommitments/node_spec.nim | 2 +- .../stealth_commitment_protocol.nim | 6 +-- examples/wakustealthcommitments/wire_spec.nim | 2 +- tests/common/test_base64_codec.nim | 2 +- tests/common/test_confutils_envvar.nim | 4 +- tests/common/test_enr_builder.nim | 2 +- tests/common/test_envvar_serialization.nim | 2 +- tests/common/test_parse_size.nim | 2 +- tests/common/test_protobuf_validation.nim | 2 +- tests/common/test_sqlite_migrations.nim | 2 +- tests/factory/test_node_factory.nim | 2 +- tests/incentivization/test_rpc_codec.nim | 35 +++++------- tests/nim.cfg | 1 + .../peer_store/test_migrations.nim | 4 +- .../peer_store/test_peer_storage.nim | 4 +- .../peer_store/test_waku_peer_storage.nim | 4 +- tests/node/peer_manager/peer_store/utils.nim | 2 +- tests/node/peer_manager/test_peer_manager.nim | 5 +- tests/node/test_wakunode_filter.nim | 2 +- tests/node/test_wakunode_legacy_store.nim | 2 +- tests/node/test_wakunode_lightpush.nim | 21 ++++---- tests/node/test_wakunode_peer_exchange.nim | 2 +- tests/node/test_wakunode_peer_manager.nim | 2 +- tests/node/test_wakunode_relay_rln.nim | 3 +- tests/node/test_wakunode_sharding.nim | 4 +- tests/node/test_wakunode_store.nim | 2 +- tests/node/utils.nim | 3 +- tests/test_message_cache.nim | 2 +- tests/test_peer_manager.nim | 26 ++++----- tests/test_peer_storage.nim | 10 ++-- tests/test_peer_store_extended.nim | 4 +- tests/test_relay_peer_exchange.nim | 3 +- tests/test_utils_compat.nim | 6 +-- tests/test_waku_dnsdisc.nim | 6 +-- tests/test_waku_enr.nim | 2 +- tests/test_waku_keepalive.nim | 3 +- tests/test_waku_keystore.nim | 4 +- tests/test_waku_keystore_keyfile.nim | 4 +- tests/test_waku_metadata.nim | 13 +++-- tests/test_waku_netconfig.nim | 4 +- tests/test_waku_noise.nim | 14 ++--- tests/test_waku_noise_sessions.nim | 14 ++--- tests/test_waku_protobufs.nim | 5 +- tests/test_waku_rendezvous.nim | 2 +- tests/test_waku_switch.nim | 2 +- tests/test_wakunode.nim | 6 +-- tests/test_wakunode_lightpush.nim | 5 +- tests/testlib/futures.nim | 2 +- tests/testlib/postgres.nim | 10 ++-- tests/testlib/tables.nim | 2 +- tests/testlib/wakucore.nim | 2 +- tests/testlib/wakunode.nim | 18 ++++--- tests/waku_archive/archive_utils.nim | 2 +- tests/waku_archive/test_driver_postgres.nim | 10 ++-- .../test_driver_postgres_query.nim | 12 +++-- tests/waku_archive/test_driver_queue.nim | 10 ++-- .../waku_archive/test_driver_queue_index.nim | 2 +- .../test_driver_queue_pagination.nim | 10 ++-- .../waku_archive/test_driver_queue_query.nim | 11 ++-- tests/waku_archive/test_driver_sqlite.nim | 10 ++-- .../waku_archive/test_driver_sqlite_query.nim | 12 +++-- tests/waku_archive/test_partition_manager.nim | 4 +- tests/waku_archive/test_retention_policy.nim | 18 ++++--- tests/waku_archive/test_waku_archive.nim | 14 ++--- tests/waku_core/test_message_digest.nim | 2 +- tests/waku_core/test_namespaced_topics.nim | 2 +- tests/waku_core/test_peers.nim | 2 +- tests/waku_core/test_time.nim | 2 +- tests/waku_core/topics/test_pubsub_topic.nim | 2 +- tests/waku_core/topics/test_sharding.nim | 2 +- tests/waku_discv5/test_waku_discv5.nim | 2 +- tests/waku_discv5/utils.nim | 2 +- tests/waku_enr/test_sharding.nim | 2 +- tests/waku_enr/utils.nim | 2 +- tests/waku_filter_v2/test_waku_client.nim | 5 +- .../test_waku_filter_protocol.nim | 12 +++-- tests/waku_filter_v2/waku_filter_utils.nim | 2 +- tests/waku_lightpush/lightpush_utils.nim | 8 +-- tests/waku_lightpush/test_client.nim | 2 +- tests/waku_lightpush/test_ratelimit.nim | 2 +- tests/waku_peer_exchange/test_protocol.nim | 2 +- tests/waku_peer_exchange/test_rpc_codec.nim | 2 +- tests/waku_peer_exchange/utils.nim | 2 +- tests/waku_relay/test_message_id.nim | 2 +- tests/waku_relay/test_protocol.nim | 2 +- tests/waku_relay/test_wakunode_relay.nim | 5 +- tests/waku_relay/utils.nim | 2 +- tests/waku_rln_relay/rln/buffer_utils.nim | 2 +- .../waku_rln_relay/rln/test_rln_interface.nim | 2 +- tests/waku_rln_relay/rln/test_wrappers.nim | 4 +- .../rln/waku_rln_relay_utils.nim | 3 +- .../test_rln_group_manager_onchain.nim | 54 ++++++++++++------- .../test_rln_group_manager_static.nim | 18 ++++--- .../waku_rln_relay/test_rln_nonce_manager.nim | 2 +- tests/waku_rln_relay/test_rln_serde.nim | 4 +- tests/waku_rln_relay/test_waku_rln_relay.nim | 33 +++++++----- .../test_wakunode_rln_relay.nim | 6 +-- tests/waku_store/store_utils.nim | 2 +- tests/waku_store/test_client.nim | 3 +- tests/waku_store/test_rpc_codec.nim | 7 +-- tests/waku_store/test_waku_store.nim | 2 +- tests/waku_store/test_wakunode_store.nim | 24 +++++---- tests/waku_store_legacy/store_utils.nim | 3 +- tests/waku_store_legacy/test_client.nim | 2 +- tests/waku_store_legacy/test_resume.nim | 16 +++--- tests/waku_store_legacy/test_rpc_codec.nim | 12 +++-- tests/waku_store_legacy/test_waku_store.nim | 2 +- .../waku_store_legacy/test_wakunode_store.nim | 26 ++++----- tests/wakunode2/test_app.nim | 7 +-- tests/wakunode2/test_validators.nim | 14 ++--- tests/wakunode_rest/test_rest_admin.nim | 24 +++++---- tests/wakunode_rest/test_rest_cors.nim | 16 +++--- tests/wakunode_rest/test_rest_debug.nim | 18 ++++--- .../wakunode_rest/test_rest_debug_serdes.nim | 2 +- tests/wakunode_rest/test_rest_filter.nim | 32 +++++------ tests/wakunode_rest/test_rest_health.nim | 22 ++++---- tests/wakunode_rest/test_rest_lightpush.nim | 28 +++++----- tests/wakunode_rest/test_rest_relay.nim | 26 ++++----- .../wakunode_rest/test_rest_relay_serdes.nim | 6 +-- tests/wakunode_rest/test_rest_serdes.nim | 2 +- tests/wakunode_rest/test_rest_store.nim | 38 ++++++------- tools/rln_db_inspector/rln_db_inspector.nim | 4 +- .../rln_keystore_generator.nim | 13 ++--- waku/factory/waku.nim | 36 ++++++------- 146 files changed, 617 insertions(+), 568 deletions(-) diff --git a/apps/benchmarks/benchmarks.nim b/apps/benchmarks/benchmarks.nim index c3930aef9a..986ffb3761 100644 --- a/apps/benchmarks/benchmarks.nim +++ b/apps/benchmarks/benchmarks.nim @@ -3,11 +3,13 @@ import std/sequtils, stew/results, options, - ../../waku/waku_rln_relay/protocol_types, - ../../waku/waku_rln_relay/rln, - ../../waku/waku_rln_relay, - ../../waku/waku_rln_relay/conversion_utils, - ../../waku/waku_rln_relay/group_manager/static/group_manager + waku/[ + waku_rln_relay/protocol_types, + waku_rln_relay/rln, + waku_rln_relay, + waku_rln_relay/conversion_utils, + waku_rln_relay/group_manager/static/group_manager, + ] import std/[times, os] diff --git a/apps/chat2/chat2.nim b/apps/chat2/chat2.nim index 20a6929036..573dd561f2 100644 --- a/apps/chat2/chat2.nim +++ b/apps/chat2/chat2.nim @@ -31,18 +31,20 @@ import nameresolving/dnsresolver, ] # define DNS resolution import - ../../waku/waku_core, - ../../waku/waku_lightpush/common, - ../../waku/waku_lightpush/rpc, - ../../waku/waku_enr, - ../../waku/discovery/waku_dnsdisc, - ../../waku/waku_store_legacy, - ../../waku/waku_node, - ../../waku/node/waku_metrics, - ../../waku/node/peer_manager, - ../../waku/factory/builder, - ../../waku/common/utils/nat, - ../../waku/waku_relay, + waku/[ + waku_core, + waku_lightpush/common, + waku_lightpush/rpc, + waku_enr, + discovery/waku_dnsdisc, + waku_store_legacy, + waku_node, + node/waku_metrics, + node/peer_manager, + factory/builder, + common/utils/nat, + waku_relay, + ], ./config_chat2 import libp2p/protocols/pubsub/rpc/messages, libp2p/protocols/pubsub/pubsub diff --git a/apps/chat2/config_chat2.nim b/apps/chat2/config_chat2.nim index ae32d9d3e4..8426396ab5 100644 --- a/apps/chat2/config_chat2.nim +++ b/apps/chat2/config_chat2.nim @@ -10,7 +10,7 @@ import nimcrypto/utils, std/strutils, regex -import ../../../waku/waku_core +import waku/waku_core type Fleet* = enum diff --git a/apps/chat2/nim.cfg b/apps/chat2/nim.cfg index 8c4e50e3ff..2231f2ebed 100644 --- a/apps/chat2/nim.cfg +++ b/apps/chat2/nim.cfg @@ -1,3 +1,4 @@ -d:chronicles_line_numbers -d:chronicles_runtime_filtering:on -d:discv5_protocol_id:d5waku +path = "../.." diff --git a/apps/chat2bridge/chat2bridge.nim b/apps/chat2bridge/chat2bridge.nim index 2e30aaaa2f..24533821d2 100644 --- a/apps/chat2bridge/chat2bridge.nim +++ b/apps/chat2bridge/chat2bridge.nim @@ -13,16 +13,18 @@ import eth/net/nat, json_rpc/rpcserver, # Matterbridge client imports - ../../waku/common/utils/matterbridge_client, # Waku v2 imports libp2p/crypto/crypto, libp2p/errors, - ../../../waku/waku_core, - ../../../waku/waku_node, - ../../../waku/node/peer_manager, - ../../waku/waku_filter_v2, - ../../waku/waku_store, - ../../waku/factory/builder, + waku/[ + waku_core, + waku_node, + node/peer_manager, + waku_filter_v2, + waku_store, + factory/builder, + common/utils/matterbridge_client, + ], # Chat 2 imports ../chat2/chat2, # Common cli config @@ -178,6 +180,7 @@ proc new*( let nodev2 = block: var builder = WakuNodeBuilder.init() builder.withNodeKey(nodev2Key) + builder .withNetworkConfigurationDetails( nodev2BindIp, nodev2BindPort, nodev2ExtIp, nodev2ExtPort @@ -239,7 +242,7 @@ proc stop*(cmb: Chat2MatterBridge) {.async: (raises: [Exception]).} = {.pop.} # @TODO confutils.nim(775, 17) Error: can raise an unlisted exception: ref IOError when isMainModule: - import ../../../waku/common/utils/nat, ../../waku/waku_api/message_cache + import waku/common/utils/nat, waku/waku_api/message_cache let rng = newRng() diff --git a/apps/chat2bridge/nim.cfg b/apps/chat2bridge/nim.cfg index 8c4e50e3ff..2231f2ebed 100644 --- a/apps/chat2bridge/nim.cfg +++ b/apps/chat2bridge/nim.cfg @@ -1,3 +1,4 @@ -d:chronicles_line_numbers -d:chronicles_runtime_filtering:on -d:discv5_protocol_id:d5waku +path = "../.." diff --git a/apps/liteprotocoltester/filter_subscriber.nim b/apps/liteprotocoltester/filter_subscriber.nim index ee77708451..e63d3be3c6 100644 --- a/apps/liteprotocoltester/filter_subscriber.nim +++ b/apps/liteprotocoltester/filter_subscriber.nim @@ -13,11 +13,7 @@ import json_serialization as js, times import - ../../../waku/common/logging, - ../../../waku/node/peer_manager, - ../../../waku/waku_node, - ../../../waku/waku_core, - ../../../waku/waku_filter_v2/client, + waku/[common/logging, node/peer_manager, waku_node, waku_core, waku_filter_v2/client], ./tester_config, ./tester_message, ./statistics diff --git a/apps/liteprotocoltester/lightpush_publisher.nim b/apps/liteprotocoltester/lightpush_publisher.nim index 0dd0b56fe2..f9e4c11e1b 100644 --- a/apps/liteprotocoltester/lightpush_publisher.nim +++ b/apps/liteprotocoltester/lightpush_publisher.nim @@ -7,11 +7,7 @@ import stew/results, json_serialization as js import - ../../../waku/common/logging, - ../../../waku/waku_node, - ../../../waku/node/peer_manager, - ../../../waku/waku_core, - ../../../waku/waku_lightpush/client, + waku/[common/logging, waku_node, node/peer_manager, waku_core, waku_lightpush/client], ./tester_config, ./tester_message diff --git a/apps/liteprotocoltester/liteprotocoltester.nim b/apps/liteprotocoltester/liteprotocoltester.nim index d63003be33..0fb2a9c699 100644 --- a/apps/liteprotocoltester/liteprotocoltester.nim +++ b/apps/liteprotocoltester/liteprotocoltester.nim @@ -11,12 +11,14 @@ import confutils import - ../../waku/common/logging, - ../../waku/factory/waku, - ../../waku/factory/external_config, - ../../waku/node/health_monitor, - ../../waku/node/waku_metrics, - ../../waku/waku_api/rest/builder as rest_server_builder, + waku/[ + common/logging, + factory/waku, + factory/external_config, + node/health_monitor, + node/waku_metrics, + waku_api/rest/builder as rest_server_builder, + ], ./tester_config, ./lightpush_publisher, ./filter_subscriber diff --git a/apps/liteprotocoltester/tester_config.nim b/apps/liteprotocoltester/tester_config.nim index 8f9a8c0503..e7f4d69df1 100644 --- a/apps/liteprotocoltester/tester_config.nim +++ b/apps/liteprotocoltester/tester_config.nim @@ -15,11 +15,13 @@ import secp256k1, json import - ../../waku/common/confutils/envvar/defs as confEnvvarDefs, - ../../waku/common/confutils/envvar/std/net as confEnvvarNet, - ../../waku/common/logging, - ../../waku/factory/external_config, - ../../waku/waku_core + waku/[ + common/confutils/envvar/defs as confEnvvarDefs, + common/confutils/envvar/std/net as confEnvvarNet, + common/logging, + factory/external_config, + waku/waku_core, + ] export confTomlDefs, confTomlNet, confEnvvarDefs, confEnvvarNet diff --git a/apps/networkmonitor/networkmonitor.nim b/apps/networkmonitor/networkmonitor.nim index fa21c231be..1d392bea46 100644 --- a/apps/networkmonitor/networkmonitor.nim +++ b/apps/networkmonitor/networkmonitor.nim @@ -18,16 +18,18 @@ import metrics/chronos_httpserver, presto/[route, server, client] import - ../../waku/waku_core, - ../../waku/node/peer_manager, - ../../waku/waku_node, - ../../waku/waku_enr, - ../../waku/discovery/waku_discv5, - ../../waku/discovery/waku_dnsdisc, - ../../waku/waku_relay, - ../../waku/waku_rln_relay, - ../../waku/factory/builder, - ../../waku/factory/networks_config, + waku/[ + waku_core, + node/peer_manager, + waku_node, + waku_enr, + discovery/waku_discv5, + discovery/waku_dnsdisc, + waku_relay, + waku_rln_relay, + factory/builder, + factory/networks_config, + ], ./networkmonitor_metrics, ./networkmonitor_config, ./networkmonitor_utils diff --git a/apps/networkmonitor/nim.cfg b/apps/networkmonitor/nim.cfg index 8d66f42d3d..2231f2ebed 100644 --- a/apps/networkmonitor/nim.cfg +++ b/apps/networkmonitor/nim.cfg @@ -1,3 +1,4 @@ -d:chronicles_line_numbers -d:chronicles_runtime_filtering:on --d:discv5_protocol_id:d5waku \ No newline at end of file +-d:discv5_protocol_id:d5waku +path = "../.." diff --git a/apps/wakucanary/nim.cfg b/apps/wakucanary/nim.cfg index 8c4e50e3ff..2231f2ebed 100644 --- a/apps/wakucanary/nim.cfg +++ b/apps/wakucanary/nim.cfg @@ -1,3 +1,4 @@ -d:chronicles_line_numbers -d:chronicles_runtime_filtering:on -d:discv5_protocol_id:d5waku +path = "../.." diff --git a/apps/wakucanary/wakucanary.nim b/apps/wakucanary/wakucanary.nim index 8aa75affd0..a67534f44d 100644 --- a/apps/wakucanary/wakucanary.nim +++ b/apps/wakucanary/wakucanary.nim @@ -12,11 +12,7 @@ import libp2p/multicodec import ./certsgenerator, - ../../waku/waku_enr, - ../../waku/node/peer_manager, - ../../waku/waku_core, - ../../waku/waku_node, - ../../waku/factory/builder + waku/[waku_enr, node/peer_manager, waku_core, waku_node, factory/builder] # protocols and their tag const ProtocolsTable = { diff --git a/apps/wakunode2/nim.cfg b/apps/wakunode2/nim.cfg index e51857e21f..a6fab9c9be 100644 --- a/apps/wakunode2/nim.cfg +++ b/apps/wakunode2/nim.cfg @@ -7,3 +7,4 @@ -d:chronicles_disabled_topics="eth,dnsdisc.client" # Results in empty output for some reason #-d:"chronicles_enabled_topics=GossipSub:TRACE,WakuRelay:TRACE" +path = "../.." diff --git a/apps/wakunode2/wakunode2.nim b/apps/wakunode2/wakunode2.nim index b5f165c0d4..afa84f6537 100644 --- a/apps/wakunode2/wakunode2.nim +++ b/apps/wakunode2/wakunode2.nim @@ -11,12 +11,14 @@ import import ../../tools/rln_keystore_generator/rln_keystore_generator, ../../tools/rln_db_inspector/rln_db_inspector, - ../../waku/common/logging, - ../../waku/factory/external_config, - ../../waku/factory/waku, - ../../waku/node/health_monitor, - ../../waku/node/waku_metrics, - ../../waku/waku_api/rest/builder as rest_server_builder + waku/[ + common/logging, + factory/external_config, + factory/waku, + node/health_monitor, + node/waku_metrics, + waku_api/rest/builder as rest_server_builder, + ] logScope: topics = "wakunode main" diff --git a/examples/filter_subscriber.nim b/examples/filter_subscriber.nim index 9f850a8799..0a3adfb06e 100644 --- a/examples/filter_subscriber.nim +++ b/examples/filter_subscriber.nim @@ -2,11 +2,7 @@ ## subscribe to messages without relay import chronicles, chronos, stew/byteutils, stew/results -import - ../../../waku/common/logging, - ../../../waku/node/peer_manager, - ../../../waku/waku_core, - ../../../waku/waku_filter_v2/client +import waku/[common/logging, node/peer_manager, waku_core, waku_filter_v2/client] const FilterPeer = diff --git a/examples/lightpush_publisher.nim b/examples/lightpush_publisher.nim index 8dee61fd1b..240fab3d1d 100644 --- a/examples/lightpush_publisher.nim +++ b/examples/lightpush_publisher.nim @@ -2,11 +2,7 @@ ## use lightpush to publish messages without relay import chronicles, chronos, stew/byteutils, stew/results -import - ../../../waku/common/logging, - ../../../waku/node/peer_manager, - ../../../waku/waku_core, - ../../../waku/waku_lightpush/client +import waku/[common/logging, node/peer_manager, waku_core, waku_lightpush/client] const LightpushPeer = diff --git a/examples/nim.cfg b/examples/nim.cfg index 7fd1b74008..2f8d45494f 100644 --- a/examples/nim.cfg +++ b/examples/nim.cfg @@ -2,3 +2,4 @@ -d:chronicles_log_level="DEBUG" -d:chronicles_runtime_filtering=on -d:discv5_protocol_id="d5waku" +path = "../" diff --git a/examples/publisher.nim b/examples/publisher.nim index c266cda9f8..de0f83a3fd 100644 --- a/examples/publisher.nim +++ b/examples/publisher.nim @@ -10,13 +10,15 @@ import eth/p2p/discoveryv5/enr import - ../../../waku/common/logging, - ../../../waku/node/peer_manager, - ../../../waku/waku_core, - ../../../waku/waku_node, - ../../../waku/waku_enr, - ../../../waku/discovery/waku_discv5, - ../../../waku/factory/builder + waku/[ + common/logging, + node/peer_manager, + waku_core, + waku_node, + waku_enr, + discovery/waku_discv5, + factory/builder, + ] proc now*(): Timestamp = getNanosecondTime(getTime().toUnixFloat()) diff --git a/examples/subscriber.nim b/examples/subscriber.nim index 45f06e1b9b..c569afcb70 100644 --- a/examples/subscriber.nim +++ b/examples/subscriber.nim @@ -10,14 +10,16 @@ import eth/p2p/discoveryv5/enr import - ../../../waku/common/logging, - ../../../waku/node/peer_manager, - ../../../waku/waku_core, - ../../../waku/waku_node, - ../../../waku/waku_enr, - ../../../waku/discovery/waku_discv5, - ../../../waku/factory/builder, - ../../../waku/waku_relay + waku/[ + common/logging, + node/peer_manager, + waku_core, + waku_node, + waku_enr, + discovery/waku_discv5, + factory/builder, + waku_relay, + ] # An accesible bootstrap node. See waku.sandbox fleets.status.im const bootstrapNode = diff --git a/examples/wakustealthcommitments/nim.cfg b/examples/wakustealthcommitments/nim.cfg index fd55a3e995..219c620caa 100644 --- a/examples/wakustealthcommitments/nim.cfg +++ b/examples/wakustealthcommitments/nim.cfg @@ -8,3 +8,4 @@ -d:chronicles_log_level=INFO # Results in empty output for some reason #-d:"chronicles_enabled_topics=GossipSub:TRACE,WakuRelay:TRACE" +path = "../../" diff --git a/examples/wakustealthcommitments/node_spec.nim b/examples/wakustealthcommitments/node_spec.nim index 85289b32a8..6edb66cc3a 100644 --- a/examples/wakustealthcommitments/node_spec.nim +++ b/examples/wakustealthcommitments/node_spec.nim @@ -1,7 +1,7 @@ {.push raises: [].} import - ../../waku/common/logging, ../../waku/factory/[waku, networks_config, external_config] + waku/[common/logging, factory/[waku, networks_config, external_config]] import std/[options, strutils, os, sequtils], stew/shims/net as stewNet, diff --git a/examples/wakustealthcommitments/stealth_commitment_protocol.nim b/examples/wakustealthcommitments/stealth_commitment_protocol.nim index 3a50297a99..41062def03 100644 --- a/examples/wakustealthcommitments/stealth_commitment_protocol.nim +++ b/examples/wakustealthcommitments/stealth_commitment_protocol.nim @@ -2,9 +2,9 @@ import stew/results, - ../../waku/common/logging, - ../../waku/waku_node, - ../../waku/waku_rln_relay, + waku/[common/logging, + waku_node, + waku_rln_relay,], ./erc_5564_interface as StealthCommitmentFFI, ./node_spec, ./wire_spec diff --git a/examples/wakustealthcommitments/wire_spec.nim b/examples/wakustealthcommitments/wire_spec.nim index 5e6c4355ff..38cc95feb8 100644 --- a/examples/wakustealthcommitments/wire_spec.nim +++ b/examples/wakustealthcommitments/wire_spec.nim @@ -1,7 +1,7 @@ import std/[times, options] import confutils, chronicles, chronos, stew/results -import ../../waku/waku_core, ../../waku/common/protobuf +import waku/[waku_core, common/protobuf] import libp2p/protobuf/minprotobuf export diff --git a/tests/common/test_base64_codec.nim b/tests/common/test_base64_codec.nim index 1f34e87f12..fd3b23c76f 100644 --- a/tests/common/test_base64_codec.nim +++ b/tests/common/test_base64_codec.nim @@ -1,7 +1,7 @@ {.used.} import std/strutils, stew/[results, byteutils], testutils/unittests -import ../../waku/common/base64 +import waku/common/base64 suite "Waku Common - stew base64 wrapper": const TestData = diff --git a/tests/common/test_confutils_envvar.nim b/tests/common/test_confutils_envvar.nim index 907819b37d..6916f52a89 100644 --- a/tests/common/test_confutils_envvar.nim +++ b/tests/common/test_confutils_envvar.nim @@ -9,8 +9,8 @@ import confutils/defs, confutils/std/net import - ../../waku/common/confutils/envvar/defs as confEnvvarDefs, - ../../waku/common/confutils/envvar/std/net as confEnvvarNet + waku/common/confutils/envvar/defs as confEnvvarDefs, + waku/common/confutils/envvar/std/net as confEnvvarNet type ConfResult[T] = Result[T, string] diff --git a/tests/common/test_enr_builder.nim b/tests/common/test_enr_builder.nim index 67eed3c7c9..6320c64032 100644 --- a/tests/common/test_enr_builder.nim +++ b/tests/common/test_enr_builder.nim @@ -1,7 +1,7 @@ {.used.} import std/options, stew/results, stew/shims/net, testutils/unittests -import ../../waku/common/enr, ../testlib/wakucore +import waku/common/enr, ../testlib/wakucore suite "nim-eth ENR - builder and typed record": test "Non-supported private key (ECDSA)": diff --git a/tests/common/test_envvar_serialization.nim b/tests/common/test_envvar_serialization.nim index 2c0e97419e..3a46ac537f 100644 --- a/tests/common/test_envvar_serialization.nim +++ b/tests/common/test_envvar_serialization.nim @@ -1,7 +1,7 @@ {.used.} import testutils/unittests -import ../../waku/common/envvar_serialization/utils +import waku/common/envvar_serialization/utils suite "nim-envvar-serialization - utils": test "construct env var key": diff --git a/tests/common/test_parse_size.nim b/tests/common/test_parse_size.nim index ef274f04ed..dd1f2c7af2 100644 --- a/tests/common/test_parse_size.nim +++ b/tests/common/test_parse_size.nim @@ -1,7 +1,7 @@ {.used.} import testutils/unittests, stew/results -import ../../waku/common/utils/parse_size_units +import waku/common/utils/parse_size_units suite "Size serialization test": test "parse normal sizes": diff --git a/tests/common/test_protobuf_validation.nim b/tests/common/test_protobuf_validation.nim index 2000768171..30254d3d42 100644 --- a/tests/common/test_protobuf_validation.nim +++ b/tests/common/test_protobuf_validation.nim @@ -1,7 +1,7 @@ {.used.} import testutils/unittests -import ../../waku/common/protobuf +import waku/common/protobuf ## Fixtures diff --git a/tests/common/test_sqlite_migrations.nim b/tests/common/test_sqlite_migrations.nim index 3a95e50094..58708ce21f 100644 --- a/tests/common/test_sqlite_migrations.nim +++ b/tests/common/test_sqlite_migrations.nim @@ -1,7 +1,7 @@ {.used.} import std/[strutils, os], stew/results, testutils/unittests -import ../../waku/common/databases/db_sqlite {.all.}, ../waku_archive/archive_utils +import waku/common/databases/db_sqlite {.all.}, ../waku_archive/archive_utils template sourceDir(): string = currentSourcePath.rsplit(DirSep, 1)[0] diff --git a/tests/factory/test_node_factory.nim b/tests/factory/test_node_factory.nim index c06ba792ee..0b68338e23 100644 --- a/tests/factory/test_node_factory.nim +++ b/tests/factory/test_node_factory.nim @@ -2,7 +2,7 @@ import testutils/unittests, chronos -import ../testlib/wakunode, ../../waku/factory/node_factory, ../../waku/waku_node +import ../testlib/wakunode, waku/factory/node_factory, waku/waku_node suite "Node Factory": test "Set up a node based on default configurations": diff --git a/tests/incentivization/test_rpc_codec.nim b/tests/incentivization/test_rpc_codec.nim index 11c8040162..803796dbd5 100644 --- a/tests/incentivization/test_rpc_codec.nim +++ b/tests/incentivization/test_rpc_codec.nim @@ -6,27 +6,20 @@ import chronos, libp2p/crypto/crypto -import - ../../../waku/incentivization/rpc, - ../../../waku/incentivization/rpc_codec - +import waku/incentivization/rpc, waku/incentivization/rpc_codec suite "Waku Incentivization Eligibility Codec": + asyncTest "encode eligibility proof": + var byteSequence: seq[byte] = @[1, 2, 3, 4, 5, 6, 7, 8] + let epRpc = EligibilityProof(proofOfPayment: some(byteSequence)) + let encoded = encode(epRpc) + let decoded = EligibilityProof.decode(encoded.buffer).get() + check: + epRpc == decoded - asyncTest "encode eligibility proof": - var byteSequence: seq[byte] = @[1, 2, 3, 4, 5, 6, 7, 8] - let epRpc = EligibilityProof(proofOfPayment: some(byteSequence)) - let encoded = encode(epRpc) - let decoded = EligibilityProof.decode(encoded.buffer).get() - check: - epRpc == decoded - - asyncTest "encode eligibility status": - let esRpc = EligibilityStatus( - statusCode: uint32(200), - statusDesc: some("OK") - ) - let encoded = encode(esRpc) - let decoded = EligibilityStatus.decode(encoded.buffer).get() - check: - esRpc == decoded + asyncTest "encode eligibility status": + let esRpc = EligibilityStatus(statusCode: uint32(200), statusDesc: some("OK")) + let encoded = encode(esRpc) + let decoded = EligibilityStatus.decode(encoded.buffer).get() + check: + esRpc == decoded diff --git a/tests/nim.cfg b/tests/nim.cfg index a196b51612..e09f88d00b 100644 --- a/tests/nim.cfg +++ b/tests/nim.cfg @@ -1,2 +1,3 @@ -d:chronicles_line_numbers -d:discv5_protocol_id=d5waku +path = "../" diff --git a/tests/node/peer_manager/peer_store/test_migrations.nim b/tests/node/peer_manager/peer_store/test_migrations.nim index 3f782589a9..a20d065ec7 100644 --- a/tests/node/peer_manager/peer_store/test_migrations.nim +++ b/tests/node/peer_manager/peer_store/test_migrations.nim @@ -1,13 +1,13 @@ import std/[options], stew/results, testutils/unittests import - ../../../../waku/[node/peer_manager/peer_store/migrations], + waku/node/peer_manager/peer_store/migrations, ../../waku_archive/archive_utils, ../../testlib/[simple_mock] import std/[tables, strutils, os], stew/results, chronicles -import ../../../../waku/[common/databases/db_sqlite, common/databases/common] +import waku/common/databases/db_sqlite, waku/common/databases/common suite "Migrations": test "migrate ok": diff --git a/tests/node/peer_manager/peer_store/test_peer_storage.nim b/tests/node/peer_manager/peer_store/test_peer_storage.nim index 6cb6a0bf51..c8a4791786 100644 --- a/tests/node/peer_manager/peer_store/test_peer_storage.nim +++ b/tests/node/peer_manager/peer_store/test_peer_storage.nim @@ -1,8 +1,6 @@ import stew/results, testutils/unittests -import - ../../../../waku/node/peer_manager/peer_store/peer_storage, - ../../../../waku/waku_core/peers +import waku/node/peer_manager/peer_store/peer_storage, waku/waku_core/peers suite "PeerStorage": var peerStorage {.threadvar.}: PeerStorage diff --git a/tests/node/peer_manager/peer_store/test_waku_peer_storage.nim b/tests/node/peer_manager/peer_store/test_waku_peer_storage.nim index 807aa2655a..1edd9243ee 100644 --- a/tests/node/peer_manager/peer_store/test_waku_peer_storage.nim +++ b/tests/node/peer_manager/peer_store/test_waku_peer_storage.nim @@ -8,9 +8,7 @@ import eth/p2p/discoveryv5/enr, nimcrypto/utils -import - ../../../../waku/waku_core/peers, - ../../../../waku/node/peer_manager/peer_store/waku_peer_storage +import waku/waku_core/peers, waku/node/peer_manager/peer_store/waku_peer_storage proc `==`(a, b: RemotePeerInfo): bool = let comparisons = diff --git a/tests/node/peer_manager/peer_store/utils.nim b/tests/node/peer_manager/peer_store/utils.nim index 8c631b5080..1d5dc6e227 100644 --- a/tests/node/peer_manager/peer_store/utils.nim +++ b/tests/node/peer_manager/peer_store/utils.nim @@ -1,7 +1,7 @@ import std/options, stew/results, libp2p/peerstore import - ../../../../waku/node/peer_manager/[waku_peer_store, peer_store/waku_peer_storage], + waku/node/peer_manager/[waku_peer_store, peer_store/waku_peer_storage], ../../../waku_archive/archive_utils proc newTestWakuPeerStorage*(path: Option[string] = string.none()): WakuPeerStorage = diff --git a/tests/node/peer_manager/test_peer_manager.nim b/tests/node/peer_manager/test_peer_manager.nim index 02dd6802bd..f74a6c584a 100644 --- a/tests/node/peer_manager/test_peer_manager.nim +++ b/tests/node/peer_manager/test_peer_manager.nim @@ -6,10 +6,11 @@ import testutils/unittests import - ../../../waku/[node/waku_node, waku_core], + waku/node/waku_node, + waku/waku_core, ../../waku_lightpush/[lightpush_utils], ../../testlib/[wakucore, wakunode, futures, testasync], - ../../../../waku/node/peer_manager/peer_manager + waku/node/peer_manager/peer_manager suite "Peer Manager": suite "onPeerMetadata": diff --git a/tests/node/test_wakunode_filter.nim b/tests/node/test_wakunode_filter.nim index 6bc5542320..8580538fa2 100644 --- a/tests/node/test_wakunode_filter.nim +++ b/tests/node/test_wakunode_filter.nim @@ -10,7 +10,7 @@ import libp2p/[peerstore, crypto/crypto] import - ../../../waku/[ + waku/[ waku_core, node/peer_manager, node/waku_node, diff --git a/tests/node/test_wakunode_legacy_store.nim b/tests/node/test_wakunode_legacy_store.nim index 67f056ce31..7c672521ec 100644 --- a/tests/node/test_wakunode_legacy_store.nim +++ b/tests/node/test_wakunode_legacy_store.nim @@ -8,7 +8,7 @@ import libp2p/crypto/crypto import - ../../../waku/[ + waku/[ common/paging, node/waku_node, node/peer_manager, diff --git a/tests/node/test_wakunode_lightpush.nim b/tests/node/test_wakunode_lightpush.nim index 0bbfaa88a8..0527c034e2 100644 --- a/tests/node/test_wakunode_lightpush.nim +++ b/tests/node/test_wakunode_lightpush.nim @@ -11,7 +11,7 @@ import libp2p/[peerstore, crypto/crypto] import - ../../../waku/[ + waku/[ waku_core, node/peer_manager, node/waku_node, @@ -23,7 +23,7 @@ import waku_lightpush/client, waku_lightpush/protocol_metrics, waku_lightpush/rpc, - waku_rln_relay + waku_rln_relay, ], ../testlib/[assertions, common, wakucore, wakunode, testasync, futures, testutils], ../resources/payloads @@ -91,12 +91,11 @@ suite "Waku Lightpush - End To End": suite "Waku LightPush Validation Tests": asyncTest "Validate message size exceeds limit": - let - msgOverLimit = fakeWakuMessage( - contentTopic = contentTopic, - payload = getByteSequence(DefaultMaxWakuMessageSize + 64 * 1024), - ) - + let msgOverLimit = fakeWakuMessage( + contentTopic = contentTopic, + payload = getByteSequence(DefaultMaxWakuMessageSize + 64 * 1024), + ) + # When the client publishes an over-limit message let publishResponse = await client.lightpushPublish( some(pubsubTopic), msgOverLimit, serverRemotePeerInfo @@ -104,7 +103,8 @@ suite "Waku Lightpush - End To End": check: publishResponse.isErr() - publishResponse.error == fmt"Message size exceeded maximum of {DefaultMaxWakuMessageSize} bytes" + publishResponse.error == + fmt"Message size exceeded maximum of {DefaultMaxWakuMessageSize} bytes" suite "RLN Proofs as a Lightpush Service": var @@ -143,7 +143,6 @@ suite "RLN Proofs as a Lightpush Service": rlnRelayTreePath: genTempPath("rln_tree", "wakunode"), ) - await allFutures(server.start(), client.start()) await server.start() @@ -176,4 +175,4 @@ suite "RLN Proofs as a Lightpush Service": echo "Publish failed: ", publishResponse.error() # Then the message is relayed to the server - assertResultOk publishResponse \ No newline at end of file + assertResultOk publishResponse diff --git a/tests/node/test_wakunode_peer_exchange.nim b/tests/node/test_wakunode_peer_exchange.nim index a9d18af6af..c2a235045e 100644 --- a/tests/node/test_wakunode_peer_exchange.nim +++ b/tests/node/test_wakunode_peer_exchange.nim @@ -13,7 +13,7 @@ import eth/p2p/discoveryv5/enr import - ../../../waku/[ + waku/[ waku_node, discovery/waku_discv5, waku_peer_exchange, diff --git a/tests/node/test_wakunode_peer_manager.nim b/tests/node/test_wakunode_peer_manager.nim index 1857b1e247..4e10556f73 100644 --- a/tests/node/test_wakunode_peer_manager.nim +++ b/tests/node/test_wakunode_peer_manager.nim @@ -13,7 +13,7 @@ import from times import getTime, toUnix import - ../../../waku/[ + waku/[ waku_core, node/peer_manager, node/waku_node, diff --git a/tests/node/test_wakunode_relay_rln.nim b/tests/node/test_wakunode_relay_rln.nim index cb1d807014..80ba3e5409 100644 --- a/tests/node/test_wakunode_relay_rln.nim +++ b/tests/node/test_wakunode_relay_rln.nim @@ -12,8 +12,7 @@ import from std/times import epochTime import - ../../../waku/ - [node/waku_node, node/peer_manager, waku_core, waku_node, waku_rln_relay], + waku/[node/waku_node, node/peer_manager, waku_core, waku_node, waku_rln_relay], ../waku_store/store_utils, ../waku_archive/archive_utils, ../waku_relay/utils, diff --git a/tests/node/test_wakunode_sharding.nim b/tests/node/test_wakunode_sharding.nim index a92e9cc380..d3f4c5e1fb 100644 --- a/tests/node/test_wakunode_sharding.nim +++ b/tests/node/test_wakunode_sharding.nim @@ -17,7 +17,7 @@ import libp2p/protocols/pubsub/pubsub import - ../../../waku/[ + waku/[ waku_core/topics/pubsub_topic, waku_core/topics/sharding, node/waku_node, @@ -31,7 +31,7 @@ import ../waku_archive/archive_utils, ../testlib/[assertions, common, wakucore, wakunode, testasync, futures, testutils] -import ../../../waku/waku_relay/protocol +import waku_relay/protocol const listenIp = ValidIpAddress.init("0.0.0.0") diff --git a/tests/node/test_wakunode_store.nim b/tests/node/test_wakunode_store.nim index e6c9d1ef8f..49c24c6d83 100644 --- a/tests/node/test_wakunode_store.nim +++ b/tests/node/test_wakunode_store.nim @@ -8,7 +8,7 @@ import libp2p/crypto/crypto import - ../../../waku/[ + waku/[ common/paging, node/waku_node, node/peer_manager, diff --git a/tests/node/utils.nim b/tests/node/utils.nim index eb0e6491df..61c6c4a5c3 100644 --- a/tests/node/utils.nim +++ b/tests/node/utils.nim @@ -1,7 +1,6 @@ import std/options, results import - ../../../waku/ - [node/peer_manager, node/waku_node, waku_enr/sharding, common/enr/typed_record], + waku/[node/peer_manager, node/waku_node, waku_enr/sharding, common/enr/typed_record], ../testlib/[wakucore] proc relayShards*(node: WakuNode): RelayShards = diff --git a/tests/test_message_cache.nim b/tests/test_message_cache.nim index 63dbed6adf..b6bb91b862 100644 --- a/tests/test_message_cache.nim +++ b/tests/test_message_cache.nim @@ -1,7 +1,7 @@ {.used.} import std/[sets, random], stew/[results, byteutils], testutils/unittests -import ../../waku/waku_core, ../../waku/waku_api/message_cache, ./testlib/wakucore +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 cb033385d9..e4a87c14ac 100644 --- a/tests/test_peer_manager.nim +++ b/tests/test_peer_manager.nim @@ -17,18 +17,20 @@ import libp2p/protocols/pubsub/rpc/message, libp2p/peerid import - ../../waku/common/databases/db_sqlite, - ../../waku/node/peer_manager/peer_manager, - ../../waku/node/peer_manager/peer_store/waku_peer_storage, - ../../waku/waku_node, - ../../waku/waku_core, - ../../waku/waku_enr/capabilities, - ../../waku/waku_relay/protocol, - ../../waku/waku_filter_v2/common, - ../../waku/waku_store/common, - ../../waku/waku_lightpush/common, - ../../waku/waku_peer_exchange, - ../../waku/waku_metadata, + waku/[ + common/databases/db_sqlite, + node/peer_manager/peer_manager, + node/peer_manager/peer_store/waku_peer_storage, + waku_node, + waku_core, + waku_enr/capabilities, + waku_relay/protocol, + waku_filter_v2/common, + waku_store/common, + waku_lightpush/common, + waku_peer_exchange, + waku_metadata, + ], ./testlib/common, ./testlib/testutils, ./testlib/wakucore, diff --git a/tests/test_peer_storage.nim b/tests/test_peer_storage.nim index 019d7e1b4f..6cb48d71e7 100644 --- a/tests/test_peer_storage.nim +++ b/tests/test_peer_storage.nim @@ -2,10 +2,12 @@ import std/options, testutils/unittests, eth/p2p/discoveryv5/enr, libp2p/crypto/crypto import - ../../waku/common/databases/db_sqlite, - ../../waku/node/peer_manager/peer_manager, - ../../waku/node/peer_manager/peer_store/waku_peer_storage, - ../../waku/waku_enr, + waku/[ + common/databases/db_sqlite, + node/peer_manager/peer_manager, + node/peer_manager/peer_store/waku_peer_storage, + waku_enr, + ], ./testlib/wakucore suite "Peer Storage": diff --git a/tests/test_peer_store_extended.nim b/tests/test_peer_store_extended.nim index 0686138f87..e06630364e 100644 --- a/tests/test_peer_store_extended.nim +++ b/tests/test_peer_store_extended.nim @@ -9,9 +9,7 @@ import libp2p/multiaddress, testutils/unittests import - ../../waku/node/peer_manager/peer_manager, - ../../waku/node/peer_manager/waku_peer_store, - ../../waku/waku_node, + waku/[node/peer_manager/peer_manager, node/peer_manager/waku_peer_store, waku_node], ./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 3ba5b878de..be27365a63 100644 --- a/tests/test_relay_peer_exchange.nim +++ b/tests/test_relay_peer_exchange.nim @@ -10,8 +10,7 @@ import libp2p/crypto/crypto, libp2p/protocols/pubsub/gossipsub -import - ../../waku/waku_core, ../../waku/waku_node, ./testlib/wakucore, ./testlib/wakunode +import waku/waku_core, waku/waku_node, ./testlib/wakucore, ./testlib/wakunode procSuite "Relay (GossipSub) Peer Exchange": asyncTest "Mount relay without peer exchange handler": diff --git a/tests/test_utils_compat.nim b/tests/test_utils_compat.nim index 4184d651bf..121efa4a5f 100644 --- a/tests/test_utils_compat.nim +++ b/tests/test_utils_compat.nim @@ -1,11 +1,7 @@ {.used.} import testutils/unittests -import - stew/results, - ../../waku/waku_core/message, - ../../waku/waku_core/time, - ./testlib/common +import stew/results, waku/waku_core/message, waku/waku_core/time, ./testlib/common suite "Waku Payload": test "Encode/Decode waku message with timestamp": diff --git a/tests/test_waku_dnsdisc.nim b/tests/test_waku_dnsdisc.nim index 55181b5c34..10f7cf59fe 100644 --- a/tests/test_waku_dnsdisc.nim +++ b/tests/test_waku_dnsdisc.nim @@ -11,9 +11,9 @@ import eth/keys, dnsdisc/builder import - ../../waku/node/peer_manager, - ../../waku/waku_node, - ../../waku/discovery/waku_dnsdisc, + waku/node/peer_manager, + waku/waku_node, + waku/discovery/waku_dnsdisc, ./testlib/common, ./testlib/wakucore, ./testlib/wakunode diff --git a/tests/test_waku_enr.nim b/tests/test_waku_enr.nim index 95a76c0e9a..a1e22144bf 100644 --- a/tests/test_waku_enr.nim +++ b/tests/test_waku_enr.nim @@ -1,7 +1,7 @@ {.used.} import std/[options, sequtils], stew/results, testutils/unittests -import ../../waku/waku_core, ../../waku/waku_enr, ./testlib/wakucore +import waku/waku_core, waku/waku_enr, ./testlib/wakucore suite "Waku ENR - Capabilities bitfield": test "check capabilities support": diff --git a/tests/test_waku_keepalive.nim b/tests/test_waku_keepalive.nim index 47d9be6fd3..872994b455 100644 --- a/tests/test_waku_keepalive.nim +++ b/tests/test_waku_keepalive.nim @@ -11,8 +11,7 @@ import libp2p/stream/bufferstream, libp2p/stream/connection, libp2p/crypto/crypto -import - ../../waku/waku_core, ../../waku/waku_node, ./testlib/wakucore, ./testlib/wakunode +import waku/waku_core, waku/waku_node, ./testlib/wakucore, ./testlib/wakunode suite "Waku Keepalive": asyncTest "handle ping keepalives": diff --git a/tests/test_waku_keystore.nim b/tests/test_waku_keystore.nim index 36e51b9edb..8fd8ad2974 100644 --- a/tests/test_waku_keystore.nim +++ b/tests/test_waku_keystore.nim @@ -1,9 +1,9 @@ {.used.} import std/[os, json], chronos, testutils/unittests -import ../../waku/waku_keystore, ./testlib/common +import waku/waku_keystore, ./testlib/common -from ../../waku/waku_noise/noise_utils import randomSeqByte +from waku/waku_noise/noise_utils import randomSeqByte procSuite "Credentials test suite": let testAppInfo = AppInfo(application: "test", appIdentifier: "1234", version: "0.1") diff --git a/tests/test_waku_keystore_keyfile.nim b/tests/test_waku_keystore_keyfile.nim index f857332abf..5f4c745912 100644 --- a/tests/test_waku_keystore_keyfile.nim +++ b/tests/test_waku_keystore_keyfile.nim @@ -1,9 +1,9 @@ {.used.} import std/[json, os], stew/byteutils, testutils/unittests, chronos, eth/keys -import ../../waku/waku_keystore, ./testlib/common +import waku/waku_keystore, ./testlib/common -from ../../waku/waku_noise/noise_utils import randomSeqByte +from waku/waku_noise/noise_utils import randomSeqByte suite "KeyFile test suite": test "Create/Save/Load single keyfile": diff --git a/tests/test_waku_metadata.nim b/tests/test_waku_metadata.nim index ea8fd8167d..aa22a43f48 100644 --- a/tests/test_waku_metadata.nim +++ b/tests/test_waku_metadata.nim @@ -14,11 +14,14 @@ import eth/keys, eth/p2p/discoveryv5/enr import - ../../waku/waku_node, - ../../waku/waku_core/topics, - ../../waku/node/peer_manager, - ../../waku/discovery/waku_discv5, - ../../waku/waku_metadata, + waku/ + [ + waku_node, + waku_core/topics, + node/peer_manager, + discovery/waku_discv5, + waku_metadata, + ], ./testlib/wakucore, ./testlib/wakunode diff --git a/tests/test_waku_netconfig.nim b/tests/test_waku_netconfig.nim index adc1ba0ba0..4d5a2df7df 100644 --- a/tests/test_waku_netconfig.nim +++ b/tests/test_waku_netconfig.nim @@ -2,9 +2,9 @@ import chronos, confutils/toml/std/net, libp2p/multiaddress, testutils/unittests -import ./testlib/wakunode, ../../waku/waku_enr/capabilities +import ./testlib/wakunode, waku/waku_enr/capabilities -include ../../waku/node/config +include waku/node/config proc defaultTestWakuFlags(): CapabilitiesBitfield = CapabilitiesBitfield.init( diff --git a/tests/test_waku_noise.nim b/tests/test_waku_noise.nim index cf975cdc55..980e752f57 100644 --- a/tests/test_waku_noise.nim +++ b/tests/test_waku_noise.nim @@ -9,12 +9,14 @@ import libp2p/protobuf/minprotobuf, stew/endians2 import - ../../waku/utils/noise as waku_message_utils, - ../../waku/waku_noise/noise_types, - ../../waku/waku_noise/noise_utils, - ../../waku/waku_noise/noise, - ../../waku/waku_noise/noise_handshake_processing, - ../../waku/waku_core, + waku/[ + utils/noise as waku_message_utils, + waku_noise/noise_types, + waku_noise/noise_utils, + waku_noise/noise, + waku_noise/noise_handshake_processing, + waku_core, + ], ./testlib/common procSuite "Waku Noise": diff --git a/tests/test_waku_noise_sessions.nim b/tests/test_waku_noise_sessions.nim index 05319ccb8c..a02407e637 100644 --- a/tests/test_waku_noise_sessions.nim +++ b/tests/test_waku_noise_sessions.nim @@ -2,12 +2,14 @@ import std/tables, stew/[results, byteutils], testutils/unittests import - ../../waku/common/protobuf, - ../../waku/utils/noise as waku_message_utils, - ../../waku/waku_noise/noise_types, - ../../waku/waku_noise/noise_utils, - ../../waku/waku_noise/noise_handshake_processing, - ../../waku/waku_core, + waku/[ + common/protobuf, + utils/noise as waku_message_utils, + waku_noise/noise_types, + waku_noise/noise_utils, + waku_noise/noise_handshake_processing, + waku_core, + ], ./testlib/common procSuite "Waku Noise Sessions": diff --git a/tests/test_waku_protobufs.nim b/tests/test_waku_protobufs.nim index b22c9bf39b..cd5e3dd025 100644 --- a/tests/test_waku_protobufs.nim +++ b/tests/test_waku_protobufs.nim @@ -2,10 +2,7 @@ import std/[options, sequtils, tables], testutils/unittests, chronos, chronicles import - ../../waku/waku_metadata, - ../../waku/waku_metadata/rpc, - ./testlib/wakucore, - ./testlib/wakunode + waku/waku_metadata, waku/waku_metadata/rpc, ./testlib/wakucore, ./testlib/wakunode procSuite "Waku Protobufs": # TODO: Missing test coverage in many encode/decode protobuf functions diff --git a/tests/test_waku_rendezvous.nim b/tests/test_waku_rendezvous.nim index 918ba52680..b32ef27bad 100644 --- a/tests/test_waku_rendezvous.nim +++ b/tests/test_waku_rendezvous.nim @@ -2,7 +2,7 @@ import chronos, testutils/unittests, libp2p, libp2p/protocols/rendezvous -import ../../waku/node/waku_switch, ./testlib/common, ./testlib/wakucore +import waku/node/waku_switch, ./testlib/common, ./testlib/wakucore proc newRendezvousClientSwitch(rdv: RendezVous): Switch = SwitchBuilder diff --git a/tests/test_waku_switch.nim b/tests/test_waku_switch.nim index bda90eefa0..6cf734a332 100644 --- a/tests/test_waku_switch.nim +++ b/tests/test_waku_switch.nim @@ -8,7 +8,7 @@ import libp2p/protocols/connectivity/relay/relay, libp2p/protocols/connectivity/relay/client, stew/byteutils -import ../../waku/node/waku_switch, ./testlib/common, ./testlib/wakucore +import waku/node/waku_switch, ./testlib/common, ./testlib/wakucore proc newCircuitRelayClientSwitch(relayClient: RelayClient): Switch = SwitchBuilder diff --git a/tests/test_wakunode.nim b/tests/test_wakunode.nim index dec018f894..1105cfd64c 100644 --- a/tests/test_wakunode.nim +++ b/tests/test_wakunode.nim @@ -17,11 +17,7 @@ import libp2p/nameresolving/mockresolver, eth/p2p/discoveryv5/enr import - ../../waku/waku_core, - ../../waku/waku_node, - ../../waku/node/peer_manager, - ../../waku/waku_relay, - ../../waku/waku_peer_exchange, + waku/[waku_core, waku_node, node/peer_manager, waku_relay, waku_peer_exchange], ./testlib/wakucore, ./testlib/wakunode diff --git a/tests/test_wakunode_lightpush.nim b/tests/test_wakunode_lightpush.nim index f22625e0c2..5f2c5e2df2 100644 --- a/tests/test_wakunode_lightpush.nim +++ b/tests/test_wakunode_lightpush.nim @@ -2,10 +2,7 @@ import std/options, stew/shims/net as stewNet, testutils/unittests, chronos import - ../../waku/waku_core, - ../../waku/waku_lightpush/common, - ../../waku/node/peer_manager, - ../../waku/waku_node, + waku/[waku_core, waku_lightpush/common, node/peer_manager, waku_node], ./testlib/wakucore, ./testlib/wakunode diff --git a/tests/testlib/futures.nim b/tests/testlib/futures.nim index b3f2e935bd..4bce30128a 100644 --- a/tests/testlib/futures.nim +++ b/tests/testlib/futures.nim @@ -1,6 +1,6 @@ import chronos -import ../../../waku/[waku_core/message, waku_store, waku_store_legacy] +import waku/[waku_core/message, waku_store, waku_store_legacy] const FUTURE_TIMEOUT* = 1.seconds diff --git a/tests/testlib/postgres.nim b/tests/testlib/postgres.nim index 3947a65ca2..1449a5936b 100644 --- a/tests/testlib/postgres.nim +++ b/tests/testlib/postgres.nim @@ -1,9 +1,11 @@ import chronicles, chronos import - ../../../waku/waku_archive, - ../../../waku/waku_archive/driver as driver_module, - ../../../waku/waku_archive/driver/builder, - ../../../waku/waku_archive/driver/postgres_driver + waku/[ + waku_archive, + waku_archive/driver as driver_module, + waku_archive/driver/builder, + waku_archive/driver/postgres_driver, + ] const storeMessageDbUrl = "postgres://postgres:test123@localhost:5432/postgres" diff --git a/tests/testlib/tables.nim b/tests/testlib/tables.nim index acc5ae7f5e..7db554575c 100644 --- a/tests/testlib/tables.nim +++ b/tests/testlib/tables.nim @@ -1,6 +1,6 @@ import std/[tables, sequtils, options] -import ../../../waku/waku_core/topics, ../testlib/wakucore +import waku/waku_core/topics, ../testlib/wakucore proc `==`*( table: Table[pubsub_topic.NsPubsubTopic, seq[NsContentTopic]], diff --git a/tests/testlib/wakucore.nim b/tests/testlib/wakucore.nim index 1001a7116b..b4daca1054 100644 --- a/tests/testlib/wakucore.nim +++ b/tests/testlib/wakucore.nim @@ -7,7 +7,7 @@ import libp2p/builders, libp2p/crypto/crypto as libp2p_keys, eth/keys as eth_keys -import ../../../waku/waku_core, ./common +import waku/waku_core, ./common export switch diff --git a/tests/testlib/wakunode.nim b/tests/testlib/wakunode.nim index f73e0e0ec9..be563a35d6 100644 --- a/tests/testlib/wakunode.nim +++ b/tests/testlib/wakunode.nim @@ -9,14 +9,16 @@ import libp2p/crypto/crypto as libp2p_keys, eth/keys as eth_keys import - ../../../waku/waku_node, - ../../../waku/waku_core/topics, - ../../../waku/node/peer_manager, - ../../../waku/waku_enr, - ../../../waku/discovery/waku_discv5, - ../../../waku/factory/external_config, - ../../../waku/factory/internal_config, - ../../../waku/factory/builder, + waku/[ + waku_node, + waku_core/topics, + node/peer_manager, + waku_enr, + discovery/waku_discv5, + factory/external_config, + factory/internal_config, + factory/builder, + ], ./common # Waku node diff --git a/tests/waku_archive/archive_utils.nim b/tests/waku_archive/archive_utils.nim index df2f80846e..454150dd91 100644 --- a/tests/waku_archive/archive_utils.nim +++ b/tests/waku_archive/archive_utils.nim @@ -3,7 +3,7 @@ import std/options, stew/results, chronos, libp2p/crypto/crypto import - ../../../waku/[ + waku/[ node/peer_manager, waku_core, waku_archive, diff --git a/tests/waku_archive/test_driver_postgres.nim b/tests/waku_archive/test_driver_postgres.nim index 75afb226fa..ef03e491c9 100644 --- a/tests/waku_archive/test_driver_postgres.nim +++ b/tests/waku_archive/test_driver_postgres.nim @@ -2,10 +2,12 @@ import std/[sequtils, options], testutils/unittests, chronos import - ../../../waku/waku_archive, - ../../../waku/waku_archive/driver/postgres_driver, - ../../../waku/waku_core, - ../../../waku/waku_core/message/digest, + waku/[ + waku_archive, + waku_archive/driver/postgres_driver, + waku_core, + waku_core/message/digest, + ], ../testlib/wakucore, ../testlib/testasync, ../testlib/postgres diff --git a/tests/waku_archive/test_driver_postgres_query.nim b/tests/waku_archive/test_driver_postgres_query.nim index 8614b6af1f..d429df7ac5 100644 --- a/tests/waku_archive/test_driver_postgres_query.nim +++ b/tests/waku_archive/test_driver_postgres_query.nim @@ -6,11 +6,13 @@ import chronos, chronicles import - ../../../waku/waku_archive, - ../../../waku/waku_archive/driver as driver_module, - ../../../waku/waku_archive/driver/postgres_driver, - ../../../waku/waku_core, - ../../../waku/waku_core/message/digest, + waku/[ + waku_archive, + waku_archive/driver as driver_module, + waku_archive/driver/postgres_driver, + waku_core, + waku_core/message/digest, + ], ../testlib/common, ../testlib/wakucore, ../testlib/testasync, diff --git a/tests/waku_archive/test_driver_queue.nim b/tests/waku_archive/test_driver_queue.nim index d57f0ee1d2..6ef56520c7 100644 --- a/tests/waku_archive/test_driver_queue.nim +++ b/tests/waku_archive/test_driver_queue.nim @@ -2,10 +2,12 @@ import std/options, stew/results, testutils/unittests import - ../../../waku/waku_archive, - ../../../waku/waku_archive/driver/queue_driver/queue_driver {.all.}, - ../../../waku/waku_archive/driver/queue_driver/index, - ../../../waku/waku_core + waku/[ + waku_archive, + waku_archive/driver/queue_driver/queue_driver {.all.}, + waku_archive/driver/queue_driver/index, + waku_core, + ] # Helper functions diff --git a/tests/waku_archive/test_driver_queue_index.nim b/tests/waku_archive/test_driver_queue_index.nim index 2f1e685c7c..214a67d22c 100644 --- a/tests/waku_archive/test_driver_queue_index.nim +++ b/tests/waku_archive/test_driver_queue_index.nim @@ -1,7 +1,7 @@ {.used.} import std/[times, random], stew/byteutils, testutils/unittests, nimcrypto -import ../../../waku/waku_core, ../../../waku/waku_archive/driver/queue_driver/index +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 6ce1d6d560..1545a4aab9 100644 --- a/tests/waku_archive/test_driver_queue_pagination.nim +++ b/tests/waku_archive/test_driver_queue_pagination.nim @@ -3,10 +3,12 @@ import std/[options, sequtils, algorithm], testutils/unittests, libp2p/protobuf/minprotobuf import - ../../../waku/waku_archive, - ../../../waku/waku_archive/driver/queue_driver/queue_driver {.all.}, - ../../../waku/waku_archive/driver/queue_driver/index, - ../../../waku/waku_core, + waku/[ + waku_archive, + waku_archive/driver/queue_driver/queue_driver {.all.}, + waku_archive/driver/queue_driver/index, + waku_core, + ], ../testlib/common, ../testlib/wakucore diff --git a/tests/waku_archive/test_driver_queue_query.nim b/tests/waku_archive/test_driver_queue_query.nim index 60016c771d..d30b96c026 100644 --- a/tests/waku_archive/test_driver_queue_query.nim +++ b/tests/waku_archive/test_driver_queue_query.nim @@ -3,10 +3,13 @@ import std/[options, sequtils, random, algorithm], testutils/unittests, chronos, chronicles import - ../../../waku/waku_archive, - ../../../waku/waku_archive/driver/queue_driver, - ../../../waku/waku_core, - ../../../waku/waku_core/message/digest, + waku/ + [ + waku_archive, + waku_archive/driver/queue_driver, + waku_core, + waku_core/message/digest, + ], ../testlib/common, ../testlib/wakucore diff --git a/tests/waku_archive/test_driver_sqlite.nim b/tests/waku_archive/test_driver_sqlite.nim index 72f560ca9a..a412ab7b7c 100644 --- a/tests/waku_archive/test_driver_sqlite.nim +++ b/tests/waku_archive/test_driver_sqlite.nim @@ -2,10 +2,12 @@ import std/sequtils, testutils/unittests, chronos import - ../../../waku/common/databases/db_sqlite, - ../../../waku/waku_archive, - ../../../waku/waku_archive/driver/sqlite_driver, - ../../../waku/waku_core, + waku/[ + common/databases/db_sqlite, + waku_archive, + waku_archive/driver/sqlite_driver, + waku_core, + ], ../waku_archive/archive_utils, ../testlib/common, ../testlib/wakucore diff --git a/tests/waku_archive/test_driver_sqlite_query.nim b/tests/waku_archive/test_driver_sqlite_query.nim index 58968b1b87..026cab2178 100644 --- a/tests/waku_archive/test_driver_sqlite_query.nim +++ b/tests/waku_archive/test_driver_sqlite_query.nim @@ -4,11 +4,13 @@ import std/[options, sequtils, random, algorithm], testutils/unittests, chronos, chronicles import - ../../../waku/common/databases/db_sqlite, - ../../../waku/waku_archive, - ../../../waku/waku_archive/driver/sqlite_driver, - ../../../waku/waku_core, - ../../../waku/waku_core/message/digest, + waku/[ + common/databases/db_sqlite, + waku_archive, + waku_archive/driver/sqlite_driver, + waku_core, + waku_core/message/digest, + ], ../testlib/common, ../testlib/wakucore, ../waku_archive/archive_utils diff --git a/tests/waku_archive/test_partition_manager.nim b/tests/waku_archive/test_partition_manager.nim index e238c7675f..dbfdd846cc 100644 --- a/tests/waku_archive/test_partition_manager.nim +++ b/tests/waku_archive/test_partition_manager.nim @@ -1,9 +1,7 @@ {.used.} import testutils/unittests, chronos -import - ../../../waku/waku_archive/driver/postgres_driver/partitions_manager, - ../../../waku/waku_core/time +import waku/waku_archive/driver/postgres_driver/partitions_manager, waku/waku_core/time suite "Partition Manager": test "Calculate end partition time": diff --git a/tests/waku_archive/test_retention_policy.nim b/tests/waku_archive/test_retention_policy.nim index f0d6f82e4c..f3d7ebf51d 100644 --- a/tests/waku_archive/test_retention_policy.nim +++ b/tests/waku_archive/test_retention_policy.nim @@ -2,14 +2,16 @@ import std/[sequtils, times], stew/results, testutils/unittests, chronos import - ../../../waku/common/databases/db_sqlite, - ../../../waku/waku_core, - ../../../waku/waku_core/message/digest, - ../../../waku/waku_archive, - ../../../waku/waku_archive/driver/sqlite_driver, - ../../../waku/waku_archive/retention_policy, - ../../../waku/waku_archive/retention_policy/retention_policy_capacity, - ../../../waku/waku_archive/retention_policy/retention_policy_size, + 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, + ], ../waku_archive/archive_utils, ../testlib/common, ../testlib/wakucore diff --git a/tests/waku_archive/test_waku_archive.nim b/tests/waku_archive/test_waku_archive.nim index cebb807aef..de7034a1b0 100644 --- a/tests/waku_archive/test_waku_archive.nim +++ b/tests/waku_archive/test_waku_archive.nim @@ -8,12 +8,14 @@ import libp2p/crypto/crypto import - ../../../waku/common/databases/db_sqlite, - ../../../waku/common/paging, - ../../../waku/waku_core, - ../../../waku/waku_core/message/digest, - ../../../waku/waku_archive/driver/sqlite_driver, - ../../../waku/waku_archive, + waku/[ + common/databases/db_sqlite, + common/paging, + waku_core, + waku_core/message/digest, + waku_archive/driver/sqlite_driver, + waku_archive, + ], ../waku_archive/archive_utils, ../testlib/common, ../testlib/wakucore diff --git a/tests/waku_core/test_message_digest.nim b/tests/waku_core/test_message_digest.nim index ab67647828..16efaa4da9 100644 --- a/tests/waku_core/test_message_digest.nim +++ b/tests/waku_core/test_message_digest.nim @@ -1,7 +1,7 @@ {.used.} import std/sequtils, stew/byteutils, stew/endians2, testutils/unittests -import ../../../waku/waku_core, ../testlib/wakucore +import waku/waku_core, ../testlib/wakucore suite "Waku Message - Deterministic hashing": test "digest computation - empty meta field": diff --git a/tests/waku_core/test_namespaced_topics.nim b/tests/waku_core/test_namespaced_topics.nim index a0cf6ae5bb..69ae059397 100644 --- a/tests/waku_core/test_namespaced_topics.nim +++ b/tests/waku_core/test_namespaced_topics.nim @@ -1,7 +1,7 @@ {.used.} import std/options, stew/results, testutils/unittests -import ../../../waku/waku_core/topics +import waku/waku_core/topics suite "Waku Message - Content topics namespacing": test "Stringify namespaced content topic": diff --git a/tests/waku_core/test_peers.nim b/tests/waku_core/test_peers.nim index f886a9912c..fd1d08a6da 100644 --- a/tests/waku_core/test_peers.nim +++ b/tests/waku_core/test_peers.nim @@ -2,7 +2,7 @@ import stew/results, testutils/unittests, libp2p/multiaddress, libp2p/peerid, libp2p/errors -import ../../waku/waku_core +import waku/waku_core suite "Waku Core - Peers": test "Peer info parses correctly": diff --git a/tests/waku_core/test_time.nim b/tests/waku_core/test_time.nim index 0ec000bd2b..c54afeb36b 100644 --- a/tests/waku_core/test_time.nim +++ b/tests/waku_core/test_time.nim @@ -1,7 +1,7 @@ {.used.} import testutils/unittests -import ../../waku/waku_core/time +import waku/waku_core/time suite "Waku Core - Time": test "Test timestamp conversion": diff --git a/tests/waku_core/topics/test_pubsub_topic.nim b/tests/waku_core/topics/test_pubsub_topic.nim index 8b93e7b37d..aef8d1a0dc 100644 --- a/tests/waku_core/topics/test_pubsub_topic.nim +++ b/tests/waku_core/topics/test_pubsub_topic.nim @@ -2,7 +2,7 @@ import std/[options], testutils/unittests, results -import ../../../../waku/[waku_core/topics/pubsub_topic], ../../testlib/[wakucore] +import waku/waku_core/topics/pubsub_topic, ../../testlib/[wakucore] suite "Static Sharding Functionality": test "Shard Cluster Identification": diff --git a/tests/waku_core/topics/test_sharding.nim b/tests/waku_core/topics/test_sharding.nim index 64a12150f9..cae797d4dd 100644 --- a/tests/waku_core/topics/test_sharding.nim +++ b/tests/waku_core/topics/test_sharding.nim @@ -1,6 +1,6 @@ import std/[options, tables], testutils/unittests -import ../../../../waku/waku_core/topics, ../../testlib/[wakucore, tables, testutils] +import waku/waku_core/topics, ../../testlib/[wakucore, tables, testutils] const GenerationZeroShardsCount = 8 const ClusterId = 1 diff --git a/tests/waku_discv5/test_waku_discv5.nim b/tests/waku_discv5/test_waku_discv5.nim index c454abaeee..3ced8d266f 100644 --- a/tests/waku_discv5/test_waku_discv5.nim +++ b/tests/waku_discv5/test_waku_discv5.nim @@ -11,7 +11,7 @@ import eth/keys as eth_keys import - ../../../waku/[waku_core/topics, waku_enr, discovery/waku_discv5, common/enr], + waku/[waku_core/topics, waku_enr, discovery/waku_discv5, common/enr], ../testlib/[wakucore, testasync, assertions, futures], ../waku_enr/utils, ./utils diff --git a/tests/waku_discv5/utils.nim b/tests/waku_discv5/utils.nim index c66c4ca2ff..10026155c7 100644 --- a/tests/waku_discv5/utils.nim +++ b/tests/waku_discv5/utils.nim @@ -6,7 +6,7 @@ import eth/keys as eth_keys import - ../../../waku/ + waku/ [waku_core/topics, waku_enr, discovery/waku_discv5, node/peer_manager/peer_manager], ../testlib/[common, wakucore] diff --git a/tests/waku_enr/test_sharding.nim b/tests/waku_enr/test_sharding.nim index 92308885d0..7c65d83fb0 100644 --- a/tests/waku_enr/test_sharding.nim +++ b/tests/waku_enr/test_sharding.nim @@ -9,7 +9,7 @@ import eth/keys as eth_keys import - ../../../waku/[waku_enr, discovery/waku_discv5, waku_core, common/enr], + waku/[waku_enr, discovery/waku_discv5, waku_core, common/enr], ../testlib/wakucore, ../waku_discv5/utils, ./utils diff --git a/tests/waku_enr/utils.nim b/tests/waku_enr/utils.nim index 2682e0ec44..5cc36f607e 100644 --- a/tests/waku_enr/utils.nim +++ b/tests/waku_enr/utils.nim @@ -7,7 +7,7 @@ import eth/keys as eth_keys import - ../../../waku/[waku_core/topics, waku_enr, discovery/waku_discv5, waku_enr/sharding], + waku/[waku_core/topics, waku_enr, discovery/waku_discv5, waku_enr/sharding], ../testlib/[common, wakucore] proc newTestEnrRecord*( diff --git a/tests/waku_filter_v2/test_waku_client.nim b/tests/waku_filter_v2/test_waku_client.nim index 28ced3b5be..0d9647920b 100644 --- a/tests/waku_filter_v2/test_waku_client.nim +++ b/tests/waku_filter_v2/test_waku_client.nim @@ -10,8 +10,9 @@ import libp2p/peerstore import - ../../../waku/[node/peer_manager, waku_core], - ../../../waku/waku_filter_v2/[common, client, subscriptions, protocol, rpc_codec], + waku/node/peer_manager, + waku/waku_core, + waku/waku_filter_v2/[common, client, subscriptions, protocol, rpc_codec], ../testlib/[wakucore, testasync, testutils, futures, sequtils], ./waku_filter_utils, ../resources/payloads diff --git a/tests/waku_filter_v2/test_waku_filter_protocol.nim b/tests/waku_filter_v2/test_waku_filter_protocol.nim index c7d611f895..f6a4ff5fca 100644 --- a/tests/waku_filter_v2/test_waku_filter_protocol.nim +++ b/tests/waku_filter_v2/test_waku_filter_protocol.nim @@ -7,11 +7,13 @@ import chronicles, libp2p/peerstore import - ../../../waku/node/peer_manager, - ../../../waku/waku_filter_v2, - ../../../waku/waku_filter_v2/rpc, - ../../../waku/waku_filter_v2/subscriptions, - ../../../waku/waku_core, + waku/[ + node/peer_manager, + waku_filter_v2, + waku_filter_v2/rpc, + waku_filter_v2/subscriptions, + waku_core, + ], ../testlib/common, ../testlib/wakucore, ./waku_filter_utils diff --git a/tests/waku_filter_v2/waku_filter_utils.nim b/tests/waku_filter_v2/waku_filter_utils.nim index 70824b3b58..446dee79d4 100644 --- a/tests/waku_filter_v2/waku_filter_utils.nim +++ b/tests/waku_filter_v2/waku_filter_utils.nim @@ -1,7 +1,7 @@ import std/[options, tables, sets, sequtils, algorithm], chronos, chronicles, os import - ../../../waku/[ + waku/[ node/peer_manager, waku_filter_v2, waku_filter_v2/client, diff --git a/tests/waku_lightpush/lightpush_utils.nim b/tests/waku_lightpush/lightpush_utils.nim index c246f4618e..f5c5ca5e6a 100644 --- a/tests/waku_lightpush/lightpush_utils.nim +++ b/tests/waku_lightpush/lightpush_utils.nim @@ -3,10 +3,10 @@ import std/options, chronicles, chronos, libp2p/crypto/crypto import - ../../waku/node/peer_manager, - ../../waku/waku_core, - ../../waku/waku_lightpush, - ../../waku/waku_lightpush/[client, common], + waku/node/peer_manager, + waku/waku_core, + waku/waku_lightpush, + waku/waku_lightpush/[client, common], ../testlib/[common, wakucore] proc newTestWakuLightpushNode*( diff --git a/tests/waku_lightpush/test_client.nim b/tests/waku_lightpush/test_client.nim index a49361c98d..8b8e5529eb 100644 --- a/tests/waku_lightpush/test_client.nim +++ b/tests/waku_lightpush/test_client.nim @@ -8,7 +8,7 @@ import libp2p/crypto/crypto import - ../../../waku/[ + waku/[ node/peer_manager, waku_core, waku_lightpush, diff --git a/tests/waku_lightpush/test_ratelimit.nim b/tests/waku_lightpush/test_ratelimit.nim index 944d89f109..280b49d425 100644 --- a/tests/waku_lightpush/test_ratelimit.nim +++ b/tests/waku_lightpush/test_ratelimit.nim @@ -8,7 +8,7 @@ import libp2p/crypto/crypto import - ../../waku/[ + waku/[ node/peer_manager, common/ratelimit, waku_core, diff --git a/tests/waku_peer_exchange/test_protocol.nim b/tests/waku_peer_exchange/test_protocol.nim index 3daa4037e6..571a1bd504 100644 --- a/tests/waku_peer_exchange/test_protocol.nim +++ b/tests/waku_peer_exchange/test_protocol.nim @@ -10,7 +10,7 @@ import eth/[keys, p2p/discoveryv5/enr] import - ../../../waku/[ + waku/[ waku_node, node/peer_manager, discovery/waku_discv5, diff --git a/tests/waku_peer_exchange/test_rpc_codec.nim b/tests/waku_peer_exchange/test_rpc_codec.nim index b07aa6916b..0393fb4894 100644 --- a/tests/waku_peer_exchange/test_rpc_codec.nim +++ b/tests/waku_peer_exchange/test_rpc_codec.nim @@ -12,7 +12,7 @@ import eth/p2p/discoveryv5/enr import - ../../../waku/[ + waku/[ node/peer_manager, discovery/waku_discv5, waku_peer_exchange/rpc, diff --git a/tests/waku_peer_exchange/utils.nim b/tests/waku_peer_exchange/utils.nim index dddb077696..88d28c5ee8 100644 --- a/tests/waku_peer_exchange/utils.nim +++ b/tests/waku_peer_exchange/utils.nim @@ -11,7 +11,7 @@ import eth/p2p/discoveryv5/enr import - ../../../waku/[ + waku/[ waku_node, discovery/waku_discv5, waku_peer_exchange, diff --git a/tests/waku_relay/test_message_id.nim b/tests/waku_relay/test_message_id.nim index 7c0f286b59..b46554d17c 100644 --- a/tests/waku_relay/test_message_id.nim +++ b/tests/waku_relay/test_message_id.nim @@ -4,7 +4,7 @@ import nimcrypto/sha2, libp2p/protocols/pubsub/rpc/messages -import ../../../waku/waku_relay/message_id, ../testlib/sequtils +import waku/waku_relay/message_id, ../testlib/sequtils 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 df9bcacb52..741f9fe9c3 100644 --- a/tests/waku_relay/test_protocol.nim +++ b/tests/waku_relay/test_protocol.nim @@ -12,7 +12,7 @@ import std/json import - ../../../waku/[ + waku/[ node/peer_manager, waku_relay/protocol, waku_relay, diff --git a/tests/waku_relay/test_wakunode_relay.nim b/tests/waku_relay/test_wakunode_relay.nim index 1acb4819e6..7c44ec90f1 100644 --- a/tests/waku_relay/test_wakunode_relay.nim +++ b/tests/waku_relay/test_wakunode_relay.nim @@ -10,10 +10,7 @@ import libp2p/protocols/pubsub/pubsub, libp2p/protocols/pubsub/gossipsub import - ../../waku/waku_core, - ../../waku/node/peer_manager, - ../../waku/waku_node, - ../../waku/waku_relay, + waku/[waku_core, node/peer_manager, waku_node, waku_relay], ../testlib/testutils, ../testlib/wakucore, ../testlib/wakunode diff --git a/tests/waku_relay/utils.nim b/tests/waku_relay/utils.nim index 2e44189d12..f63a100827 100644 --- a/tests/waku_relay/utils.nim +++ b/tests/waku_relay/utils.nim @@ -12,7 +12,7 @@ import from std/times import epochTime import - ../../../waku/ + waku/ [ waku_relay, node/waku_node, diff --git a/tests/waku_rln_relay/rln/buffer_utils.nim b/tests/waku_rln_relay/rln/buffer_utils.nim index 82814341da..e38cc5c176 100644 --- a/tests/waku_rln_relay/rln/buffer_utils.nim +++ b/tests/waku_rln_relay/rln/buffer_utils.nim @@ -1,4 +1,4 @@ -import ../../../../waku/waku_rln_relay/rln/rln_interface +import waku/waku_rln_relay/rln/rln_interface proc `==`*(a: Buffer, b: seq[uint8]): bool = if a.len != uint(b.len): diff --git a/tests/waku_rln_relay/rln/test_rln_interface.nim b/tests/waku_rln_relay/rln/test_rln_interface.nim index 08c9d87253..7aedf587f9 100644 --- a/tests/waku_rln_relay/rln/test_rln_interface.nim +++ b/tests/waku_rln_relay/rln/test_rln_interface.nim @@ -1,6 +1,6 @@ import testutils/unittests -import ../../../../waku/waku_rln_relay/rln/rln_interface, ./buffer_utils +import waku/waku_rln_relay/rln/rln_interface, ./buffer_utils suite "Buffer": suite "toBuffer": diff --git a/tests/waku_rln_relay/rln/test_wrappers.nim b/tests/waku_rln_relay/rln/test_wrappers.nim index 167ee77fe6..fd8e1a29f0 100644 --- a/tests/waku_rln_relay/rln/test_wrappers.nim +++ b/tests/waku_rln_relay/rln/test_wrappers.nim @@ -11,7 +11,9 @@ import metrics/chronos_httpserver import - ../../../waku/[waku_rln_relay, waku_rln_relay/rln, waku_rln_relay/rln/wrappers], + waku/waku_rln_relay, + waku/waku_rln_relay/rln, + waku/waku_rln_relay/rln/wrappers, ./waku_rln_relay_utils, ../../testlib/[simple_mock] diff --git a/tests/waku_rln_relay/rln/waku_rln_relay_utils.nim b/tests/waku_rln_relay/rln/waku_rln_relay_utils.nim index ab3807983f..383f45c655 100644 --- a/tests/waku_rln_relay/rln/waku_rln_relay_utils.nim +++ b/tests/waku_rln_relay/rln/waku_rln_relay_utils.nim @@ -1,6 +1,6 @@ import std/tempfiles -import ../../../waku/waku_rln_relay, ../../../waku/waku_rln_relay/[rln, protocol_types] +import waku/waku_rln_relay, waku/waku_rln_relay/[rln, protocol_types] proc createRLNInstanceWrapper*(): RLNResult = return createRlnInstance(tree_path = genTempPath("rln_tree", "waku_rln_relay")) @@ -19,6 +19,5 @@ proc unsafeAppendRLNProof*( let proof = rlnPeer.groupManager.generateProof(input, epoch, 0).valueOr: return err("could not generate rln-v2 proof: " & $error) - msg.proof = proof.encode().buffer return ok() 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 b839a2f7a5..6269e23aec 100644 --- a/tests/waku_rln_relay/test_rln_group_manager_onchain.nim +++ b/tests/waku_rln_relay/test_rln_group_manager_onchain.nim @@ -14,12 +14,14 @@ import libp2p/crypto/crypto, eth/keys import - ../../../waku/waku_rln_relay/protocol_types, - ../../../waku/waku_rln_relay/constants, - ../../../waku/waku_rln_relay/contract, - ../../../waku/waku_rln_relay/rln, - ../../../waku/waku_rln_relay/conversion_utils, - ../../../waku/waku_rln_relay/group_manager/on_chain/group_manager, + waku/[ + 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/common, ./utils @@ -65,12 +67,18 @@ proc uploadRLNContract*(ethClientAddress: string): Future[Address] {.async.} = let poseidonAddressStripped = strip0xPrefix($poseidonT3Address) # deploy lazy imt bytecode - let lazyImtReceipt = await web3.deployContract(LazyIMT.replace("__$PoseidonT3$__", poseidonAddressStripped)) + let lazyImtReceipt = await web3.deployContract( + LazyIMT.replace("__$PoseidonT3$__", poseidonAddressStripped) + ) let lazyImtAddress = lazyImtReceipt.contractAddress.get() let lazyImtAddressStripped = strip0xPrefix($lazyImtAddress) # deploy waku rlnv2 contract - let wakuRlnContractReceipt = await web3.deployContract(WakuRlnV2Contract.replace("__$PoseidonT3$__", poseidonAddressStripped).replace("__$LazyIMT$__", lazyImtAddressStripped)) + let wakuRlnContractReceipt = await web3.deployContract( + WakuRlnV2Contract.replace("__$PoseidonT3$__", poseidonAddressStripped).replace( + "__$LazyIMT$__", lazyImtAddressStripped + ) + ) let wakuRlnContractAddress = wakuRlnContractReceipt.contractAddress.get() let wakuRlnAddressStripped = strip0xPrefix($wakuRlnContractAddress) @@ -79,8 +87,9 @@ proc uploadRLNContract*(ethClientAddress: string): Future[Address] {.async.} = # need to send concat: impl & init_bytes let contractInput = encode(wakuRlnContractAddress).data & Erc1967ProxyContractInput debug "contractInput", contractInput - let proxyReceipt = await web3.deployContract(Erc1967Proxy, contractInput = contractInput) - + let proxyReceipt = + await web3.deployContract(Erc1967Proxy, contractInput = contractInput) + debug "proxy receipt", proxyReceipt let proxyAddress = proxyReceipt.contractAddress.get() @@ -138,8 +147,14 @@ proc runAnvil(): Process = let runAnvil = startProcess( anvilPath, args = [ - "--port", "8540", "--gas-limit", "300000000000000", "--balance", "1000000000", - "--chain-id", $CHAIN_ID, + "--port", + "8540", + "--gas-limit", + "300000000000000", + "--balance", + "1000000000", + "--chain-id", + $CHAIN_ID, ], options = {poUsePath}, ) @@ -348,7 +363,8 @@ suite "Onchain group manager": ): OnRegisterCallback = var futureIndex = 0 proc callback(registrations: seq[Membership]): Future[void] {.async.} = - let rateCommitment = getRateCommitment(credentials[futureIndex], UserMessageLimit(1)) + let rateCommitment = + getRateCommitment(credentials[futureIndex], UserMessageLimit(1)) if registrations.len == 1 and registrations[0].rateCommitment == rateCommitment.get() and registrations[0].index == MembershipIndex(futureIndex): @@ -485,7 +501,6 @@ suite "Onchain group manager": manager.idCredentials = some(credentials) fut.complete() - manager.onRegister(callback) try: @@ -568,7 +583,6 @@ suite "Onchain group manager": manager.idCredentials = some(credentials) fut.complete() - manager.onRegister(callback) try: @@ -595,7 +609,8 @@ suite "Onchain group manager": let verified = manager.verifyProof(messageBytes, validProof).valueOr: raiseAssert $error - check: verified + check: + verified await manager.stop() asyncTest "verifyProof: should reject invalid proof": @@ -608,8 +623,11 @@ suite "Onchain group manager": let idCredential = generateCredentials(manager.rlnInstance) try: - await manager.register(RateCommitment(idCommitment: idCredential.idCommitment, - userMessageLimit: UserMessageLimit(1))) + await manager.register( + RateCommitment( + idCommitment: idCredential.idCommitment, userMessageLimit: UserMessageLimit(1) + ) + ) except Exception, CatchableError: assert false, "exception raised when calling startGroupSync: " & getCurrentExceptionMsg() 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 e0617df7e2..56b5e8df12 100644 --- a/tests/waku_rln_relay/test_rln_group_manager_static.nim +++ b/tests/waku_rln_relay/test_rln_group_manager_static.nim @@ -6,10 +6,12 @@ import testutils/unittests, stew/results, options, - ../../../waku/waku_rln_relay/protocol_types, - ../../../waku/waku_rln_relay/rln, - ../../../waku/waku_rln_relay/conversion_utils, - ../../../waku/waku_rln_relay/group_manager/static/group_manager + waku/[ + waku_rln_relay/protocol_types, + waku_rln_relay/rln, + waku_rln_relay/conversion_utils, + waku_rln_relay/group_manager/static/group_manager, + ] import stew/shims/net, chronos, libp2p/crypto/crypto, eth/keys, dnsdisc/builder @@ -137,7 +139,9 @@ suite "Static group manager": registrations[0].rateCommitment == RateCommitment( idCommitment: idCommitment, userMessageLimit: DefaultUserMessageLimit - ).toLeaf().get() + ) + .toLeaf() + .get() callbackCalled = true fut.complete() @@ -201,7 +205,9 @@ suite "Static group manager": withdrawals[0].rateCommitment == RateCommitment( idCommitment: idCommitment, userMessageLimit: DefaultUserMessageLimit - ).toLeaf().get() + ) + .toLeaf() + .get() callbackCalled = true fut.complete() diff --git a/tests/waku_rln_relay/test_rln_nonce_manager.nim b/tests/waku_rln_relay/test_rln_nonce_manager.nim index 81564c4201..3a473f1867 100644 --- a/tests/waku_rln_relay/test_rln_nonce_manager.nim +++ b/tests/waku_rln_relay/test_rln_nonce_manager.nim @@ -1,7 +1,7 @@ {.used.} import testutils/unittests, chronos, os -import ../../../waku/waku_rln_relay/nonce_manager +import waku/waku_rln_relay/nonce_manager suite "Nonce manager": test "should initialize successfully": diff --git a/tests/waku_rln_relay/test_rln_serde.nim b/tests/waku_rln_relay/test_rln_serde.nim index 4517d86ddc..a41d348b8a 100644 --- a/tests/waku_rln_relay/test_rln_serde.nim +++ b/tests/waku_rln_relay/test_rln_serde.nim @@ -4,9 +4,7 @@ import ./rln/waku_rln_relay_utils, - ../../waku/waku_keystore/protocol_types, - ../../waku/waku_rln_relay, - ../../waku/waku_rln_relay/rln + waku/[waku_keystore/protocol_types, waku_rln_relay, waku_rln_relay/rln] import testutils/unittests import stew/results, stint diff --git a/tests/waku_rln_relay/test_waku_rln_relay.nim b/tests/waku_rln_relay/test_waku_rln_relay.nim index 454ec10a51..4c2e854824 100644 --- a/tests/waku_rln_relay/test_waku_rln_relay.nim +++ b/tests/waku_rln_relay/test_waku_rln_relay.nim @@ -10,11 +10,13 @@ import stint, libp2p/crypto/crypto import - ../../../waku/waku_core, - ../../../waku/waku_rln_relay, - ../../../waku/waku_rln_relay/rln, - ../../../waku/waku_rln_relay/protocol_metrics, - ../../../waku/waku_keystore, + waku/[ + waku_core, + waku_rln_relay, + waku_rln_relay/rln, + waku_rln_relay/protocol_metrics, + waku_keystore, + ], ../testlib/common, ./rln/waku_rln_relay_utils @@ -886,7 +888,7 @@ suite "Waku rln relay": check: buckets.len == 5 buckets == [2.0, 4.0, 6.0, 8.0, 10.0] - + asyncTest "nullifierLog clearing only after epoch has passed": let index = MembershipIndex(0) @@ -904,22 +906,25 @@ suite "Waku rln relay": let rlnMaxEpochGap = wakuRlnRelay.rlnMaxEpochGap let testProofMetadata = default(ProofMetadata) - let testProofMetadataTable = {testProofMetadata.nullifier: testProofMetadata}.toTable() + let testProofMetadataTable = + {testProofMetadata.nullifier: testProofMetadata}.toTable() - for i in 0..rlnMaxEpochGap: + for i in 0 .. rlnMaxEpochGap: # we add epochs to the nullifierLog - let testEpoch = wakuRlnRelay.calcEpoch(epochTime() + float(rlnEpochSizeSec * i)) + let testEpoch = wakuRlnRelay.calcEpoch(epochTime() + float(rlnEpochSizeSec * i)) wakuRlnRelay.nullifierLog[testEpoch] = testProofMetadataTable - check: wakuRlnRelay.nullifierLog.len().uint == i + 1 + check: + wakuRlnRelay.nullifierLog.len().uint == i + 1 - check: wakuRlnRelay.nullifierLog.len().uint == rlnMaxEpochGap + 1 + check: + wakuRlnRelay.nullifierLog.len().uint == rlnMaxEpochGap + 1 # clearing it now will remove 1 epoch wakuRlnRelay.clearNullifierLog() - check: wakuRlnRelay.nullifierLog.len().uint == rlnMaxEpochGap + check: + wakuRlnRelay.nullifierLog.len().uint == rlnMaxEpochGap - var testEpochSizes: seq[uint] = @[1,5,10,30,60,600] + var testEpochSizes: seq[uint] = @[1, 5, 10, 30, 60, 600] for i in testEpochSizes: await runTestForEpochSizeSec(i) - diff --git a/tests/waku_rln_relay/test_wakunode_rln_relay.nim b/tests/waku_rln_relay/test_wakunode_rln_relay.nim index 9a25f21ad8..75ff65aa43 100644 --- a/tests/waku_rln_relay/test_wakunode_rln_relay.nim +++ b/tests/waku_rln_relay/test_wakunode_rln_relay.nim @@ -10,9 +10,7 @@ import libp2p/switch, libp2p/protocols/pubsub/pubsub import - ../../../waku/waku_core, - ../../../waku/waku_node, - ../../../waku/waku_rln_relay, + waku/[waku_core, waku_node, waku_rln_relay], ../testlib/wakucore, ../testlib/wakunode, ./rln/waku_rln_relay_utils @@ -413,6 +411,7 @@ procSuite "WakuNode - RLN relay": raiseAssert $error node3.wakuRlnRelay.unsafeAppendRLNProof(wm2, time).isOkOr: raiseAssert $error + node3.wakuRlnRelay.unsafeAppendRLNProof( wm3, time + float64(node3.wakuRlnRelay.rlnEpochSizeSec) ).isOkOr: @@ -530,6 +529,7 @@ procSuite "WakuNode - RLN relay": raiseAssert $error node1.wakuRlnRelay.unsafeAppendRLNProof(wm2, time).isOkOr: raiseAssert $error + node1.wakuRlnRelay.unsafeAppendRLNProof( wm3, time + float64(node1.wakuRlnRelay.rlnEpochSizeSec * 2) ).isOkOr: diff --git a/tests/waku_store/store_utils.nim b/tests/waku_store/store_utils.nim index 595466fb84..80990f2383 100644 --- a/tests/waku_store/store_utils.nim +++ b/tests/waku_store/store_utils.nim @@ -3,7 +3,7 @@ import std/options, chronos, chronicles, libp2p/crypto/crypto import - ../../../waku/[node/peer_manager, waku_core, waku_store, waku_store/client], + waku/[node/peer_manager, waku_core, waku_store, waku_store/client], ../testlib/[common, wakucore] proc newTestWakuStore*( diff --git a/tests/waku_store/test_client.nim b/tests/waku_store/test_client.nim index b4ba91a99c..53e95b83e2 100644 --- a/tests/waku_store/test_client.nim +++ b/tests/waku_store/test_client.nim @@ -3,8 +3,7 @@ import std/options, testutils/unittests, chronos, chronicles, libp2p/crypto/crypto import - ../../../waku/ - [node/peer_manager, waku_core, waku_store, waku_store/client, common/paging], + waku/[node/peer_manager, waku_core, waku_store, waku_store/client, common/paging], ../testlib/[common, wakucore, testasync, futures], ./store_utils diff --git a/tests/waku_store/test_rpc_codec.nim b/tests/waku_store/test_rpc_codec.nim index 6f5135d154..961e3c029d 100644 --- a/tests/waku_store/test_rpc_codec.nim +++ b/tests/waku_store/test_rpc_codec.nim @@ -2,11 +2,8 @@ import std/options, testutils/unittests, chronos import - ../../../waku/common/protobuf, - ../../../waku/common/paging, - ../../../waku/waku_core, - ../../../waku/waku_store/common, - ../../../waku/waku_store/rpc_codec, + waku/ + [common/protobuf, common/paging, waku_core, waku_store/common, waku_store/rpc_codec], ../testlib/wakucore procSuite "Waku Store - RPC codec": diff --git a/tests/waku_store/test_waku_store.nim b/tests/waku_store/test_waku_store.nim index 38fa46271e..ab2c888aa1 100644 --- a/tests/waku_store/test_waku_store.nim +++ b/tests/waku_store/test_waku_store.nim @@ -3,7 +3,7 @@ import std/options, testutils/unittests, chronos, chronicles, libp2p/crypto/crypto import - ../../../waku/[ + waku/[ common/paging, node/peer_manager, waku_core, diff --git a/tests/waku_store/test_wakunode_store.nim b/tests/waku_store/test_wakunode_store.nim index c9806971ac..a3c9436277 100644 --- a/tests/waku_store/test_wakunode_store.nim +++ b/tests/waku_store/test_wakunode_store.nim @@ -14,17 +14,19 @@ import libp2p/protocols/pubsub/pubsub, libp2p/protocols/pubsub/gossipsub import - ../../../waku/common/paging, - ../../../waku/waku_core, - ../../../waku/waku_core/message/digest, - ../../../waku/waku_core/subscription, - ../../../waku/node/peer_manager, - ../../../waku/waku_archive, - ../../../waku/waku_archive/driver/sqlite_driver, - ../../../waku/waku_filter_v2, - ../../../waku/waku_filter_v2/client, - ../../../waku/waku_store, - ../../../waku/waku_node, + waku/[ + 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, + waku_node, + ], ../waku_store/store_utils, ../waku_archive/archive_utils, ../testlib/wakucore, diff --git a/tests/waku_store_legacy/store_utils.nim b/tests/waku_store_legacy/store_utils.nim index 20dcf66935..cd62369288 100644 --- a/tests/waku_store_legacy/store_utils.nim +++ b/tests/waku_store_legacy/store_utils.nim @@ -3,8 +3,7 @@ import std/options, chronos, chronicles, libp2p/crypto/crypto import - ../../../waku/ - [node/peer_manager, waku_core, waku_store_legacy, waku_store_legacy/client], + waku/[node/peer_manager, waku_core, waku_store_legacy, waku_store_legacy/client], ../testlib/[common, wakucore] proc newTestWakuStore*( diff --git a/tests/waku_store_legacy/test_client.nim b/tests/waku_store_legacy/test_client.nim index 7b52a623a6..57099e9957 100644 --- a/tests/waku_store_legacy/test_client.nim +++ b/tests/waku_store_legacy/test_client.nim @@ -3,7 +3,7 @@ import std/options, testutils/unittests, chronos, chronicles, libp2p/crypto/crypto import - ../../../waku/[ + waku/[ node/peer_manager, waku_core, waku_store_legacy, diff --git a/tests/waku_store_legacy/test_resume.nim b/tests/waku_store_legacy/test_resume.nim index a35c2f9bd4..a7eacd0bf2 100644 --- a/tests/waku_store_legacy/test_resume.nim +++ b/tests/waku_store_legacy/test_resume.nim @@ -11,13 +11,15 @@ when defined(waku_exp_store_resume): chronicles, libp2p/crypto/crypto import - ../../waku/common/databases/db_sqlite, - ../../waku/waku_archive/driver, - ../../waku/waku_archive/driver/sqlite_driver/sqlite_driver, - ../../waku/node/peer_manager, - ../../waku/waku_core, - ../../waku/waku_core/message/digest, - ../../waku/waku_store_legacy, + waku/[ + common/databases/db_sqlite, + waku_archive/driver, + waku_archive/driver/sqlite_driver/sqlite_driver, + node/peer_manager, + waku_core, + waku_core/message/digest, + waku_store_legacy, + ], ../waku_store_legacy/store_utils, ../waku_archive/archive_utils, ./testlib/common, diff --git a/tests/waku_store_legacy/test_rpc_codec.nim b/tests/waku_store_legacy/test_rpc_codec.nim index 211aecb6c5..dae738d01a 100644 --- a/tests/waku_store_legacy/test_rpc_codec.nim +++ b/tests/waku_store_legacy/test_rpc_codec.nim @@ -2,11 +2,13 @@ import std/options, testutils/unittests, chronos import - ../../../waku/common/protobuf, - ../../../waku/common/paging, - ../../../waku/waku_core, - ../../../waku/waku_store_legacy/rpc, - ../../../waku/waku_store_legacy/rpc_codec, + waku/[ + common/protobuf, + common/paging, + waku_core, + waku_store_legacy/rpc, + waku_store_legacy/rpc_codec, + ], ../testlib/common, ../testlib/wakucore diff --git a/tests/waku_store_legacy/test_waku_store.nim b/tests/waku_store_legacy/test_waku_store.nim index 1e190ee8d3..a134645a9c 100644 --- a/tests/waku_store_legacy/test_waku_store.nim +++ b/tests/waku_store_legacy/test_waku_store.nim @@ -3,7 +3,7 @@ import std/options, testutils/unittests, chronos, chronicles, libp2p/crypto/crypto import - ../../../waku/[ + waku/[ common/paging, node/peer_manager, waku_core, diff --git a/tests/waku_store_legacy/test_wakunode_store.nim b/tests/waku_store_legacy/test_wakunode_store.nim index ede1f943dc..e2fe7d5e7d 100644 --- a/tests/waku_store_legacy/test_wakunode_store.nim +++ b/tests/waku_store_legacy/test_wakunode_store.nim @@ -13,18 +13,20 @@ import libp2p/protocols/pubsub/pubsub, libp2p/protocols/pubsub/gossipsub import - ../../../waku/common/databases/db_sqlite, - ../../../waku/common/paging, - ../../../waku/waku_core, - ../../../waku/waku_core/message/digest, - ../../../waku/waku_core/subscription, - ../../../waku/node/peer_manager, - ../../../waku/waku_archive, - ../../../waku/waku_archive/driver/sqlite_driver, - ../../../waku/waku_filter_v2, - ../../../waku/waku_filter_v2/client, - ../../../waku/waku_store_legacy, - ../../../waku/waku_node, + waku/[ + common/databases/db_sqlite, + 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_legacy, + waku_node, + ], ../waku_store_legacy/store_utils, ../waku_archive/archive_utils, ../testlib/common, diff --git a/tests/wakunode2/test_app.nim b/tests/wakunode2/test_app.nim index fa5099f718..6228fef3fa 100644 --- a/tests/wakunode2/test_app.nim +++ b/tests/wakunode2/test_app.nim @@ -10,12 +10,9 @@ import libp2p/multiaddress, libp2p/switch import - ../testlib/common, - ../testlib/wakucore, - ../testlib/wakunode, - ../../waku/node/waku_metrics + ../testlib/common, ../testlib/wakucore, ../testlib/wakunode, waku/node/waku_metrics -include ../../waku/factory/waku +include waku/factory/waku suite "Wakunode2 - Waku": test "compilation version should be reported": diff --git a/tests/wakunode2/test_validators.nim b/tests/wakunode2/test_validators.nim index 2331036758..5c30d14667 100644 --- a/tests/wakunode2/test_validators.nim +++ b/tests/wakunode2/test_validators.nim @@ -13,12 +13,14 @@ import libp2p/multihash, secp256k1 import - ../../waku/waku_core, - ../../waku/node/peer_manager, - ../../waku/waku_node, - ../../waku/waku_relay, - ../../waku/factory/external_config, - ../../waku/factory/validator_signed, + waku/[ + waku_core, + node/peer_manager, + waku_node, + waku_relay, + factory/external_config, + factory/validator_signed, + ], ../testlib/wakucore, ../testlib/wakunode diff --git a/tests/wakunode_rest/test_rest_admin.nim b/tests/wakunode_rest/test_rest_admin.nim index d53b949b65..d7b83d23bf 100644 --- a/tests/wakunode_rest/test_rest_admin.nim +++ b/tests/wakunode_rest/test_rest_admin.nim @@ -9,17 +9,19 @@ import libp2p/crypto/crypto import - ../../waku/waku_core, - ../../waku/waku_node, - ../../waku/waku_filter_v2/client, - ../../waku/node/peer_manager, - ../../waku/waku_api/rest/server, - ../../waku/waku_api/rest/client, - ../../waku/waku_api/rest/responses, - ../../waku/waku_api/rest/admin/types, - ../../waku/waku_api/rest/admin/handlers as admin_api, - ../../waku/waku_api/rest/admin/client as admin_api_client, - ../../waku/waku_relay, + waku/[ + waku_core, + waku_node, + waku_filter_v2/client, + node/peer_manager, + waku_api/rest/server, + waku_api/rest/client, + waku_api/rest/responses, + waku_api/rest/admin/types, + waku_api/rest/admin/handlers as admin_api, + waku_api/rest/admin/client as admin_api_client, + waku_relay, + ], ../testlib/wakucore, ../testlib/wakunode, ../testlib/testasync diff --git a/tests/wakunode_rest/test_rest_cors.nim b/tests/wakunode_rest/test_rest_cors.nim index 0ad24489df..49b05df169 100644 --- a/tests/wakunode_rest/test_rest_cors.nim +++ b/tests/wakunode_rest/test_rest_cors.nim @@ -9,13 +9,15 @@ import libp2p/multiaddress, libp2p/crypto/crypto import - ../../waku/waku_node, - ../../waku/node/waku_node as waku_node2, - ../../waku/waku_api/rest/server, - ../../waku/waku_api/rest/client, - ../../waku/waku_api/rest/responses, - ../../waku/waku_api/rest/debug/handlers as debug_api, - ../../waku/waku_api/rest/debug/client as debug_api_client, + waku/[ + 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, ../testlib/wakunode diff --git a/tests/wakunode_rest/test_rest_debug.nim b/tests/wakunode_rest/test_rest_debug.nim index a0fdcf2ba0..1d7359f683 100644 --- a/tests/wakunode_rest/test_rest_debug.nim +++ b/tests/wakunode_rest/test_rest_debug.nim @@ -9,14 +9,16 @@ import libp2p/multiaddress, libp2p/crypto/crypto import - ../../waku/waku_node, - ../../waku/node/waku_node as waku_node2, - # TODO: Remove after moving `git_version` to the app code. - ../../waku/waku_api/rest/server, - ../../waku/waku_api/rest/client, - ../../waku/waku_api/rest/responses, - ../../waku/waku_api/rest/debug/handlers as debug_api, - ../../waku/waku_api/rest/debug/client as debug_api_client, + waku/[ + waku_node, + node/waku_node as waku_node2, + # TODO: Remove after moving `git_version` to the app code. + 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, ../testlib/wakunode diff --git a/tests/wakunode_rest/test_rest_debug_serdes.nim b/tests/wakunode_rest/test_rest_debug_serdes.nim index 7b44f579b1..bf007b8d29 100644 --- a/tests/wakunode_rest/test_rest_debug_serdes.nim +++ b/tests/wakunode_rest/test_rest_debug_serdes.nim @@ -1,7 +1,7 @@ {.used.} import stew/results, stew/byteutils, testutils/unittests, json_serialization -import ../../waku/waku_api/rest/serdes, ../../waku/waku_api/rest/debug/types +import waku/waku_api/rest/serdes, waku/waku_api/rest/debug/types suite "Waku v2 REST API - Debug - serialization": suite "DebugWakuInfo - decode": diff --git a/tests/wakunode_rest/test_rest_filter.nim b/tests/wakunode_rest/test_rest_filter.nim index 1127a9cc98..60252f92aa 100644 --- a/tests/wakunode_rest/test_rest_filter.nim +++ b/tests/wakunode_rest/test_rest_filter.nim @@ -10,21 +10,23 @@ import presto/client as presto_client, libp2p/crypto/crypto import - ../../waku/waku_api/message_cache, - ../../waku/waku_core, - ../../waku/waku_node, - ../../waku/node/peer_manager, - ../../waku/waku_api/rest/server, - ../../waku/waku_api/rest/client, - ../../waku/waku_api/rest/responses, - ../../waku/waku_api/rest/filter/types, - ../../waku/waku_api/rest/filter/handlers as filter_api, - ../../waku/waku_api/rest/filter/client as filter_api_client, - ../../waku/waku_relay, - ../../waku/waku_filter_v2/subscriptions, - ../../waku/waku_filter_v2/common, - ../../waku/waku_api/rest/relay/handlers as relay_api, - ../../waku/waku_api/rest/relay/client as relay_api_client, + waku/[ + waku_api/message_cache, + waku_core, + waku_node, + node/peer_manager, + waku_api/rest/server, + waku_api/rest/client, + waku_api/rest/responses, + waku_api/rest/filter/types, + waku_api/rest/filter/handlers as filter_api, + waku_api/rest/filter/client as filter_api_client, + waku_relay, + waku_filter_v2/subscriptions, + waku_filter_v2/common, + waku_api/rest/relay/handlers as relay_api, + waku_api/rest/relay/client as relay_api_client, + ], ../testlib/wakucore, ../testlib/wakunode diff --git a/tests/wakunode_rest/test_rest_health.nim b/tests/wakunode_rest/test_rest_health.nim index f2ff967ffc..f3b27906ee 100644 --- a/tests/wakunode_rest/test_rest_health.nim +++ b/tests/wakunode_rest/test_rest_health.nim @@ -10,16 +10,18 @@ import libp2p/multiaddress, libp2p/crypto/crypto import - ../../waku/waku_node, - ../../waku/node/waku_node as waku_node2, - # TODO: Remove after moving `git_version` to the app code. - ../../waku/waku_api/rest/server, - ../../waku/waku_api/rest/client, - ../../waku/waku_api/rest/responses, - ../../waku/waku_api/rest/health/handlers as health_api, - ../../waku/waku_api/rest/health/client as health_api_client, - ../../waku/waku_rln_relay, - ../../waku/node/health_monitor, + waku/[ + waku_node, + node/waku_node as waku_node2, + # TODO: Remove after moving `git_version` to the app code. + waku_api/rest/server, + waku_api/rest/client, + waku_api/rest/responses, + waku_api/rest/health/handlers as health_api, + waku_api/rest/health/client as health_api_client, + waku_rln_relay, + node/health_monitor, + ], ../testlib/common, ../testlib/testutils, ../testlib/wakucore, diff --git a/tests/wakunode_rest/test_rest_lightpush.nim b/tests/wakunode_rest/test_rest_lightpush.nim index 217540f46e..0922ba322a 100644 --- a/tests/wakunode_rest/test_rest_lightpush.nim +++ b/tests/wakunode_rest/test_rest_lightpush.nim @@ -10,19 +10,21 @@ import libp2p/crypto/crypto import - ../../waku/waku_api/message_cache, - ../../waku/waku_core, - ../../waku/waku_node, - ../../waku/node/peer_manager, - ../../waku/waku_lightpush/common, - ../../waku/waku_api/rest/server, - ../../waku/waku_api/rest/client, - ../../waku/waku_api/rest/responses, - ../../waku/waku_api/rest/lightpush/types, - ../../waku/waku_api/rest/lightpush/handlers as lightpush_api, - ../../waku/waku_api/rest/lightpush/client as lightpush_api_client, - ../../waku/waku_relay, - ../../waku/common/ratelimit, + waku/[ + waku_api/message_cache, + waku_core, + waku_node, + node/peer_manager, + waku_lightpush/common, + waku_api/rest/server, + waku_api/rest/client, + waku_api/rest/responses, + waku_api/rest/lightpush/types, + waku_api/rest/lightpush/handlers as lightpush_api, + waku_api/rest/lightpush/client as lightpush_api_client, + waku_relay, + common/ratelimit, + ], ../testlib/wakucore, ../testlib/wakunode, ../testlib/testutils diff --git a/tests/wakunode_rest/test_rest_relay.nim b/tests/wakunode_rest/test_rest_relay.nim index d146521f53..f3462a2789 100644 --- a/tests/wakunode_rest/test_rest_relay.nim +++ b/tests/wakunode_rest/test_rest_relay.nim @@ -9,18 +9,20 @@ import presto/client as presto_client, libp2p/crypto/crypto import - ../../waku/common/base64, - ../../waku/waku_core, - ../../waku/waku_node, - ../../waku/waku_api/message_cache, - ../../waku/waku_api/rest/server, - ../../waku/waku_api/rest/client, - ../../waku/waku_api/rest/responses, - ../../waku/waku_api/rest/relay/types, - ../../waku/waku_api/rest/relay/handlers as relay_api, - ../../waku/waku_api/rest/relay/client as relay_api_client, - ../../waku/waku_relay, - ../../../waku/waku_rln_relay, + waku/[ + common/base64, + waku_core, + waku_node, + waku_api/message_cache, + waku_api/rest/server, + waku_api/rest/client, + waku_api/rest/responses, + waku_api/rest/relay/types, + waku_api/rest/relay/handlers as relay_api, + waku_api/rest/relay/client as relay_api_client, + waku_relay, + waku_rln_relay, + ], ../testlib/wakucore, ../testlib/wakunode, ../resources/payloads diff --git a/tests/wakunode_rest/test_rest_relay_serdes.nim b/tests/wakunode_rest/test_rest_relay_serdes.nim index 78255689e6..8cc5835f06 100644 --- a/tests/wakunode_rest/test_rest_relay_serdes.nim +++ b/tests/wakunode_rest/test_rest_relay_serdes.nim @@ -1,11 +1,7 @@ {.used.} import stew/[results, byteutils], chronicles, unittest2, json_serialization -import - ../../waku/common/base64, - ../../waku/waku_api/rest/serdes, - ../../waku/waku_api/rest/relay/types, - ../../waku/waku_core +import waku/[common/base64, waku_api/rest/serdes, waku_api/rest/relay/types, waku_core] suite "Waku v2 Rest API - Relay - serialization": suite "RelayWakuMessage - decode": diff --git a/tests/wakunode_rest/test_rest_serdes.nim b/tests/wakunode_rest/test_rest_serdes.nim index 94e8ab89b2..c50bba9838 100644 --- a/tests/wakunode_rest/test_rest_serdes.nim +++ b/tests/wakunode_rest/test_rest_serdes.nim @@ -1,7 +1,7 @@ {.used.} import stew/[results, byteutils], chronicles, unittest2, json_serialization -import ../../waku/waku_api/rest/serdes, ../../waku/waku_api/rest/debug/types +import waku/waku_api/rest/serdes, waku/waku_api/rest/debug/types # TODO: Decouple this test suite from the `debug_api` module by defining # private custom types for this test suite module diff --git a/tests/wakunode_rest/test_rest_store.nim b/tests/wakunode_rest/test_rest_store.nim index 4c653b55fd..030fae2dc7 100644 --- a/tests/wakunode_rest/test_rest_store.nim +++ b/tests/wakunode_rest/test_rest_store.nim @@ -11,24 +11,26 @@ import presto/client as presto_client, libp2p/crypto/crypto import - ../../../waku/waku_core/message, - ../../../waku/waku_core/message/digest, - ../../../waku/waku_core/topics, - ../../../waku/waku_core/time, - ../../../waku/waku_node, - ../../../waku/node/peer_manager, - ../../../waku/waku_api/rest/server, - ../../../waku/waku_api/rest/client, - ../../../waku/waku_api/rest/responses, - ../../../waku/waku_api/rest/store/handlers as store_api, - ../../../waku/waku_api/rest/store/client as store_api_client, - ../../../waku/waku_api/rest/store/types, - ../../../waku/waku_archive, - ../../../waku/waku_archive/driver/queue_driver, - ../../../waku/waku_archive/driver/sqlite_driver, - ../../../waku/common/databases/db_sqlite, - ../../../waku/waku_archive/driver/postgres_driver, - ../../../waku/waku_store as waku_store, + waku/[ + waku_core/message, + waku_core/message/digest, + waku_core/topics, + waku_core/time, + waku_node, + node/peer_manager, + waku_api/rest/server, + waku_api/rest/client, + waku_api/rest/responses, + waku_api/rest/store/handlers as store_api, + waku_api/rest/store/client as store_api_client, + waku_api/rest/store/types, + waku_archive, + waku_archive/driver/queue_driver, + waku_archive/driver/sqlite_driver, + common/databases/db_sqlite, + waku_archive/driver/postgres_driver, + waku_store as waku_store, + ], ../testlib/wakucore, ../testlib/wakunode diff --git a/tools/rln_db_inspector/rln_db_inspector.nim b/tools/rln_db_inspector/rln_db_inspector.nim index 0820e255fe..c344b43350 100644 --- a/tools/rln_db_inspector/rln_db_inspector.nim +++ b/tools/rln_db_inspector/rln_db_inspector.nim @@ -6,9 +6,7 @@ else: import chronicles, sequtils, stew/[results] import - ../../waku/waku_rln_relay/rln, - ../../waku/waku_rln_relay/conversion_utils, - ../../waku/factory/external_config + waku/[waku_rln_relay/rln, waku_rln_relay/conversion_utils, factory/external_config] logScope: topics = "rln_db_inspector" diff --git a/tools/rln_keystore_generator/rln_keystore_generator.nim b/tools/rln_keystore_generator/rln_keystore_generator.nim index 2157b1c1b3..fb6280a527 100644 --- a/tools/rln_keystore_generator/rln_keystore_generator.nim +++ b/tools/rln_keystore_generator/rln_keystore_generator.nim @@ -6,11 +6,13 @@ else: import chronicles, stew/[results], std/tempfiles import - ../../waku/waku_keystore, - ../../waku/waku_rln_relay/rln, - ../../waku/waku_rln_relay/conversion_utils, - ../../waku/waku_rln_relay/group_manager/on_chain, - ../../waku/factory/external_config + waku/[ + waku_keystore, + waku_rln_relay/rln, + waku_rln_relay/conversion_utils, + waku_rln_relay/group_manager/on_chain, + factory/external_config, + ] logScope: topics = "rln_keystore_generator" @@ -91,7 +93,6 @@ proc doRlnKeystoreGenerator*(conf: WakuNodeConf) = userMessageLimit: conf.rlnRelayUserMessageLimit, ) - let persistRes = addMembershipCredentials( conf.rlnRelayCredPath, keystoreCred, conf.rlnRelayCredPassword, RLNAppInfo ) diff --git a/waku/factory/waku.nim b/waku/factory/waku.nim index 709be62c27..91a228cdb6 100644 --- a/waku/factory/waku.nim +++ b/waku/factory/waku.nim @@ -15,24 +15,24 @@ import metrics, metrics/chronos_httpserver import - ../../waku/common/logging, - ../../waku/waku_core, - ../../waku/waku_node, - ../../waku/node/peer_manager, - ../../waku/node/health_monitor, - ../../waku/waku_api/message_cache, - ../../waku/waku_api/rest/server, - ../../waku/waku_archive, - ../../waku/discovery/waku_dnsdisc, - ../../waku/discovery/waku_discv5, - ../../waku/waku_enr/sharding, - ../../waku/waku_rln_relay, - ../../waku/waku_store, - ../../waku/waku_filter_v2, - ../../waku/factory/networks_config, - ../../waku/factory/node_factory, - ../../waku/factory/internal_config, - ../../waku/factory/external_config + ../common/logging, + ../waku_core, + ../waku_node, + ../node/peer_manager, + ../node/health_monitor, + ../waku_api/message_cache, + ../waku_api/rest/server, + ../waku_archive, + ../discovery/waku_dnsdisc, + ../discovery/waku_discv5, + ../waku_enr/sharding, + ../waku_rln_relay, + ../waku_store, + ../waku_filter_v2, + ../factory/networks_config, + ../factory/node_factory, + ../factory/internal_config, + ../factory/external_config logScope: topics = "wakunode waku"