all binaries compiling
This commit is contained in:
@@ -19,8 +19,7 @@ use nym_sphinx::anonymous_replies::requests::AnonymousSenderTag;
|
||||
use nym_sphinx::params::PacketType;
|
||||
use nym_task::connections::TransmissionLane;
|
||||
use nym_task::TaskManager;
|
||||
use nym_validator_client::nyxd::QueryNyxdClient;
|
||||
use nym_validator_client::Client;
|
||||
use nym_validator_client::QueryHttpRpcNyxdClient;
|
||||
use std::error::Error;
|
||||
use tokio::sync::watch::error::SendError;
|
||||
|
||||
@@ -29,7 +28,7 @@ pub use nym_sphinx::receiver::ReconstructedMessage;
|
||||
|
||||
pub mod config;
|
||||
|
||||
type NativeClientBuilder<'a> = BaseClientBuilder<'a, Client<QueryNyxdClient>, OnDiskPersistent>;
|
||||
type NativeClientBuilder<'a> = BaseClientBuilder<'a, QueryHttpRpcNyxdClient, OnDiskPersistent>;
|
||||
|
||||
pub struct SocketClient {
|
||||
/// Client configuration options, including, among other things, packet sending rates,
|
||||
|
||||
@@ -109,20 +109,15 @@ pub fn create_bandwidth_controller<St: CredentialStorage>(
|
||||
.get_validator_endpoints()
|
||||
.pop()
|
||||
.expect("No nyxd validator endpoint provided");
|
||||
let api_url = config
|
||||
.get_nym_api_endpoints()
|
||||
.pop()
|
||||
.expect("No validator api endpoint provided");
|
||||
|
||||
create_bandwidth_controller_with_urls(nyxd_url, api_url, storage)
|
||||
create_bandwidth_controller_with_urls(nyxd_url, storage)
|
||||
}
|
||||
|
||||
pub fn create_bandwidth_controller_with_urls<St: CredentialStorage>(
|
||||
nyxd_url: Url,
|
||||
nym_api_url: Url,
|
||||
storage: St,
|
||||
) -> BandwidthController<QueryHttpRpcNyxdClient, St> {
|
||||
let client = default_query_dkg_client(nyxd_url, nym_api_url);
|
||||
let client = default_query_dkg_client(nyxd_url);
|
||||
|
||||
BandwidthController::new(storage, client)
|
||||
}
|
||||
@@ -132,12 +127,8 @@ pub fn default_query_dkg_client_from_config(config: &Config) -> QueryHttpRpcNyxd
|
||||
.get_validator_endpoints()
|
||||
.pop()
|
||||
.expect("No nyxd validator endpoint provided");
|
||||
let api_url = config
|
||||
.get_nym_api_endpoints()
|
||||
.pop()
|
||||
.expect("No validator api endpoint provided");
|
||||
|
||||
default_query_dkg_client(nyxd_url, api_url)
|
||||
default_query_dkg_client(nyxd_url)
|
||||
}
|
||||
|
||||
pub fn default_query_dkg_client(nyxd_url: Url) -> QueryHttpRpcNyxdClient {
|
||||
|
||||
@@ -9,6 +9,7 @@ use async_trait::async_trait;
|
||||
use cw3::ProposalResponse;
|
||||
use cw4::MemberResponse;
|
||||
use nym_coconut_bandwidth_contract_common::spend_credential::SpendCredentialResponse;
|
||||
use nym_coconut_dkg_common::msg::QueryMsg as DkgQueryMsg;
|
||||
use nym_coconut_dkg_common::types::InitialReplacementData;
|
||||
use nym_coconut_dkg_common::{
|
||||
dealer::{ContractDealing, DealerDetails, DealerDetailsResponse},
|
||||
@@ -427,6 +428,16 @@ impl crate::coconut::client::Client for Client {
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl DkgQueryClient for Client {
|
||||
async fn query_dkg_contract<T>(&self, query: DkgQueryMsg) -> std::result::Result<T, NyxdError>
|
||||
where
|
||||
for<'a> T: Deserialize<'a>,
|
||||
{
|
||||
self.0.read().await.query_dkg_contract(query).await
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl SpDirectoryQueryClient for Client {
|
||||
async fn query_service_provider_contract<T>(
|
||||
|
||||
@@ -6,9 +6,8 @@ use nym_bandwidth_controller::acquire::state::State;
|
||||
use nym_credential_storage::storage::Storage;
|
||||
use nym_credentials::coconut::bandwidth::BandwidthVoucher;
|
||||
use nym_network_defaults::NymNetworkDetails;
|
||||
use nym_validator_client::nyxd::{Coin, SigningNyxdClient};
|
||||
use nym_validator_client::signing::direct_wallet::DirectSecp256k1HdWallet;
|
||||
use nym_validator_client::{Client, Config};
|
||||
use nym_validator_client::nyxd::Coin;
|
||||
use nym_validator_client::{nyxd, DirectSigningHttpRpcNyxdClient};
|
||||
|
||||
/// The serialized version of the yet untransformed bandwidth voucher. It can be used to complete
|
||||
/// the acquirement process of a bandwidth credential.
|
||||
@@ -22,7 +21,7 @@ pub type VoucherBlob = Vec<u8>;
|
||||
/// client.
|
||||
pub struct BandwidthAcquireClient<'a, St: Storage> {
|
||||
network_details: NymNetworkDetails,
|
||||
client: Client<SigningNyxdClient<DirectSecp256k1HdWallet>>,
|
||||
client: DirectSigningHttpRpcNyxdClient,
|
||||
storage: &'a St,
|
||||
}
|
||||
|
||||
@@ -36,8 +35,14 @@ where
|
||||
mnemonic: String,
|
||||
storage: &'a St,
|
||||
) -> Result<Self> {
|
||||
let config = Config::try_from_nym_network_details(&network_details)?;
|
||||
let client = nym_validator_client::Client::new_signing(config, mnemonic.parse()?)?;
|
||||
let nyxd_url = network_details.endpoints[0].nyxd_url.as_str();
|
||||
let config = nyxd::Config::try_from_nym_network_details(&network_details)?;
|
||||
|
||||
let client = DirectSigningHttpRpcNyxdClient::connect_with_mnemonic(
|
||||
config,
|
||||
nyxd_url,
|
||||
mnemonic.parse()?,
|
||||
)?;
|
||||
Ok(Self {
|
||||
network_details,
|
||||
client,
|
||||
@@ -51,7 +56,7 @@ where
|
||||
/// associated bandwidth credential, using [`Self::recover`].
|
||||
pub async fn acquire(&self, amount: u128) -> Result<()> {
|
||||
let amount = Coin::new(amount, &self.network_details.chain_details.mix_denom.base);
|
||||
let state = nym_bandwidth_controller::acquire::deposit(&self.client.nyxd, amount).await?;
|
||||
let state = nym_bandwidth_controller::acquire::deposit(&self.client, amount).await?;
|
||||
nym_bandwidth_controller::acquire::get_credential(&state, &self.client, self.storage)
|
||||
.await
|
||||
.map_err(|reason| Error::UnconvertedDeposit {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
use nym_validator_client::nyxd::error::NyxdError;
|
||||
use std::path::PathBuf;
|
||||
|
||||
/// Top-level Error enum for the mixnet client and its relevant types.
|
||||
@@ -46,7 +47,7 @@ pub enum Error {
|
||||
DisabledCredentialsMode,
|
||||
|
||||
#[error("bad validator details: {0}")]
|
||||
BadValidatorDetails(#[from] nym_validator_client::ValidatorClientError),
|
||||
BadValidatorDetails(#[from] NyxdError),
|
||||
|
||||
#[error("socks5 configuration set: {}, but expected to be {}", set, !set)]
|
||||
Socks5Config { set: bool },
|
||||
|
||||
@@ -24,8 +24,7 @@ use nym_network_defaults::NymNetworkDetails;
|
||||
use nym_socks5_client_core::config::Socks5;
|
||||
use nym_task::manager::TaskStatus;
|
||||
use nym_topology::provider_trait::TopologyProvider;
|
||||
use nym_validator_client::nyxd::QueryNyxdClient;
|
||||
use nym_validator_client::Client;
|
||||
use nym_validator_client::{nyxd, QueryHttpRpcNyxdClient};
|
||||
use std::path::Path;
|
||||
use std::path::PathBuf;
|
||||
use url::Url;
|
||||
@@ -214,7 +213,7 @@ where
|
||||
|
||||
/// In the case of enabled credentials, a client instance responsible for querying the state of the
|
||||
/// dkg and coconut contracts
|
||||
dkg_query_client: Option<Client<QueryNyxdClient>>,
|
||||
dkg_query_client: Option<QueryHttpRpcNyxdClient>,
|
||||
|
||||
/// Alternative provider of network topology used for constructing sphinx packets.
|
||||
custom_topology_provider: Option<Box<dyn TopologyProvider + Send + Sync>>,
|
||||
@@ -244,10 +243,12 @@ where
|
||||
) -> Result<DisconnectedMixnetClient<S>> {
|
||||
// don't create dkg client for the bandwidth controller if credentials are disabled
|
||||
let dkg_query_client = if config.enabled_credentials_mode {
|
||||
let client_config = nym_validator_client::Config::try_from_nym_network_details(
|
||||
&config.network_details,
|
||||
let client_config =
|
||||
nyxd::Config::try_from_nym_network_details(&config.network_details)?;
|
||||
let client = QueryHttpRpcNyxdClient::connect(
|
||||
client_config,
|
||||
config.network_details.endpoints[0].nyxd_url.as_str(),
|
||||
)?;
|
||||
let client = nym_validator_client::Client::new_query(client_config)?;
|
||||
Some(client)
|
||||
} else {
|
||||
None
|
||||
|
||||
Reference in New Issue
Block a user