Remove lingering runtime upgrades (#6476)

* Remove lingering runtime upgrades

* remove unused warnings

* remove tests
This commit is contained in:
Shawn Tabrizi
2020-06-23 12:42:28 +02:00
committed by GitHub
parent ceb0fa6358
commit b10f1a907d
7 changed files with 4 additions and 173 deletions
-17
View File
@@ -160,7 +160,6 @@ use sp_runtime::{
use codec::{Encode, Decode, Input};
use frame_support::{
decl_module, decl_storage, decl_event, decl_error, ensure, Parameter,
storage::IterableStorageMap,
weights::{Weight, DispatchClass},
traits::{
Currency, ReservableCurrency, LockableCurrency, WithdrawReason, LockIdentifier, Get,
@@ -602,22 +601,6 @@ decl_module! {
fn deposit_event() = default;
fn on_runtime_upgrade() -> Weight {
if let None = StorageVersion::get() {
StorageVersion::put(Releases::V1);
DepositOf::<T>::translate::<
(BalanceOf<T>, Vec<T::AccountId>), _
>(|_, (balance, accounts)| {
Some((accounts, balance))
});
T::MaximumBlockWeight::get()
} else {
T::DbWeight::get().reads(1)
}
}
/// Propose a sensitive action to be taken.
///
/// The dispatch origin of this call must be _Signed_ and the sender must
-1
View File
@@ -42,7 +42,6 @@ mod preimage;
mod public_proposals;
mod scheduling;
mod voting;
mod migration;
mod decoders;
const AYE: Vote = Vote { aye: true, conviction: Conviction::None };
@@ -1,45 +0,0 @@
// 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/>.
//! The tests for migration.
use super::*;
use frame_support::{storage::migration, Hashable, traits::OnRuntimeUpgrade};
use substrate_test_utils::assert_eq_uvec;
#[test]
fn migration() {
new_test_ext().execute_with(|| {
for i in 0..3 {
let k = i.twox_64_concat();
let v: (BalanceOf<Test>, Vec<u64>) = (i * 1000, vec![i]);
migration::put_storage_value(b"Democracy", b"DepositOf", &k, v);
}
StorageVersion::kill();
Democracy::on_runtime_upgrade();
assert_eq!(StorageVersion::get(), Some(Releases::V1));
assert_eq_uvec!(
DepositOf::<Test>::iter().collect::<Vec<_>>(),
vec![
(0, (vec![0u64], <BalanceOf<Test>>::from(0u32))),
(1, (vec![1u64], <BalanceOf<Test>>::from(1000u32))),
(2, (vec![2u64], <BalanceOf<Test>>::from(2000u32))),
]
);
})
}