Skip to content

Commit

Permalink
chore: add migration hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
kylezs committed Sep 27, 2023
1 parent a39d37e commit 872a519
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion state-chain/pallets/cf-broadcast/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use frame_support::{
dispatch::DispatchResultWithPostInfo,
pallet_prelude::DispatchResult,
sp_runtime::traits::Saturating,
traits::{Get, StorageVersion, UnfilteredDispatchable},
traits::{Get, OnRuntimeUpgrade, StorageVersion, UnfilteredDispatchable},
Twox64Concat,
};

Expand Down Expand Up @@ -380,6 +380,20 @@ pub mod pallet {
Weight::zero()
}
}

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

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

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

#[pallet::call]
Expand Down

0 comments on commit 872a519

Please sign in to comment.