From fede9cc194058596a1fe91af546260b583a39ef7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20H=C3=A4ggblad?= Date: Mon, 20 Feb 2023 17:05:08 +0100 Subject: [PATCH] Add nym prefix to topology and version checker crates (#3061) * Rename crate to nym-topology * Rename crate to nym-version-checker * Remove unused topology * rustfmt --- Cargo.lock | 76 +++++++++---------- clients/client-core/Cargo.toml | 2 +- .../real_messages_control/message_handler.rs | 2 +- .../src/client/topology_control.rs | 2 +- clients/client-core/src/config/mod.rs | 4 +- clients/client-core/src/error.rs | 2 +- clients/client-core/src/init/helpers.rs | 2 +- clients/native/Cargo.toml | 4 +- clients/native/src/commands/run.rs | 2 +- clients/native/src/commands/upgrade.rs | 2 +- clients/socks5/Cargo.toml | 4 +- clients/socks5/src/commands/run.rs | 2 +- clients/socks5/src/commands/upgrade.rs | 2 +- clients/webassembly/Cargo.toml | 1 - common/mixnode-common/Cargo.toml | 2 +- common/mixnode-common/src/verloc/mod.rs | 9 ++- common/nymsphinx/Cargo.toml | 2 +- common/nymsphinx/acknowledgements/Cargo.toml | 2 +- .../acknowledgements/src/surb_ack.rs | 2 +- common/nymsphinx/anonymous-replies/Cargo.toml | 2 +- .../anonymous-replies/src/reply_surb.rs | 2 +- common/nymsphinx/cover/Cargo.toml | 2 +- common/nymsphinx/cover/src/lib.rs | 2 +- common/nymsphinx/src/preparer/mod.rs | 2 +- common/nymsphinx/src/receiver.rs | 2 +- common/topology/Cargo.toml | 4 +- common/topology/src/filter.rs | 2 +- common/version-checker/Cargo.toml | 2 +- gateway/Cargo.toml | 2 +- gateway/src/commands/mod.rs | 2 +- gateway/src/commands/upgrade.rs | 2 +- mixnode/Cargo.toml | 4 +- mixnode/src/commands/mod.rs | 2 +- mixnode/src/commands/upgrade.rs | 2 +- mixnode/src/node/mod.rs | 2 +- nym-api/Cargo.toml | 4 +- nym-api/src/network_monitor/chunker.rs | 2 +- .../src/network_monitor/monitor/preparer.rs | 2 +- nym-api/src/network_monitor/test_packet.rs | 2 +- nym-api/src/network_monitor/test_route/mod.rs | 2 +- nym-connect-android/src-tauri/Cargo.toml | 1 - nym-connect/src-tauri/Cargo.toml | 1 - .../network-requester/Cargo.toml | 2 +- .../network-requester/src/cli/run.rs | 2 +- 44 files changed, 89 insertions(+), 89 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2d9a6d9980..d2cec6d7fd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -710,6 +710,7 @@ dependencies = [ "nym-crypto", "nym-pemstore", "nym-sphinx", + "nym-topology", "rand 0.7.3", "serde", "serde_json", @@ -721,7 +722,6 @@ dependencies = [ "time 0.3.17", "tokio", "tokio-stream", - "topology", "url", "validator-client", "wasm-bindgen", @@ -3194,6 +3194,7 @@ dependencies = [ "nym-sphinx-framing", "nym-sphinx-params", "nym-sphinx-types", + "nym-version-checker", "rand 0.8.5", "serde", "task", @@ -3202,7 +3203,6 @@ dependencies = [ "tokio-util", "url", "validator-client", - "version-checker", ] [[package]] @@ -3406,6 +3406,8 @@ dependencies = [ "nym-mixnet-contract-common", "nym-pemstore", "nym-sphinx", + "nym-topology", + "nym-version-checker", "nym-vesting-contract-common", "nymcoconut", "okapi", @@ -3427,11 +3429,9 @@ dependencies = [ "time 0.3.17", "tokio", "tokio-stream", - "topology", "ts-rs", "url", "validator-client", - "version-checker", ] [[package]] @@ -3546,6 +3546,8 @@ dependencies = [ "nym-crypto", "nym-pemstore", "nym-sphinx", + "nym-topology", + "nym-version-checker", "pretty_env_logger", "rand 0.7.3", "serde", @@ -3555,10 +3557,8 @@ dependencies = [ "thiserror", "tokio", "tokio-tungstenite 0.14.0", - "topology", "url", "validator-client", - "version-checker", "websocket-requests", ] @@ -3633,6 +3633,7 @@ dependencies = [ "nym-pemstore", "nym-sphinx", "nym-types", + "nym-version-checker", "once_cell", "pretty_env_logger", "rand 0.7.3", @@ -3649,7 +3650,6 @@ dependencies = [ "tokio-util", "url", "validator-client", - "version-checker", ] [[package]] @@ -3699,7 +3699,9 @@ dependencies = [ "nym-sphinx", "nym-sphinx-params", "nym-sphinx-types", + "nym-topology", "nym-types", + "nym-version-checker", "pretty_env_logger", "rand 0.7.3", "rocket", @@ -3710,10 +3712,8 @@ dependencies = [ "tokio", "tokio-util", "toml", - "topology", "url", "validator-client", - "version-checker", ] [[package]] @@ -3737,6 +3737,7 @@ dependencies = [ "nym-crypto", "nym-sdk", "nym-sphinx", + "nym-version-checker", "ordered-buffer", "pretty_env_logger", "proxy-helpers", @@ -3754,7 +3755,6 @@ dependencies = [ "tokio", "tokio-tungstenite 0.17.2", "url", - "version-checker", "websocket-requests", ] @@ -3847,6 +3847,8 @@ dependencies = [ "nym-crypto", "nym-pemstore", "nym-sphinx", + "nym-topology", + "nym-version-checker", "ordered-buffer", "pin-project", "pretty_env_logger", @@ -3860,10 +3862,8 @@ dependencies = [ "task", "thiserror", "tokio", - "topology", "url", "validator-client", - "version-checker", ] [[package]] @@ -3881,11 +3881,11 @@ dependencies = [ "nym-sphinx-framing", "nym-sphinx-params", "nym-sphinx-types", + "nym-topology", "rand 0.7.3", "rand_distr", "thiserror", "tokio", - "topology", ] [[package]] @@ -3897,9 +3897,9 @@ dependencies = [ "nym-sphinx-addressing", "nym-sphinx-params", "nym-sphinx-types", + "nym-topology", "rand 0.7.3", "thiserror", - "topology", ] [[package]] @@ -3922,10 +3922,10 @@ dependencies = [ "nym-sphinx-addressing", "nym-sphinx-params", "nym-sphinx-types", + "nym-topology", "rand 0.7.3", "serde", "thiserror", - "topology", "wasm-bindgen", ] @@ -3952,9 +3952,9 @@ dependencies = [ "nym-sphinx-forwarding", "nym-sphinx-params", "nym-sphinx-types", + "nym-topology", "rand 0.7.3", "thiserror", - "topology", ] [[package]] @@ -3993,6 +3993,21 @@ dependencies = [ "sphinx", ] +[[package]] +name = "nym-topology" +version = "0.1.0" +dependencies = [ + "bs58", + "log", + "nym-crypto", + "nym-mixnet-contract-common", + "nym-sphinx-addressing", + "nym-sphinx-types", + "nym-version-checker", + "rand 0.7.3", + "thiserror", +] + [[package]] name = "nym-types" version = "1.0.0" @@ -4019,6 +4034,13 @@ dependencies = [ "validator-client", ] +[[package]] +name = "nym-version-checker" +version = "0.1.0" +dependencies = [ + "semver 0.11.0", +] + [[package]] name = "nym-vesting-contract" version = "1.1.3" @@ -6533,21 +6555,6 @@ dependencies = [ "tracing-futures", ] -[[package]] -name = "topology" -version = "0.1.0" -dependencies = [ - "bs58", - "log", - "nym-crypto", - "nym-mixnet-contract-common", - "nym-sphinx-addressing", - "nym-sphinx-types", - "rand 0.7.3", - "thiserror", - "version-checker", -] - [[package]] name = "tower" version = "0.4.13" @@ -6988,13 +6995,6 @@ dependencies = [ "time 0.3.17", ] -[[package]] -name = "version-checker" -version = "0.1.0" -dependencies = [ - "semver 0.11.0", -] - [[package]] name = "version_check" version = "0.9.4" diff --git a/clients/client-core/Cargo.toml b/clients/client-core/Cargo.toml index 0f4b688584..8c6ebb514d 100644 --- a/clients/client-core/Cargo.toml +++ b/clients/client-core/Cargo.toml @@ -33,7 +33,7 @@ gateway-requests = { path = "../../gateway/gateway-requests" } nonexhaustive-delayqueue = { path = "../../common/nonexhaustive-delayqueue" } nym-sphinx = { path = "../../common/nymsphinx" } nym-pemstore = { path = "../../common/pemstore" } -topology = { path = "../../common/topology" } +nym-topology = { path = "../../common/topology" } validator-client = { path = "../../common/client-libs/validator-client", default-features = false } task = { path = "../../common/task" } diff --git a/clients/client-core/src/client/real_messages_control/message_handler.rs b/clients/client-core/src/client/real_messages_control/message_handler.rs index 473e9d8985..29f9a39fad 100644 --- a/clients/client-core/src/client/real_messages_control/message_handler.rs +++ b/clients/client-core/src/client/real_messages_control/message_handler.rs @@ -19,12 +19,12 @@ use nym_sphinx::message::NymMessage; use nym_sphinx::params::{PacketSize, DEFAULT_NUM_MIX_HOPS}; use nym_sphinx::preparer::{MessagePreparer, PreparedFragment}; use nym_sphinx::Delay; +use nym_topology::{NymTopology, NymTopologyError}; use rand::{CryptoRng, Rng}; use std::collections::HashMap; use std::sync::Arc; use std::time::Duration; use thiserror::Error; -use topology::{NymTopology, NymTopologyError}; // TODO: move that error elsewhere since it seems to be contaminating different files #[derive(Debug, Clone, Error)] diff --git a/clients/client-core/src/client/topology_control.rs b/clients/client-core/src/client/topology_control.rs index 0f0c13ad1c..e10aafbf29 100644 --- a/clients/client-core/src/client/topology_control.rs +++ b/clients/client-core/src/client/topology_control.rs @@ -6,13 +6,13 @@ use futures::StreamExt; use log::*; use nym_sphinx::addressing::clients::Recipient; use nym_sphinx::params::DEFAULT_NUM_MIX_HOPS; +use nym_topology::{nym_topology_from_detailed, NymTopology, NymTopologyError}; use rand::seq::SliceRandom; use rand::thread_rng; use std::ops::Deref; use std::sync::Arc; use std::time::Duration; use tokio::sync::{RwLock, RwLockReadGuard}; -use topology::{nym_topology_from_detailed, NymTopology, NymTopologyError}; use url::Url; // I'm extremely curious why compiler NEVER complained about lack of Debug here before diff --git a/clients/client-core/src/config/mod.rs b/clients/client-core/src/config/mod.rs index 4c5c458e8c..ad573c463b 100644 --- a/clients/client-core/src/config/mod.rs +++ b/clients/client-core/src/config/mod.rs @@ -435,8 +435,8 @@ impl GatewayEndpointConfig { } } -impl From for GatewayEndpointConfig { - fn from(node: topology::gateway::Node) -> GatewayEndpointConfig { +impl From for GatewayEndpointConfig { + fn from(node: nym_topology::gateway::Node) -> GatewayEndpointConfig { let gateway_listener = node.clients_address(); GatewayEndpointConfig { gateway_id: node.identity_key.to_base58_string(), diff --git a/clients/client-core/src/error.rs b/clients/client-core/src/error.rs index b5f176e818..0436187ed8 100644 --- a/clients/client-core/src/error.rs +++ b/clients/client-core/src/error.rs @@ -3,7 +3,7 @@ use gateway_client::error::GatewayClientError; use nym_crypto::asymmetric::identity::Ed25519RecoveryError; -use topology::NymTopologyError; +use nym_topology::NymTopologyError; use validator_client::ValidatorClientError; #[derive(thiserror::Error, Debug)] diff --git a/clients/client-core/src/init/helpers.rs b/clients/client-core/src/init/helpers.rs index 2ad70c4d98..f1062c6b35 100644 --- a/clients/client-core/src/init/helpers.rs +++ b/clients/client-core/src/init/helpers.rs @@ -12,10 +12,10 @@ use gateway_client::wasm_mockups::SigningNyxdClient; use gateway_client::GatewayClient; use gateway_requests::registration::handshake::SharedKeys; use nym_crypto::asymmetric::identity; +use nym_topology::{filter::VersionFilterable, gateway}; use rand::{seq::SliceRandom, thread_rng}; use std::{sync::Arc, time::Duration}; use tap::TapFallible; -use topology::{filter::VersionFilterable, gateway}; use url::Url; #[cfg(not(target_arch = "wasm32"))] use validator_client::nyxd::SigningNyxdClient; diff --git a/clients/native/Cargo.toml b/clients/native/Cargo.toml index fbdd630764..562ff9e469 100644 --- a/clients/native/Cargo.toml +++ b/clients/native/Cargo.toml @@ -50,9 +50,9 @@ network-defaults = { path = "../../common/network-defaults" } nym-sphinx = { path = "../../common/nymsphinx" } nym-pemstore = { path = "../../common/pemstore" } task = { path = "../../common/task" } -topology = { path = "../../common/topology" } +nym-topology = { path = "../../common/topology" } validator-client = { path = "../../common/client-libs/validator-client", features = ["nyxd-client"] } -version-checker = { path = "../../common/version-checker" } +nym-version-checker = { path = "../../common/version-checker" } websocket-requests = { path = "websocket-requests" } [dev-dependencies] diff --git a/clients/native/src/commands/run.rs b/clients/native/src/commands/run.rs index f6c377a8ba..39d98516c1 100644 --- a/clients/native/src/commands/run.rs +++ b/clients/native/src/commands/run.rs @@ -14,7 +14,7 @@ use clap::Args; use config::NymConfig; use log::*; use nym_crypto::asymmetric::identity; -use version_checker::is_minor_version_compatible; +use nym_version_checker::is_minor_version_compatible; #[derive(Args, Clone)] pub(crate) struct Run { diff --git a/clients/native/src/commands/upgrade.rs b/clients/native/src/commands/upgrade.rs index a440054aea..2e67e6e62b 100644 --- a/clients/native/src/commands/upgrade.rs +++ b/clients/native/src/commands/upgrade.rs @@ -4,7 +4,7 @@ use crate::client::config::{Config, MISSING_VALUE}; use config::NymConfig; -use version_checker::Version; +use nym_version_checker::Version; use clap::Args; use std::fmt::Display; diff --git a/clients/socks5/Cargo.toml b/clients/socks5/Cargo.toml index 976871cce5..2cd17e6a4f 100644 --- a/clients/socks5/Cargo.toml +++ b/clients/socks5/Cargo.toml @@ -48,9 +48,9 @@ proxy-helpers = { path = "../../common/socks5/proxy-helpers" } service-providers-common = { path = "../../service-providers/common" } socks5-requests = { path = "../../common/socks5/requests" } task = { path = "../../common/task" } -topology = { path = "../../common/topology" } +nym-topology = { path = "../../common/topology" } validator-client = { path = "../../common/client-libs/validator-client", features = ["nyxd-client"] } -version-checker = { path = "../../common/version-checker" } +nym-version-checker = { path = "../../common/version-checker" } [features] default = ["credential-storage"] diff --git a/clients/socks5/src/commands/run.rs b/clients/socks5/src/commands/run.rs index 231965732e..95fbcc0970 100644 --- a/clients/socks5/src/commands/run.rs +++ b/clients/socks5/src/commands/run.rs @@ -12,7 +12,7 @@ use config::NymConfig; use log::*; use nym_crypto::asymmetric::identity; use nym_sphinx::addressing::clients::Recipient; -use version_checker::is_minor_version_compatible; +use nym_version_checker::is_minor_version_compatible; #[derive(Args, Clone)] pub(crate) struct Run { diff --git a/clients/socks5/src/commands/upgrade.rs b/clients/socks5/src/commands/upgrade.rs index 121f045905..151d21059e 100644 --- a/clients/socks5/src/commands/upgrade.rs +++ b/clients/socks5/src/commands/upgrade.rs @@ -4,7 +4,7 @@ use crate::client::config::{Config, MISSING_VALUE}; use config::NymConfig; -use version_checker::Version; +use nym_version_checker::Version; use clap::Args; use std::{fmt::Display, process}; diff --git a/clients/webassembly/Cargo.toml b/clients/webassembly/Cargo.toml index cb15659b49..2510a41f4a 100644 --- a/clients/webassembly/Cargo.toml +++ b/clients/webassembly/Cargo.toml @@ -36,7 +36,6 @@ coconut-interface = { path = "../../common/coconut-interface" } credentials = { path = "../../common/credentials" } nym-crypto = { path = "../../common/crypto" } nym-sphinx = { path = "../../common/nymsphinx" } -topology = { path = "../../common/topology" } gateway-client = { path = "../../common/client-libs/gateway-client", default-features = false, features = ["wasm"] } validator-client = { path = "../../common/client-libs/validator-client", default-features = false } wasm-utils = { path = "../../common/wasm-utils" } diff --git a/common/mixnode-common/Cargo.toml b/common/mixnode-common/Cargo.toml index 978379c1e5..5156013848 100644 --- a/common/mixnode-common/Cargo.toml +++ b/common/mixnode-common/Cargo.toml @@ -28,4 +28,4 @@ nym-sphinx-params = { path = "../nymsphinx/params" } nym-sphinx-types = { path = "../nymsphinx/types" } task = { path = "../task" } validator-client = { path = "../client-libs/validator-client", features = ["nyxd-client"]} -version-checker = { path = "../version-checker" } +nym-version-checker = { path = "../version-checker" } diff --git a/common/mixnode-common/src/verloc/mod.rs b/common/mixnode-common/src/verloc/mod.rs index 384a0abfda..53be86c791 100644 --- a/common/mixnode-common/src/verloc/mod.rs +++ b/common/mixnode-common/src/verloc/mod.rs @@ -8,6 +8,7 @@ use futures::StreamExt; use log::*; use network_defaults::mainnet::NYM_API; use nym_crypto::asymmetric::identity; +use nym_version_checker::parse_version; use rand::seq::SliceRandom; use rand::thread_rng; use std::net::SocketAddr; @@ -18,7 +19,6 @@ use task::TaskClient; use tokio::task::JoinHandle; use tokio::time::sleep; use url::Url; -use version_checker::parse_version; pub use crate::verloc::measurement::{AtomicVerlocResult, Verloc, VerlocResult}; @@ -44,7 +44,7 @@ const DEFAULT_RETRY_TIMEOUT: Duration = Duration::from_secs(60 * 30); #[derive(Clone, Debug)] pub struct Config { /// Minimum semver version of a node (gateway or mixnode) that is capable of replying to echo packets. - minimum_compatible_node_version: version_checker::Version, + minimum_compatible_node_version: nym_version_checker::Version, /// Socket address of this node on which it will be listening for the measurement packets. listening_address: SocketAddr, @@ -89,7 +89,10 @@ impl ConfigBuilder { Self::default() } - pub fn minimum_compatible_node_version(mut self, version: version_checker::Version) -> Self { + pub fn minimum_compatible_node_version( + mut self, + version: nym_version_checker::Version, + ) -> Self { self.0.minimum_compatible_node_version = version; self } diff --git a/common/nymsphinx/Cargo.toml b/common/nymsphinx/Cargo.toml index 33246054e3..f356fe5e08 100644 --- a/common/nymsphinx/Cargo.toml +++ b/common/nymsphinx/Cargo.toml @@ -23,7 +23,7 @@ nym-sphinx-types = { path = "types" } # those dependencies are due to intriducing preparer and receiver. Perpaphs that indicates they should be moved # to separate crate? nym-crypto = { path = "../crypto" } -topology = { path = "../topology" } +nym-topology = { path = "../topology" } [dev-dependencies] nym-mixnet-contract-common = { path = "../cosmwasm-smart-contracts/mixnet-contract" } diff --git a/common/nymsphinx/acknowledgements/Cargo.toml b/common/nymsphinx/acknowledgements/Cargo.toml index 3e1abf760c..18264253e1 100644 --- a/common/nymsphinx/acknowledgements/Cargo.toml +++ b/common/nymsphinx/acknowledgements/Cargo.toml @@ -15,6 +15,6 @@ nym-sphinx-addressing = { path = "../addressing" } nym-sphinx-params = { path = "../params" } nym-sphinx-types = { path = "../types" } nym-pemstore = { path = "../../pemstore" } -topology = { path = "../../topology" } +nym-topology = { path = "../../topology" } diff --git a/common/nymsphinx/acknowledgements/src/surb_ack.rs b/common/nymsphinx/acknowledgements/src/surb_ack.rs index 8526fc109f..5df36e1f0b 100644 --- a/common/nymsphinx/acknowledgements/src/surb_ack.rs +++ b/common/nymsphinx/acknowledgements/src/surb_ack.rs @@ -15,11 +15,11 @@ use nym_sphinx_types::{ delays::{self, Delay}, SphinxPacket, }; +use nym_topology::{NymTopology, NymTopologyError}; use rand::{CryptoRng, RngCore}; use std::convert::TryFrom; use std::time; use thiserror::Error; -use topology::{NymTopology, NymTopologyError}; pub struct SurbAck { surb_ack_packet: SphinxPacket, diff --git a/common/nymsphinx/anonymous-replies/Cargo.toml b/common/nymsphinx/anonymous-replies/Cargo.toml index 25269fdbd6..8d706108ed 100644 --- a/common/nymsphinx/anonymous-replies/Cargo.toml +++ b/common/nymsphinx/anonymous-replies/Cargo.toml @@ -16,7 +16,7 @@ nym-crypto = { path = "../../crypto", features = ["symmetric", "rand"] } nym-sphinx-addressing = { path = "../addressing" } nym-sphinx-params = { path = "../params" } nym-sphinx-types = { path = "../types" } -topology = { path = "../../topology" } +nym-topology = { path = "../../topology" } [target."cfg(target_arch = \"wasm32\")".dependencies.wasm-bindgen] version = "0.2.83" diff --git a/common/nymsphinx/anonymous-replies/src/reply_surb.rs b/common/nymsphinx/anonymous-replies/src/reply_surb.rs index 049e3569e7..4f00cdc164 100644 --- a/common/nymsphinx/anonymous-replies/src/reply_surb.rs +++ b/common/nymsphinx/anonymous-replies/src/reply_surb.rs @@ -8,6 +8,7 @@ use nym_sphinx_addressing::nodes::{NymNodeRoutingAddress, MAX_NODE_ADDRESS_UNPAD use nym_sphinx_params::packet_sizes::PacketSize; use nym_sphinx_params::{ReplySurbKeyDigestAlgorithm, DEFAULT_NUM_MIX_HOPS}; use nym_sphinx_types::{delays, Error as SphinxError, SURBMaterial, SphinxPacket, SURB}; +use nym_topology::{NymTopology, NymTopologyError}; use rand::{CryptoRng, RngCore}; use serde::de::{Error as SerdeError, Visitor}; use serde::{Deserialize, Deserializer, Serialize, Serializer}; @@ -15,7 +16,6 @@ use std::convert::TryFrom; use std::fmt::{self, Formatter}; use std::time; use thiserror::Error; -use topology::{NymTopology, NymTopologyError}; #[derive(Debug, Error)] pub enum ReplySurbError { diff --git a/common/nymsphinx/cover/Cargo.toml b/common/nymsphinx/cover/Cargo.toml index 3677b8f8e3..ab3bd14213 100644 --- a/common/nymsphinx/cover/Cargo.toml +++ b/common/nymsphinx/cover/Cargo.toml @@ -17,4 +17,4 @@ nym-sphinx-chunking = { path = "../chunking" } nym-sphinx-params = { path = "../params" } nym-sphinx-forwarding = { path = "../forwarding" } nym-sphinx-types = { path = "../types" } -topology = { path = "../../topology" } +nym-topology = { path = "../../topology" } diff --git a/common/nymsphinx/cover/src/lib.rs b/common/nymsphinx/cover/src/lib.rs index 8a046b38a9..19e6e96e09 100644 --- a/common/nymsphinx/cover/src/lib.rs +++ b/common/nymsphinx/cover/src/lib.rs @@ -15,11 +15,11 @@ use nym_sphinx_params::{ }; use nym_sphinx_types::builder::SphinxPacketBuilder; use nym_sphinx_types::{delays, Error as SphinxError}; +use nym_topology::{NymTopology, NymTopologyError}; use rand::{CryptoRng, RngCore}; use std::convert::TryFrom; use std::time; use thiserror::Error; -use topology::{NymTopology, NymTopologyError}; pub const LOOP_COVER_MESSAGE_PAYLOAD: &[u8] = b"The cake is a lie!"; diff --git a/common/nymsphinx/src/preparer/mod.rs b/common/nymsphinx/src/preparer/mod.rs index cc4c4bb026..d7445275ca 100644 --- a/common/nymsphinx/src/preparer/mod.rs +++ b/common/nymsphinx/src/preparer/mod.rs @@ -14,10 +14,10 @@ use nym_sphinx_params::packet_sizes::PacketSize; use nym_sphinx_params::DEFAULT_NUM_MIX_HOPS; use nym_sphinx_types::builder::SphinxPacketBuilder; use nym_sphinx_types::{delays, Delay}; +use nym_topology::{NymTopology, NymTopologyError}; use rand::{CryptoRng, Rng}; use std::convert::TryFrom; use std::time::Duration; -use topology::{NymTopology, NymTopologyError}; pub(crate) mod payload; diff --git a/common/nymsphinx/src/receiver.rs b/common/nymsphinx/src/receiver.rs index 5651f98216..93e370d55e 100644 --- a/common/nymsphinx/src/receiver.rs +++ b/common/nymsphinx/src/receiver.rs @@ -186,8 +186,8 @@ mod message_receiver { use super::*; use nym_crypto::asymmetric::identity; use nym_mixnet_contract_common::Layer; + use nym_topology::{gateway, mix, NymTopology}; use std::collections::HashMap; - use topology::{gateway, mix, NymTopology}; // TODO: is it somehow maybe possible to move it to `topology` and have if conditionally // available to other modules? diff --git a/common/topology/Cargo.toml b/common/topology/Cargo.toml index 9d0eba1d5c..164a47925c 100644 --- a/common/topology/Cargo.toml +++ b/common/topology/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "topology" +name = "nym-topology" version = "0.1.0" authors = ["Jedrzej Stuczynski "] edition = "2021" @@ -17,4 +17,4 @@ nym-crypto = { path = "../crypto" } nym-mixnet-contract-common = { path = "../cosmwasm-smart-contracts/mixnet-contract" } nym-sphinx-addressing = { path = "../nymsphinx/addressing" } nym-sphinx-types = { path = "../nymsphinx/types" } -version-checker = { path = "../version-checker" } +nym-version-checker = { path = "../version-checker" } diff --git a/common/topology/src/filter.rs b/common/topology/src/filter.rs index 6c1a3c2fe1..fdbbc9b119 100644 --- a/common/topology/src/filter.rs +++ b/common/topology/src/filter.rs @@ -20,7 +20,7 @@ where fn filter_by_version(&self, expected_version: &str) -> Self { self.iter() .filter(|node| { - version_checker::is_minor_version_compatible(&node.version(), expected_version) + nym_version_checker::is_minor_version_compatible(&node.version(), expected_version) }) .cloned() .collect() diff --git a/common/version-checker/Cargo.toml b/common/version-checker/Cargo.toml index 9bc3c16ccf..df15f395df 100644 --- a/common/version-checker/Cargo.toml +++ b/common/version-checker/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "version-checker" +name = "nym-version-checker" version = "0.1.0" authors = ["Dave Hrycyszyn "] edition = "2021" diff --git a/gateway/Cargo.toml b/gateway/Cargo.toml index 28ed60d52c..27f8bd2edf 100644 --- a/gateway/Cargo.toml +++ b/gateway/Cargo.toml @@ -71,7 +71,7 @@ task = { path = "../common/task" } validator-client = { path = "../common/client-libs/validator-client", features = [ "nyxd-client", ] } -version-checker = { path = "../common/version-checker" } +nym-version-checker = { path = "../common/version-checker" } nym-types = { path = "../common/types" } serde_json = "1" atty = "0.2" diff --git a/gateway/src/commands/mod.rs b/gateway/src/commands/mod.rs index d7cfcd4b9f..17b38a5967 100644 --- a/gateway/src/commands/mod.rs +++ b/gateway/src/commands/mod.rs @@ -155,7 +155,7 @@ pub(crate) fn ensure_config_version_compatibility(cfg: &Config) -> Result<(), Ga if binary_version == config_version { Ok(()) - } else if version_checker::is_minor_version_compatible(binary_version, config_version) { + } else if nym_version_checker::is_minor_version_compatible(binary_version, config_version) { log::warn!( "The gateway binary has different version than what is specified in config file! {binary_version} and {config_version}. \ But, they are still semver compatible. However, consider running the `upgrade` command."); diff --git a/gateway/src/commands/upgrade.rs b/gateway/src/commands/upgrade.rs index b3eefd9ed2..abab75caa7 100644 --- a/gateway/src/commands/upgrade.rs +++ b/gateway/src/commands/upgrade.rs @@ -4,9 +4,9 @@ use crate::config::{Config, MISSING_VALUE}; use clap::Args; use config::NymConfig; +use nym_version_checker::Version; use std::fmt::Display; use std::process; -use version_checker::Version; #[derive(Args, Clone)] pub struct Upgrade { diff --git a/mixnode/Cargo.toml b/mixnode/Cargo.toml index 51ecfaffce..21c2534fc1 100644 --- a/mixnode/Cargo.toml +++ b/mixnode/Cargo.toml @@ -52,9 +52,9 @@ nym-sphinx = { path="../common/nymsphinx" } nym-pemstore = { path = "../common/pemstore", version = "0.1.0" } task = { path = "../common/task" } nym-types = { path = "../common/types" } -topology = { path="../common/topology" } +nym-topology = { path="../common/topology" } validator-client = { path="../common/client-libs/validator-client" } -version-checker = { path="../common/version-checker" } +nym-version-checker = { path="../common/version-checker" } [dev-dependencies] tokio = { version="1.21.2", features = ["rt-multi-thread", "net", "signal", "test-util"] } diff --git a/mixnode/src/commands/mod.rs b/mixnode/src/commands/mod.rs index 49d70a7f44..e2c0f39aed 100644 --- a/mixnode/src/commands/mod.rs +++ b/mixnode/src/commands/mod.rs @@ -141,7 +141,7 @@ pub(crate) fn version_check(cfg: &Config) -> bool { true } else { warn!("The mixnode binary has different version than what is specified in config file! {} and {}", binary_version, config_version); - if version_checker::is_minor_version_compatible(binary_version, config_version) { + if nym_version_checker::is_minor_version_compatible(binary_version, config_version) { info!("but they are still semver compatible. However, consider running the `upgrade` command"); true } else { diff --git a/mixnode/src/commands/upgrade.rs b/mixnode/src/commands/upgrade.rs index 46c8192312..bef202b651 100644 --- a/mixnode/src/commands/upgrade.rs +++ b/mixnode/src/commands/upgrade.rs @@ -4,9 +4,9 @@ use crate::config::{missing_string_value, Config}; use clap::Args; use config::NymConfig; +use nym_version_checker::Version; use std::fmt::Display; use std::process; -use version_checker::Version; #[derive(Args)] pub(crate) struct Upgrade { diff --git a/mixnode/src/node/mod.rs b/mixnode/src/node/mod.rs index 4504029bd9..6624e74a56 100644 --- a/mixnode/src/node/mod.rs +++ b/mixnode/src/node/mod.rs @@ -23,13 +23,13 @@ use config::NymConfig; use log::{error, info, warn}; use mixnode_common::verloc::{self, AtomicVerlocResult, VerlocMeasurer}; use nym_crypto::asymmetric::{encryption, identity}; +use nym_version_checker::parse_version; use rand::seq::SliceRandom; use rand::thread_rng; use std::net::SocketAddr; use std::process; use std::sync::Arc; use task::{TaskClient, TaskManager}; -use version_checker::parse_version; mod http; mod listener; diff --git a/nym-api/Cargo.toml b/nym-api/Cargo.toml index feccd7bd42..a9801a7bc1 100644 --- a/nym-api/Cargo.toml +++ b/nym-api/Cargo.toml @@ -88,12 +88,12 @@ nymcoconut = { path = "../common/nymcoconut" } nym-sphinx = { path = "../common/nymsphinx" } nym-pemstore = { path = "../common/pemstore" } task = { path = "../common/task" } -topology = { path = "../common/topology" } +nym-topology = { path = "../common/topology" } nym-api-requests = { path = "nym-api-requests" } validator-client = { path = "../common/client-libs/validator-client", features = [ "nyxd-client", ] } -version-checker = { path = "../common/version-checker" } +nym-version-checker = { path = "../common/version-checker" } [features] no-reward = [] diff --git a/nym-api/src/network_monitor/chunker.rs b/nym-api/src/network_monitor/chunker.rs index 02d5ba796b..2ac9fa04a0 100644 --- a/nym-api/src/network_monitor/chunker.rs +++ b/nym-api/src/network_monitor/chunker.rs @@ -6,9 +6,9 @@ use nym_sphinx::message::NymMessage; use nym_sphinx::{ acknowledgements::AckKey, addressing::clients::Recipient, preparer::MessagePreparer, }; +use nym_topology::NymTopology; use rand_07::rngs::OsRng; use std::time::Duration; -use topology::NymTopology; const DEFAULT_AVERAGE_PACKET_DELAY: Duration = Duration::from_millis(200); const DEFAULT_AVERAGE_ACK_DELAY: Duration = Duration::from_millis(200); diff --git a/nym-api/src/network_monitor/monitor/preparer.rs b/nym-api/src/network_monitor/monitor/preparer.rs index 81bd295a19..a0df027e9a 100644 --- a/nym-api/src/network_monitor/monitor/preparer.rs +++ b/nym-api/src/network_monitor/monitor/preparer.rs @@ -11,13 +11,13 @@ use nym_crypto::asymmetric::{encryption, identity}; use nym_mixnet_contract_common::{Addr, GatewayBond, Layer, MixId, MixNodeBond}; use nym_sphinx::addressing::clients::Recipient; use nym_sphinx::forwarding::packet::MixPacket; +use nym_topology::{gateway, mix, NymTopology}; use rand::seq::SliceRandom; use rand::{thread_rng, Rng}; use std::collections::{HashMap, HashSet}; use std::convert::TryInto; use std::fmt::{self, Display, Formatter}; use std::time::Duration; -use topology::{gateway, mix, NymTopology}; // declared type aliases for easier code reasoning type Version = String; diff --git a/nym-api/src/network_monitor/test_packet.rs b/nym-api/src/network_monitor/test_packet.rs index 687eb0cf93..0a38e642b7 100644 --- a/nym-api/src/network_monitor/test_packet.rs +++ b/nym-api/src/network_monitor/test_packet.rs @@ -5,13 +5,13 @@ use crate::network_monitor::monitor::preparer::TestedNode; use nym_crypto::asymmetric::identity; use nym_crypto::asymmetric::identity::Ed25519RecoveryError; use nym_mixnet_contract_common::MixId; +use nym_topology::{gateway, mix}; use std::convert::TryInto; use std::fmt::{self, Display, Formatter}; use std::hash::{Hash, Hasher}; use std::mem; use std::str::Utf8Error; use thiserror::Error; -use topology::{gateway, mix}; const MIXNODE_TYPE: u8 = 0; const GATEWAY_TYPE: u8 = 1; diff --git a/nym-api/src/network_monitor/test_route/mod.rs b/nym-api/src/network_monitor/test_route/mod.rs index 5f32610a03..c4b98ac5a0 100644 --- a/nym-api/src/network_monitor/test_route/mod.rs +++ b/nym-api/src/network_monitor/test_route/mod.rs @@ -4,8 +4,8 @@ use crate::network_monitor::test_packet::{NodeType, TestPacket}; use crate::network_monitor::ROUTE_TESTING_TEST_NONCE; use nym_crypto::asymmetric::identity; +use nym_topology::{gateway, mix, NymTopology}; use std::fmt::{Debug, Formatter}; -use topology::{gateway, mix, NymTopology}; #[derive(Clone)] pub(crate) struct TestRoute { diff --git a/nym-connect-android/src-tauri/Cargo.toml b/nym-connect-android/src-tauri/Cargo.toml index c175940b5e..63cfe55553 100644 --- a/nym-connect-android/src-tauri/Cargo.toml +++ b/nym-connect-android/src-tauri/Cargo.toml @@ -54,7 +54,6 @@ nym-crypto = { path = "../../common/crypto" } logging = { path = "../../common/logging"} nym-socks5-client = { path = "../../clients/socks5", features = ["mobile"], default-features = false } task = { path = "../../common/task" } -topology = { path = "../../common/topology" } [dev-dependencies] ts-rs = "6.1.2" diff --git a/nym-connect/src-tauri/Cargo.toml b/nym-connect/src-tauri/Cargo.toml index 11dd7db775..a5ceea91db 100644 --- a/nym-connect/src-tauri/Cargo.toml +++ b/nym-connect/src-tauri/Cargo.toml @@ -52,7 +52,6 @@ nym-crypto = { path = "../../common/crypto" } logging = { path = "../../common/logging"} nym-socks5-client = { path = "../../clients/socks5" } task = { path = "../../common/task" } -topology = { path = "../../common/topology" } [dev-dependencies] ts-rs = "6.1.2" diff --git a/service-providers/network-requester/Cargo.toml b/service-providers/network-requester/Cargo.toml index ac47ca41d0..873b39521b 100644 --- a/service-providers/network-requester/Cargo.toml +++ b/service-providers/network-requester/Cargo.toml @@ -47,5 +47,5 @@ service-providers-common = { path = "../common" } socks5-requests = { path = "../../common/socks5/requests" } statistics-common = { path = "../../common/statistics" } task = { path = "../../common/task" } -version-checker = { path = "../../common/version-checker" } +nym-version-checker = { path = "../../common/version-checker" } websocket-requests = { path = "../../clients/native/websocket-requests" } diff --git a/service-providers/network-requester/src/cli/run.rs b/service-providers/network-requester/src/cli/run.rs index 0970c79975..7dd5fef982 100644 --- a/service-providers/network-requester/src/cli/run.rs +++ b/service-providers/network-requester/src/cli/run.rs @@ -73,7 +73,7 @@ fn version_check(cfg: &Config) -> bool { binary_version, config_version ); - if version_checker::is_minor_version_compatible(binary_version, config_version) { + if nym_version_checker::is_minor_version_compatible(binary_version, config_version) { log::info!( "but they are still semver compatible. \ However, consider running the `upgrade` command"