From 2c6e5eb673a82f75f8f38f09abf305be75295ba0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Stuczy=C5=84ski?= Date: Thu, 25 Jul 2024 17:50:19 +0100 Subject: [PATCH] cherry-pick: fix build issues --- Cargo.lock | 1 + .../src/nyxd/cosmwasm_client/mod.rs | 5 +++++ .../client-libs/validator-client/src/nyxd/mod.rs | 5 +++++ common/client-libs/validator-client/src/rpc/mod.rs | 5 +++++ common/topology/src/error.rs | 1 - common/topology/src/random_route_provider.rs | 1 + common/wasm/utils/Cargo.toml | 4 +++- nym-api/src/coconut/dkg/public_key.rs | 1 + nym-api/src/coconut/storage/manager.rs | 9 +-------- nym-api/src/coconut/tests/fixtures.rs | 6 +++--- nym-api/src/epoch_operations/mod.rs | 14 +++++++------- nym-wallet/src-tauri/src/state.rs | 1 + nym-wallet/src-tauri/src/wallet_storage/mod.rs | 4 ++-- sdk/rust/nym-sdk/src/mixnet/client.rs | 6 ++---- 14 files changed, 37 insertions(+), 26 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ed1435c339..251fde9db4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9439,6 +9439,7 @@ dependencies = [ name = "wasm-utils" version = "0.1.0" dependencies = [ + "console_error_panic_hook", "futures", "getrandom 0.2.15", "gloo-net", diff --git a/common/client-libs/validator-client/src/nyxd/cosmwasm_client/mod.rs b/common/client-libs/validator-client/src/nyxd/cosmwasm_client/mod.rs index 98f2f8d07c..544f6aaf0d 100644 --- a/common/client-libs/validator-client/src/nyxd/cosmwasm_client/mod.rs +++ b/common/client-libs/validator-client/src/nyxd/cosmwasm_client/mod.rs @@ -1,6 +1,11 @@ // Copyright 2021 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 +// TEMPORARY WORKAROUND: +// those features are expected as the below should only get activated whenever +// the corresponding features in tendermint-rpc are enabled transitively +#![allow(unexpected_cfgs)] + use crate::nyxd::cosmwasm_client::client_traits::SigningCosmWasmClient; use crate::nyxd::error::NyxdError; use crate::nyxd::{Config, GasPrice, Hash, Height}; diff --git a/common/client-libs/validator-client/src/nyxd/mod.rs b/common/client-libs/validator-client/src/nyxd/mod.rs index e396af4053..608fb2b2b0 100644 --- a/common/client-libs/validator-client/src/nyxd/mod.rs +++ b/common/client-libs/validator-client/src/nyxd/mod.rs @@ -1,6 +1,11 @@ // Copyright 2021 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 +// TEMPORARY WORKAROUND: +// those features are expected as the below should only get activated whenever +// the corresponding features in tendermint-rpc are enabled transitively +#![allow(unexpected_cfgs)] + use crate::nyxd::contract_traits::{NymContractsProvider, TypedNymContracts}; use crate::nyxd::cosmwasm_client::types::{ ChangeAdminResult, ContractCodeId, ExecuteResult, InstantiateOptions, InstantiateResult, diff --git a/common/client-libs/validator-client/src/rpc/mod.rs b/common/client-libs/validator-client/src/rpc/mod.rs index 78f5476b48..bbab0cbc38 100644 --- a/common/client-libs/validator-client/src/rpc/mod.rs +++ b/common/client-libs/validator-client/src/rpc/mod.rs @@ -1,6 +1,11 @@ // Copyright 2023 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 +// TEMPORARY WORKAROUND: +// those features are expected as the below should only get activated whenever +// the corresponding features in tendermint-rpc are enabled transitively +#![allow(unexpected_cfgs)] + use async_trait::async_trait; use cosmrs::tendermint::{self, abci, block::Height, evidence::Evidence, Genesis, Hash}; use serde::{de::DeserializeOwned, Serialize}; diff --git a/common/topology/src/error.rs b/common/topology/src/error.rs index 4c8714c0d6..68f169ccc7 100644 --- a/common/topology/src/error.rs +++ b/common/topology/src/error.rs @@ -44,7 +44,6 @@ pub enum NymTopologyError { PayloadBuilder, #[error("Outfox: {0}")] - #[cfg(feature = "outfox")] Outfox(#[from] nym_sphinx_types::OutfoxError), #[error("{0}")] diff --git a/common/topology/src/random_route_provider.rs b/common/topology/src/random_route_provider.rs index 65d9452161..1771c83eb7 100644 --- a/common/topology/src/random_route_provider.rs +++ b/common/topology/src/random_route_provider.rs @@ -7,6 +7,7 @@ use nym_sphinx_routing::SphinxRouteMaker; use nym_sphinx_types::Node; use rand::{CryptoRng, Rng}; +#[allow(dead_code)] pub struct NymTopologyRouteProvider { rng: R, inner: NymTopology, diff --git a/common/wasm/utils/Cargo.toml b/common/wasm/utils/Cargo.toml index 57d33b6602..76ebe5f3dd 100644 --- a/common/wasm/utils/Cargo.toml +++ b/common/wasm/utils/Cargo.toml @@ -17,6 +17,8 @@ gloo-utils = { workspace = true } gloo-net = { workspace = true, features = ["websocket"], optional = true } #gloo-net = { path = "../../../../gloo/crates/net", features = ["websocket"], optional = true } +console_error_panic_hook = { workspace = true, optional = true } + # we don't want entire tokio-tungstenite, tungstenite itself is just fine - we just want message and error enums [dependencies.tungstenite] workspace = true @@ -28,7 +30,7 @@ workspace = true optional = true [features] -default = ["sleep"] +default = ["sleep", "console_error_panic_hook"] sleep = ["web-sys", "web-sys/Window"] websocket = [ "getrandom", diff --git a/nym-api/src/coconut/dkg/public_key.rs b/nym-api/src/coconut/dkg/public_key.rs index b7a899b6cb..b2b7689923 100644 --- a/nym-api/src/coconut/dkg/public_key.rs +++ b/nym-api/src/coconut/dkg/public_key.rs @@ -20,6 +20,7 @@ impl DkgController { /// - BTE public key (alongside the proof of discrete log) /// - ed25519 public key /// - announce address to be used by clients for obtaining credentials + /// /// Upon successful registration, the node will receive a unique "NodeIndex" /// which is the x-coordinate of the to be derived keys. /// diff --git a/nym-api/src/coconut/storage/manager.rs b/nym-api/src/coconut/storage/manager.rs index 8cea9ef898..c22d295459 100644 --- a/nym-api/src/coconut/storage/manager.rs +++ b/nym-api/src/coconut/storage/manager.rs @@ -4,7 +4,6 @@ use crate::coconut::storage::models::{EpochCredentials, IssuedCredential}; use crate::support::storage::manager::StorageManager; use nym_coconut_dkg_common::types::EpochId; -use thiserror::Error; #[async_trait] pub trait CoconutStorageManagerExt { @@ -23,6 +22,7 @@ pub trait CoconutStorageManagerExt { /// # Arguments /// /// * `epoch_id`: Id of the (coconut) epoch in question. + #[allow(dead_code)] async fn create_epoch_credentials_entry(&self, epoch_id: EpochId) -> Result<(), sqlx::Error>; /// Update the EpochCredentials by incrementing the total number of issued credentials, @@ -361,10 +361,3 @@ impl CoconutStorageManagerExt for StorageManager { Ok(()) } } - -#[derive(Debug, Error)] -#[error("tried to store an invalid nonce. the received value is {got} while current is {current}. expected {current} + 1")] -pub struct UnexpectedNonce { - current: u32, - got: u32, -} diff --git a/nym-api/src/coconut/tests/fixtures.rs b/nym-api/src/coconut/tests/fixtures.rs index 38e964f395..d883d122ba 100644 --- a/nym-api/src/coconut/tests/fixtures.rs +++ b/nym-api/src/coconut/tests/fixtures.rs @@ -33,12 +33,12 @@ pub fn pseudorandom_account(rng: &mut ChaCha20Rng) -> AccountId { AccountId::new("n", &dummy_account_key_hash).unwrap() } -pub fn dealer_fixture(mut rng: &mut ChaCha20Rng, id: NodeIndex) -> DealerDetails { +pub fn dealer_fixture(rng: &mut ChaCha20Rng, id: NodeIndex) -> DealerDetails { // we might possibly need that private key later on - let keypair = DkgKeyPair::new(dkg::params(), &mut rng); + let keypair = DkgKeyPair::new(dkg::params(), rng.clone()); let addr = pseudorandom_account(rng); - let identity_keypair = identity::KeyPair::new(&mut rng); + let identity_keypair = identity::KeyPair::new(rng); let bte_public_key_with_proof = bs58::encode(&keypair.public_key().to_bytes()).into_string(); let port = 8080 + id; diff --git a/nym-api/src/epoch_operations/mod.rs b/nym-api/src/epoch_operations/mod.rs index 7bb3116086..c14fd7f90a 100644 --- a/nym-api/src/epoch_operations/mod.rs +++ b/nym-api/src/epoch_operations/mod.rs @@ -63,15 +63,15 @@ impl RewardedSetUpdater { /// 2. it queries the mixnet contract to check the current `EpochState` in order to figure out whether /// a different nym-api has already started epoch transition (not yet applicable) /// 3. it sends a `BeginEpochTransition` message to the mixnet contract causing the following to happen: - /// - if successful, the address of the this validator is going to be saved as being responsible for progressing this epoch. - /// What it means in practice is that once we have multiple instances of nym-api running, - /// only this one will try to perform the rest of the actions. It will also allow it to - /// more easily recover in case of crashes. + /// - if successful, the address of this validator is going to be saved as being responsible for progressing this epoch. + /// What it means in practice is that once we have multiple instances of nym-api running, + /// only this one will try to perform the rest of the actions. It will also allow it to + /// more easily recover in case of crashes. /// - the `EpochState` changes to `Rewarding`, meaning the nym-api will now be allowed to send - /// `RewardMixnode` transactions. However, it's not going to be able anything else like `ReconcileEpochEvents` - /// until that is done. + /// `RewardMixnode` transactions. However, it's not going to be able anything else like `ReconcileEpochEvents` + /// until that is done. /// - ability to send transactions (by other users) that get resolved once given epoch/interval rolls over, - /// such as `BondMixnode` or `DelegateToMixnode` will temporarily be frozen until the entire procedure is finished. + /// such as `BondMixnode` or `DelegateToMixnode` will temporarily be frozen until the entire procedure is finished. /// 4. it obtains the current rewarded set and for each node in there (**SORTED BY MIX_ID!!**), /// it sends (in a single batch) `RewardMixnode` message with the measured performance. /// Once the final message gets executed, the mixnet contract automatically transitions diff --git a/nym-wallet/src-tauri/src/state.rs b/nym-wallet/src-tauri/src/state.rs index 5fd4485e18..714f542498 100644 --- a/nym-wallet/src-tauri/src/state.rs +++ b/nym-wallet/src-tauri/src/state.rs @@ -272,6 +272,7 @@ impl WalletStateInner { /// 1. from the configuration file /// 2. provided remotely /// 3. hardcoded fallback + /// /// The format is the config backend format, which is flat due to serialization preference. pub fn get_config_validator_entries( &self, diff --git a/nym-wallet/src-tauri/src/wallet_storage/mod.rs b/nym-wallet/src-tauri/src/wallet_storage/mod.rs index 01b2461982..14d295a8a4 100644 --- a/nym-wallet/src-tauri/src/wallet_storage/mod.rs +++ b/nym-wallet/src-tauri/src/wallet_storage/mod.rs @@ -7,8 +7,8 @@ /// /// Wallet /// - Login -/// -- Account -/// --- Mnemonic +/// -- Account +/// --- Mnemonic pub(crate) use crate::wallet_storage::account_data::StoredLogin; pub(crate) use crate::wallet_storage::password::{AccountId, LoginId, UserPassword}; diff --git a/sdk/rust/nym-sdk/src/mixnet/client.rs b/sdk/rust/nym-sdk/src/mixnet/client.rs index 52bfa59883..f22c20e072 100644 --- a/sdk/rust/nym-sdk/src/mixnet/client.rs +++ b/sdk/rust/nym-sdk/src/mixnet/client.rs @@ -610,8 +610,7 @@ where /// /// - If the client is already registered with a gateway, use that gateway. /// - If no gateway is registered, but there is an existing configuration and key, use that. - /// - If no gateway is registered, and there is no pre-existing configuration or key, try to - /// register a new gateway. + /// - If no gateway is registered, and there is no pre-existing configuration or key, try to register a new gateway. /// /// # Example /// @@ -691,8 +690,7 @@ where /// /// - If the client is already registered with a gateway, use that gateway. /// - If no gateway is registered, but there is an existing configuration and key, use that. - /// - If no gateway is registered, and there is no pre-existing configuration or key, try to - /// register a new gateway. + /// - If no gateway is registered, and there is no pre-existing configuration or key, try to register a new gateway. /// /// # Example ///