Skip to content

Commit b1f2c29

Browse files
authored
Remove the code migrated to runtime 296 (#483)
1 parent f38b3cd commit b1f2c29

File tree

1 file changed

+1
-123
lines changed

1 file changed

+1
-123
lines changed

runtime/turing/src/lib.rs

Lines changed: 1 addition & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -139,121 +139,6 @@ pub type UncheckedExtrinsic =
139139
/// Extrinsic type that has already been checked.
140140
pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, RuntimeCall, SignedExtra>;
141141

142-
/// The runtime migrations per release.
143-
#[allow(deprecated, missing_docs)]
144-
pub mod migrations {
145-
use super::*;
146-
use frame_support::{
147-
pallet_prelude::OptionQuery,
148-
storage_alias,
149-
traits::{GetStorageVersion, OnRuntimeUpgrade, StorageVersion},
150-
Blake2_128Concat, Twox64Concat,
151-
};
152-
use sp_core::Get;
153-
use xcm::{prelude::XcmVersion, VersionedMultiLocation};
154-
155-
pub type V0943 = (SetStorageVersions, PalletXcmMigrateToV1<Runtime>);
156-
157-
/// Migrations that set `StorageVersion`s we missed to set.
158-
///
159-
/// It's *possible* that these pallets have not in fact been migrated to the versions being set,
160-
/// which we should keep in mind in the future if we notice any strange behavior.
161-
/// We opted to not check exactly what on-chain versions each pallet is at, since it would be
162-
/// an involved effort, this is testnet, and no one has complained
163-
/// (https://github.com/paritytech/polkadot/issues/6657#issuecomment-1552956439).
164-
pub struct SetStorageVersions;
165-
166-
impl OnRuntimeUpgrade for SetStorageVersions {
167-
fn on_runtime_upgrade() -> Weight {
168-
let mut writes = 0;
169-
let mut reads = 0;
170-
171-
// Bounties
172-
if Bounties::on_chain_storage_version() < 4 {
173-
StorageVersion::new(4).put::<Bounties>();
174-
writes += 1;
175-
}
176-
reads += 1;
177-
178-
// Preimage
179-
if Preimage::on_chain_storage_version() < 1 {
180-
StorageVersion::new(1).put::<Preimage>();
181-
writes += 1;
182-
}
183-
reads += 1;
184-
185-
// Scheduler
186-
if Scheduler::on_chain_storage_version() == 3 {
187-
StorageVersion::new(4).put::<Scheduler>();
188-
writes += 1;
189-
}
190-
reads += 1;
191-
192-
// Multisig
193-
if Multisig::on_chain_storage_version() == 0 {
194-
StorageVersion::new(1).put::<Multisig>();
195-
writes += 1;
196-
}
197-
reads += 1;
198-
199-
// Democracy
200-
if Democracy::on_chain_storage_version() == 0 {
201-
StorageVersion::new(1).put::<Democracy>();
202-
writes += 1;
203-
}
204-
reads += 1;
205-
206-
RocksDbWeight::get().reads_writes(reads, writes)
207-
}
208-
}
209-
210-
// PalletXcmMigrateToV1
211-
212-
#[storage_alias]
213-
type VersionNotifyTargets<T: pallet_xcm::Config> = StorageDoubleMap<
214-
pallet_xcm::Pallet<T>,
215-
Twox64Concat,
216-
XcmVersion,
217-
Blake2_128Concat,
218-
VersionedMultiLocation,
219-
(QueryId, Weight, XcmVersion),
220-
OptionQuery,
221-
>;
222-
223-
const DEFAULT_PROOF_SIZE: u64 = 64 * 1024;
224-
225-
pub struct PalletXcmMigrateToV1<T>(sp_std::marker::PhantomData<T>);
226-
impl<T: pallet_xcm::Config> OnRuntimeUpgrade for PalletXcmMigrateToV1<T> {
227-
fn on_runtime_upgrade() -> Weight {
228-
if StorageVersion::get::<pallet_xcm::Pallet<T>>() == 0 {
229-
log::info!("The pallet_xcm is migrating to version 1");
230-
let mut weight = T::DbWeight::get().reads(1);
231-
232-
// Because the previous migration wasn't executed correctly,
233-
// there is incorrect data on the chain with { ref_time: 0, proof_size: 0}.
234-
// We will modify it to { ref_time: 0, proof_size: 65535}.
235-
let translate = |pre: (u64, Weight, u32)| -> Option<(u64, Weight, u32)> {
236-
weight = weight.saturating_add(T::DbWeight::get().reads_writes(1, 1));
237-
let translated =
238-
(pre.0, Weight::from_parts(pre.1.ref_time(), DEFAULT_PROOF_SIZE), pre.2);
239-
log::info!("Migrated VersionNotifyTarget {:?} to {:?}", pre, translated);
240-
Some(translated)
241-
};
242-
243-
VersionNotifyTargets::<T>::translate_values(translate);
244-
245-
log::info!("v1 applied successfully");
246-
StorageVersion::new(1).put::<pallet_xcm::Pallet<T>>();
247-
248-
weight.saturating_add(T::DbWeight::get().writes(1))
249-
} else {
250-
log::warn!("skipping v1, should be removed");
251-
T::DbWeight::get().reads(1)
252-
}
253-
}
254-
}
255-
}
256-
257142
/// Executive: handles dispatch to the various modules.
258143
pub type Executive = frame_executive::Executive<
259144
Runtime,
@@ -266,14 +151,7 @@ pub type Executive = frame_executive::Executive<
266151

267152
// All migrations executed on runtime upgrade as a nested tuple of types implementing
268153
// `OnRuntimeUpgrade`.
269-
type Migrations = (
270-
orml_asset_registry::Migration<Runtime>,
271-
orml_unknown_tokens::Migration<Runtime>,
272-
// pallet_balances::migration::ResetInactive<Runtime>,
273-
// We need to apply this migration again, because `ResetInactive` resets the state again.
274-
pallet_balances::migration::MigrateToTrackInactive<Runtime, xcm_config::CheckingAccount>,
275-
migrations::V0943,
276-
);
154+
type Migrations = ();
277155

278156
/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know
279157
/// the specifics of the runtime. They can then be made to be agnostic over specific formats

0 commit comments

Comments
 (0)