Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix migrations for pallet-xcm #6099

Closed
wants to merge 34 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
b01161f
feat(xcm-v5): skeleton
franciscoaguirre Jun 5, 2024
0b83e68
feat(xcm-v3): no longer use v2 types
franciscoaguirre Jun 5, 2024
e917d67
feat: remove XCMv2
franciscoaguirre Jun 5, 2024
9005e04
Merge branch 'master' into xcm-v5
franciscoaguirre Jun 19, 2024
5fc4a32
fix(xcm-v5): fix most compilation errors
franciscoaguirre Jun 19, 2024
337e26e
Merge branch 'master' into xcm-v5
franciscoaguirre Jun 26, 2024
19cc1da
fix(pallet-xcm): change V4 to V5
franciscoaguirre Jun 26, 2024
5cfd108
Merge branch 'master' into xcm-v5
franciscoaguirre Aug 14, 2024
96b5b4b
Merge branch 'master' into xcm-v5
franciscoaguirre Aug 14, 2024
6de7a42
Merge branch 'master' into xcm-v5
franciscoaguirre Aug 16, 2024
126ef2f
fix(xcm-v5): change v4 to v5
franciscoaguirre Aug 16, 2024
a16e19f
fix: more v4 to v5 conversions
franciscoaguirre Aug 16, 2024
a3a09af
Merge branch 'master' into xcm-v5
franciscoaguirre Aug 16, 2024
bbba323
fix: more v4 to v5 conversions
franciscoaguirre Aug 16, 2024
98c3906
fix: more v4 to v5 conversions
franciscoaguirre Aug 16, 2024
08a82d1
fix(xcm-builder): use previously unused function
franciscoaguirre Aug 19, 2024
1f031ec
fix(xcm-executor): change v4 to v5
franciscoaguirre Aug 19, 2024
5b423ad
Merge branch 'master' into xcm-v5
franciscoaguirre Aug 21, 2024
1116cbb
Merge branch 'master' into xcm-v5
franciscoaguirre Aug 21, 2024
cfa2ef4
Merge branch 'master' into xcm-v5
franciscoaguirre Aug 27, 2024
241e992
Merge branch 'master' into xcm-v5
franciscoaguirre Sep 4, 2024
d421d3f
Merge branch 'master' into xcm-v5
franciscoaguirre Sep 4, 2024
3e85791
Merge branch 'master' into xcm-v5
franciscoaguirre Oct 1, 2024
f80c76a
fix: v4 -> v5
franciscoaguirre Oct 1, 2024
cbf789d
Missing `MigrateToLatestXcmVersion` for westend
bkontur Oct 17, 2024
d1425bb
[XCMv5] Better fee mechanism (#5420)
franciscoaguirre Oct 17, 2024
b4353a1
Merge branch 'xcm-v5' into bko-xcm-v5-fix-migrations
bkontur Oct 17, 2024
f481f8e
Merge branch 'master' of github.com:paritytech/polkadot-sdk into xcm-v5
acatangiu Oct 17, 2024
678a379
Merge branch 'master' into xcm-v5
acatangiu Oct 17, 2024
a2e84a6
Merge branch 'xcm-v5' into bko-xcm-v5-fix-migrations
bkontur Oct 17, 2024
4d9cc77
Merge branch 'master' of github.com:paritytech/polkadot-sdk into xcm-v5
acatangiu Oct 17, 2024
cdfecb7
fix merge dmg
acatangiu Oct 17, 2024
309d7a0
Merge branch 'xcm-v5' into bko-xcm-v5-fix-migrations
bkontur Oct 18, 2024
f44ae3e
Merge branch 'master' into bko-xcm-v5-fix-migrations
bkontur Oct 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bridges/modules/xcm-bridge-hub-router/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ impl InspectMessageQueues for TestToBridgeHubSender {
.iter()
.map(|(location, message)| {
(
VersionedLocation::V4(location.clone()),
vec![VersionedXcm::V4(message.clone())],
VersionedLocation::from(location.clone()),
vec![VersionedXcm::from(message.clone())],
)
})
.collect()
Expand Down
2 changes: 1 addition & 1 deletion bridges/snowbridge/pallets/system/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ mod benchmarks {
T::Token::mint_into(&caller, amount)?;

let relay_token_asset_id: Location = Location::parent();
let asset = Box::new(VersionedLocation::V4(relay_token_asset_id));
let asset = Box::new(VersionedLocation::from(relay_token_asset_id));
let asset_metadata = AssetMetadata {
name: "wnd".as_bytes().to_vec().try_into().unwrap(),
symbol: "wnd".as_bytes().to_vec().try_into().unwrap(),
Expand Down
4 changes: 2 additions & 2 deletions bridges/snowbridge/pallets/system/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,12 +269,12 @@ pub mod pallet {
/// Lookup table for foreign token ID to native location relative to ethereum
#[pallet::storage]
pub type ForeignToNativeId<T: Config> =
StorageMap<_, Blake2_128Concat, TokenId, xcm::v4::Location, OptionQuery>;
StorageMap<_, Blake2_128Concat, TokenId, xcm::v5::Location, OptionQuery>;

/// Lookup table for native location relative to ethereum to foreign token ID
#[pallet::storage]
pub type NativeToForeignId<T: Config> =
StorageMap<_, Blake2_128Concat, xcm::v4::Location, TokenId, OptionQuery>;
StorageMap<_, Blake2_128Concat, xcm::v5::Location, TokenId, OptionQuery>;

#[pallet::genesis_config]
#[derive(frame_support::DefaultNoBound)]
Expand Down
2 changes: 1 addition & 1 deletion cumulus/pallets/xcmp-queue/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,7 @@ impl<T: Config> InspectMessageQueues for Pallet<T> {
}

(
VersionedLocation::V4((Parent, Parachain(para_id.into())).into()),
VersionedLocation::from(Location::new(1, Parachain(para_id.into()))),
decoded_messages,
)
})
Expand Down
23 changes: 12 additions & 11 deletions cumulus/pallets/xcmp-queue/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ fn send_xcm_nested_works() {
XcmpQueue::take_outbound_messages(usize::MAX),
vec![(
HRMP_PARA_ID.into(),
(XcmpMessageFormat::ConcatenatedVersionedXcm, VersionedXcm::V4(good.clone()))
(XcmpMessageFormat::ConcatenatedVersionedXcm, VersionedXcm::from(good.clone()))
.encode(),
)]
);
Expand Down Expand Up @@ -512,7 +512,7 @@ fn hrmp_signals_are_prioritized() {
// Without a signal we get the messages in order:
let mut expected_msg = XcmpMessageFormat::ConcatenatedVersionedXcm.encode();
for _ in 0..31 {
expected_msg.extend(VersionedXcm::V4(message.clone()).encode());
expected_msg.extend(VersionedXcm::from(message.clone()).encode());
}

hypothetically!({
Expand All @@ -539,6 +539,7 @@ fn maybe_double_encoded_versioned_xcm_works() {
// pre conditions
assert_eq!(VersionedXcm::<()>::V3(Default::default()).encode(), &[3, 0]);
assert_eq!(VersionedXcm::<()>::V4(Default::default()).encode(), &[4, 0]);
assert_eq!(VersionedXcm::<()>::V5(Default::default()).encode(), &[5, 0]);
}

// Now also testing a page instead of just concat messages.
Expand Down Expand Up @@ -597,7 +598,7 @@ fn take_first_concatenated_xcm_good_recursion_depth_works() {
for _ in 0..MAX_XCM_DECODE_DEPTH - 1 {
good = Xcm(vec![SetAppendix(good)]);
}
let good = VersionedXcm::V4(good);
let good = VersionedXcm::from(good);

let page = good.encode();
assert_ok!(XcmpQueue::take_first_concatenated_xcm(&mut &page[..], &mut WeightMeter::new()));
Expand All @@ -610,7 +611,7 @@ fn take_first_concatenated_xcm_good_bad_depth_errors() {
for _ in 0..MAX_XCM_DECODE_DEPTH {
bad = Xcm(vec![SetAppendix(bad)]);
}
let bad = VersionedXcm::V4(bad);
let bad = VersionedXcm::from(bad);

let page = bad.encode();
assert_err!(
Expand Down Expand Up @@ -872,18 +873,18 @@ fn get_messages_works() {
queued_messages,
vec![
(
VersionedLocation::V4(other_destination),
VersionedLocation::from(other_destination),
vec![
VersionedXcm::V4(Xcm(vec![ClearOrigin])),
VersionedXcm::V4(Xcm(vec![ClearOrigin])),
VersionedXcm::from(Xcm(vec![ClearOrigin])),
VersionedXcm::from(Xcm(vec![ClearOrigin])),
],
),
(
VersionedLocation::V4(destination),
VersionedLocation::from(destination),
vec![
VersionedXcm::V4(Xcm(vec![ClearOrigin])),
VersionedXcm::V4(Xcm(vec![ClearOrigin])),
VersionedXcm::V4(Xcm(vec![ClearOrigin])),
VersionedXcm::from(Xcm(vec![ClearOrigin])),
VersionedXcm::from(Xcm(vec![ClearOrigin])),
VersionedXcm::from(Xcm(vec![ClearOrigin])),
],
),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl_accounts_helpers_for_parachain!(AssetHubRococo);
impl_assert_events_helpers_for_parachain!(AssetHubRococo);
impl_assets_helpers_for_system_parachain!(AssetHubRococo, Rococo);
impl_assets_helpers_for_parachain!(AssetHubRococo);
impl_foreign_assets_helpers_for_parachain!(AssetHubRococo, xcm::v4::Location);
impl_foreign_assets_helpers_for_parachain!(AssetHubRococo, xcm::v5::Location);
impl_xcm_helpers_for_parachain!(AssetHubRococo);
impl_bridge_helpers_for_chain!(
AssetHubRococo,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl_accounts_helpers_for_parachain!(AssetHubWestend);
impl_assert_events_helpers_for_parachain!(AssetHubWestend);
impl_assets_helpers_for_system_parachain!(AssetHubWestend, Westend);
impl_assets_helpers_for_parachain!(AssetHubWestend);
impl_foreign_assets_helpers_for_parachain!(AssetHubWestend, xcm::v4::Location);
impl_foreign_assets_helpers_for_parachain!(AssetHubWestend, xcm::v5::Location);
impl_xcm_helpers_for_parachain!(AssetHubWestend);
impl_bridge_helpers_for_chain!(
AssetHubWestend,
Expand Down
21 changes: 11 additions & 10 deletions cumulus/parachains/integration-tests/emulated/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ use polkadot_primitives::{AssignmentId, ValidatorId};
pub const XCM_V2: u32 = 2;
pub const XCM_V3: u32 = 3;
pub const XCM_V4: u32 = 4;
pub const XCM_V5: u32 = 5;
pub const REF_TIME_THRESHOLD: u64 = 33;
pub const PROOF_SIZE_THRESHOLD: u64 = 33;

Expand All @@ -60,19 +61,19 @@ pub const PENPAL_B_ID: u32 = 2001;
pub const ASSETS_PALLET_ID: u8 = 50;

parameter_types! {
pub PenpalTeleportableAssetLocation: xcm::v4::Location
= xcm::v4::Location::new(1, [
xcm::v4::Junction::Parachain(PENPAL_ID),
xcm::v4::Junction::PalletInstance(ASSETS_PALLET_ID),
xcm::v4::Junction::GeneralIndex(TELEPORTABLE_ASSET_ID.into()),
pub PenpalTeleportableAssetLocation: xcm::v5::Location
= xcm::v5::Location::new(1, [
xcm::v5::Junction::Parachain(PENPAL_ID),
xcm::v5::Junction::PalletInstance(ASSETS_PALLET_ID),
xcm::v5::Junction::GeneralIndex(TELEPORTABLE_ASSET_ID.into()),
]
);
pub PenpalSiblingSovereignAccount: AccountId = Sibling::from(PENPAL_ID).into_account_truncating();
pub PenpalBTeleportableAssetLocation: xcm::v4::Location
= xcm::v4::Location::new(1, [
xcm::v4::Junction::Parachain(PENPAL_B_ID),
xcm::v4::Junction::PalletInstance(ASSETS_PALLET_ID),
xcm::v4::Junction::GeneralIndex(TELEPORTABLE_ASSET_ID.into()),
pub PenpalBTeleportableAssetLocation: xcm::v5::Location
= xcm::v5::Location::new(1, [
xcm::v5::Junction::Parachain(PENPAL_B_ID),
xcm::v5::Junction::PalletInstance(ASSETS_PALLET_ID),
xcm::v5::Junction::GeneralIndex(TELEPORTABLE_ASSET_ID.into()),
]
);
pub PenpalBSiblingSovereignAccount: AccountId = Sibling::from(PENPAL_B_ID).into_account_truncating();
Expand Down
Loading
Loading