fix conflicts

This commit is contained in:
fmtabbara
2022-03-17 16:53:29 +00:00
4 changed files with 10 additions and 83 deletions
@@ -380,16 +380,6 @@ impl<C> NymdClient<C> {
}
pub async fn get_reward_pool(&self) -> Result<Uint128, NymdError>
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<u64, NymdError>
where
C: CosmWasmClient + Sync,
{
@@ -439,6 +429,16 @@ impl<C> NymdClient<C> {
.await
}
pub async fn get_epochs_in_interval(&self) -> Result<u64, NymdError>
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<Option<MixNodeBond>, NymdError>
where
-39
View File
@@ -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,
)
}
}
}
@@ -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;
@@ -96,35 +96,6 @@ pub fn try_advance_epoch(env: Env, storage: &mut dyn Storage) -> Result<Response
})
}
pub fn try_advance_epoch(env: Env, storage: &mut dyn Storage) -> Result<Response, ContractError> {
// 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::*;