allow to optionally skip state migration

This commit is contained in:
Jędrzej Stuczyński
2024-10-14 11:41:36 +01:00
parent 08aa0af562
commit 16edca21b0
3 changed files with 10 additions and 4 deletions
@@ -830,4 +830,5 @@ pub enum QueryMsg {
#[cw_serde]
pub struct MigrateMsg {
pub vesting_contract_address: Option<String>,
pub unsafe_skip_state_updates: Option<bool>,
}
+8 -4
View File
@@ -576,11 +576,15 @@ pub fn migrate(
set_build_information!(deps.storage)?;
cw2::ensure_from_older_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?;
// remove all family-related things
crate::queued_migrations::families_purge(deps.branch())?;
let skip_state_updates = msg.unsafe_skip_state_updates.unwrap_or(false);
// prepare the ground for using nym-nodes rather than standalone mixnodes/gateways
migrate_to_nym_nodes_usage(deps.branch(), &msg)?;
if !skip_state_updates {
// remove all family-related things
crate::queued_migrations::families_purge(deps.branch())?;
// prepare the ground for using nym-nodes rather than standalone mixnodes/gateways
migrate_to_nym_nodes_usage(deps.branch(), &msg)?;
}
// due to circular dependency on contract addresses (i.e. mixnet contract requiring vesting contract address
// and vesting contract requiring the mixnet contract address), if we ever want to deploy any new fresh
@@ -109,6 +109,7 @@ impl NetworkManager {
) -> Result<nym_mixnet_contract_common::MigrateMsg, NetworkManagerError> {
Ok(nym_mixnet_contract_common::MigrateMsg {
vesting_contract_address: Some(ctx.network.contracts.vesting.address()?.to_string()),
unsafe_skip_state_updates: Some(true),
})
}