diff --git a/contracts/mixnet/src/contract.rs b/contracts/mixnet/src/contract.rs index 181f70a82f..0f3748b0d2 100644 --- a/contracts/mixnet/src/contract.rs +++ b/contracts/mixnet/src/contract.rs @@ -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 { - // 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 diff --git a/contracts/mixnet/src/queued_migrations.rs b/contracts/mixnet/src/queued_migrations.rs index 596179f6e6..8df3ef5d86 100644 --- a/contracts/mixnet/src/queued_migrations.rs +++ b/contracts/mixnet/src/queued_migrations.rs @@ -1,18 +1,2 @@ -// Copyright 2022 - Nym Technologies SA +// Copyright 2022-2023 - Nym Technologies SA // 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(()) -} diff --git a/contracts/vesting/src/contract.rs b/contracts/vesting/src/contract.rs index 9454a2c34e..bfac829ebd 100644 --- a/contracts/vesting/src/contract.rs +++ b/contracts/vesting/src/contract.rs @@ -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 { - // 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 +// Copyright 2022-2023 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0