diff --git a/pallets/gear-messenger/src/migrations/context_store.rs b/pallets/gear-messenger/src/migrations/context_store.rs index 368f0282a23..9862b49ca95 100644 --- a/pallets/gear-messenger/src/migrations/context_store.rs +++ b/pallets/gear-messenger/src/migrations/context_store.rs @@ -24,7 +24,14 @@ use common::{ }; #[cfg(feature = "try-runtime")] -use {frame_support::ensure, sp_runtime::TryRuntimeError, sp_std::vec::Vec}; +use { + frame_support::ensure, + sp_runtime::{ + codec::{Decode, Encode}, + TryRuntimeError, + }, + sp_std::vec::Vec, +}; use frame_support::{ traits::{GetStorageVersion, OnRuntimeUpgrade, StorageVersion}, @@ -113,15 +120,17 @@ impl OnRuntimeUpgrade for RemoveCommitStorage { "Current storage version is not allowed for migration, check migration code in order to allow it." ); - Ok(vec![1]) + Ok(Some(1u64).encode()) } else { - Ok(vec![0]) + Ok(Option::::None.encode()) } } #[cfg(feature = "try-runtime")] fn post_upgrade(state: Vec) -> Result<(), TryRuntimeError> { - if state[0] == 1 { + if let Some(1) = Option::::decode(&mut state.as_ref()) + .map_err(|_| "`pre_upgrade` provided an invalid state")? + { ensure!( Pallet::::on_chain_storage_version() == MIGRATE_TO_VERSION, "incorrect storage version after migration" diff --git a/pallets/gear-program/src/migrations/add_section_sizes.rs b/pallets/gear-program/src/migrations/add_section_sizes.rs index 33c6cb9ff57..2d8dc2f6bbe 100644 --- a/pallets/gear-program/src/migrations/add_section_sizes.rs +++ b/pallets/gear-program/src/migrations/add_section_sizes.rs @@ -28,7 +28,6 @@ use { codec::{Decode, Encode}, TryRuntimeError, }, - sp_std::vec, sp_std::vec::Vec, };