Skip to content

Commit

Permalink
update migration code
Browse files Browse the repository at this point in the history
  • Loading branch information
AlastairHolmes committed Nov 21, 2023
1 parent c617c2e commit ab1f5d2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 16 deletions.
18 changes: 2 additions & 16 deletions state-chain/pallets/cf-pools/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use cf_traits::{impl_pallet_safe_mode, Chainflip, LpBalanceApi, PoolApi, Swappin
use frame_support::{
pallet_prelude::*,
sp_runtime::{Permill, Saturating},
traits::{OnRuntimeUpgrade, StorageVersion},
traits::StorageVersion,
transactional,
};
use frame_system::pallet_prelude::OriginFor;
Expand All @@ -25,7 +25,7 @@ use sp_std::{collections::btree_set::BTreeSet, vec::Vec};
pub use pallet::*;

mod benchmarking;
mod migrations;
pub mod migrations;
pub mod weights;
pub use weights::WeightInfo;

Expand Down Expand Up @@ -478,20 +478,6 @@ pub mod pallet {
}
weight_used
}

fn on_runtime_upgrade() -> Weight {
migrations::PalletMigration::<T>::on_runtime_upgrade()
}

#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<Vec<u8>, DispatchError> {
migrations::PalletMigration::<T>::pre_upgrade()
}

#[cfg(feature = "try-runtime")]
fn post_upgrade(state: Vec<u8>) -> Result<(), DispatchError> {
migrations::PalletMigration::<T>::post_upgrade(state)
}
}

#[pallet::error]
Expand Down
1 change: 1 addition & 0 deletions state-chain/pallets/cf-pools/src/migrations/v1.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::*;
use frame_support::traits::OnRuntimeUpgrade;
use sp_std::marker::PhantomData;

pub struct Migration<T: Config>(PhantomData<T>);
Expand Down
1 change: 1 addition & 0 deletions state-chain/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,7 @@ type PalletMigrations = (
pallet_cf_ingress_egress::migrations::PalletMigration<Runtime, Instance3>,
pallet_cf_swapping::migrations::PalletMigration<Runtime>,
pallet_cf_lp::migrations::PalletMigration<Runtime>,
pallet_cf_pools::migrations::PalletMigration<Runtime>,
);

#[cfg(feature = "runtime-benchmarks")]
Expand Down

0 comments on commit ab1f5d2

Please sign in to comment.