Skip to content

Commit

Permalink
Add migration to karura. (#1365)
Browse files Browse the repository at this point in the history
* Add migration to karura.

* Add runtime upgrade to executor.

* Add try-runtime to CI.
  • Loading branch information
shaunxw authored Aug 26, 2021
1 parent 1113b04 commit 07998bf
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,5 @@ jobs:
run: make test-benchmarking
- name: Check benchmarks
run: make check-benchmarks
- name: Check try-runtime
run: make check-try-runtime
19 changes: 17 additions & 2 deletions runtime/karura/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1619,6 +1619,15 @@ impl orml_xcm::Config for Runtime {
type SovereignOrigin = EnsureRootOrHalfGeneralCouncil;
}

pub struct OnRuntimeUpgrade;
impl frame_support::traits::OnRuntimeUpgrade for OnRuntimeUpgrade {
fn on_runtime_upgrade() -> u64 {
frame_support::migrations::migrate_from_pallet_version_to_storage_version::<AllPalletsWithSystem>(
&RocksDbWeight::get(),
)
}
}

#[allow(clippy::large_enum_variant)]
construct_runtime!(
pub enum Runtime where
Expand Down Expand Up @@ -1754,8 +1763,14 @@ pub type SignedPayload = generic::SignedPayload<Call, SignedExtra>;
/// Extrinsic type that has already been checked.
pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, Call, SignedExtra>;
/// Executive: handles dispatch to the various modules.
pub type Executive =
frame_executive::Executive<Runtime, Block, frame_system::ChainContext<Runtime>, Runtime, AllPallets, ()>;
pub type Executive = frame_executive::Executive<
Runtime,
Block,
frame_system::ChainContext<Runtime>,
Runtime,
AllPallets,
OnRuntimeUpgrade,
>;

#[cfg(not(feature = "disable-runtime-api"))]
impl_runtime_apis! {
Expand Down

0 comments on commit 07998bf

Please sign in to comment.