From ebc30ec2483278af4bc7cd19b4e73d58aff2f01c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20H=C3=A4ggblad?= Date: Mon, 20 May 2024 09:38:22 +0200 Subject: [PATCH] Remove everywhere sp contract is used --- Cargo.lock | 16 -- Cargo.toml | 1 - .../client-libs/validator-client/Cargo.toml | 9 -- .../examples/query_name_service.rs | 37 ----- .../query_service_provider_directory.rs | 45 ------ .../validator-client/src/nym_api/mod.rs | 7 - .../src/nyxd/contract_traits/mod.rs | 13 -- .../sp_directory_query_client.rs | 142 ----------------- .../sp_directory_signing_client.rs | 148 ------------------ .../validator-client/src/nyxd/mod.rs | 13 -- common/commands/Cargo.toml | 1 - .../src/validator/mixnet/operators/mod.rs | 6 - .../validator/mixnet/operators/name/delete.rs | 25 --- .../validator/mixnet/operators/name/mod.rs | 22 --- .../mixnet/operators/name/register.rs | 53 ------- .../operators/name/register_sign_payload.rs | 65 -------- .../mixnet/operators/service/announce.rs | 45 ------ .../service/announce_sign_payload.rs | 61 -------- .../mixnet/operators/service/delete.rs | 23 --- .../validator/mixnet/operators/service/mod.rs | 23 --- .../src/validator/mixnet/query/mod.rs | 6 - .../validator/mixnet/query/query_all_names.rs | 53 ------- .../query/query_all_service_providers.rs | 55 ------- nym-api/Cargo.toml | 1 - nym-api/src/nym_contract_cache/cache/data.rs | 4 - nym-api/src/nym_contract_cache/cache/mod.rs | 16 -- .../src/nym_contract_cache/cache/refresher.rs | 33 +--- nym-api/src/nym_contract_cache/mod.rs | 1 - nym-api/src/nym_contract_cache/routes.rs | 8 - nym-api/src/support/nyxd/mod.rs | 16 +- .../src/validator/mixnet/operators/mod.rs | 8 +- .../validator/mixnet/operators/name/mod.rs | 36 ----- .../mixnet/operators/services/mod.rs | 15 -- .../nym-cli/src/validator/mixnet/query/mod.rs | 14 -- 34 files changed, 7 insertions(+), 1014 deletions(-) delete mode 100644 common/client-libs/validator-client/examples/query_name_service.rs delete mode 100644 common/client-libs/validator-client/examples/query_service_provider_directory.rs delete mode 100644 common/client-libs/validator-client/src/nyxd/contract_traits/sp_directory_query_client.rs delete mode 100644 common/client-libs/validator-client/src/nyxd/contract_traits/sp_directory_signing_client.rs delete mode 100644 common/commands/src/validator/mixnet/operators/name/delete.rs delete mode 100644 common/commands/src/validator/mixnet/operators/name/mod.rs delete mode 100644 common/commands/src/validator/mixnet/operators/name/register.rs delete mode 100644 common/commands/src/validator/mixnet/operators/name/register_sign_payload.rs delete mode 100644 common/commands/src/validator/mixnet/operators/service/announce.rs delete mode 100644 common/commands/src/validator/mixnet/operators/service/announce_sign_payload.rs delete mode 100644 common/commands/src/validator/mixnet/operators/service/delete.rs delete mode 100644 common/commands/src/validator/mixnet/operators/service/mod.rs delete mode 100644 common/commands/src/validator/mixnet/query/query_all_names.rs delete mode 100644 common/commands/src/validator/mixnet/query/query_all_service_providers.rs delete mode 100644 tools/nym-cli/src/validator/mixnet/operators/name/mod.rs delete mode 100644 tools/nym-cli/src/validator/mixnet/operators/services/mod.rs diff --git a/Cargo.lock b/Cargo.lock index 74bd1cfb50..47c59ea358 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3956,7 +3956,6 @@ dependencies = [ "nym-node-requests", "nym-node-tester-utils", "nym-pemstore", - "nym-service-provider-directory-common", "nym-sphinx", "nym-task", "nym-topology", @@ -4138,7 +4137,6 @@ dependencies = [ "nym-multisig-contract-common", "nym-network-defaults", "nym-pemstore", - "nym-service-provider-directory-common", "nym-sphinx", "nym-types", "nym-validator-client", @@ -5283,19 +5281,6 @@ dependencies = [ "url", ] -[[package]] -name = "nym-service-provider-directory-common" -version = "0.1.0" -dependencies = [ - "cosmwasm-schema", - "cosmwasm-std", - "cw-controllers", - "cw-utils", - "cw2", - "nym-contracts-common", - "thiserror", -] - [[package]] name = "nym-service-providers-common" version = "0.1.0" @@ -5720,7 +5705,6 @@ dependencies = [ "nym-mixnet-contract-common", "nym-multisig-contract-common", "nym-network-defaults", - "nym-service-provider-directory-common", "nym-vesting-contract-common", "prost 0.12.4", "reqwest 0.12.4", diff --git a/Cargo.toml b/Cargo.toml index 152cd08aed..598aa7f4ee 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,7 +39,6 @@ members = [ "common/cosmwasm-smart-contracts/group-contract", "common/cosmwasm-smart-contracts/mixnet-contract", "common/cosmwasm-smart-contracts/multisig-contract", - "common/cosmwasm-smart-contracts/service-provider-directory", "common/cosmwasm-smart-contracts/vesting-contract", "common/country-group", "common/credential-storage", diff --git a/common/client-libs/validator-client/Cargo.toml b/common/client-libs/validator-client/Cargo.toml index 816fff4303..7579fecfba 100644 --- a/common/client-libs/validator-client/Cargo.toml +++ b/common/client-libs/validator-client/Cargo.toml @@ -20,7 +20,6 @@ nym-vesting-contract-common = { path = "../../cosmwasm-smart-contracts/vesting-c nym-coconut-bandwidth-contract-common = { path = "../../cosmwasm-smart-contracts/coconut-bandwidth-contract" } nym-multisig-contract-common = { path = "../../cosmwasm-smart-contracts/multisig-contract" } nym-group-contract-common = { path = "../../cosmwasm-smart-contracts/group-contract" } -nym-service-provider-directory-common = { path = "../../cosmwasm-smart-contracts/service-provider-directory" } serde = { workspace = true, features = ["derive"] } serde_json = { workspace = true } nym-http-api-client = { path = "../../../common/http-api-client"} @@ -85,14 +84,6 @@ name = "offline_signing" # (traits would need to be moved around and refactored themselves) required-features = ["http-client"] -[[example]] -name = "query_service_provider_directory" -required-features = ["http-client"] - -[[example]] -name = "query_name_service" -required-features = ["http-client"] - [features] default = ["http-client"] http-client = ["cosmrs/rpc"] diff --git a/common/client-libs/validator-client/examples/query_name_service.rs b/common/client-libs/validator-client/examples/query_name_service.rs deleted file mode 100644 index bf5001c86e..0000000000 --- a/common/client-libs/validator-client/examples/query_name_service.rs +++ /dev/null @@ -1,37 +0,0 @@ -use std::str::FromStr; - -use cosmrs::AccountId; -use nym_name_service_common::Address; -use nym_network_defaults::{setup_env, NymNetworkDetails}; -use nym_validator_client::nyxd::contract_traits::{ - NameServiceQueryClient, PagedNameServiceQueryClient, -}; - -#[tokio::main] -async fn main() { - setup_env(Some("../../../envs/qa.env")); - let network_details = NymNetworkDetails::new_from_env(); - let config = - nym_validator_client::Config::try_from_nym_network_details(&network_details).unwrap(); - let client = nym_validator_client::Client::new_query(config).unwrap(); - - let config = client.nyxd.get_name_service_config().await.unwrap(); - println!("config: {config:?}"); - - let names_paged = client.nyxd.get_names_paged(None, None).await.unwrap(); - println!("names (paged): {names_paged:#?}"); - - let names = client.nyxd.get_all_names().await.unwrap(); - println!("names: {names:#?}"); - - let owner = AccountId::from_str("n1hmf957kc7arcd39rl7xq8l0a4zyg7kxnv7su87").unwrap(); - let names_by_owner = client.nyxd.get_names_by_owner(owner).await.unwrap(); - println!("names (by owner): {names_by_owner:#?}"); - - let nym_address = Address::new("client_id.client_key@gateway_id").unwrap(); - let names_by_address = client.nyxd.get_names_by_address(nym_address).await.unwrap(); - println!("names (by address): {names_by_address:#?}"); - - let service_info = client.nyxd.get_name_entry(1).await; - println!("service info: {service_info:#?}"); -} diff --git a/common/client-libs/validator-client/examples/query_service_provider_directory.rs b/common/client-libs/validator-client/examples/query_service_provider_directory.rs deleted file mode 100644 index c0cd2b1399..0000000000 --- a/common/client-libs/validator-client/examples/query_service_provider_directory.rs +++ /dev/null @@ -1,45 +0,0 @@ -use std::str::FromStr; - -use cosmrs::AccountId; -use nym_network_defaults::{setup_env, NymNetworkDetails}; -use nym_service_provider_directory_common::NymAddress; -use nym_validator_client::nyxd::contract_traits::{ - PagedSpDirectoryQueryClient, SpDirectoryQueryClient, -}; - -#[tokio::main] -async fn main() { - setup_env(Some("../../../envs/qa.env")); - let network_details = NymNetworkDetails::new_from_env(); - let config = - nym_validator_client::Config::try_from_nym_network_details(&network_details).unwrap(); - let client = nym_validator_client::Client::new_query(config).unwrap(); - - let config = client.nyxd.get_service_config().await.unwrap(); - println!("config: {config:?}"); - - let services_paged = client.nyxd.get_services_paged(None, None).await.unwrap(); - println!("services (paged): {services_paged:#?}"); - - let services = client.nyxd.get_all_services().await.unwrap(); - println!("services: {services:#?}"); - - let announcer = AccountId::from_str("n1hmf957kc7arcd39rl7xq8l0a4zyg7kxnv7su87").unwrap(); - let services_by_announcer = client - .nyxd - .get_services_by_announcer(announcer) - .await - .unwrap(); - println!("services (by announcer): {services_by_announcer:#?}"); - - let nym_address = NymAddress::new("foo.bar@gateway"); - let services_by_nym_address = client - .nyxd - .get_services_by_nym_address(nym_address) - .await - .unwrap(); - assert_eq!(services_by_announcer, services_by_nym_address); - - let service_info = client.nyxd.get_service_info(1).await; - println!("service info: {service_info:#?}"); -} diff --git a/common/client-libs/validator-client/src/nym_api/mod.rs b/common/client-libs/validator-client/src/nym_api/mod.rs index b7e9eb3f21..e54d4698ba 100644 --- a/common/client-libs/validator-client/src/nym_api/mod.rs +++ b/common/client-libs/validator-client/src/nym_api/mod.rs @@ -25,7 +25,6 @@ pub use nym_coconut_dkg_common::types::EpochId; use nym_http_api_client::{ApiClient, NO_PARAMS}; use nym_mixnet_contract_common::mixnode::MixNodeDetails; use nym_mixnet_contract_common::{GatewayBond, IdentityKeyRef, MixId}; -use nym_service_provider_directory_common::response::ServicesListResponse; pub mod error; pub mod routes; @@ -491,12 +490,6 @@ pub trait NymApiClientExt: ApiClient { ) .await } - - async fn get_service_providers(&self) -> Result { - log::trace!("Getting service providers"); - self.get_json(&[routes::API_VERSION, routes::SERVICE_PROVIDERS], NO_PARAMS) - .await - } } #[cfg_attr(target_arch = "wasm32", async_trait(?Send))] diff --git a/common/client-libs/validator-client/src/nyxd/contract_traits/mod.rs b/common/client-libs/validator-client/src/nyxd/contract_traits/mod.rs index 4d1df939d3..5e4b785bf5 100644 --- a/common/client-libs/validator-client/src/nyxd/contract_traits/mod.rs +++ b/common/client-libs/validator-client/src/nyxd/contract_traits/mod.rs @@ -14,7 +14,6 @@ pub mod ephemera_query_client; pub mod group_query_client; pub mod mixnet_query_client; pub mod multisig_query_client; -pub mod sp_directory_query_client; pub mod vesting_query_client; // signing clients @@ -24,7 +23,6 @@ pub mod ephemera_signing_client; pub mod group_signing_client; pub mod mixnet_signing_client; pub mod multisig_signing_client; -pub mod sp_directory_signing_client; pub mod vesting_signing_client; // re-export query traits @@ -36,7 +34,6 @@ pub use ephemera_query_client::{EphemeraQueryClient, PagedEphemeraQueryClient}; pub use group_query_client::{GroupQueryClient, PagedGroupQueryClient}; pub use mixnet_query_client::{MixnetQueryClient, PagedMixnetQueryClient}; pub use multisig_query_client::{MultisigQueryClient, PagedMultisigQueryClient}; -pub use sp_directory_query_client::{PagedSpDirectoryQueryClient, SpDirectoryQueryClient}; pub use vesting_query_client::{PagedVestingQueryClient, VestingQueryClient}; // re-export signing traits @@ -46,7 +43,6 @@ pub use ephemera_signing_client::EphemeraSigningClient; pub use group_signing_client::GroupSigningClient; pub use mixnet_signing_client::MixnetSigningClient; pub use multisig_signing_client::MultisigSigningClient; -pub use sp_directory_signing_client::SpDirectorySigningClient; pub use vesting_signing_client::VestingSigningClient; // helper for providing blanket implementation for query clients @@ -63,9 +59,6 @@ pub trait NymContractsProvider { // ephemera-related fn ephemera_contract_address(&self) -> Option<&AccountId>; - - // SPs - fn service_provider_contract_address(&self) -> Option<&AccountId>; } #[derive(Debug, Clone)] @@ -79,8 +72,6 @@ pub struct TypedNymContracts { pub coconut_dkg_contract_address: Option, pub ephemera_contract_address: Option, - - pub service_provider_directory_contract_address: Option, } impl TryFrom for TypedNymContracts { @@ -116,10 +107,6 @@ impl TryFrom for TypedNymContracts { .ephemera_contract_address .map(|addr| addr.parse()) .transpose()?, - service_provider_directory_contract_address: value - .service_provider_directory_contract_address - .map(|addr| addr.parse()) - .transpose()?, }) } } diff --git a/common/client-libs/validator-client/src/nyxd/contract_traits/sp_directory_query_client.rs b/common/client-libs/validator-client/src/nyxd/contract_traits/sp_directory_query_client.rs deleted file mode 100644 index 09279c543a..0000000000 --- a/common/client-libs/validator-client/src/nyxd/contract_traits/sp_directory_query_client.rs +++ /dev/null @@ -1,142 +0,0 @@ -use crate::collect_paged; -use async_trait::async_trait; -use cosmrs::AccountId; -use nym_contracts_common::{signing::Nonce, ContractBuildInformation}; -use nym_service_provider_directory_common::{ - msg::QueryMsg as SpQueryMsg, - response::{ - ConfigResponse, PagedServicesListResponse, ServiceInfoResponse, ServicesListResponse, - }, - NymAddress, Service, ServiceId, -}; -use serde::Deserialize; - -use crate::nyxd::contract_traits::NymContractsProvider; -use crate::nyxd::{error::NyxdError, CosmWasmClient}; - -#[cfg_attr(target_arch = "wasm32", async_trait(?Send))] -#[cfg_attr(not(target_arch = "wasm32"), async_trait)] -pub trait SpDirectoryQueryClient { - async fn query_service_provider_contract(&self, query: SpQueryMsg) -> Result - where - for<'a> T: Deserialize<'a>; - - async fn get_service_config(&self) -> Result { - self.query_service_provider_contract(SpQueryMsg::Config {}) - .await - } - - async fn get_service_info( - &self, - service_id: ServiceId, - ) -> Result { - self.query_service_provider_contract(SpQueryMsg::ServiceId { service_id }) - .await - } - - async fn get_services_paged( - &self, - start_after: Option, - limit: Option, - ) -> Result { - self.query_service_provider_contract(SpQueryMsg::All { limit, start_after }) - .await - } - - async fn get_services_by_announcer( - &self, - announcer: AccountId, - ) -> Result { - self.query_service_provider_contract(SpQueryMsg::ByAnnouncer { - announcer: announcer.to_string(), - }) - .await - } - - async fn get_services_by_nym_address( - &self, - nym_address: NymAddress, - ) -> Result { - self.query_service_provider_contract(SpQueryMsg::ByNymAddress { nym_address }) - .await - } - - async fn get_sp_contract_version(&self) -> Result { - self.query_service_provider_contract(SpQueryMsg::GetContractVersion {}) - .await - } - - async fn get_sp_contract_cw2_version(&self) -> Result { - self.query_service_provider_contract(SpQueryMsg::GetCW2ContractVersion {}) - .await - } - - async fn get_service_signing_nonce(&self, address: &AccountId) -> Result { - self.query_service_provider_contract(SpQueryMsg::SigningNonce { - address: address.to_string(), - }) - .await - } -} - -#[cfg_attr(target_arch = "wasm32", async_trait(?Send))] -#[cfg_attr(not(target_arch = "wasm32"), async_trait)] -pub trait PagedSpDirectoryQueryClient: SpDirectoryQueryClient { - async fn get_all_services(&self) -> Result, NyxdError> { - collect_paged!(self, get_services_paged, services) - } -} - -#[async_trait] -impl PagedSpDirectoryQueryClient for T where T: SpDirectoryQueryClient {} - -#[cfg_attr(target_arch = "wasm32", async_trait(?Send))] -#[cfg_attr(not(target_arch = "wasm32"), async_trait)] -impl SpDirectoryQueryClient for C -where - C: CosmWasmClient + NymContractsProvider + Send + Sync, -{ - async fn query_service_provider_contract(&self, query: SpQueryMsg) -> Result - where - for<'a> T: Deserialize<'a>, - { - let sp_directory_contract_address = - &self.service_provider_contract_address().ok_or_else(|| { - NyxdError::unavailable_contract_address("service provider directory contract") - })?; - self.query_contract_smart(sp_directory_contract_address, &query) - .await - } -} - -#[cfg(test)] -mod tests { - use super::*; - use crate::nyxd::contract_traits::tests::IgnoreValue; - - // it's enough that this compiles and clippy is happy about it - #[allow(dead_code)] - fn all_query_variants_are_covered( - client: C, - msg: SpQueryMsg, - ) { - match msg { - SpQueryMsg::ServiceId { service_id } => client.get_service_info(service_id).ignore(), - SpQueryMsg::ByAnnouncer { announcer } => client - .get_services_by_announcer(announcer.parse().unwrap()) - .ignore(), - SpQueryMsg::ByNymAddress { nym_address } => { - client.get_services_by_nym_address(nym_address).ignore() - } - SpQueryMsg::All { limit, start_after } => { - client.get_services_paged(start_after, limit).ignore() - } - SpQueryMsg::SigningNonce { address } => client - .get_service_signing_nonce(&address.parse().unwrap()) - .ignore(), - SpQueryMsg::Config {} => client.get_service_config().ignore(), - SpQueryMsg::GetContractVersion {} => client.get_sp_contract_version().ignore(), - SpQueryMsg::GetCW2ContractVersion {} => client.get_sp_contract_cw2_version().ignore(), - }; - } -} diff --git a/common/client-libs/validator-client/src/nyxd/contract_traits/sp_directory_signing_client.rs b/common/client-libs/validator-client/src/nyxd/contract_traits/sp_directory_signing_client.rs deleted file mode 100644 index c1efde20f5..0000000000 --- a/common/client-libs/validator-client/src/nyxd/contract_traits/sp_directory_signing_client.rs +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright 2023 - Nym Technologies SA -// SPDX-License-Identifier: Apache-2.0 - -use crate::nyxd::contract_traits::NymContractsProvider; -use crate::nyxd::{ - coin::Coin, cosmwasm_client::types::ExecuteResult, error::NyxdError, Fee, SigningCosmWasmClient, -}; -use crate::signing::signer::OfflineSigner; -use async_trait::async_trait; -use nym_contracts_common::signing::MessageSignature; -use nym_service_provider_directory_common::{ - msg::ExecuteMsg as SpExecuteMsg, NymAddress, ServiceDetails, ServiceId, -}; - -#[cfg_attr(target_arch = "wasm32", async_trait(?Send))] -#[cfg_attr(not(target_arch = "wasm32"), async_trait)] -pub trait SpDirectorySigningClient { - async fn execute_service_provider_directory_contract( - &self, - fee: Option, - msg: SpExecuteMsg, - funds: Vec, - ) -> Result; - - async fn announce_service_provider( - &self, - service: ServiceDetails, - owner_signature: MessageSignature, - deposit: Coin, - fee: Option, - ) -> Result { - self.execute_service_provider_directory_contract( - fee, - SpExecuteMsg::Announce { - service, - owner_signature, - }, - vec![deposit], - ) - .await - } - - async fn delete_service_provider_by_id( - &self, - service_id: ServiceId, - fee: Option, - ) -> Result { - self.execute_service_provider_directory_contract( - fee, - SpExecuteMsg::DeleteId { service_id }, - vec![], - ) - .await - } - - async fn delete_service_provider_by_nym_address( - &self, - nym_address: NymAddress, - fee: Option, - ) -> Result { - self.execute_service_provider_directory_contract( - fee, - SpExecuteMsg::DeleteNymAddress { nym_address }, - vec![], - ) - .await - } - - async fn update_deposit_required( - &self, - deposit_required: Coin, - fee: Option, - ) -> Result { - self.execute_service_provider_directory_contract( - fee, - SpExecuteMsg::UpdateDepositRequired { - deposit_required: deposit_required.into(), - }, - vec![], - ) - .await - } -} - -#[cfg_attr(target_arch = "wasm32", async_trait(?Send))] -#[cfg_attr(not(target_arch = "wasm32"), async_trait)] -impl SpDirectorySigningClient for C -where - C: SigningCosmWasmClient + NymContractsProvider + Sync, - NyxdError: From<::Error>, -{ - async fn execute_service_provider_directory_contract( - &self, - fee: Option, - msg: SpExecuteMsg, - funds: Vec, - ) -> Result { - let sp_directory_contract_address = - &self.service_provider_contract_address().ok_or_else(|| { - NyxdError::unavailable_contract_address("service provider directory contract") - })?; - - let fee = fee.unwrap_or(Fee::Auto(Some(self.simulated_gas_multiplier()))); - let memo = msg.default_memo(); - - let signer_address = &self.signer_addresses()?[0]; - self.execute( - signer_address, - sp_directory_contract_address, - &msg, - fee, - memo, - funds, - ) - .await - } -} - -#[cfg(test)] -mod tests { - use super::*; - use crate::nyxd::contract_traits::tests::{mock_coin, IgnoreValue}; - - // it's enough that this compiles and clippy is happy about it - #[allow(dead_code)] - fn all_execute_variants_are_covered( - client: C, - msg: SpExecuteMsg, - ) { - match msg { - SpExecuteMsg::Announce { - service, - owner_signature, - } => client - .announce_service_provider(service, owner_signature, mock_coin(), None) - .ignore(), - SpExecuteMsg::DeleteId { service_id } => client - .delete_service_provider_by_id(service_id, None) - .ignore(), - SpExecuteMsg::DeleteNymAddress { nym_address } => client - .delete_service_provider_by_nym_address(nym_address, None) - .ignore(), - SpExecuteMsg::UpdateDepositRequired { deposit_required } => client - .update_deposit_required(deposit_required.into(), None) - .ignore(), - }; - } -} diff --git a/common/client-libs/validator-client/src/nyxd/mod.rs b/common/client-libs/validator-client/src/nyxd/mod.rs index 899ab9f8fb..0f337de5a1 100644 --- a/common/client-libs/validator-client/src/nyxd/mod.rs +++ b/common/client-libs/validator-client/src/nyxd/mod.rs @@ -246,12 +246,6 @@ impl NyxdClient { self.config.contracts.multisig_contract_address = Some(address); } - pub fn set_service_provider_contract_address(&mut self, address: AccountId) { - self.config - .contracts - .service_provider_directory_contract_address = Some(address); - } - pub fn set_simulated_gas_multiplier(&mut self, multiplier: f32) { self.config.simulated_gas_multiplier = multiplier; } @@ -288,13 +282,6 @@ impl NymContractsProvider for NyxdClient { fn ephemera_contract_address(&self) -> Option<&AccountId> { self.config.contracts.ephemera_contract_address.as_ref() } - - fn service_provider_contract_address(&self) -> Option<&AccountId> { - self.config - .contracts - .service_provider_directory_contract_address - .as_ref() - } } // queries diff --git a/common/commands/Cargo.toml b/common/commands/Cargo.toml index 394031e33b..4de5342848 100644 --- a/common/commands/Cargo.toml +++ b/common/commands/Cargo.toml @@ -46,7 +46,6 @@ nym-vesting-contract-common = { path = "../cosmwasm-smart-contracts/vesting-cont nym-coconut-bandwidth-contract-common = { path = "../cosmwasm-smart-contracts/coconut-bandwidth-contract" } nym-coconut-dkg-common = { path = "../cosmwasm-smart-contracts/coconut-dkg" } nym-multisig-contract-common = { path = "../cosmwasm-smart-contracts/multisig-contract" } -nym-service-provider-directory-common = { path = "../cosmwasm-smart-contracts/service-provider-directory" } nym-sphinx = { path = "../../common/nymsphinx" } nym-client-core = { path = "../../common/client-core" } nym-config = { path = "../../common/config" } diff --git a/common/commands/src/validator/mixnet/operators/mod.rs b/common/commands/src/validator/mixnet/operators/mod.rs index ce732be9e4..cde9dc3754 100644 --- a/common/commands/src/validator/mixnet/operators/mod.rs +++ b/common/commands/src/validator/mixnet/operators/mod.rs @@ -6,8 +6,6 @@ use clap::{Args, Subcommand}; pub mod gateway; pub mod identity_key; pub mod mixnode; -pub mod name; -pub mod service; #[derive(Debug, Args)] #[clap(args_conflicts_with_subcommands = true, subcommand_required = true)] @@ -23,10 +21,6 @@ pub enum MixnetOperatorsCommands { Mixnode(mixnode::MixnetOperatorsMixnode), /// Manage your gateway Gateway(gateway::MixnetOperatorsGateway), - /// Manage your service - ServiceProvider(service::MixnetOperatorsService), - /// Manage your registered name - Name(name::MixnetOperatorsName), /// Sign messages using your private identity key IdentityKey(identity_key::MixnetOperatorsIdentityKey), } diff --git a/common/commands/src/validator/mixnet/operators/name/delete.rs b/common/commands/src/validator/mixnet/operators/name/delete.rs deleted file mode 100644 index d93b432108..0000000000 --- a/common/commands/src/validator/mixnet/operators/name/delete.rs +++ /dev/null @@ -1,25 +0,0 @@ -use clap::Parser; -use log::{error, info}; -use nym_name_service_common::NameId; -use nym_validator_client::nyxd::{contract_traits::NameServiceSigningClient, error::NyxdError}; -use tap::TapFallible; - -use crate::context::SigningClient; - -#[derive(Debug, Parser)] -pub struct Args { - #[clap(long)] - pub id: NameId, -} - -pub async fn delete(args: Args, client: SigningClient) -> Result<(), NyxdError> { - info!("Deleting registered name alias with id {}", args.id); - - let res = client - .delete_name_by_id(args.id, None) - .await - .tap_err(|err| error!("Failed to delete name: {err:#?}"))?; - - info!("Deleted: {res:?}"); - Ok(()) -} diff --git a/common/commands/src/validator/mixnet/operators/name/mod.rs b/common/commands/src/validator/mixnet/operators/name/mod.rs deleted file mode 100644 index c4adb3301d..0000000000 --- a/common/commands/src/validator/mixnet/operators/name/mod.rs +++ /dev/null @@ -1,22 +0,0 @@ -use clap::{Args, Subcommand}; - -pub mod delete; -pub mod register; -pub mod register_sign_payload; - -#[derive(Debug, Args)] -#[clap(args_conflicts_with_subcommands = true, subcommand_required = true)] -pub struct MixnetOperatorsName { - #[clap(subcommand)] - pub command: MixnetOperatorsNameCommands, -} - -#[derive(Debug, Subcommand)] -pub enum MixnetOperatorsNameCommands { - /// Register a name alias for a nym address - Register(register::Args), - /// Delete name alias for a nym address - Delete(delete::Args), - /// Create base58-encoded payload required for producing valiid register signature. - CreateNameRegisterPayload(register_sign_payload::Args), -} diff --git a/common/commands/src/validator/mixnet/operators/name/register.rs b/common/commands/src/validator/mixnet/operators/name/register.rs deleted file mode 100644 index 54a4b1a20d..0000000000 --- a/common/commands/src/validator/mixnet/operators/name/register.rs +++ /dev/null @@ -1,53 +0,0 @@ -use clap::Parser; -use log::{error, info}; -use nym_contracts_common::signing::MessageSignature; -use nym_name_service_common::{Address, Coin, NameDetails, NymName}; -use nym_sphinx::addressing::clients::Recipient; -use nym_validator_client::nyxd::{contract_traits::NameServiceSigningClient, error::NyxdError}; -use tap::TapFallible; - -use crate::context::SigningClient; - -#[derive(Debug, Parser)] -pub struct Args { - /// Name alias - #[clap(long)] - pub name: NymName, - - /// Nym address that the alias is pointing to - #[clap(long)] - pub nym_address: Recipient, - - #[clap(long)] - pub signature: MessageSignature, - - /// Deposit to be made to the service provider directory, in curent DENOMINATION (e.g. 'unym') - #[clap(long)] - pub deposit: u128, -} - -pub async fn register(args: Args, client: SigningClient) -> Result<(), NyxdError> { - info!( - "Registering name alias '{}' for nym address '{}'", - args.name, args.nym_address - ); - - let address = Address::new(&args.nym_address.to_string()).expect("invalid address"); - let identity_key = address.client_id().to_string(); - let name = NameDetails { - name: args.name, - address, - identity_key, - }; - - let denom = client.current_chain_details().mix_denom.base.as_str(); - let deposit = Coin::new(args.deposit, denom); - - let res = client - .register_name(name, args.signature, deposit.into(), None) - .await - .tap_err(|err| error!("Failed to register name: {err:#?}"))?; - - info!("Registered name: {res:?}"); - Ok(()) -} diff --git a/common/commands/src/validator/mixnet/operators/name/register_sign_payload.rs b/common/commands/src/validator/mixnet/operators/name/register_sign_payload.rs deleted file mode 100644 index e293f23c2e..0000000000 --- a/common/commands/src/validator/mixnet/operators/name/register_sign_payload.rs +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2023 - Nym Technologies SA -// SPDX-License-Identifier: Apache-2.0 - -use crate::{ - context::SigningClient, - utils::{account_id_to_cw_addr, DataWrapper}, -}; - -use clap::Parser; -use cosmwasm_std::Coin; - -use nym_bin_common::output_format::OutputFormat; -use nym_name_service_common::{ - signing_types::construct_name_register_sign_payload, Address, NymName, -}; -use nym_sphinx::addressing::clients::Recipient; -use nym_validator_client::nyxd::{contract_traits::NameServiceQueryClient, error::NyxdError}; - -#[derive(Debug, Parser)] -pub struct Args { - // The name to register. - #[arg(long)] - pub name: NymName, - - /// The nym address the name should point to. - #[arg(long)] - pub nym_address: Recipient, - - #[arg(long)] - pub amount: u128, - - #[arg(short, long, default_value_t = OutputFormat::default())] - output: OutputFormat, -} - -pub async fn create_payload(args: Args, client: SigningClient) -> Result<(), NyxdError> { - let address = Address::new(&args.nym_address.to_string()).expect("invalid address"); - let identity_key = address.client_id().to_string(); - let name = nym_name_service_common::NameDetails { - name: args.name, - address, - identity_key, - }; - - let denom = client.current_chain_details().mix_denom.base.as_str(); - let deposit = Coin::new(args.amount, denom); - - let nonce = match client.get_name_signing_nonce(&client.address()).await { - Ok(nonce) => nonce, - Err(err) => { - eprint!( - "failed to query for the signing nonce of {}: {err}", - client.address() - ); - return Err(err); - } - }; - - let address = account_id_to_cw_addr(&client.address()); - let payload = construct_name_register_sign_payload(nonce, address, deposit, name); - let wrapper = DataWrapper::new(payload.to_base58_string().unwrap()); - println!("{}", args.output.format(&wrapper)); - - Ok(()) -} diff --git a/common/commands/src/validator/mixnet/operators/service/announce.rs b/common/commands/src/validator/mixnet/operators/service/announce.rs deleted file mode 100644 index b61652254e..0000000000 --- a/common/commands/src/validator/mixnet/operators/service/announce.rs +++ /dev/null @@ -1,45 +0,0 @@ -use clap::Parser; -use log::info; -use nym_contracts_common::signing::MessageSignature; -use nym_service_provider_directory_common::{Coin, NymAddress, ServiceDetails, ServiceType}; -use nym_validator_client::nyxd::contract_traits::SpDirectorySigningClient; - -use crate::context::SigningClient; - -#[derive(Debug, Parser)] -pub struct Args { - #[clap(long)] - pub nym_address: String, - - #[clap(long)] - pub signature: MessageSignature, - - /// Deposit to be made to the service provider directory, in curent DENOMINATION (e.g. 'unym') - #[clap(long)] - pub deposit: u128, - - #[clap(long)] - pub identity_key: String, -} - -pub async fn announce(args: Args, client: SigningClient) { - info!("Annoucing service provider"); - - let nym_address = NymAddress::Address(args.nym_address); - let service_type = ServiceType::NetworkRequester; - let service = ServiceDetails { - nym_address, - service_type, - identity_key: args.identity_key, - }; - - let denom = client.current_chain_details().mix_denom.base.as_str(); - let deposit = Coin::new(args.deposit, denom); - - let res = client - .announce_service_provider(service, args.signature, deposit.into(), None) - .await - .expect("Failed to announce service provider"); - - info!("Announced service provider: {res:?}"); -} diff --git a/common/commands/src/validator/mixnet/operators/service/announce_sign_payload.rs b/common/commands/src/validator/mixnet/operators/service/announce_sign_payload.rs deleted file mode 100644 index f3dc4e5e66..0000000000 --- a/common/commands/src/validator/mixnet/operators/service/announce_sign_payload.rs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2023 - Nym Technologies SA -// SPDX-License-Identifier: Apache-2.0 - -use crate::{ - context::SigningClient, - utils::{account_id_to_cw_addr, DataWrapper}, -}; - -use clap::Parser; -use cosmwasm_std::Coin; - -use nym_bin_common::output_format::OutputFormat; -use nym_service_provider_directory_common::{ - signing_types::construct_service_provider_announce_sign_payload, NymAddress, - ServiceType::NetworkRequester, -}; -use nym_sphinx::addressing::clients::Recipient; -use nym_validator_client::nyxd::contract_traits::SpDirectoryQueryClient; - -#[derive(Debug, Parser)] -pub struct Args { - #[clap(long)] - pub nym_address: Recipient, - - #[clap(long)] - pub amount: u128, - - #[clap(long)] - pub identity_key: String, - - #[clap(short, long, default_value_t = OutputFormat::default())] - output: OutputFormat, -} - -pub async fn create_payload(args: Args, client: SigningClient) { - let service = nym_service_provider_directory_common::ServiceDetails { - nym_address: NymAddress::new(&args.nym_address.to_string()), - service_type: NetworkRequester, - identity_key: args.identity_key, - }; - - let denom = client.current_chain_details().mix_denom.base.as_str(); - let deposit = Coin::new(args.amount, denom); - - let nonce = match client.get_service_signing_nonce(&client.address()).await { - Ok(nonce) => nonce, - Err(err) => { - eprint!( - "failed to query for the signing nonce of {}: {err}", - client.address() - ); - return; - } - }; - - let address = account_id_to_cw_addr(&client.address()); - let payload = - construct_service_provider_announce_sign_payload(nonce, address, deposit, service); - let wrapper = DataWrapper::new(payload.to_base58_string().unwrap()); - println!("{}", args.output.format(&wrapper)) -} diff --git a/common/commands/src/validator/mixnet/operators/service/delete.rs b/common/commands/src/validator/mixnet/operators/service/delete.rs deleted file mode 100644 index 3d0ca4a676..0000000000 --- a/common/commands/src/validator/mixnet/operators/service/delete.rs +++ /dev/null @@ -1,23 +0,0 @@ -use clap::Parser; -use log::info; -use nym_service_provider_directory_common::ServiceId; -use nym_validator_client::nyxd::contract_traits::SpDirectorySigningClient; - -use crate::context::SigningClient; - -#[derive(Debug, Parser)] -pub struct Args { - #[clap(long)] - pub id: ServiceId, -} - -pub async fn delete(args: Args, client: SigningClient) { - info!("Deleting service provider with id {}", args.id); - - let res = client - .delete_service_provider_by_id(args.id, None) - .await - .expect("Failed to delete service provider"); - - info!("Deleted: {res:?}"); -} diff --git a/common/commands/src/validator/mixnet/operators/service/mod.rs b/common/commands/src/validator/mixnet/operators/service/mod.rs deleted file mode 100644 index 1367c51bf6..0000000000 --- a/common/commands/src/validator/mixnet/operators/service/mod.rs +++ /dev/null @@ -1,23 +0,0 @@ -use clap::{Args, Subcommand}; - -pub mod announce; -pub mod announce_sign_payload; -pub mod delete; - -#[derive(Debug, Args)] -#[clap(args_conflicts_with_subcommands = true, subcommand_required = true)] -pub struct MixnetOperatorsService { - #[clap(subcommand)] - pub command: MixnetOperatorsServiceCommands, -} - -#[allow(clippy::large_enum_variant)] -#[derive(Debug, Subcommand)] -pub enum MixnetOperatorsServiceCommands { - /// Announce service provider to the world - Announce(announce::Args), - /// Delete entry for service provider from the directory - Delete(delete::Args), - /// Create base58-encoded payload required for producing valid announce signature. - CreateServiceAnnounceSignPayload(announce_sign_payload::Args), -} diff --git a/common/commands/src/validator/mixnet/query/mod.rs b/common/commands/src/validator/mixnet/query/mod.rs index 2a6c04c312..6d86e6c7b9 100644 --- a/common/commands/src/validator/mixnet/query/mod.rs +++ b/common/commands/src/validator/mixnet/query/mod.rs @@ -5,8 +5,6 @@ use clap::{Args, Subcommand}; pub mod query_all_gateways; pub mod query_all_mixnodes; -pub mod query_all_names; -pub mod query_all_service_providers; #[derive(Debug, Args)] #[clap(args_conflicts_with_subcommands = true, subcommand_required = true)] @@ -21,8 +19,4 @@ pub enum MixnetQueryCommands { Mixnodes(query_all_mixnodes::Args), /// Query gateways Gateways(query_all_gateways::Args), - /// Query announced service-providers - ServiceProviders(query_all_service_providers::Args), - /// Query registed names - Names(query_all_names::Args), } diff --git a/common/commands/src/validator/mixnet/query/query_all_names.rs b/common/commands/src/validator/mixnet/query/query_all_names.rs deleted file mode 100644 index fa75752c6c..0000000000 --- a/common/commands/src/validator/mixnet/query/query_all_names.rs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2023 - Nym Technologies SA -// SPDX-License-Identifier: Apache-2.0 - -use crate::context::QueryClientWithNyxd; -use crate::utils::show_error; -use clap::Parser; -use comfy_table::Table; -use nym_validator_client::client::NymApiClientExt; -use nym_validator_client::nym_api::error::NymAPIError; - -#[derive(Debug, Parser)] -pub struct Args { - #[clap(value_parser)] - #[clap(help = "Optionally, the registered name to display")] - pub name: Option, -} - -pub async fn query(args: Args, client: &QueryClientWithNyxd) { - log::trace!("Querying all registered names"); - - match client.nym_api.get_registered_names().await { - Ok(res) => { - if let Some(name) = args.name { - let name = res.names.iter().find(|name_entry| { - name_entry.name.name.to_string().eq_ignore_ascii_case(&name) - }); - println!( - "{}", - ::serde_json::to_string_pretty(&name).expect("json formatting error") - ); - } else { - let mut table = Table::new(); - - table.set_header(vec!["Name Id", "Owner", "Nym Address", "Name"]); - for name_entry in res.names { - table.add_row(vec![ - name_entry.id.to_string(), - name_entry.owner.to_string(), - name_entry.name.address.to_string(), - name_entry.name.name.to_string(), - ]); - } - - println!("The registered names in the directory are:"); - println!("{table}"); - } - } - Err(NymAPIError::NotFound) => { - println!("nym-api reports no name endpoint available"); - } - Err(e) => show_error(e), - } -} diff --git a/common/commands/src/validator/mixnet/query/query_all_service_providers.rs b/common/commands/src/validator/mixnet/query/query_all_service_providers.rs deleted file mode 100644 index 74ef07a637..0000000000 --- a/common/commands/src/validator/mixnet/query/query_all_service_providers.rs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2023 - Nym Technologies SA -// SPDX-License-Identifier: Apache-2.0 - -use crate::context::QueryClientWithNyxd; -use crate::utils::show_error; -use clap::Parser; -use comfy_table::Table; -use nym_validator_client::client::NymApiClientExt; -use nym_validator_client::nym_api::error::NymAPIError; - -#[derive(Debug, Parser)] -pub struct Args { - #[clap(value_parser)] - #[clap(help = "Optionally, the service provider to display")] - pub nym_address: Option, -} - -pub async fn query(args: Args, client: &QueryClientWithNyxd) { - match client.nym_api.get_service_providers().await { - Ok(res) => { - if let Some(nym_address) = args.nym_address { - let service = res.services.iter().find(|service| { - service - .service - .nym_address - .to_string() - .eq_ignore_ascii_case(&nym_address) - }); - println!( - "{}", - ::serde_json::to_string_pretty(&service).expect("json formatting error") - ); - } else { - let mut table = Table::new(); - - table.set_header(vec!["Service Id", "Announcer", "Type", "Nym Address"]); - for service in res.services { - table.add_row(vec![ - service.service_id.to_string(), - service.announcer.to_string(), - service.service.service_type.to_string(), - service.service.nym_address.to_string(), - ]); - } - - println!("The service providers in the directory are:"); - println!("{table}"); - } - } - Err(NymAPIError::NotFound) => { - println!("nym-api reports no service provider endpoint available"); - } - Err(e) => show_error(e), - } -} diff --git a/nym-api/Cargo.toml b/nym-api/Cargo.toml index e1ae449728..fb93526d70 100644 --- a/nym-api/Cargo.toml +++ b/nym-api/Cargo.toml @@ -94,7 +94,6 @@ nym-mixnet-contract-common = { path = "../common/cosmwasm-smart-contracts/mixnet nym-vesting-contract-common = { path = "../common/cosmwasm-smart-contracts/vesting-contract" } nym-contracts-common = { path = "../common/cosmwasm-smart-contracts/contracts-common" } nym-multisig-contract-common = { path = "../common/cosmwasm-smart-contracts/multisig-contract" } -nym-service-provider-directory-common = { path = "../common/cosmwasm-smart-contracts/service-provider-directory" } nym-coconut = { path = "../common/nymcoconut", features = ["key-zeroize"] } nym-sphinx = { path = "../common/nymsphinx" } nym-pemstore = { path = "../common/pemstore" } diff --git a/nym-api/src/nym_contract_cache/cache/data.rs b/nym-api/src/nym_contract_cache/cache/data.rs index c24966845e..c04404f2df 100644 --- a/nym-api/src/nym_contract_cache/cache/data.rs +++ b/nym-api/src/nym_contract_cache/cache/data.rs @@ -7,7 +7,6 @@ use nym_mixnet_contract_common::{ families::FamilyHead, GatewayBond, IdentityKey, Interval, MixId, MixNodeDetails, RewardingParams, }; -use nym_service_provider_directory_common::Service; use nym_validator_client::nyxd::AccountId; use std::collections::{HashMap, HashSet}; @@ -26,8 +25,6 @@ pub(crate) struct ValidatorCacheData { pub(crate) mix_to_family: Cache>, - pub(crate) service_providers: Cache>, - pub(crate) contracts_info: Cache, } @@ -43,7 +40,6 @@ impl ValidatorCacheData { current_interval: Cache::default(), current_reward_params: Cache::default(), mix_to_family: Cache::default(), - service_providers: Cache::default(), contracts_info: Cache::default(), } } diff --git a/nym-api/src/nym_contract_cache/cache/mod.rs b/nym-api/src/nym_contract_cache/cache/mod.rs index 61a84fbff9..811e44f347 100644 --- a/nym-api/src/nym_contract_cache/cache/mod.rs +++ b/nym-api/src/nym_contract_cache/cache/mod.rs @@ -9,7 +9,6 @@ use nym_mixnet_contract_common::{ families::FamilyHead, GatewayBond, IdentityKey, Interval, MixId, MixNodeBond, MixNodeDetails, RewardingParams, }; -use nym_service_provider_directory_common::Service; use rocket::fairing::AdHoc; use std::{ collections::HashSet, @@ -55,7 +54,6 @@ impl NymContractCache { rewarding_params: RewardingParams, current_interval: Interval, mix_to_family: Vec<(IdentityKey, FamilyHead)>, - services: Option>, nym_contracts_info: CachedContractsInfo, ) { match time::timeout(Duration::from_millis(100), self.inner.write()).await { @@ -71,10 +69,6 @@ impl NymContractCache { .current_interval .unchecked_update(Some(current_interval)); cache.mix_to_family.unchecked_update(mix_to_family); - // Just return empty lists when these are not available - cache - .service_providers - .unchecked_update(services.unwrap_or_default()); cache.contracts_info.unchecked_update(nym_contracts_info) } Err(err) => { @@ -307,16 +301,6 @@ impl NymContractCache { self.mixnode_details(mix_id).await.1 } - pub(crate) async fn services(&self) -> Cache> { - match time::timeout(Duration::from_millis(100), self.inner.read()).await { - Ok(cache) => cache.service_providers.clone_cache(), - Err(err) => { - error!("{err}"); - Cache::new(Vec::new()) - } - } - } - pub fn initialised(&self) -> bool { self.initialised.load(Ordering::Relaxed) } diff --git a/nym-api/src/nym_contract_cache/cache/refresher.rs b/nym-api/src/nym_contract_cache/cache/refresher.rs index c7c73f9eb0..b855e48f83 100644 --- a/nym-api/src/nym_contract_cache/cache/refresher.rs +++ b/nym-api/src/nym_contract_cache/cache/refresher.rs @@ -10,8 +10,7 @@ use futures::future::join_all; use nym_mixnet_contract_common::{MixId, MixNodeDetails, RewardedSetNodeStatus}; use nym_task::TaskClient; use nym_validator_client::nyxd::contract_traits::{ - MixnetQueryClient, NymContractsProvider, PagedSpDirectoryQueryClient, SpDirectoryQueryClient, - VestingQueryClient, + MixnetQueryClient, NymContractsProvider, VestingQueryClient, }; use nym_validator_client::nyxd::CosmWasmClient; use std::{collections::HashMap, sync::atomic::Ordering, time::Duration}; @@ -55,7 +54,6 @@ impl NymContractCacheRefresher { let mixnet = query_guard!(client_guard, mixnet_contract_address()); let vesting = query_guard!(client_guard, vesting_contract_address()); - let service_provider = query_guard!(client_guard, service_provider_contract_address()); let coconut_bandwidth = query_guard!(client_guard, coconut_bandwidth_contract_address()); let coconut_dkg = query_guard!(client_guard, dkg_contract_address()); let group = query_guard!(client_guard, group_contract_address()); @@ -64,7 +62,6 @@ impl NymContractCacheRefresher { // get cw2 versions let mixnet_cw2_future = query_guard!(client_guard, get_mixnet_contract_cw2_version()); let vesting_cw2_future = query_guard!(client_guard, get_vesting_contract_cw2_version()); - let service_provider_cw2_future = query_guard!(client_guard, get_sp_contract_cw2_version()); // group and multisig contract save that information in their storage but don't expose it via queries // so a temporary workaround... @@ -93,38 +90,17 @@ impl NymContractCacheRefresher { None }; - let mut cw2_info = join_all(vec![ - mixnet_cw2_future, - vesting_cw2_future, - service_provider_cw2_future, - ]) - .await; + let mut cw2_info = join_all(vec![mixnet_cw2_future, vesting_cw2_future]).await; // get detailed build info let mixnet_detailed_future = query_guard!(client_guard, get_mixnet_contract_version()); let vesting_detailed_future = query_guard!(client_guard, get_vesting_contract_version()); - let service_provider_detailed_future = - query_guard!(client_guard, get_sp_contract_version()); - let mut build_info = join_all(vec![ - mixnet_detailed_future, - vesting_detailed_future, - service_provider_detailed_future, - ]) - .await; + let mut build_info = join_all(vec![mixnet_detailed_future, vesting_detailed_future]).await; // the below unwraps are fine as we definitely have the specified number of entries // Note to whoever updates this code in the future: `pop` removes **LAST** element, // so make sure you call them in correct order, depending on what's specified in the `join_all` - updated.insert( - "nym-service-provider-directory-contract".to_string(), - CachedContractInfo::new( - service_provider, - cw2_info.pop().unwrap().ok(), - build_info.pop().unwrap().ok(), - ), - ); - updated.insert( "nym-vesting-contract".to_string(), CachedContractInfo::new( @@ -176,8 +152,6 @@ impl NymContractCacheRefresher { let (rewarded_set, active_set) = Self::collect_rewarded_and_active_set_details(&mixnodes, &rewarded_set_map); - // The service providers and names are optional - let services = self.nyxd_client.get_all_services().await.ok(); let contract_info = self.get_nym_contracts_info().await?; info!( @@ -195,7 +169,6 @@ impl NymContractCacheRefresher { rewarding_params, current_interval, mix_to_family, - services, contract_info, ) .await; diff --git a/nym-api/src/nym_contract_cache/mod.rs b/nym-api/src/nym_contract_cache/mod.rs index d04f183809..15d861e51e 100644 --- a/nym-api/src/nym_contract_cache/mod.rs +++ b/nym-api/src/nym_contract_cache/mod.rs @@ -27,7 +27,6 @@ pub(crate) fn nym_contract_cache_routes(settings: &OpenApiSettings) -> (Vec) -> Json> { Json(*cache.current_interval().await) } - -#[openapi(tag = "contract-cache")] -#[get("/services")] -pub async fn get_services(cache: &State) -> Json { - let services = cache.services().await.clone(); - Json(services.as_slice().into()) -} diff --git a/nym-api/src/support/nyxd/mod.rs b/nym-api/src/support/nyxd/mod.rs index 46fe2b6f63..99a6afa21e 100644 --- a/nym-api/src/support/nyxd/mod.rs +++ b/nym-api/src/support/nyxd/mod.rs @@ -30,7 +30,6 @@ use nym_mixnet_contract_common::{ CurrentIntervalResponse, EpochStatus, ExecuteMsg, GatewayBond, IdentityKey, LayerAssignment, MixId, RewardedSetNodeStatus, }; -use nym_service_provider_directory_common::msg::QueryMsg as SpQueryMsg; use nym_validator_client::nyxd::contract_traits::PagedDkgQueryClient; use nym_validator_client::nyxd::error::NyxdError; use nym_validator_client::nyxd::{ @@ -38,7 +37,7 @@ use nym_validator_client::nyxd::{ CoconutBandwidthQueryClient, DkgQueryClient, DkgSigningClient, GroupQueryClient, MixnetQueryClient, MixnetSigningClient, MultisigQueryClient, MultisigSigningClient, NymContractsProvider, PagedMixnetQueryClient, PagedMultisigQueryClient, - PagedVestingQueryClient, SpDirectoryQueryClient, + PagedVestingQueryClient, }, cosmwasm_client::types::ExecuteResult, CosmWasmClient, Fee, @@ -600,16 +599,3 @@ impl DkgQueryClient for Client { nyxd_query!(self, query_dkg_contract(query).await) } } - -#[async_trait] -impl SpDirectoryQueryClient for Client { - async fn query_service_provider_contract( - &self, - query: SpQueryMsg, - ) -> std::result::Result - where - for<'a> T: Deserialize<'a>, - { - nyxd_query!(self, query_service_provider_contract(query).await) - } -} diff --git a/tools/nym-cli/src/validator/mixnet/operators/mod.rs b/tools/nym-cli/src/validator/mixnet/operators/mod.rs index feb336524c..0e14e36a21 100644 --- a/tools/nym-cli/src/validator/mixnet/operators/mod.rs +++ b/tools/nym-cli/src/validator/mixnet/operators/mod.rs @@ -7,8 +7,6 @@ use nym_network_defaults::NymNetworkDetails; pub(crate) mod gateways; pub(crate) mod identity_key; pub(crate) mod mixnodes; -pub(crate) mod name; -pub(crate) mod services; pub(crate) async fn execute( global_args: ClientArgs, @@ -22,8 +20,8 @@ pub(crate) async fn execute( nym_cli_commands::validator::mixnet::operators::MixnetOperatorsCommands::Mixnode( mixnode, ) => mixnodes::execute(global_args, mixnode, network_details).await, - nym_cli_commands::validator::mixnet::operators::MixnetOperatorsCommands::ServiceProvider(service) => services::execute(global_args, service, network_details).await, - nym_cli_commands::validator::mixnet::operators::MixnetOperatorsCommands::Name(name) => name::execute(global_args, name, network_details).await, - nym_cli_commands::validator::mixnet::operators::MixnetOperatorsCommands::IdentityKey(identity_key) => identity_key::execute(global_args, identity_key, network_details).await, + nym_cli_commands::validator::mixnet::operators::MixnetOperatorsCommands::IdentityKey( + identity_key, + ) => identity_key::execute(global_args, identity_key, network_details).await, } } diff --git a/tools/nym-cli/src/validator/mixnet/operators/name/mod.rs b/tools/nym-cli/src/validator/mixnet/operators/name/mod.rs deleted file mode 100644 index 5ab1f3dcba..0000000000 --- a/tools/nym-cli/src/validator/mixnet/operators/name/mod.rs +++ /dev/null @@ -1,36 +0,0 @@ -use nym_cli_commands::context::{create_signing_client, ClientArgs}; -use nym_network_defaults::NymNetworkDetails; - -pub(crate) async fn execute( - global_args: ClientArgs, - name: nym_cli_commands::validator::mixnet::operators::name::MixnetOperatorsName, - network_details: &NymNetworkDetails, -) -> anyhow::Result<()> { - let res = match name.command { - nym_cli_commands::validator::mixnet::operators::name::MixnetOperatorsNameCommands::Register(register) => { - let res = nym_cli_commands::validator::mixnet::operators::name::register::register(register, create_signing_client(global_args, network_details)?).await; - match res { - Ok(_) => println!("Successfully registered the name"), - Err(_) => println!("Failed to register name") - }; - res - }, - nym_cli_commands::validator::mixnet::operators::name::MixnetOperatorsNameCommands::Delete(delete) => { - let res = nym_cli_commands::validator::mixnet::operators::name::delete::delete(delete, create_signing_client(global_args, network_details)?).await; - match res { - Ok(_) => println!("Successfully deleted the name"), - Err(_) => println!("Failed to delete name") - }; - res - }, - nym_cli_commands::validator::mixnet::operators::name::MixnetOperatorsNameCommands::CreateNameRegisterPayload(args) => { - let res = nym_cli_commands::validator::mixnet::operators::name::register_sign_payload::create_payload(args, create_signing_client(global_args, network_details)?).await; - match res { - Ok(_) => (), - Err(_) => println!("Failed to create payload") - }; - res - } - }; - Ok(res?) -} diff --git a/tools/nym-cli/src/validator/mixnet/operators/services/mod.rs b/tools/nym-cli/src/validator/mixnet/operators/services/mod.rs deleted file mode 100644 index 1ee172d7c4..0000000000 --- a/tools/nym-cli/src/validator/mixnet/operators/services/mod.rs +++ /dev/null @@ -1,15 +0,0 @@ -use nym_cli_commands::context::{create_signing_client, ClientArgs}; -use nym_network_defaults::NymNetworkDetails; - -pub(crate) async fn execute( - global_args: ClientArgs, - service: nym_cli_commands::validator::mixnet::operators::service::MixnetOperatorsService, - network_details: &NymNetworkDetails, -) -> anyhow::Result<()> { - match service.command { - nym_cli_commands::validator::mixnet::operators::service::MixnetOperatorsServiceCommands::Announce(announce) => nym_cli_commands::validator::mixnet::operators::service::announce::announce(announce, create_signing_client(global_args, network_details)?).await, - nym_cli_commands::validator::mixnet::operators::service::MixnetOperatorsServiceCommands::Delete(delete) => nym_cli_commands::validator::mixnet::operators::service::delete::delete(delete, create_signing_client(global_args, network_details)?).await, - nym_cli_commands::validator::mixnet::operators::service::MixnetOperatorsServiceCommands::CreateServiceAnnounceSignPayload(args) => nym_cli_commands::validator::mixnet::operators::service::announce_sign_payload::create_payload(args, create_signing_client(global_args, network_details)?).await, - } - Ok(()) -} diff --git a/tools/nym-cli/src/validator/mixnet/query/mod.rs b/tools/nym-cli/src/validator/mixnet/query/mod.rs index 8f0e299720..8726787fc3 100644 --- a/tools/nym-cli/src/validator/mixnet/query/mod.rs +++ b/tools/nym-cli/src/validator/mixnet/query/mod.rs @@ -23,20 +23,6 @@ pub(crate) async fn execute( ) .await } - nym_cli_commands::validator::mixnet::query::MixnetQueryCommands::ServiceProviders(args) => { - nym_cli_commands::validator::mixnet::query::query_all_service_providers::query( - args, - &create_query_client_with_nym_api(network_details)?, - ) - .await - } - nym_cli_commands::validator::mixnet::query::MixnetQueryCommands::Names(args) => { - nym_cli_commands::validator::mixnet::query::query_all_names::query( - args, - &create_query_client_with_nym_api(network_details)?, - ) - .await - } } Ok(()) }