Skip to content

Commit 139c32f

Browse files
authored
remove migrations (#972)
1 parent 84c58de commit 139c32f

File tree

6 files changed

+2
-376
lines changed

6 files changed

+2
-376
lines changed

asset-registry/src/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ mod mock;
2828
#[cfg(test)]
2929
mod tests;
3030

31-
mod migrations;
32-
pub use migrations::Migration;
33-
3431
#[frame_support::pallet]
3532
pub mod module {
3633
use super::*;

asset-registry/src/migrations.rs

Lines changed: 0 additions & 44 deletions
This file was deleted.

asset-registry/src/tests.rs

Lines changed: 1 addition & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@
33
use super::*;
44
use crate as orml_asset_registry;
55
use crate::tests::para::{AdminAssetTwo, AssetRegistry, CustomMetadata, RuntimeOrigin, Tokens, TreasuryAccount};
6-
use frame_support::{
7-
assert_noop, assert_ok,
8-
storage::migration::{get_storage_value, put_storage_value},
9-
traits::OnRuntimeUpgrade,
10-
StorageHasher,
11-
};
6+
use frame_support::{assert_noop, assert_ok, traits::OnRuntimeUpgrade, StorageHasher};
127
use mock::{para::RuntimeCall, *};
138
use orml_traits::MultiCurrency;
149
use polkadot_parachain_primitives::primitives::Sibling;
@@ -594,128 +589,6 @@ fn test_v2_to_v3_incompatible_multilocation() {
594589
);
595590
}
596591

597-
#[test]
598-
fn from_unversioned_to_v2_storage() {
599-
TestNet::reset();
600-
601-
ParaA::execute_with(|| {
602-
let module_prefix = b"AssetRegistry";
603-
let storage_prefix = b"LocationToAssetId";
604-
605-
// StorageVersion is 0 before migration
606-
assert_eq!(StorageVersion::get::<Pallet<para::Runtime>>(), 0);
607-
608-
// V2 storage
609-
let old_multilocation_0 = xcm::v2::MultiLocation::new(
610-
0,
611-
xcm::v2::Junctions::X1(xcm::v2::Junction::GeneralKey(vec![0].try_into().unwrap())),
612-
);
613-
let old_multilocation_1 = xcm::v2::MultiLocation::new(
614-
1,
615-
xcm::v2::Junctions::X2(
616-
xcm::v2::Junction::Parachain(2096),
617-
xcm::v2::Junction::GeneralKey(vec![0, 0, 0, 0, 0, 0, 0, 0, 0].try_into().unwrap()),
618-
),
619-
);
620-
let old_multilocation_2 = xcm::v2::MultiLocation::new(
621-
1,
622-
xcm::v2::Junctions::X2(
623-
xcm::v2::Junction::Parachain(2096),
624-
xcm::v2::Junction::GeneralKey(vec![1, 1].try_into().unwrap()),
625-
),
626-
);
627-
628-
let asset_id_0: para::ParaAssetId = 5u32;
629-
let asset_id_1: para::ParaAssetId = 6u32;
630-
let asset_id_2: para::ParaAssetId = 7u32;
631-
632-
// Store raw xcm::v2 data
633-
put_storage_value(
634-
module_prefix,
635-
storage_prefix,
636-
&Twox64Concat::hash(&old_multilocation_0.encode()),
637-
asset_id_0,
638-
);
639-
put_storage_value(
640-
module_prefix,
641-
storage_prefix,
642-
&Twox64Concat::hash(&old_multilocation_1.encode()),
643-
asset_id_1,
644-
);
645-
put_storage_value(
646-
module_prefix,
647-
storage_prefix,
648-
&Twox64Concat::hash(&old_multilocation_2.encode()),
649-
asset_id_2,
650-
);
651-
652-
// V3 storage key
653-
let new_multilocation_0 = MultiLocation::new(0, X1(Junction::from(BoundedVec::try_from(vec![0]).unwrap())));
654-
let new_multilocation_1 = MultiLocation::new(
655-
1,
656-
X2(
657-
Parachain(2096),
658-
Junction::from(BoundedVec::try_from(vec![0, 0, 0, 0, 0, 0, 0, 0, 0]).unwrap()),
659-
),
660-
);
661-
let new_multilocation_2 = MultiLocation::new(
662-
1,
663-
X2(
664-
Parachain(2096),
665-
Junction::from(BoundedVec::try_from(vec![1, 1]).unwrap()),
666-
),
667-
);
668-
669-
// Assert new StorageKey still does not exist
670-
assert_eq!(AssetRegistry::location_to_asset_id(new_multilocation_0), None);
671-
assert_eq!(AssetRegistry::location_to_asset_id(new_multilocation_1), None);
672-
assert_eq!(AssetRegistry::location_to_asset_id(new_multilocation_2), None);
673-
674-
// Run StorageKey migration
675-
crate::Migration::<para::Runtime>::on_runtime_upgrade();
676-
677-
// StorageVersion is 2 after migration
678-
assert_eq!(StorageVersion::get::<Pallet<para::Runtime>>(), 2);
679-
680-
// Assert the StorageKey exists and has been migrated to xcm::v3
681-
assert_eq!(
682-
AssetRegistry::location_to_asset_id(new_multilocation_0),
683-
Some(asset_id_0)
684-
);
685-
assert_eq!(
686-
AssetRegistry::location_to_asset_id(new_multilocation_1),
687-
Some(asset_id_1)
688-
);
689-
assert_eq!(
690-
AssetRegistry::location_to_asset_id(new_multilocation_2),
691-
Some(asset_id_2)
692-
);
693-
694-
// Assert the old key does not exist anymore
695-
assert!(get_storage_value::<para::ParaAssetId>(
696-
module_prefix,
697-
storage_prefix,
698-
&Twox64Concat::hash(&old_multilocation_0.encode()),
699-
)
700-
.is_none());
701-
assert!(get_storage_value::<para::ParaAssetId>(
702-
module_prefix,
703-
storage_prefix,
704-
&Twox64Concat::hash(&old_multilocation_1.encode()),
705-
)
706-
.is_none());
707-
assert!(get_storage_value::<para::ParaAssetId>(
708-
module_prefix,
709-
storage_prefix,
710-
&Twox64Concat::hash(&old_multilocation_2.encode()),
711-
)
712-
.is_none());
713-
714-
// Assert further calls are no-op
715-
assert_eq!(crate::Migration::<para::Runtime>::on_runtime_upgrade(), Weight::zero());
716-
});
717-
}
718-
719592
#[test]
720593
fn test_decode_bounded_vec() {
721594
TestNet::reset();

unknown-tokens/src/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ pub use module::*;
1212
mod mock;
1313
mod tests;
1414

15-
mod migrations;
16-
pub use migrations::Migration;
17-
1815
#[frame_support::pallet]
1916
pub mod module {
2017
use super::*;

unknown-tokens/src/migrations.rs

Lines changed: 0 additions & 86 deletions
This file was deleted.

0 commit comments

Comments
 (0)