From 3816142479c673da7d57fcfd4321e2b8ed3bb956 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Stuczy=C5=84ski?= Date: Tue, 2 Jan 2024 10:06:26 +0000 Subject: [PATCH 1/3] ignoring unused imports created in macro expansions --- explorer-api/src/country_statistics/http.rs | 3 +++ explorer-api/src/gateways/http.rs | 3 +++ explorer-api/src/mix_node/http.rs | 3 +++ explorer-api/src/mix_nodes/http.rs | 3 +++ explorer-api/src/overview/http.rs | 3 +++ explorer-api/src/ping/http.rs | 3 +++ explorer-api/src/service_providers/http.rs | 3 +++ explorer-api/src/validators/http.rs | 3 +++ nym-api/src/circulating_supply_api/routes.rs | 3 +++ nym-api/src/coconut/api_routes/mod.rs | 3 +++ nym-api/src/network/routes.rs | 3 +++ nym-api/src/node_status_api/routes.rs | 3 +++ nym-api/src/nym_contract_cache/routes.rs | 3 +++ nym-api/src/nym_nodes/routes.rs | 3 +++ service-providers/network-requester/src/config/mod.rs | 1 - .../network-statistics/src/api/routes.rs | 11 ++++++----- 16 files changed, 48 insertions(+), 6 deletions(-) diff --git a/explorer-api/src/country_statistics/http.rs b/explorer-api/src/country_statistics/http.rs index 45259f11dc..f51b8d242e 100644 --- a/explorer-api/src/country_statistics/http.rs +++ b/explorer-api/src/country_statistics/http.rs @@ -1,3 +1,6 @@ +// due to the macro expansion of rather old rocket macros... +#![allow(unused_imports)] + use crate::country_statistics::country_nodes_distribution::CountryNodesDistribution; use crate::state::ExplorerApiStateContext; use rocket::serde::json::Json; diff --git a/explorer-api/src/gateways/http.rs b/explorer-api/src/gateways/http.rs index ac0d85c0b1..f47ea51146 100644 --- a/explorer-api/src/gateways/http.rs +++ b/explorer-api/src/gateways/http.rs @@ -1,6 +1,9 @@ // Copyright 2022 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 +// due to the macro expansion of rather old rocket macros... +#![allow(unused_imports)] + use nym_explorer_api_requests::PrettyDetailedGatewayBond; use rocket::response::status::NotFound; use rocket::serde::json::Json; diff --git a/explorer-api/src/mix_node/http.rs b/explorer-api/src/mix_node/http.rs index e00ed8ff82..f1d2738db7 100644 --- a/explorer-api/src/mix_node/http.rs +++ b/explorer-api/src/mix_node/http.rs @@ -1,6 +1,9 @@ // Copyright 2022 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 +// due to the macro expansion of rather old rocket macros... +#![allow(unused_imports)] + use crate::mix_node::delegations::{ get_single_mixnode_delegations, get_single_mixnode_delegations_summed, }; diff --git a/explorer-api/src/mix_nodes/http.rs b/explorer-api/src/mix_nodes/http.rs index a36843b66f..5043a559e6 100644 --- a/explorer-api/src/mix_nodes/http.rs +++ b/explorer-api/src/mix_nodes/http.rs @@ -1,3 +1,6 @@ +// due to the macro expansion of rather old rocket macros... +#![allow(unused_imports)] + use crate::mix_nodes::models::{MixNodeActiveSetSummary, MixNodeSummary}; use crate::state::ExplorerApiStateContext; use nym_explorer_api_requests::{MixnodeStatus, PrettyDetailedMixNodeBond}; diff --git a/explorer-api/src/overview/http.rs b/explorer-api/src/overview/http.rs index a5cfb127c5..1f130e68c6 100644 --- a/explorer-api/src/overview/http.rs +++ b/explorer-api/src/overview/http.rs @@ -1,3 +1,6 @@ +// due to the macro expansion of rather old rocket macros... +#![allow(unused_imports)] + use rocket::serde::json::Json; use rocket::{Route, State}; use rocket_okapi::okapi::openapi3::OpenApi; diff --git a/explorer-api/src/ping/http.rs b/explorer-api/src/ping/http.rs index c3cd4107f1..a486c5c7a6 100644 --- a/explorer-api/src/ping/http.rs +++ b/explorer-api/src/ping/http.rs @@ -1,6 +1,9 @@ // Copyright 2021-2023 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 +// due to the macro expansion of rather old rocket macros... +#![allow(unused_imports)] + use nym_mixnet_contract_common::{MixId, MixNode}; use rocket::serde::json::Json; use rocket::{Route, State}; diff --git a/explorer-api/src/service_providers/http.rs b/explorer-api/src/service_providers/http.rs index a942a68755..5da66d9958 100644 --- a/explorer-api/src/service_providers/http.rs +++ b/explorer-api/src/service_providers/http.rs @@ -1,3 +1,6 @@ +// due to the macro expansion of rather old rocket macros... +#![allow(unused_imports)] + use crate::service_providers::models::{ DirectoryService, DirectorySpDetailed, HarbourMasterService, PagedResult, }; diff --git a/explorer-api/src/validators/http.rs b/explorer-api/src/validators/http.rs index 88a06eea01..ee42d2f14b 100644 --- a/explorer-api/src/validators/http.rs +++ b/explorer-api/src/validators/http.rs @@ -1,6 +1,9 @@ // Copyright 2022 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 +// due to the macro expansion of rather old rocket macros... +#![allow(unused_imports)] + use rocket::response::status::NotFound; use rocket::serde::json::Json; use rocket::{Route, State}; diff --git a/nym-api/src/circulating_supply_api/routes.rs b/nym-api/src/circulating_supply_api/routes.rs index 5bc76ab8bb..fcf23b67fb 100644 --- a/nym-api/src/circulating_supply_api/routes.rs +++ b/nym-api/src/circulating_supply_api/routes.rs @@ -1,6 +1,9 @@ // Copyright 2022-2023 - Nym Technologies SA // SPDX-License-Identifier: GPL-3.0-only +// due to the macro expansion of rather old rocket macros... +#![allow(unused_imports)] + use crate::circulating_supply_api::cache::CirculatingSupplyCache; use crate::node_status_api::models::ErrorResponse; use nym_api_requests::models::CirculatingSupplyResponse; diff --git a/nym-api/src/coconut/api_routes/mod.rs b/nym-api/src/coconut/api_routes/mod.rs index b783f9c0a2..9110487ade 100644 --- a/nym-api/src/coconut/api_routes/mod.rs +++ b/nym-api/src/coconut/api_routes/mod.rs @@ -1,6 +1,9 @@ // Copyright 2023 - Nym Technologies SA // SPDX-License-Identifier: GPL-3.0-only +// due to the macro expansion of rather old rocket macros... +#![allow(unused_imports)] + use crate::coconut::api_routes::helpers::build_credentials_response; use crate::coconut::error::{CoconutError, Result}; use crate::coconut::helpers::{accepted_vote_err, blind_sign}; diff --git a/nym-api/src/network/routes.rs b/nym-api/src/network/routes.rs index 73625f8b88..5febb8fd75 100644 --- a/nym-api/src/network/routes.rs +++ b/nym-api/src/network/routes.rs @@ -1,6 +1,9 @@ // Copyright 2023 - Nym Technologies SA // SPDX-License-Identifier: GPL-3.0-only +// due to the macro expansion of rather old rocket macros... +#![allow(unused_imports)] + use crate::network::models::{ContractInformation, NetworkDetails}; use crate::nym_contract_cache::cache::NymContractCache; use nym_contracts_common::ContractBuildInformation; diff --git a/nym-api/src/node_status_api/routes.rs b/nym-api/src/node_status_api/routes.rs index 466b10f883..c3b95e3336 100644 --- a/nym-api/src/node_status_api/routes.rs +++ b/nym-api/src/node_status_api/routes.rs @@ -1,6 +1,9 @@ // Copyright 2021-2023 - Nym Technologies SA // SPDX-License-Identifier: GPL-3.0-only +// due to the macro expansion of rather old rocket macros... +#![allow(unused_imports)] + use super::helpers::_get_gateways_detailed; use super::NodeStatusCache; use crate::node_status_api::helpers::{ diff --git a/nym-api/src/nym_contract_cache/routes.rs b/nym-api/src/nym_contract_cache/routes.rs index 01fbab47ac..5573d3a629 100644 --- a/nym-api/src/nym_contract_cache/routes.rs +++ b/nym-api/src/nym_contract_cache/routes.rs @@ -1,6 +1,9 @@ // Copyright 2021-2023 - Nym Technologies SA // SPDX-License-Identifier: GPL-3.0-only +// due to the macro expansion of rather old rocket macros... +#![allow(unused_imports)] + use crate::{ node_status_api::{ helpers::{_get_active_set_detailed, _get_mixnodes_detailed, _get_rewarded_set_detailed}, diff --git a/nym-api/src/nym_nodes/routes.rs b/nym-api/src/nym_nodes/routes.rs index 1df0250844..3dbf62120b 100644 --- a/nym-api/src/nym_nodes/routes.rs +++ b/nym-api/src/nym_nodes/routes.rs @@ -1,6 +1,9 @@ // Copyright 2023 - Nym Technologies SA // SPDX-License-Identifier: GPL-3.0-only +// due to the macro expansion of rather old rocket macros... +#![allow(unused_imports)] + use crate::node_describe_cache::DescribedNodes; use crate::nym_contract_cache::cache::NymContractCache; use crate::support::caching::cache::SharedCache; diff --git a/service-providers/network-requester/src/config/mod.rs b/service-providers/network-requester/src/config/mod.rs index 022b488d57..bce2d5effa 100644 --- a/service-providers/network-requester/src/config/mod.rs +++ b/service-providers/network-requester/src/config/mod.rs @@ -22,7 +22,6 @@ use std::time::Duration; use url::Url; pub use nym_client_core::config::Config as BaseClientConfig; -pub use nym_client_core::config::{DebugConfig, GatewayEndpointConfig}; pub mod old_config_v1_1_13; pub mod old_config_v1_1_20; diff --git a/service-providers/network-statistics/src/api/routes.rs b/service-providers/network-statistics/src/api/routes.rs index 6d36a9f909..632841a675 100644 --- a/service-providers/network-statistics/src/api/routes.rs +++ b/service-providers/network-statistics/src/api/routes.rs @@ -1,14 +1,15 @@ // Copyright 2022 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 -use rocket::serde::json::Json; -use rocket::State; -use serde::{Deserialize, Serialize}; - -use nym_statistics_common::StatsMessage; +// due to the macro expansion of rather old rocket macros... +#![allow(unused_imports)] use crate::api::error::Result; use crate::storage::NetworkStatisticsStorage; +use nym_statistics_common::StatsMessage; +use rocket::serde::json::Json; +use rocket::State; +use serde::{Deserialize, Serialize}; #[derive(Clone, Serialize, Deserialize, Debug)] pub struct StatisticsRequest { From 7232fd83d1759c9886bc4c3888cd32fb8a936496 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Stuczy=C5=84ski?= Date: Tue, 2 Jan 2024 10:09:03 +0000 Subject: [PATCH 2/3] ignoring pedantic clippy lints from ephemera --- ephemera/src/block/manager.rs | 1 + ephemera/src/network/mod.rs | 2 ++ 2 files changed, 3 insertions(+) diff --git a/ephemera/src/block/manager.rs b/ephemera/src/block/manager.rs index c125fed228..a0538479db 100644 --- a/ephemera/src/block/manager.rs +++ b/ephemera/src/block/manager.rs @@ -43,6 +43,7 @@ pub(crate) enum BlockManagerError { BlockManager(#[from] anyhow::Error), } +#[allow(clippy::struct_field_names)] // this should get resolved properly at some point, but not now... /// It helps to use atomic state management for new blocks. pub(crate) struct BlockChainState { pub(crate) last_blocks: LruCache, diff --git a/ephemera/src/network/mod.rs b/ephemera/src/network/mod.rs index 205e147903..ece4db4e67 100644 --- a/ephemera/src/network/mod.rs +++ b/ephemera/src/network/mod.rs @@ -102,6 +102,8 @@ pub(crate) struct Peer { /// assert_eq!(peer_id, public_key.peer_id()); /// /// ``` + #[allow(clippy::struct_field_names)] + // this should get resolved properly at some point, but not now... pub peer_id: PeerId, /// The peer's public key. It matches PeerId. pub public_key: PublicKey, From 2d9e34cc816733462008528c05314906148c5537 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Stuczy=C5=84ski?= Date: Tue, 2 Jan 2024 10:27:43 +0000 Subject: [PATCH 3/3] clippy --- common/client-core/src/client/helpers/wasm.rs | 2 + common/nymcoconut/src/tests/helpers.rs | 22 +++--- nym-wallet/Cargo.lock | 76 ++++++++----------- .../examples/libp2p_shared/connection.rs | 8 +- .../nym-sdk/examples/libp2p_shared/error.rs | 10 +-- .../nym-sdk/examples/libp2p_shared/mixnet.rs | 6 +- .../examples/libp2p_shared/transport.rs | 18 ++--- tools/nymvisor/src/upgrades/types.rs | 2 +- 8 files changed, 66 insertions(+), 78 deletions(-) diff --git a/common/client-core/src/client/helpers/wasm.rs b/common/client-core/src/client/helpers/wasm.rs index 5046463ee5..502ae53479 100644 --- a/common/client-core/src/client/helpers/wasm.rs +++ b/common/client-core/src/client/helpers/wasm.rs @@ -1,6 +1,8 @@ // Copyright 2022 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 +#![allow(unused_imports)] + use std::time::Duration; pub use wasmtimer::{std::Instant, tokio::*}; diff --git a/common/nymcoconut/src/tests/helpers.rs b/common/nymcoconut/src/tests/helpers.rs index 61c4531903..e0f58ba33b 100644 --- a/common/nymcoconut/src/tests/helpers.rs +++ b/common/nymcoconut/src/tests/helpers.rs @@ -108,6 +108,17 @@ pub fn transpose_matrix(matrix: Vec>) -> Vec> { .collect::>() } +#[macro_export] +macro_rules! random_scalars_refs { + ( $x: ident, $params: expr, $n: expr ) => { + let _vec = $params.n_random_scalars($n); + #[allow(clippy::map_identity)] + let $x = _vec.iter().collect::>(); + }; +} + +pub use random_scalars_refs; + #[cfg(test)] pub mod tests { use super::*; @@ -170,14 +181,3 @@ pub mod tests { .collect() } } - -#[macro_export] -macro_rules! random_scalars_refs { - ( $x: ident, $params: expr, $n: expr ) => { - let _vec = $params.n_random_scalars($n); - #[allow(clippy::map_identity)] - let $x = _vec.iter().collect::>(); - }; -} - -pub use random_scalars_refs; diff --git a/nym-wallet/Cargo.lock b/nym-wallet/Cargo.lock index 37ef1a08d6..8108a547af 100644 --- a/nym-wallet/Cargo.lock +++ b/nym-wallet/Cargo.lock @@ -400,12 +400,12 @@ dependencies = [ [[package]] name = "bls12_381" -version = "0.6.0" -source = "git+https://github.com/jstuczyn/bls12_381?branch=gt-serialisation#10fb6f700bfda17c8475af3bfd31e3fec15f2278" +version = "0.8.0" +source = "git+https://github.com/jstuczyn/bls12_381?branch=feature/gt-serialization-0.8.0#c4543fde7d02efea6ecfcf22e14476ddb516b483" dependencies = [ "digest 0.9.0", - "ff 0.11.1", - "group 0.11.0", + "ff 0.13.0", + "group 0.13.0", "pairing", "rand_core 0.6.4", "subtle 2.4.1", @@ -1051,6 +1051,7 @@ dependencies = [ "byteorder", "digest 0.9.0", "rand_core 0.5.1", + "serde", "subtle 2.4.1", "zeroize", ] @@ -1455,6 +1456,7 @@ version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" dependencies = [ + "serde", "signature 1.6.4", ] @@ -1491,6 +1493,7 @@ dependencies = [ "ed25519 1.5.3", "rand 0.7.3", "serde", + "serde_bytes", "sha2 0.9.9", "zeroize", ] @@ -1665,16 +1668,6 @@ dependencies = [ "log", ] -[[package]] -name = "ff" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "131655483be284720a17d74ff97592b8e76576dc25563148601df2d7c9080924" -dependencies = [ - "rand_core 0.6.4", - "subtle 2.4.1", -] - [[package]] name = "ff" version = "0.12.1" @@ -1691,6 +1684,7 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" dependencies = [ + "bitvec", "rand_core 0.6.4", "subtle 2.4.1", ] @@ -2170,18 +2164,6 @@ dependencies = [ "system-deps 6.1.1", ] -[[package]] -name = "group" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5ac374b108929de78460075f3dc439fa66df9d8fc77e8f12caa5165fcf0c89" -dependencies = [ - "byteorder", - "ff 0.11.1", - "rand_core 0.6.4", - "subtle 2.4.1", -] - [[package]] name = "group" version = "0.12.1" @@ -2803,9 +2785,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.147" +version = "0.2.151" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" [[package]] name = "libgit2-sys" @@ -2981,9 +2963,9 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.8" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" +checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" dependencies = [ "libc", "wasi 0.11.0+wasi-snapshot-preview1", @@ -3149,10 +3131,12 @@ dependencies = [ "cosmwasm-std", "getset", "nym-coconut-interface", + "nym-crypto", "nym-mixnet-contract-common", "nym-node-requests", "schemars", "serde", + "tendermint", ] [[package]] @@ -3178,9 +3162,9 @@ dependencies = [ "bls12_381", "bs58 0.4.0", "digest 0.9.0", - "ff 0.11.1", + "ff 0.13.0", "getrandom 0.2.10", - "group 0.11.0", + "group 0.13.0", "itertools 0.10.5", "nym-dkg", "nym-pemstore", @@ -3256,6 +3240,8 @@ dependencies = [ "nym-pemstore", "nym-sphinx-types", "rand 0.7.3", + "serde", + "serde_bytes", "subtle-encoding", "thiserror", "x25519-dalek 1.1.1", @@ -3269,8 +3255,8 @@ dependencies = [ "bitvec", "bls12_381", "bs58 0.4.0", - "ff 0.11.1", - "group 0.11.0", + "ff 0.13.0", + "group 0.13.0", "lazy_static", "nym-pemstore", "rand 0.8.5", @@ -3566,7 +3552,6 @@ dependencies = [ "nym-crypto", "serde", "thiserror", - "tokio", "x25519-dalek 2.0.0", ] @@ -3765,11 +3750,11 @@ checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[package]] name = "pairing" -version = "0.21.0" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2e415e349a3006dd7d9482cdab1c980a845bed1377777d768cb693a44540b42" +checksum = "81fec4625e73cf41ef4bb6846cafa6d44736525f442ba45e407c4a000a13996f" dependencies = [ - "group 0.11.0", + "group 0.13.0", ] [[package]] @@ -5067,9 +5052,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.3" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877" +checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" dependencies = [ "libc", "windows-sys 0.48.0", @@ -5798,9 +5783,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.31.0" +version = "1.35.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40de3a2ba249dcb097e01be5e67a5ff53cf250397715a071a81543e8a832a920" +checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" dependencies = [ "backtrace", "bytes", @@ -5810,16 +5795,16 @@ dependencies = [ "parking_lot", "pin-project-lite", "signal-hook-registry", - "socket2 0.5.3", + "socket2 0.5.5", "tokio-macros", "windows-sys 0.48.0", ] [[package]] name = "tokio-macros" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" +checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", @@ -6742,6 +6727,7 @@ checksum = "5a0c105152107e3b96f6a00a65e86ce82d9b125230e1c4302940eca58ff71f4f" dependencies = [ "curve25519-dalek 3.2.0", "rand_core 0.5.1", + "serde", "zeroize", ] diff --git a/sdk/rust/nym-sdk/examples/libp2p_shared/connection.rs b/sdk/rust/nym-sdk/examples/libp2p_shared/connection.rs index fd5c41ccd1..04c166ce59 100644 --- a/sdk/rust/nym-sdk/examples/libp2p_shared/connection.rs +++ b/sdk/rust/nym-sdk/examples/libp2p_shared/connection.rs @@ -109,7 +109,7 @@ impl Connection { }, }), }) - .map_err(|e| Error::OutboundSendError(e.to_string()))?; + .map_err(|e| Error::OutboundSendFailure(e.to_string()))?; // track pending outbound substreams // TODO we should probably lock this? storing map values should be atomic @@ -159,7 +159,7 @@ impl Connection { // notify poll_close that the substream is closed self.close_tx .send(substream_id) - .map_err(|e| Error::InboundSendError(e.to_string())) + .map_err(|e| Error::InboundSendFailure(e.to_string())) } } @@ -217,13 +217,13 @@ impl StreamMuxer for Connection { }, }), }) - .map_err(|e| Error::OutboundSendError(e.to_string()))?; + .map_err(|e| Error::OutboundSendFailure(e.to_string()))?; debug!("wrote OpenResponse for substream: {:?}", &msg.substream_id); // send the substream to our own channel to be returned in poll_inbound self.inbound_open_tx .send(substream) - .map_err(|e| Error::InboundSendError(e.to_string()))?; + .map_err(|e| Error::InboundSendFailure(e.to_string()))?; debug!("new inbound substream: {:?}", &msg.substream_id); } diff --git a/sdk/rust/nym-sdk/examples/libp2p_shared/error.rs b/sdk/rust/nym-sdk/examples/libp2p_shared/error.rs index bf1ebc8175..a81674b0fa 100644 --- a/sdk/rust/nym-sdk/examples/libp2p_shared/error.rs +++ b/sdk/rust/nym-sdk/examples/libp2p_shared/error.rs @@ -48,15 +48,15 @@ pub enum Error { #[error("no substream found for given ID")] SubstreamIdDoesNotExist(SubstreamId), #[error("recv error: channel closed")] - OneshotRecvError(#[from] tokio::sync::oneshot::error::RecvError), + OneshotRecvFailure(#[from] tokio::sync::oneshot::error::RecvError), #[error("recv error: channel closed")] - RecvError, + RecvFailure, #[error("outbound send error")] - OutboundSendError(String), + OutboundSendFailure(String), #[error("inbound send error")] - InboundSendError(String), + InboundSendFailure(String), #[error("failed to send new connection; receiver dropped")] - ConnectionSendError, + ConnectionSendFailure, #[error("failed to send initial TransportEvent::NewAddress")] SendErrorTransportEvent, #[error("dial timed out")] diff --git a/sdk/rust/nym-sdk/examples/libp2p_shared/mixnet.rs b/sdk/rust/nym-sdk/examples/libp2p_shared/mixnet.rs index f75048203b..c696bce8fd 100644 --- a/sdk/rust/nym-sdk/examples/libp2p_shared/mixnet.rs +++ b/sdk/rust/nym-sdk/examples/libp2p_shared/mixnet.rs @@ -62,7 +62,7 @@ async fn check_inbound( if let Some(notify_tx) = notify_inbound_tx { notify_tx .send(()) - .map_err(|e| Error::InboundSendError(e.to_string()))?; + .map_err(|e| Error::InboundSendFailure(e.to_string()))?; } handle_inbound(msg, inbound_tx).await?; @@ -78,7 +78,7 @@ async fn handle_inbound( let data = parse_message_data(&msg.message)?; inbound_tx .send(data) - .map_err(|e| Error::InboundSendError(e.to_string()))?; + .map_err(|e| Error::InboundSendFailure(e.to_string()))?; Ok(()) } @@ -95,7 +95,7 @@ async fn check_outbound( ) .await } - None => Err(Error::RecvError), + None => Err(Error::RecvFailure), } } diff --git a/sdk/rust/nym-sdk/examples/libp2p_shared/transport.rs b/sdk/rust/nym-sdk/examples/libp2p_shared/transport.rs index 79c3de5cbb..6fde934bf8 100644 --- a/sdk/rust/nym-sdk/examples/libp2p_shared/transport.rs +++ b/sdk/rust/nym-sdk/examples/libp2p_shared/transport.rs @@ -170,7 +170,7 @@ impl NymTransport { ); inbound_tx .send(msg.message.clone()) - .map_err(|e| Error::InboundSendError(e.to_string()))?; + .map_err(|e| Error::InboundSendFailure(e.to_string()))?; } } None => { @@ -207,7 +207,7 @@ impl NymTransport { pending_conn .connection_tx .send(conn) - .map_err(|_| Error::ConnectionSendError)?; + .map_err(|_| Error::ConnectionSendFailure)?; if let Some(waker) = self.waker.take() { waker.wake(); @@ -247,7 +247,7 @@ impl NymTransport { message: Message::ConnectionResponse(resp), recipient: msg.recipient.unwrap(), }) - .map_err(|e| Error::OutboundSendError(e.to_string()))?; + .map_err(|e| Error::OutboundSendFailure(e.to_string()))?; if let Some(waker) = self.waker.take() { waker.wake(); @@ -287,7 +287,7 @@ impl NymTransport { ); inbound_tx .send(msg.message.clone()) - .map_err(|e| Error::InboundSendError(e.to_string()))?; + .map_err(|e| Error::InboundSendFailure(e.to_string()))?; // try to pop queued messages and send them on inbound channel while let Some(msg) = queue.pop() { @@ -297,7 +297,7 @@ impl NymTransport { ); inbound_tx .send(msg.message.clone()) - .map_err(|e| Error::InboundSendError(e.to_string()))?; + .map_err(|e| Error::InboundSendFailure(e.to_string()))?; } if let Some(waker) = self.waker.clone().take() { @@ -340,7 +340,7 @@ impl NymTransport { let upgrade = Upgrade::new(connection_rx); connection_tx .send((inner.peer_id, conn)) - .map_err(|_| Error::ConnectionSendError)?; + .map_err(|_| Error::ConnectionSendFailure)?; Ok(InboundTransportEvent::ConnectionRequest(upgrade)) } Err(e) => Err(e), @@ -380,7 +380,7 @@ impl Future for Upgrade { fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { self.connection_tx .poll_unpin(cx) - .map_err(|_| Error::RecvError) + .map_err(|_| Error::RecvFailure) } } @@ -441,7 +441,7 @@ impl Transport for NymTransport { message: Message::ConnectionRequest(msg), recipient, }) - .map_err(|e| Error::OutboundSendError(e.to_string()))?; + .map_err(|e| Error::OutboundSendFailure(e.to_string()))?; debug!("sent outbound ConnectionRequest"); if let Some(waker) = waker.take() { @@ -555,7 +555,7 @@ mod test { message: msg, }), }) - .map_err(|e| Error::OutboundSendError(e.to_string()))?; + .map_err(|e| Error::OutboundSendFailure(e.to_string()))?; Ok(()) } } diff --git a/tools/nymvisor/src/upgrades/types.rs b/tools/nymvisor/src/upgrades/types.rs index 1afa75e8ec..abeea0ed70 100644 --- a/tools/nymvisor/src/upgrades/types.rs +++ b/tools/nymvisor/src/upgrades/types.rs @@ -92,7 +92,7 @@ impl UpgradePlan { } pub(crate) fn next_upgrade(&self) -> Option<&UpgradeInfo> { - self.queued_up.get(0) + self.queued_up.first() } pub(crate) fn pop_next_upgrade(&mut self) -> Option {