Skip to content

Commit

Permalink
Renamed the type alias NodeId to MixId and fixed some usages (nymtech…
Browse files Browse the repository at this point in the history
…#1682)

* Renamed the type alias NodeId to MixId and fixed some usages

* fix(wallet): bonding context

* fix(wallet): remove ip field (type error)

Co-authored-by: pierre <[email protected]>
jstuczyn and doums authored Oct 17, 2022
1 parent 6a3ac6b commit c3bea66
Showing 84 changed files with 540 additions and 540 deletions.
20 changes: 10 additions & 10 deletions common/client-libs/validator-client/src/client.rs
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@

use crate::{validator_api, ValidatorClientError};
use mixnet_contract_common::mixnode::MixNodeDetails;
use mixnet_contract_common::NodeId;
use mixnet_contract_common::MixId;
use mixnet_contract_common::{GatewayBond, IdentityKeyRef};
use url::Url;
use validator_api_requests::coconut::{
@@ -206,7 +206,7 @@ impl<C> Client<C> {
// basically handles paging for us
pub async fn get_all_nymd_rewarded_set_mixnodes(
&self,
) -> Result<Vec<(NodeId, RewardedSetNodeStatus)>, ValidatorClientError>
) -> Result<Vec<(MixId, RewardedSetNodeStatus)>, ValidatorClientError>
where
C: CosmWasmClient + Sync + Send,
{
@@ -280,7 +280,7 @@ impl<C> Client<C> {

pub async fn get_all_nymd_unbonded_mixnodes(
&self,
) -> Result<Vec<(NodeId, UnbondedMixnode)>, ValidatorClientError>
) -> Result<Vec<(MixId, UnbondedMixnode)>, ValidatorClientError>
where
C: CosmWasmClient + Sync + Send,
{
@@ -306,7 +306,7 @@ impl<C> Client<C> {
pub async fn get_all_nymd_unbonded_mixnodes_by_owner(
&self,
owner: &cosmrs::AccountId,
) -> Result<Vec<(NodeId, UnbondedMixnode)>, ValidatorClientError>
) -> Result<Vec<(MixId, UnbondedMixnode)>, ValidatorClientError>
where
C: CosmWasmClient + Sync + Send,
{
@@ -332,7 +332,7 @@ impl<C> Client<C> {
pub async fn get_all_nymd_unbonded_mixnodes_by_identity(
&self,
identity_key: String,
) -> Result<Vec<(NodeId, UnbondedMixnode)>, ValidatorClientError>
) -> Result<Vec<(MixId, UnbondedMixnode)>, ValidatorClientError>
where
C: CosmWasmClient + Sync + Send,
{
@@ -384,7 +384,7 @@ impl<C> Client<C> {

pub async fn get_all_nymd_single_mixnode_delegations(
&self,
mix_id: NodeId,
mix_id: MixId,
) -> Result<Vec<Delegation>, ValidatorClientError>
where
C: CosmWasmClient + Sync + Send,
@@ -632,7 +632,7 @@ impl ApiClient {

pub async fn get_mixnode_core_status_count(
&self,
mix_id: NodeId,
mix_id: MixId,
since: Option<i64>,
) -> Result<MixnodeCoreStatusResponse, ValidatorClientError> {
Ok(self
@@ -643,14 +643,14 @@ impl ApiClient {

pub async fn get_mixnode_status(
&self,
mix_id: NodeId,
mix_id: MixId,
) -> Result<MixnodeStatusResponse, ValidatorClientError> {
Ok(self.validator_api.get_mixnode_status(mix_id).await?)
}

pub async fn get_mixnode_reward_estimation(
&self,
mix_id: NodeId,
mix_id: MixId,
) -> Result<RewardEstimationResponse, ValidatorClientError> {
Ok(self
.validator_api
@@ -660,7 +660,7 @@ impl ApiClient {

pub async fn get_mixnode_stake_saturation(
&self,
mix_id: NodeId,
mix_id: MixId,
) -> Result<StakeSaturationResponse, ValidatorClientError> {
Ok(self
.validator_api
4 changes: 2 additions & 2 deletions common/client-libs/validator-client/src/nymd/mod.rs
Original file line number Diff line number Diff line change
@@ -44,7 +44,7 @@ pub use cosmrs::Coin as CosmosCoin;
pub use cosmrs::{bip32, AccountId, Decimal, Denom};
pub use cosmwasm_std::Coin as CosmWasmCoin;
pub use fee::{gas_price::GasPrice, GasAdjustable, GasAdjustment};
use mixnet_contract_common::NodeId;
use mixnet_contract_common::MixId;
pub use signing_client::Client as SigningNymdClient;
pub use traits::{VestingQueryClient, VestingSigningClient};

@@ -725,7 +725,7 @@ impl<C> NymdClient<C> {
#[execute("vesting")]
fn _vesting_withdraw_delegator_reward(
&self,
mix_id: NodeId,
mix_id: MixId,
fee: Option<Fee>,
) -> (VestingExecuteMsg, Option<Fee>)
where
Original file line number Diff line number Diff line change
@@ -18,10 +18,11 @@ use mixnet_contract_common::rewarding::{
use mixnet_contract_common::{
delegation, ContractBuildInformation, ContractState, ContractStateParams,
CurrentIntervalResponse, EpochEventId, GatewayBondResponse, GatewayOwnershipResponse,
IdentityKey, IntervalEventId, LayerDistribution, MixOwnershipResponse, MixnodeDetailsResponse,
NodeId, PagedAllDelegationsResponse, PagedDelegatorDelegationsResponse, PagedGatewayResponse,
PagedMixNodeDelegationsResponse, PagedMixnodeBondsResponse, PagedRewardedSetResponse,
PendingEpochEventsResponse, PendingIntervalEventsResponse, QueryMsg as MixnetQueryMsg,
IdentityKey, IntervalEventId, LayerDistribution, MixId, MixOwnershipResponse,
MixnodeDetailsResponse, PagedAllDelegationsResponse, PagedDelegatorDelegationsResponse,
PagedGatewayResponse, PagedMixNodeDelegationsResponse, PagedMixnodeBondsResponse,
PagedRewardedSetResponse, PendingEpochEventsResponse, PendingIntervalEventsResponse,
QueryMsg as MixnetQueryMsg,
};
use serde::Deserialize;

@@ -65,7 +66,7 @@ pub trait MixnetQueryClient {

async fn get_rewarded_set_paged(
&self,
start_after: Option<NodeId>,
start_after: Option<MixId>,
limit: Option<u32>,
) -> Result<PagedRewardedSetResponse, NymdError> {
self.query_mixnet_contract(MixnetQueryMsg::GetRewardedSet { limit, start_after })
@@ -77,7 +78,7 @@ pub trait MixnetQueryClient {
async fn get_mixnode_bonds_paged(
&self,
limit: Option<u32>,
start_after: Option<NodeId>,
start_after: Option<MixId>,
) -> Result<PagedMixnodeBondsResponse, NymdError> {
self.query_mixnet_contract(MixnetQueryMsg::GetMixNodeBonds { limit, start_after })
.await
@@ -86,7 +87,7 @@ pub trait MixnetQueryClient {
async fn get_mixnodes_detailed_paged(
&self,
limit: Option<u32>,
start_after: Option<NodeId>,
start_after: Option<MixId>,
) -> Result<PagedMixnodesDetailsResponse, NymdError> {
self.query_mixnet_contract(MixnetQueryMsg::GetMixNodesDetailed { limit, start_after })
.await
@@ -95,7 +96,7 @@ pub trait MixnetQueryClient {
async fn get_unbonded_paged(
&self,
limit: Option<u32>,
start_after: Option<NodeId>,
start_after: Option<MixId>,
) -> Result<PagedUnbondedMixnodesResponse, NymdError> {
self.query_mixnet_contract(MixnetQueryMsg::GetUnbondedMixNodes { limit, start_after })
.await
@@ -105,7 +106,7 @@ pub trait MixnetQueryClient {
&self,
owner: &AccountId,
limit: Option<u32>,
start_after: Option<NodeId>,
start_after: Option<MixId>,
) -> Result<PagedUnbondedMixnodesResponse, NymdError> {
self.query_mixnet_contract(MixnetQueryMsg::GetUnbondedMixNodesByOwner {
owner: owner.to_string(),
@@ -119,7 +120,7 @@ pub trait MixnetQueryClient {
&self,
identity_key: String,
limit: Option<u32>,
start_after: Option<NodeId>,
start_after: Option<MixId>,
) -> Result<PagedUnbondedMixnodesResponse, NymdError> {
self.query_mixnet_contract(MixnetQueryMsg::GetUnbondedMixNodesByIdentityKey {
identity_key,
@@ -141,31 +142,31 @@ pub trait MixnetQueryClient {

async fn get_mixnode_details(
&self,
mix_id: NodeId,
mix_id: MixId,
) -> Result<MixnodeDetailsResponse, NymdError> {
self.query_mixnet_contract(MixnetQueryMsg::GetMixnodeDetails { mix_id })
.await
}

async fn get_mixnode_rewarding_details(
&self,
mix_id: NodeId,
mix_id: MixId,
) -> Result<MixnodeRewardingDetailsResponse, NymdError> {
self.query_mixnet_contract(MixnetQueryMsg::GetMixnodeRewardingDetails { mix_id })
.await
}

async fn get_mixnode_stake_saturation(
&self,
mix_id: NodeId,
mix_id: MixId,
) -> Result<StakeSaturationResponse, NymdError> {
self.query_mixnet_contract(MixnetQueryMsg::GetStakeSaturation { mix_id })
.await
}

async fn get_unbonded_mixnode_information(
&self,
mix_id: NodeId,
mix_id: MixId,
) -> Result<UnbondedMixnodeResponse, NymdError> {
self.query_mixnet_contract(MixnetQueryMsg::GetUnbondedMixNodeInformation { mix_id })
.await
@@ -212,7 +213,7 @@ pub trait MixnetQueryClient {
/// Gets list of all delegations towards particular mixnode on particular page.
async fn get_mixnode_delegations_paged(
&self,
mix_id: NodeId,
mix_id: MixId,
start_after: Option<String>,
limit: Option<u32>,
) -> Result<PagedMixNodeDelegationsResponse, NymdError> {
@@ -228,7 +229,7 @@ pub trait MixnetQueryClient {
async fn get_delegator_delegations_paged(
&self,
delegator: String,
start_after: Option<(NodeId, OwnerProxySubKey)>,
start_after: Option<(MixId, OwnerProxySubKey)>,
limit: Option<u32>,
) -> Result<PagedDelegatorDelegationsResponse, NymdError> {
self.query_mixnet_contract(MixnetQueryMsg::GetDelegatorDelegations {
@@ -242,7 +243,7 @@ pub trait MixnetQueryClient {
/// Checks value of delegation of given client towards particular mixnode.
async fn get_delegation_details(
&self,
mix_id: NodeId,
mix_id: MixId,
delegator: &AccountId,
proxy: Option<String>,
) -> Result<MixNodeDelegationResponse, NymdError> {
@@ -277,7 +278,7 @@ pub trait MixnetQueryClient {

async fn get_pending_mixnode_operator_reward(
&self,
mix_id: NodeId,
mix_id: MixId,
) -> Result<PendingRewardResponse, NymdError> {
self.query_mixnet_contract(MixnetQueryMsg::GetPendingMixNodeOperatorReward { mix_id })
.await
@@ -286,7 +287,7 @@ pub trait MixnetQueryClient {
async fn get_pending_delegator_reward(
&self,
delegator: &AccountId,
mix_id: NodeId,
mix_id: MixId,
proxy: Option<String>,
) -> Result<PendingRewardResponse, NymdError> {
self.query_mixnet_contract(MixnetQueryMsg::GetPendingDelegatorReward {
@@ -300,7 +301,7 @@ pub trait MixnetQueryClient {
// given the provided performance, estimate the reward at the end of the current epoch
async fn get_estimated_current_epoch_operator_reward(
&self,
mix_id: NodeId,
mix_id: MixId,
estimated_performance: Performance,
) -> Result<EstimatedCurrentEpochRewardResponse, NymdError> {
self.query_mixnet_contract(MixnetQueryMsg::GetEstimatedCurrentEpochOperatorReward {
@@ -314,7 +315,7 @@ pub trait MixnetQueryClient {
async fn get_estimated_current_epoch_delegator_reward(
&self,
delegator: &AccountId,
mix_id: NodeId,
mix_id: MixId,
proxy: Option<String>,
estimated_performance: Performance,
) -> Result<EstimatedCurrentEpochRewardResponse, NymdError> {
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ use cosmrs::AccountId;
use mixnet_contract_common::mixnode::{MixNodeConfigUpdate, MixNodeCostParams};
use mixnet_contract_common::reward_params::{IntervalRewardingParamsUpdate, Performance};
use mixnet_contract_common::{
ContractStateParams, ExecuteMsg as MixnetExecuteMsg, Gateway, MixNode, NodeId,
ContractStateParams, ExecuteMsg as MixnetExecuteMsg, Gateway, MixId, MixNode,
};

#[async_trait]
@@ -108,7 +108,7 @@ pub trait MixnetSigningClient {

async fn advance_current_epoch(
&self,
new_rewarded_set: Vec<NodeId>,
new_rewarded_set: Vec<MixId>,
expected_active_set_size: u32,
fee: Option<Fee>,
) -> Result<ExecuteResult, NymdError> {
@@ -324,7 +324,7 @@ pub trait MixnetSigningClient {

async fn delegate_to_mixnode(
&self,
mix_id: NodeId,
mix_id: MixId,
amount: Coin,
fee: Option<Fee>,
) -> Result<ExecuteResult, NymdError> {
@@ -339,7 +339,7 @@ pub trait MixnetSigningClient {
async fn delegate_to_mixnode_on_behalf(
&self,
delegate: AccountId,
mix_id: NodeId,
mix_id: MixId,
amount: Coin,
fee: Option<Fee>,
) -> Result<ExecuteResult, NymdError> {
@@ -356,7 +356,7 @@ pub trait MixnetSigningClient {

async fn undelegate_from_mixnode(
&self,
mix_id: NodeId,
mix_id: MixId,
fee: Option<Fee>,
) -> Result<ExecuteResult, NymdError> {
self.execute_mixnet_contract(
@@ -370,7 +370,7 @@ pub trait MixnetSigningClient {
async fn undelegate_to_mixnode_on_behalf(
&self,
delegate: AccountId,
mix_id: NodeId,
mix_id: MixId,
fee: Option<Fee>,
) -> Result<ExecuteResult, NymdError> {
self.execute_mixnet_contract(
@@ -388,7 +388,7 @@ pub trait MixnetSigningClient {

async fn reward_mixnode(
&self,
mix_id: NodeId,
mix_id: MixId,
performance: Performance,
fee: Option<Fee>,
) -> Result<ExecuteResult, NymdError> {
@@ -425,7 +425,7 @@ pub trait MixnetSigningClient {

async fn withdraw_delegator_reward(
&self,
mix_id: NodeId,
mix_id: MixId,
fee: Option<Fee>,
) -> Result<ExecuteResult, NymdError> {
self.execute_mixnet_contract(
@@ -439,7 +439,7 @@ pub trait MixnetSigningClient {
async fn withdraw_delegator_reward_on_behalf(
&self,
owner: AccountId,
mix_id: NodeId,
mix_id: MixId,
fee: Option<Fee>,
) -> Result<ExecuteResult, NymdError> {
self.execute_mixnet_contract(
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ use crate::nymd::error::NymdError;
use crate::nymd::NymdClient;
use async_trait::async_trait;
use cosmwasm_std::{Coin as CosmWasmCoin, Timestamp};
use mixnet_contract_common::NodeId;
use mixnet_contract_common::MixId;
use vesting_contract::vesting::Account;
use vesting_contract_common::{
messages::QueryMsg as VestingQueryMsg, AllDelegationsResponse, DelegationTimesResponse,
@@ -76,12 +76,12 @@ pub trait VestingQueryClient {
async fn get_delegation_timestamps(
&self,
address: &str,
mix_id: NodeId,
mix_id: MixId,
) -> Result<DelegationTimesResponse, NymdError>;

async fn get_all_vesting_delegations_paged(
&self,
start_after: Option<(u32, NodeId, u64)>,
start_after: Option<(u32, MixId, u64)>,
limit: Option<u32>,
) -> Result<AllDelegationsResponse, NymdError>;

@@ -269,7 +269,7 @@ impl<C: CosmWasmClient + Sync + Send> VestingQueryClient for NymdClient<C> {
async fn get_delegation_timestamps(
&self,
address: &str,
mix_id: NodeId,
mix_id: MixId,
) -> Result<DelegationTimesResponse, NymdError> {
let request = VestingQueryMsg::GetDelegationTimes {
address: address.to_string(),
@@ -282,7 +282,7 @@ impl<C: CosmWasmClient + Sync + Send> VestingQueryClient for NymdClient<C> {

async fn get_all_vesting_delegations_paged(
&self,
start_after: Option<(u32, NodeId, u64)>,
start_after: Option<(u32, MixId, u64)>,
limit: Option<u32>,
) -> Result<AllDelegationsResponse, NymdError> {
let request = VestingQueryMsg::GetAllDelegations { start_after, limit };
Loading

0 comments on commit c3bea66

Please sign in to comment.