removed migration code from mixnet and vesting contracts (#3207)
This commit is contained in:
committed by
GitHub
parent
cfef9e96e6
commit
271a126556
@@ -8,7 +8,6 @@ use crate::mixnodes::storage as mixnode_storage;
|
||||
use crate::rewards::storage as rewards_storage;
|
||||
use cosmwasm_std::{
|
||||
entry_point, to_binary, Addr, Coin, Deps, DepsMut, Env, MessageInfo, QueryResponse, Response,
|
||||
StdError,
|
||||
};
|
||||
use mixnet_contract_common::error::MixnetContractError;
|
||||
use mixnet_contract_common::{
|
||||
@@ -603,17 +602,6 @@ pub fn migrate(
|
||||
_env: Env,
|
||||
msg: MigrateMsg,
|
||||
) -> Result<Response, MixnetContractError> {
|
||||
// this is the first migration that uses cw2 standard and thus the value in the storage doesn't yet exist
|
||||
// set it instead.
|
||||
if matches!(
|
||||
cw2::get_contract_version(deps.storage),
|
||||
Err(StdError::NotFound { .. })
|
||||
) {
|
||||
cw2::set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?;
|
||||
crate::queued_migrations::create_epoch_status(deps.storage)?;
|
||||
return Ok(Response::new());
|
||||
}
|
||||
|
||||
// note: don't remove this particular bit of code as we have to ALWAYS check whether we have to update the stored version
|
||||
let version: Version = CONTRACT_VERSION.parse().map_err(|error: semver::Error| {
|
||||
MixnetContractError::SemVerFailure {
|
||||
@@ -635,8 +623,7 @@ pub fn migrate(
|
||||
cw2::set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?;
|
||||
|
||||
// If state structure changed in any contract version in the way migration is needed, it
|
||||
// should occur here
|
||||
crate::queued_migrations::create_epoch_status(deps.storage)?;
|
||||
// should occur here, for example anything from `crate::queued_migrations::`
|
||||
}
|
||||
|
||||
// due to circular dependency on contract addresses (i.e. mixnet contract requiring vesting contract address
|
||||
|
||||
@@ -1,18 +1,2 @@
|
||||
// Copyright 2022 - Nym Technologies SA <contact@nymtech.net>
|
||||
// Copyright 2022-2023 - Nym Technologies SA <contact@nymtech.net>
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use crate::interval::storage as interval_storage;
|
||||
use cosmwasm_std::Storage;
|
||||
use mixnet_contract_common::error::MixnetContractError;
|
||||
use mixnet_contract_common::EpochStatus;
|
||||
|
||||
pub(crate) fn create_epoch_status(storage: &mut dyn Storage) -> Result<(), MixnetContractError> {
|
||||
let current_rewarding_validator =
|
||||
crate::mixnet_contract_settings::storage::rewarding_validator_address(storage)?;
|
||||
interval_storage::save_current_epoch_status(
|
||||
storage,
|
||||
&EpochStatus::new(current_rewarding_validator),
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ use contracts_common::signing::MessageSignature;
|
||||
use contracts_common::ContractBuildInformation;
|
||||
use cosmwasm_std::{
|
||||
coin, entry_point, to_binary, Addr, BankMsg, Coin, Deps, DepsMut, Env, MessageInfo, Order,
|
||||
QueryResponse, Response, StdError, StdResult, Timestamp, Uint128,
|
||||
QueryResponse, Response, StdResult, Timestamp, Uint128,
|
||||
};
|
||||
use cw_storage_plus::Bound;
|
||||
use mixnet_contract_common::gateway::GatewayConfigUpdate;
|
||||
@@ -75,15 +75,6 @@ pub fn instantiate(
|
||||
|
||||
#[entry_point]
|
||||
pub fn migrate(deps: DepsMut<'_>, _env: Env, _msg: MigrateMsg) -> Result<Response, ContractError> {
|
||||
// this is the first migration that uses cw2 standard and thus the value in the storage doesn't yet exist
|
||||
// set it instead.
|
||||
if matches!(
|
||||
cw2::get_contract_version(deps.storage),
|
||||
Err(StdError::NotFound { .. })
|
||||
) {
|
||||
cw2::set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?;
|
||||
}
|
||||
|
||||
// note: don't remove this particular bit of code as we have to ALWAYS check whether we have to update the stored version
|
||||
let version: Version =
|
||||
CONTRACT_VERSION
|
||||
@@ -106,7 +97,7 @@ pub fn migrate(deps: DepsMut<'_>, _env: Env, _msg: MigrateMsg) -> Result<Respons
|
||||
cw2::set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?;
|
||||
|
||||
// If state structure changed in any contract version in the way migration is needed, it
|
||||
// should occur here
|
||||
// should occur here, for example anything from `crate::queued_migrations::`
|
||||
}
|
||||
|
||||
Ok(Response::new())
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
// Copyright 2022 - Nym Technologies SA <contact@nymtech.net>
|
||||
// Copyright 2022-2023 - Nym Technologies SA <contact@nymtech.net>
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
Reference in New Issue
Block a user