Files
pezkuwi-subxt/substrate/frame/contracts/src/migration.rs
T
Alexander Theißen 1ac95b6ba6 contracts: Move Schedule from Storage to Config (#8773)
* Move `Schedule` from Storage to Config

* Updated CHANGELOG

* Fix nits from review

* Fix migration

* Print the debug buffer as tracing message

* Use `debug` instead of `trace` and update README

* Add additional assert to test

* Rename `schedule_version` to `instruction_weights_version`

* Fixed typo

* Added more comments to wat fixtures

* Add clarification for the `debug_message` field
2021-05-13 19:56:11 +00:00

41 lines
1.2 KiB
Rust

// This file is part of Substrate.
// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::{Config, Weight, Pallet};
use frame_support::{
storage::migration,
traits::{GetPalletVersion, PalletVersion, PalletInfoAccess, Get},
};
pub fn migrate<T: Config>() -> Weight {
let mut weight: Weight = 0;
match <Pallet<T>>::storage_version() {
Some(version) if version == PalletVersion::new(3, 0, 0) => {
weight = weight.saturating_add(T::DbWeight::get().writes(1));
migration::remove_storage_prefix(
<Pallet<T>>::name().as_bytes(),
b"CurrentSchedule",
b"",
);
}
_ => (),
}
weight
}