Skip to content

Commit

Permalink
fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
playX18 committed Nov 12, 2024
1 parent af369bc commit ec46dfb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
17 changes: 13 additions & 4 deletions pallets/gear-messenger/src/migrations/context_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -113,15 +120,17 @@ impl<T: Config> OnRuntimeUpgrade for RemoveCommitStorage<T> {
"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::<u64>::None.encode())
}
}

#[cfg(feature = "try-runtime")]
fn post_upgrade(state: Vec<u8>) -> Result<(), TryRuntimeError> {
if state[0] == 1 {
if let Some(1) = Option::<u64>::decode(&mut state.as_ref())
.map_err(|_| "`pre_upgrade` provided an invalid state")?
{
ensure!(
Pallet::<T>::on_chain_storage_version() == MIGRATE_TO_VERSION,
"incorrect storage version after migration"
Expand Down
1 change: 0 additions & 1 deletion pallets/gear-program/src/migrations/add_section_sizes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ use {
codec::{Decode, Encode},
TryRuntimeError,
},
sp_std::vec,
sp_std::vec::Vec,
};

Expand Down

0 comments on commit ec46dfb

Please sign in to comment.