From 1864a61706a5e6d137c3125aac006bee56e5c748 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= <alex.theissen@me.com> Date: Mon, 21 Feb 2022 16:28:25 +0100 Subject: [PATCH] canvas: Run migrations defined by `pallet-contracts` (#1011) * Run migrations defined by pallet-contracts * cargo fmt --- .../canvas-kusama/src/contracts.rs | 13 ++++++++++++- .../polkadot-parachains/canvas-kusama/src/lib.rs | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/cumulus/polkadot-parachains/canvas-kusama/src/contracts.rs b/cumulus/polkadot-parachains/canvas-kusama/src/contracts.rs index 5f433835551..d5c368fa7c6 100644 --- a/cumulus/polkadot-parachains/canvas-kusama/src/contracts.rs +++ b/cumulus/polkadot-parachains/canvas-kusama/src/contracts.rs @@ -2,7 +2,11 @@ use crate::{ constants::currency::deposit, Balance, Balances, Call, Event, RandomnessCollectiveFlip, Runtime, RuntimeBlockWeights, Timestamp, }; -use frame_support::{parameter_types, traits::Nothing, weights::Weight}; +use frame_support::{ + parameter_types, + traits::{Nothing, OnRuntimeUpgrade}, + weights::Weight, +}; use pallet_contracts::{ weights::{SubstrateWeight, WeightInfo}, Config, DefaultAddressGenerator, Frame, Schedule, @@ -52,3 +56,10 @@ impl Config for Runtime { type CallStack = [Frame<Self>; 31]; type AddressGenerator = DefaultAddressGenerator; } + +pub struct Migrations; +impl OnRuntimeUpgrade for Migrations { + fn on_runtime_upgrade() -> Weight { + pallet_contracts::migration::migrate::<Runtime>() + } +} diff --git a/cumulus/polkadot-parachains/canvas-kusama/src/lib.rs b/cumulus/polkadot-parachains/canvas-kusama/src/lib.rs index e8a3b946fcc..6f27584c4b2 100644 --- a/cumulus/polkadot-parachains/canvas-kusama/src/lib.rs +++ b/cumulus/polkadot-parachains/canvas-kusama/src/lib.rs @@ -97,6 +97,7 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext<Runtime>, Runtime, AllPalletsWithSystem, + contracts::Migrations, >; impl_opaque_keys! { -- GitLab