From 479327849a3e2a882a8fbfbb77b307c3389fffbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Stuczy=C5=84ski?= Date: Thu, 30 Mar 2023 15:36:38 +0100 Subject: [PATCH] gateway: added --output to commands that strictly require it --- Cargo.lock | 1 + clients/credential/Cargo.toml | 2 +- clients/native/Cargo.toml | 6 ++-- clients/native/websocket-requests/Cargo.toml | 4 +-- common/bin-common/Cargo.toml | 1 + common/bin-common/src/lib.rs | 1 + common/bin-common/src/output_format/mod.rs | 36 +++++++++++++++++++ common/client-core/Cargo.toml | 4 +-- common/client-libs/gateway-client/Cargo.toml | 2 +- .../client-libs/validator-client/Cargo.toml | 4 +-- common/coconut-interface/Cargo.toml | 2 +- common/commands/Cargo.toml | 2 +- common/config/Cargo.toml | 2 +- common/types/Cargo.toml | 2 +- common/types/src/helpers.rs | 1 + gateway/Cargo.toml | 6 ++-- gateway/gateway-requests/Cargo.toml | 4 +-- gateway/src/commands/init.rs | 8 +++-- gateway/src/commands/mod.rs | 10 +++--- gateway/src/commands/node_details.rs | 12 +++---- gateway/src/commands/run.rs | 16 +++++---- gateway/src/commands/sign.rs | 23 +++++------- gateway/src/main.rs | 30 ++-------------- gateway/src/node/mod.rs | 14 ++------ mixnode/Cargo.toml | 4 +-- mixnode/src/main.rs | 12 ------- nym-api/Cargo.toml | 2 +- .../network-requester/Cargo.toml | 2 +- .../network-statistics/Cargo.toml | 2 +- 29 files changed, 105 insertions(+), 110 deletions(-) create mode 100644 common/bin-common/src/output_format/mod.rs diff --git a/Cargo.lock b/Cargo.lock index 1cc99e3071..0b95bb44ab 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3156,6 +3156,7 @@ dependencies = [ "pretty_env_logger", "semver 0.11.0", "serde", + "serde_json", "vergen", ] diff --git a/clients/credential/Cargo.toml b/clients/credential/Cargo.toml index b82767a434..98d9fbbd67 100644 --- a/clients/credential/Cargo.toml +++ b/clients/credential/Cargo.toml @@ -10,7 +10,7 @@ bip39 = { workspace = true } clap = { version = "4.0", features = ["cargo", "derive"] } log = "0.4" rand = "0.7.3" -serde = { version = "1.0", features = ["derive"] } +serde = { workspace = true, features = ["derive"] } thiserror = "1.0" url = "2.2" tokio = { version = "1.24.1", features = ["rt-multi-thread", "net", "signal", "macros"] } # async runtime diff --git a/clients/native/Cargo.toml b/clients/native/Cargo.toml index b8bd48d01e..9a92353283 100644 --- a/clients/native/Cargo.toml +++ b/clients/native/Cargo.toml @@ -26,8 +26,8 @@ lazy_static = "1.4.0" log = { workspace = true } # self explanatory pretty_env_logger = "0.4" # for formatting log messages rand = { version = "0.7.3", features = ["wasm-bindgen"] } # rng-related traits + some rng implementation to use -serde = { version = "1.0.104", features = ["derive"] } # for config serialization/deserialization -serde_json = "1.0" +serde = { workspace = true, features = ["derive"] } # for config serialization/deserialization +serde_json = { workspace = true } thiserror = "1.0.34" tap = "1.0.1" tokio = { version = "1.24.1", features = ["rt-multi-thread", "net", "signal"] } # async runtime @@ -52,4 +52,4 @@ validator-client = { path = "../../common/client-libs/validator-client", feature websocket-requests = { path = "websocket-requests" } [dev-dependencies] -serde_json = "1.0" # for the "textsend" example +serde_json = { workspace = true } # for the "textsend" example diff --git a/clients/native/websocket-requests/Cargo.toml b/clients/native/websocket-requests/Cargo.toml index 0f0921f636..cd1f5b589f 100644 --- a/clients/native/websocket-requests/Cargo.toml +++ b/clients/native/websocket-requests/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -serde = { version = "1.0", features = ["derive"] } -serde_json = "1.0" +serde = { workspace = true, features = ["derive"] } +serde_json = { workspace = true } nym-sphinx = { path = "../../../common/nymsphinx" } diff --git a/common/bin-common/Cargo.toml b/common/bin-common/Cargo.toml index 21f90d27f9..6c0750e3c6 100644 --- a/common/bin-common/Cargo.toml +++ b/common/bin-common/Cargo.toml @@ -15,6 +15,7 @@ log = { workspace = true } pretty_env_logger = "0.4.0" semver = "0.11" serde = { workspace = true, features = ["derive"], optional = true } +serde_json = { workspace = true, optional = true } [build-dependencies] vergen = { version = "=7.4.3", default-features = false, features = ["build", "git", "rustc", "cargo"] } diff --git a/common/bin-common/src/lib.rs b/common/bin-common/src/lib.rs index eed7b4f998..8659264149 100644 --- a/common/bin-common/src/lib.rs +++ b/common/bin-common/src/lib.rs @@ -4,4 +4,5 @@ pub mod build_information; pub mod completions; pub mod logging; +pub mod output_format; pub mod version_checker; diff --git a/common/bin-common/src/output_format/mod.rs b/common/bin-common/src/output_format/mod.rs new file mode 100644 index 0000000000..dfde754237 --- /dev/null +++ b/common/bin-common/src/output_format/mod.rs @@ -0,0 +1,36 @@ +// Copyright 2023 - Nym Technologies SA +// SPDX-License-Identifier: Apache-2.0 + +use clap::ValueEnum; +use serde::Serialize; +use std::fmt::{Display, Formatter}; + +#[derive(Default, Copy, Debug, Clone, ValueEnum)] +pub enum OutputFormat { + #[default] + Text, + Json, +} + +impl Display for OutputFormat { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + match self { + OutputFormat::Text => write!(f, "text"), + OutputFormat::Json => write!(f, "json"), + } + } +} + +impl OutputFormat { + pub fn is_text(&self) -> bool { + matches!(self, OutputFormat::Text) + } + + #[cfg(feature = "serde_json")] + pub fn format(&self, data: &T) -> String { + match self { + OutputFormat::Text => data.to_string(), + OutputFormat::Json => serde_json::to_string(data).unwrap(), + } + } +} diff --git a/common/client-core/Cargo.toml b/common/client-core/Cargo.toml index 856cd17e57..6ca0d7ba6b 100644 --- a/common/client-core/Cargo.toml +++ b/common/client-core/Cargo.toml @@ -15,8 +15,8 @@ futures = "0.3" humantime-serde = "1.0" log = { workspace = true } rand = { version = "0.7.3", features = ["wasm-bindgen"] } -serde = { version = "1.0", features = ["derive"] } -serde_json = "1.0.89" +serde = { workspace = true, features = ["derive"] } +serde_json = { workspace = true } tap = "1.0.1" thiserror = "1.0.34" url = { version ="2.2", features = ["serde"] } diff --git a/common/client-libs/gateway-client/Cargo.toml b/common/client-libs/gateway-client/Cargo.toml index f630a24154..7d3bd02ba1 100644 --- a/common/client-libs/gateway-client/Cargo.toml +++ b/common/client-libs/gateway-client/Cargo.toml @@ -27,7 +27,7 @@ nym-sphinx = { path = "../../nymsphinx" } nym-pemstore = { path = "../../pemstore" } validator-client = { path = "../validator-client" } nym-task = { path = "../../task" } -serde = { version = "1.0", features = ["derive"]} +serde = { workspace = true, features = ["derive"] } mobile-storage = { path = "../../mobile-storage" } diff --git a/common/client-libs/validator-client/Cargo.toml b/common/client-libs/validator-client/Cargo.toml index 3df2637ebb..4c0917b5d4 100644 --- a/common/client-libs/validator-client/Cargo.toml +++ b/common/client-libs/validator-client/Cargo.toml @@ -19,8 +19,8 @@ nym-coconut-bandwidth-contract-common = { path = "../../cosmwasm-smart-contracts nym-multisig-contract-common = { path = "../../cosmwasm-smart-contracts/multisig-contract" } nym-group-contract-common = { path = "../../cosmwasm-smart-contracts/group-contract" } nym-vesting-contract = { path = "../../../contracts/vesting" } -serde = { version = "1", features = ["derive"] } -serde_json = "1" +serde = { workspace = true, features = ["derive"] } +serde_json = { workspace = true } reqwest = { version = "0.11", features = ["json"] } thiserror = "1" log = { workspace = true } diff --git a/common/coconut-interface/Cargo.toml b/common/coconut-interface/Cargo.toml index 18f9115052..30093aa243 100644 --- a/common/coconut-interface/Cargo.toml +++ b/common/coconut-interface/Cargo.toml @@ -7,7 +7,7 @@ description = "Crutch library until there is proper SerDe support for coconut st [dependencies] bs58 = "0.4.0" getset = "0.1.1" -serde = { version = "1.0", features = ["derive"] } +serde = { workspace = true, features = ["derive"] } thiserror = "1" nymcoconut = {path = "../nymcoconut" } diff --git a/common/commands/Cargo.toml b/common/commands/Cargo.toml index 86f8fcc54a..d4cdfbe91d 100644 --- a/common/commands/Cargo.toml +++ b/common/commands/Cargo.toml @@ -18,7 +18,7 @@ k256 = { version = "0.10", features = ["ecdsa", "sha256"] } log = { workspace = true } rand = {version = "0.6", features = ["std"] } serde = { version = "1.0", features = ["derive"] } -serde_json = "1" +serde_json = { workspace = true } thiserror = "1" time = { version = "0.3.6", features = ["parsing", "formatting"] } toml = "0.5.6" diff --git a/common/config/Cargo.toml b/common/config/Cargo.toml index 496d483d75..3add3dc1b4 100644 --- a/common/config/Cargo.toml +++ b/common/config/Cargo.toml @@ -10,7 +10,7 @@ edition = "2021" cfg-if = "1.0.0" handlebars = "3.0.1" log = { workspace = true } -serde = { version = "1.0", features = ["derive"] } +serde = { workspace = true, features = ["derive"] } toml = "0.5.6" url = "2.2" diff --git a/common/types/Cargo.toml b/common/types/Cargo.toml index 5f822c4987..d1c1cfd67a 100644 --- a/common/types/Cargo.toml +++ b/common/types/Cargo.toml @@ -13,7 +13,7 @@ itertools = "0.10" reqwest = "0.11.9" schemars = "0.8" serde = { version = "1.0", features = ["derive"] } -serde_json = "1.0" +serde_json = { workspace = true } strum = { version = "0.23", features = ["derive"] } thiserror = "1.0" url = "2.2" diff --git a/common/types/src/helpers.rs b/common/types/src/helpers.rs index 87ef78c90c..7c8f69de8d 100644 --- a/common/types/src/helpers.rs +++ b/common/types/src/helpers.rs @@ -18,6 +18,7 @@ impl ConsoleSigningOutput { } } + #[deprecated] pub fn to_json_string(&self) -> String { serde_json::to_string(self).expect("json serialization of 'ConsoleSigningOutput' failed") } diff --git a/gateway/Cargo.toml b/gateway/Cargo.toml index cc6a1d6a3d..317a5e1f81 100644 --- a/gateway/Cargo.toml +++ b/gateway/Cargo.toml @@ -31,7 +31,7 @@ log = { workspace = true } once_cell = "1.7.2" pretty_env_logger = "0.4" rand = "0.7" -serde = { version = "1.0", features = ["derive"] } +serde = { workspace = true, features = ["derive"] } sqlx = { version = "0.5", features = [ "runtime-tokio-rustls", "sqlite", @@ -56,7 +56,7 @@ nym-coconut-interface = { path = "../common/coconut-interface" } nym-credentials = { path = "../common/credentials" } nym-config = { path = "../common/config" } nym-crypto = { path = "../common/crypto" } -nym-bin-common = { path = "../common/bin-common" } +nym-bin-common = { path = "../common/bin-common", features = ["serde_json"] } gateway-requests = { path = "gateway-requests" } mixnet-client = { path = "../common/client-libs/mixnet-client" } mixnode-common = { path = "../common/mixnode-common" } @@ -70,7 +70,7 @@ validator-client = { path = "../common/client-libs/validator-client", features = "nyxd-client", ] } nym-types = { path = "../common/types" } -serde_json = "1" +serde_json = { workspace = true } atty = "0.2" diff --git a/gateway/gateway-requests/Cargo.toml b/gateway/gateway-requests/Cargo.toml index 3fce04a8ae..ab663c6e27 100644 --- a/gateway/gateway-requests/Cargo.toml +++ b/gateway/gateway-requests/Cargo.toml @@ -15,8 +15,8 @@ futures = "0.3.15" log = { workspace = true } nym-sphinx = { path = "../../common/nymsphinx" } rand = { version = "0.7.3", features = ["wasm-bindgen"] } -serde = { version = "1.0", features = ["derive"] } -serde_json = "1.0" +serde = { workspace = true, features = ["derive"] } +serde_json = { workspace = true } thiserror = "1.0" nym-crypto = { path = "../../common/crypto" } diff --git a/gateway/src/commands/init.rs b/gateway/src/commands/init.rs index 02eefb6f69..1a51e912e0 100644 --- a/gateway/src/commands/init.rs +++ b/gateway/src/commands/init.rs @@ -77,6 +77,9 @@ pub struct Init { /// URL where a statistics aggregator is running. The default value is a Nym aggregator server #[clap(long)] statistics_service_url: Option, + + #[clap(short, long, default_value_t = OutputFormat::default())] + output: OutputFormat, } impl From for OverrideConfig { @@ -100,7 +103,7 @@ impl From for OverrideConfig { } } -pub async fn execute(args: Init, output: OutputFormat) -> Result<(), Box> { +pub async fn execute(args: Init) -> Result<(), Box> { eprintln!("Initialising gateway {}...", args.id); let already_init = if Config::default_config_file_path(&args.id).exists() { @@ -156,7 +159,7 @@ pub async fn execute(args: Init, output: OutputFormat) -> Result<(), Box Result<(), Box> { let bin_name = "nym-gateway"; - let output = args.output(); - match args.command { - Commands::Init(m) => init::execute(m, output).await?, - Commands::NodeDetails(m) => node_details::execute(m, output).await?, - Commands::Run(m) => run::execute(m, output).await?, - Commands::Sign(m) => sign::execute(m, output)?, + Commands::Init(m) => init::execute(m).await?, + Commands::NodeDetails(m) => node_details::execute(m).await?, + Commands::Run(m) => run::execute(m).await?, + Commands::Sign(m) => sign::execute(m)?, Commands::Upgrade(m) => upgrade::execute(&m).await, Commands::Completions(s) => s.generate(&mut crate::Cli::command(), bin_name), Commands::GenerateFigSpec => fig_generate(&mut crate::Cli::command(), bin_name), diff --git a/gateway/src/commands/node_details.rs b/gateway/src/commands/node_details.rs index 694bdb15b8..36f682bd10 100644 --- a/gateway/src/commands/node_details.rs +++ b/gateway/src/commands/node_details.rs @@ -3,8 +3,8 @@ use crate::commands::OverrideConfig; use crate::support::config::build_config; -use crate::OutputFormat; use clap::Args; +use nym_bin_common::output_format::OutputFormat; use std::error::Error; #[derive(Args, Clone)] @@ -12,15 +12,15 @@ pub struct NodeDetails { /// The id of the gateway you want to show details for #[clap(long)] id: String, + + #[clap(short, long, default_value_t = OutputFormat::default())] + output: OutputFormat, } -pub async fn execute( - args: NodeDetails, - output: OutputFormat, -) -> Result<(), Box> { +pub async fn execute(args: NodeDetails) -> Result<(), Box> { let config = build_config(args.id.clone(), OverrideConfig::default())?; Ok(crate::node::create_gateway(config) .await - .print_node_details(output)?) + .print_node_details(args.output)) } diff --git a/gateway/src/commands/run.rs b/gateway/src/commands/run.rs index 4000fd8a7f..8c9635a557 100644 --- a/gateway/src/commands/run.rs +++ b/gateway/src/commands/run.rs @@ -1,12 +1,10 @@ // Copyright 2020-2023 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 +use crate::commands::{ensure_config_version_compatibility, OverrideConfig}; use crate::support::config::build_config; -use crate::{ - commands::{ensure_config_version_compatibility, OverrideConfig}, - OutputFormat, -}; use clap::Args; +use nym_bin_common::output_format::OutputFormat; use std::error::Error; use std::net::IpAddr; use std::path::PathBuf; @@ -75,6 +73,9 @@ pub struct Run { /// URL where a statistics aggregator is running. The default value is a Nym aggregator server #[clap(long)] statistics_service_url: Option, + + #[clap(short, long, default_value_t = OutputFormat::default())] + output: OutputFormat, } impl From for OverrideConfig { @@ -112,10 +113,11 @@ fn special_addresses() -> Vec<&'static str> { vec!["localhost", "127.0.0.1", "0.0.0.0", "::1", "[::1]"] } -pub async fn execute(args: Run, output: OutputFormat) -> Result<(), Box> { +pub async fn execute(args: Run) -> Result<(), Box> { let id = args.id.clone(); - println!("Starting gateway {id}..."); + eprintln!("Starting gateway {id}..."); + let output = args.output; let config = build_config(id, args)?; ensure_config_version_compatibility(&config)?; @@ -127,7 +129,7 @@ pub async fn execute(args: Run, output: OutputFormat) -> Result<(), Box, + + #[clap(short, long, default_value_t = OutputFormat::default())] + output: OutputFormat, } enum SignedTarget { @@ -94,12 +98,7 @@ fn print_signed_text( let signature = private_key.sign_text(text); let sign_output = ConsoleSigningOutput::new(text, signature); - - let msg = match output { - OutputFormat::Json => sign_output.to_json_string(), - OutputFormat::Text => sign_output.to_string(), - }; - println!("{msg}"); + println!("{}", output.format(&sign_output)); Ok(()) } @@ -131,18 +130,14 @@ fn print_signed_contract_msg( let signature = private_key.sign(&decoded).to_base58_string(); let sign_output = ConsoleSigningOutput::new(decoded_string, signature); - - let msg = match output { - OutputFormat::Json => sign_output.to_json_string(), - OutputFormat::Text => sign_output.to_string(), - }; - println!("{msg}") + println!("{}", output.format(&sign_output)); } -pub fn execute(args: Sign, output: OutputFormat) -> Result<(), Box> { +pub fn execute(args: Sign) -> Result<(), Box> { let config = build_config(args.id.clone(), OverrideConfig::default())?; ensure_config_version_compatibility(&config)?; + let output = args.output; let signed_target = SignedTarget::try_from(args)?; let pathfinder = GatewayPathfinder::new_from_config(&config); let identity_keypair = load_identity_keys(&pathfinder); diff --git a/gateway/src/main.rs b/gateway/src/main.rs index 11f8e69457..b17906d4f0 100644 --- a/gateway/src/main.rs +++ b/gateway/src/main.rs @@ -1,11 +1,12 @@ -// Copyright 2020 - Nym Technologies SA +// Copyright 2020-2023 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 -use clap::{crate_name, crate_version, Parser, ValueEnum}; +use clap::{crate_name, crate_version, Parser}; use colored::Colorize; use lazy_static::lazy_static; use log::error; use nym_bin_common::logging::setup_logging; +use nym_bin_common::output_format::OutputFormat; use nym_bin_common::{build_information::BinaryBuildInformation, logging::banner}; use nym_network_defaults::setup_env; use std::error::Error; @@ -26,18 +27,6 @@ fn pretty_build_info_static() -> &'static str { &PRETTY_BUILD_INFORMATION } -#[derive(Clone, ValueEnum)] -pub enum OutputFormat { - Json, - Text, -} - -impl Default for OutputFormat { - fn default() -> Self { - OutputFormat::Text - } -} - #[derive(Parser)] #[clap(author = "Nymtech", version, about, long_version = pretty_build_info_static())] struct Cli { @@ -45,23 +34,10 @@ struct Cli { #[clap(short, long)] pub(crate) config_env_file: Option, - #[clap(short, long)] - pub(crate) output: Option, - #[clap(subcommand)] command: commands::Commands, } -impl Cli { - fn output(&self) -> OutputFormat { - if let Some(ref output) = self.output { - output.clone() - } else { - OutputFormat::default() - } - } -} - #[tokio::main] async fn main() -> Result<(), Box> { setup_logging(); diff --git a/gateway/src/node/mod.rs b/gateway/src/node/mod.rs index 343802fea1..5d135fef0f 100644 --- a/gateway/src/node/mod.rs +++ b/gateway/src/node/mod.rs @@ -11,9 +11,9 @@ use crate::node::client_handling::websocket::connection_handler::coconut::Coconu use crate::node::mixnet_handling::receiver::connection_handler::ConnectionHandler; use crate::node::statistics::collector::GatewayStatisticsCollector; use crate::node::storage::Storage; -use crate::OutputFormat; use log::*; use mixnet_client::forwarder::{MixForwardingSender, PacketForwarder}; +use nym_bin_common::output_format::OutputFormat; use nym_crypto::asymmetric::{encryption, identity}; use nym_network_defaults::NymNetworkDetails; use nym_statistics_common::collector::StatisticsSender; @@ -106,7 +106,7 @@ where sphinx_keypair } - pub(crate) fn print_node_details(&self, output: OutputFormat) -> Result<(), GatewayError> { + pub(crate) fn print_node_details(&self, output: OutputFormat) { let node_details = nym_types::gateway::GatewayNodeDetailsResponse { identity_key: self.identity_keypair.public_key().to_base58_string(), sphinx_key: self.sphinx_keypair.public_key().to_base58_string(), @@ -123,15 +123,7 @@ where .to_string(), }; - match output { - OutputFormat::Json => println!( - "{}", - serde_json::to_string(&node_details) - .unwrap_or_else(|_| "Could not serialize node details".to_string()) - ), - OutputFormat::Text => println!("{}", node_details), - } - Ok(()) + println!("{}", output.format(&node_details)); } fn start_mix_socket_listener( diff --git a/mixnode/Cargo.toml b/mixnode/Cargo.toml index 3a1a21b9af..53d3857a55 100644 --- a/mixnode/Cargo.toml +++ b/mixnode/Cargo.toml @@ -29,8 +29,8 @@ log = { workspace = true } pretty_env_logger = "0.4.0" rand = "0.7.3" rocket = { version = "0.5.0-rc.2", features = ["json"] } -serde = { version = "1.0", features = ["derive"] } -serde_json = "1.0" +serde = { workspace = true, features = ["derive"] } +serde_json = { workspace = true } sysinfo = "0.27.7" tokio = { version = "1.21.2", features = ["rt-multi-thread", "net", "signal"] } tokio-util = { version = "0.7.3", features = ["codec"] } diff --git a/mixnode/src/main.rs b/mixnode/src/main.rs index 609e63a0ad..277f4b8f66 100644 --- a/mixnode/src/main.rs +++ b/mixnode/src/main.rs @@ -24,18 +24,6 @@ fn pretty_build_info_static() -> &'static str { &PRETTY_BUILD_INFORMATION } -#[derive(Clone, ValueEnum)] -enum OutputFormat { - Json, - Text, -} - -impl Default for OutputFormat { - fn default() -> Self { - OutputFormat::Text - } -} - #[derive(Parser)] #[clap(author = "Nymtech", version, about, long_version = pretty_build_info_static())] struct Cli { diff --git a/nym-api/Cargo.toml b/nym-api/Cargo.toml index d6e3be4373..fad3925f93 100644 --- a/nym-api/Cargo.toml +++ b/nym-api/Cargo.toml @@ -34,7 +34,7 @@ reqwest = { version = "0.11.11", features = ["json"] } rocket = { version = "0.5.0-rc.2", features = ["json"] } rocket_cors = { git = "https://github.com/lawliet89/rocket_cors", rev = "dfd3662c49e2f6fc37df35091cb94d82f7fb5915" } serde = "1.0" -serde_json = "1.0" +serde_json = { workspace = true } tap = "1.0" thiserror = "1.0" time = { version = "0.3.14", features = ["serde-human-readable", "parsing"] } diff --git a/service-providers/network-requester/Cargo.toml b/service-providers/network-requester/Cargo.toml index bf49bab7c1..fe39370b8e 100644 --- a/service-providers/network-requester/Cargo.toml +++ b/service-providers/network-requester/Cargo.toml @@ -22,7 +22,7 @@ pretty_env_logger = "0.4.0" publicsuffix = "1.5" # Can't update this until bip updates to support newer idna version rand = "0.7.3" reqwest = { version = "0.11.11", features = ["json"] } -serde = { version = "1.0", features = ["derive"] } +serde = { workspace = true, features = ["derive"] } sqlx = { version = "0.6.1", features = ["runtime-tokio-rustls", "chrono"]} tap = { workspace = true } thiserror = "1.0" diff --git a/service-providers/network-statistics/Cargo.toml b/service-providers/network-statistics/Cargo.toml index 14c4cc317e..9ee8add427 100644 --- a/service-providers/network-statistics/Cargo.toml +++ b/service-providers/network-statistics/Cargo.toml @@ -10,7 +10,7 @@ dirs = "4.0" log = { workspace = true } pretty_env_logger = "0.4" rocket = { version = "0.5.0-rc.2", features = ["json"] } -serde = { version = "1.0", features = ["derive"] } +serde = { workspace = true, features = ["derive"] } sqlx = { version = "0.5", features = ["runtime-tokio-rustls", "sqlite", "macros", "migrate", "chrono"]} thiserror = "1" tokio = { version = "1.4", features = [ "net", "rt-multi-thread", "macros", "time" ] }