diff --git a/common/client-libs/validator-client/src/nymd/mod.rs b/common/client-libs/validator-client/src/nymd/mod.rs index d7a83bb3e0..3e440f4c2a 100644 --- a/common/client-libs/validator-client/src/nymd/mod.rs +++ b/common/client-libs/validator-client/src/nymd/mod.rs @@ -380,16 +380,6 @@ impl NymdClient { } pub async fn get_reward_pool(&self) -> Result - where - C: CosmWasmClient + Sync, - { - let request = QueryMsg::GetRewardPool {}; - self.client - .query_contract_smart(self.mixnet_contract_address()?, &request) - .await - } - - pub async fn get_epochs_in_interval(&self) -> Result where C: CosmWasmClient + Sync, { @@ -439,6 +429,16 @@ impl NymdClient { .await } + pub async fn get_epochs_in_interval(&self) -> Result + where + C: CosmWasmClient + Sync, + { + let request = QueryMsg::GetEpochsInInterval {}; + self.client + .query_contract_smart(self.mixnet_contract_address()?, &request) + .await + } + /// Checks whether there is a bonded mixnode associated with the provided client's address pub async fn owns_mixnode(&self, address: &AccountId) -> Result, NymdError> where diff --git a/contracts/mixnet/src/contract.rs b/contracts/mixnet/src/contract.rs index 28b97a1fd0..c39e49b80b 100644 --- a/contracts/mixnet/src/contract.rs +++ b/contracts/mixnet/src/contract.rs @@ -277,45 +277,6 @@ pub fn execute( info, ) } - ExecuteMsg::AdvanceCurrentEpoch {} => { - crate::interval::transactions::try_advance_epoch(env, deps.storage) - } - ExecuteMsg::CompoundDelegatorReward { mix_identity } => { - crate::rewards::transactions::try_compound_delegator_reward( - deps, - env, - info, - mix_identity, - ) - } - ExecuteMsg::CompoundOperatorReward {} => { - crate::rewards::transactions::try_compound_operator_reward(deps, env, info) - } - ExecuteMsg::CompoundDelegatorRewardOnBehalf { - owner, - mix_identity, - } => crate::rewards::transactions::try_compound_delegator_reward_on_behalf( - deps, - env, - info, - owner, - mix_identity, - ), - ExecuteMsg::CompoundOperatorRewardOnBehalf { owner } => { - crate::rewards::transactions::try_compound_operator_reward_on_behalf( - deps, env, info, owner, - ) - } - ExecuteMsg::ReconcileDelegations {} => { - crate::delegations::transactions::try_reconcile_all_delegation_events(deps, info) - } - ExecuteMsg::CheckpointMixnodes {} => { - crate::mixnodes::transactions::try_checkpoint_mixnodes( - deps.storage, - env.block.height, - info, - ) - } } } diff --git a/contracts/mixnet/src/delegations/storage.rs b/contracts/mixnet/src/delegations/storage.rs index 28c7c9f766..976b6bd8ac 100644 --- a/contracts/mixnet/src/delegations/storage.rs +++ b/contracts/mixnet/src/delegations/storage.rs @@ -14,11 +14,6 @@ pub const PENDING_DELEGATION_EVENTS: Map< DelegationEvent, > = Map::new("pend"); -pub const PENDING_DELEGATION_EVENTS: Map< - (BlockHeight, IdentityKey, OwnerAddress), - DelegationEvent, -> = Map::new("pend"); - // paged retrieval limits for all queries and transactions pub(crate) const DELEGATION_PAGE_MAX_LIMIT: u32 = 500; pub(crate) const DELEGATION_PAGE_DEFAULT_LIMIT: u32 = 250; diff --git a/contracts/mixnet/src/interval/transactions.rs b/contracts/mixnet/src/interval/transactions.rs index 26c2e8e287..8cb2f9f54f 100644 --- a/contracts/mixnet/src/interval/transactions.rs +++ b/contracts/mixnet/src/interval/transactions.rs @@ -96,35 +96,6 @@ pub fn try_advance_epoch(env: Env, storage: &mut dyn Storage) -> Result Result { - // in theory, we could have just changed the state and relied on its reversal upon failed - // execution, but better safe than sorry and do not modify the state at all unless we know - // all checks have succeeded. - let current_epoch = storage::current_epoch(storage)?; - let next_epoch = current_epoch.next(); - - if next_epoch.start_unix_timestamp() > env.block.time.seconds() as i64 { - // the reason for this check is as follows: - // nobody, even trusted validators, should be able to continuously keep advancing epochs, - // because otherwise it would be possible for them to continuously keep rewarding nodes. - // - // Therefore, even if "trusted" validator, responsible for rewarding, is malicious, - // they can't send rewards more often than every `REWARDED_SET_REFRESH_BLOCKS` - // and changing this value requires going through governance and having agreement of - // the super-majority of the validators (by stake) - return Err(EpochNotInProgress { - current_block_time: env.block.time.seconds(), - epoch_start: next_epoch.start_unix_timestamp(), - epoch_end: next_epoch.end_unix_timestamp(), - }); - } - - storage::save_epoch(storage, &next_epoch)?; - storage::save_epoch_reward_params(next_epoch.id(), storage)?; - - Ok(Response::new().add_event(new_advance_interval_event(next_epoch))) -} - #[cfg(test)] mod tests { use super::*;