mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-28 05:07:55 +00:00
Assign unique storage names to pallets. (#5010)
* Assign unique storage names to pallets. * Bump spec * Upgrade logic for finality tracker (untested) * Logic for migrating Identity (untested) * Logic for migrating transaction-payment * Fix tests * Fix `decl_storage` build * Contract -> Contracts * Update Cargo.lock * bump spec * update migration * Fix merge error * Migration for contracts * Remove serde * Remove some illegal spaces and Options * Fix types in identity. * Minor variable rename Co-authored-by: Gavin Wood <gavin@parity.io>
This commit is contained in:
@@ -48,6 +48,8 @@ use sp_runtime::{
|
||||
};
|
||||
use pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo;
|
||||
|
||||
mod migration;
|
||||
|
||||
type Multiplier = Fixed64;
|
||||
type BalanceOf<T> =
|
||||
<<T as Trait>::Currency as Currency<<T as frame_system::Trait>::AccountId>>::Balance;
|
||||
@@ -77,7 +79,7 @@ pub trait Trait: frame_system::Trait {
|
||||
}
|
||||
|
||||
decl_storage! {
|
||||
trait Store for Module<T: Trait> as Balances {
|
||||
trait Store for Module<T: Trait> as TransactionPayment {
|
||||
pub NextFeeMultiplier get(fn next_fee_multiplier): Multiplier = Multiplier::from_parts(0);
|
||||
}
|
||||
}
|
||||
@@ -95,6 +97,10 @@ decl_module! {
|
||||
*fm = T::FeeMultiplierUpdate::convert(*fm)
|
||||
});
|
||||
}
|
||||
|
||||
fn on_runtime_upgrade() {
|
||||
migration::on_runtime_upgrade()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
// Copyright 2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Substrate.
|
||||
|
||||
// Substrate is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Substrate is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Migration code to update storage.
|
||||
|
||||
use super::*;
|
||||
use frame_support::storage::migration::{put_storage_value, take_storage_value};
|
||||
|
||||
pub fn on_runtime_upgrade() {
|
||||
change_name_balances_to_transaction_payment()
|
||||
}
|
||||
|
||||
// Change the storage name used by this pallet from `Balances` to `TransactionPayment`.
|
||||
//
|
||||
// Since the format of the storage items themselves have not changed, we do not
|
||||
// need to keep track of a storage version. If the runtime does not need to be
|
||||
// upgraded, nothing here will happen anyway.
|
||||
|
||||
fn change_name_balances_to_transaction_payment() {
|
||||
sp_runtime::print("Migrating Transaction Payment.");
|
||||
|
||||
if let Some(next_fee_multiplier) = take_storage_value::<Multiplier>(b"Balances", b"NextFeeMultiplier", &[]) {
|
||||
put_storage_value(b"TransactionPayment", b"NextFeeMultiplier", &[], next_fee_multiplier);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user