Skip to content

Commit fe847b9

Browse files
karolk91acatangiu
andauthored
Update pallet-xcm to 22.0.1 (latest unstable2507) (#880)
Update of pallet-xcm in order integrate changes from paritytech/polkadot-sdk#9544 New version of `pallet-xcm` was published from `unstable2507` (paritytech/polkadot-sdk#9643) TODO: - [x] migrate tests using `reserve_transfer_assets`, `limited_reserve_transfer_assets` to `transfer_assets_using_type_and_then` - [x] fix `reserve_transferable_asset_and_dest` benchmarks to use USDT instead of DOT - [x] update `reserve_transfer_assets` weights to `Weight::MAX` for relays - [x] add changelog entry --------- Co-authored-by: Adrian Catangiu <adrian@parity.io>
1 parent 18cbc8b commit fe847b9

File tree

18 files changed

+364
-119
lines changed

18 files changed

+364
-119
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ Changelog for the runtimes governed by the Polkadot Fellowship.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
66

7+
## [Unreleased]
8+
9+
### Changed
10+
11+
- Pallet XCM - Disable reserve_asset_transfer for DOT|KSM ([polkadot-fellows/runtimes/pull/880](https://github.com/polkadot-fellows/runtimes/pull/880))
12+
🚨 Pallet XCM's `limited_reserve_transfer_assets` and `reserve_transfer_assets` extrinsics now returns an error when it determines that a reserve transfer of DOT|KSM has to be done.
13+
This is a safeguard in preparation for the Asset Hub Migration (AHM), where the reserve of DOT|KSM will change from the Relay Chain to Asset Hub.
14+
After the migration, another patch will remove this error case and use the correct reserve.
15+
🚨 For DOT|KSM cross-chain transfers please use `transfer_assets_using_type_and_then` or `execute`.
16+
Please see this [Polkadot forum post](https://forum.polkadot.network/t/mandatory-action-guide-for-ahm-broken-native-crosschain-transfers/) for more details.
17+
718
## [1.7.1] 28.08.2025
819

920
### Fixed

Cargo.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ asset-hub-kusama-emulated-chain = { path = "integration-tests/emulated/chains/pa
1212
asset-hub-kusama-runtime = { path = "system-parachains/asset-hubs/asset-hub-kusama" }
1313
asset-hub-polkadot-emulated-chain = { path = "integration-tests/emulated/chains/parachains/assets/asset-hub-polkadot" }
1414
asset-hub-polkadot-runtime = { path = "system-parachains/asset-hubs/asset-hub-polkadot" }
15-
asset-test-utils = { version = "26.0.0" }
15+
asset-test-utils = { version = "26.0.1" }
1616
assets-common = { version = "0.24.0", default-features = false }
1717
authority-discovery-primitives = { version = "38.0.0", default-features = false, package = "sp-authority-discovery" }
1818
babe-primitives = { version = "0.44.0", default-features = false, package = "sp-consensus-babe" }
@@ -170,7 +170,7 @@ pallet-uniques = { version = "42.0.0", default-features = false }
170170
pallet-utility = { version = "42.0.0", default-features = false }
171171
pallet-vesting = { version = "42.0.0", default-features = false }
172172
pallet-whitelist = { version = "41.0.0", default-features = false }
173-
pallet-xcm = { version = "22.0.0", default-features = false }
173+
pallet-xcm = { version = "22.0.1", default-features = false }
174174
pallet-xcm-benchmarks = { version = "22.0.0", default-features = false }
175175
pallet-xcm-bridge-hub = { version = "0.18.0", default-features = false }
176176
pallet-xcm-bridge-hub-router = { version = "0.20.0", default-features = false }

integration-tests/emulated/tests/assets/asset-hub-kusama/src/tests/reserve_transfer.rs

Lines changed: 100 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -374,46 +374,113 @@ fn relay_to_para_reserve_transfer_assets(t: RelayToParaTest) -> DispatchResult {
374374
let Parachain(para_id) = *t.args.dest.chain_location().last().unwrap() else {
375375
unimplemented!("Destination is not a parachain?")
376376
};
377+
type Runtime = <Kusama as Chain>::Runtime;
378+
let remote_fee_id: AssetId = t
379+
.args
380+
.assets
381+
.clone()
382+
.into_inner()
383+
.get(t.args.fee_asset_item as usize)
384+
.ok_or(pallet_xcm::Error::<Runtime>::Empty)?
385+
.clone()
386+
.id;
377387
Dmp::make_parachain_reachable(para_id);
378-
<Kusama as KusamaPallet>::XcmPallet::limited_reserve_transfer_assets(
388+
<Kusama as KusamaPallet>::XcmPallet::transfer_assets_using_type_and_then(
379389
t.signed_origin,
380390
bx!(t.args.dest.into()),
381-
bx!(t.args.beneficiary.into()),
382391
bx!(t.args.assets.into()),
383-
t.args.fee_asset_item,
392+
bx!(TransferType::LocalReserve),
393+
bx!(remote_fee_id.into()),
394+
bx!(TransferType::LocalReserve),
395+
bx!(VersionedXcm::from(
396+
Xcm::<()>::builder_unsafe()
397+
.deposit_asset(AllCounted(1), t.args.beneficiary)
398+
.build()
399+
)),
384400
t.args.weight_limit,
385401
)
386402
}
387403

388404
fn para_to_relay_reserve_transfer_assets(t: ParaToRelayTest) -> DispatchResult {
389-
<PenpalA as PenpalAPallet>::PolkadotXcm::limited_reserve_transfer_assets(
405+
type Runtime = <PenpalA as Chain>::Runtime;
406+
let remote_fee_id: AssetId = t
407+
.args
408+
.assets
409+
.clone()
410+
.into_inner()
411+
.get(t.args.fee_asset_item as usize)
412+
.ok_or(pallet_xcm::Error::<Runtime>::Empty)?
413+
.clone()
414+
.id;
415+
416+
<PenpalA as PenpalAPallet>::PolkadotXcm::transfer_assets_using_type_and_then(
390417
t.signed_origin,
391418
bx!(t.args.dest.into()),
392-
bx!(t.args.beneficiary.into()),
393419
bx!(t.args.assets.into()),
394-
t.args.fee_asset_item,
420+
bx!(TransferType::DestinationReserve),
421+
bx!(remote_fee_id.into()),
422+
bx!(TransferType::DestinationReserve),
423+
bx!(VersionedXcm::from(
424+
Xcm::<()>::builder_unsafe()
425+
.deposit_asset(AllCounted(1), t.args.beneficiary)
426+
.build()
427+
)),
395428
t.args.weight_limit,
396429
)
397430
}
398431

399432
fn system_para_to_para_reserve_transfer_assets(t: SystemParaToParaTest) -> DispatchResult {
400-
<AssetHubKusama as AssetHubKusamaPallet>::PolkadotXcm::limited_reserve_transfer_assets(
433+
type Runtime = <AssetHubKusama as Chain>::Runtime;
434+
let remote_fee_id: AssetId = t
435+
.args
436+
.assets
437+
.clone()
438+
.into_inner()
439+
.get(t.args.fee_asset_item as usize)
440+
.ok_or(pallet_xcm::Error::<Runtime>::Empty)?
441+
.clone()
442+
.id;
443+
444+
<AssetHubKusama as AssetHubKusamaPallet>::PolkadotXcm::transfer_assets_using_type_and_then(
401445
t.signed_origin,
402446
bx!(t.args.dest.into()),
403-
bx!(t.args.beneficiary.into()),
404447
bx!(t.args.assets.into()),
405-
t.args.fee_asset_item,
448+
bx!(TransferType::LocalReserve),
449+
bx!(remote_fee_id.into()),
450+
bx!(TransferType::LocalReserve),
451+
bx!(VersionedXcm::from(
452+
Xcm::<()>::builder_unsafe()
453+
.deposit_asset(AllCounted(2), t.args.beneficiary)
454+
.build()
455+
)),
406456
t.args.weight_limit,
407457
)
408458
}
409459

410460
fn para_to_system_para_reserve_transfer_assets(t: ParaToSystemParaTest) -> DispatchResult {
411-
<PenpalA as PenpalAPallet>::PolkadotXcm::limited_reserve_transfer_assets(
461+
type Runtime = <PenpalA as Chain>::Runtime;
462+
let remote_fee_id: AssetId = t
463+
.args
464+
.assets
465+
.clone()
466+
.into_inner()
467+
.get(t.args.fee_asset_item as usize)
468+
.ok_or(pallet_xcm::Error::<Runtime>::Empty)?
469+
.clone()
470+
.id;
471+
472+
<PenpalA as PenpalAPallet>::PolkadotXcm::transfer_assets_using_type_and_then(
412473
t.signed_origin,
413474
bx!(t.args.dest.into()),
414-
bx!(t.args.beneficiary.into()),
415475
bx!(t.args.assets.into()),
416-
t.args.fee_asset_item,
476+
bx!(TransferType::DestinationReserve),
477+
bx!(remote_fee_id.into()),
478+
bx!(TransferType::DestinationReserve),
479+
bx!(VersionedXcm::from(
480+
Xcm::<()>::builder_unsafe()
481+
.deposit_asset(AllCounted(2), t.args.beneficiary)
482+
.build()
483+
)),
417484
t.args.weight_limit,
418485
)
419486
}
@@ -424,15 +491,33 @@ fn para_to_para_through_relay_limited_reserve_transfer_assets(
424491
let Parachain(para_id) = *t.args.dest.chain_location().last().unwrap() else {
425492
unimplemented!("Destination is not a parachain?")
426493
};
494+
type Runtime = <PenpalB as Chain>::Runtime;
495+
let remote_fee_id: AssetId = t
496+
.args
497+
.assets
498+
.clone()
499+
.into_inner()
500+
.get(t.args.fee_asset_item as usize)
501+
.ok_or(pallet_xcm::Error::<Runtime>::Empty)?
502+
.clone()
503+
.id;
504+
505+
let relay_location = VersionedLocation::from(Location::parent());
427506
Kusama::ext_wrapper(|| {
428507
Dmp::make_parachain_reachable(para_id);
429508
});
430-
<PenpalA as PenpalAPallet>::PolkadotXcm::limited_reserve_transfer_assets(
509+
<PenpalA as PenpalAPallet>::PolkadotXcm::transfer_assets_using_type_and_then(
431510
t.signed_origin,
432511
bx!(t.args.dest.into()),
433-
bx!(t.args.beneficiary.into()),
434512
bx!(t.args.assets.into()),
435-
t.args.fee_asset_item,
513+
bx!(TransferType::RemoteReserve(relay_location.clone())),
514+
bx!(remote_fee_id.into()),
515+
bx!(TransferType::RemoteReserve(relay_location)),
516+
bx!(VersionedXcm::from(
517+
Xcm::<()>::builder_unsafe()
518+
.deposit_asset(AllCounted(1), t.args.beneficiary)
519+
.build()
520+
)),
436521
t.args.weight_limit,
437522
)
438523
}

integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/reserve_transfer.rs

Lines changed: 100 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -375,46 +375,113 @@ fn relay_to_para_reserve_transfer_assets(t: RelayToParaTest) -> DispatchResult {
375375
let Parachain(para_id) = *t.args.dest.chain_location().last().unwrap() else {
376376
unimplemented!("Destination is not a parachain?")
377377
};
378+
type Runtime = <Polkadot as Chain>::Runtime;
379+
let remote_fee_id: AssetId = t
380+
.args
381+
.assets
382+
.clone()
383+
.into_inner()
384+
.get(t.args.fee_asset_item as usize)
385+
.ok_or(pallet_xcm::Error::<Runtime>::Empty)?
386+
.clone()
387+
.id;
378388
Dmp::make_parachain_reachable(para_id);
379-
<Polkadot as PolkadotPallet>::XcmPallet::limited_reserve_transfer_assets(
389+
<Polkadot as PolkadotPallet>::XcmPallet::transfer_assets_using_type_and_then(
380390
t.signed_origin,
381391
bx!(t.args.dest.into()),
382-
bx!(t.args.beneficiary.into()),
383392
bx!(t.args.assets.into()),
384-
t.args.fee_asset_item,
393+
bx!(TransferType::LocalReserve),
394+
bx!(remote_fee_id.into()),
395+
bx!(TransferType::LocalReserve),
396+
bx!(VersionedXcm::from(
397+
Xcm::<()>::builder_unsafe()
398+
.deposit_asset(AllCounted(1), t.args.beneficiary)
399+
.build()
400+
)),
385401
t.args.weight_limit,
386402
)
387403
}
388404

389405
fn para_to_relay_reserve_transfer_assets(t: ParaToRelayTest) -> DispatchResult {
390-
<PenpalA as PenpalAPallet>::PolkadotXcm::limited_reserve_transfer_assets(
406+
type Runtime = <PenpalA as Chain>::Runtime;
407+
let remote_fee_id: AssetId = t
408+
.args
409+
.assets
410+
.clone()
411+
.into_inner()
412+
.get(t.args.fee_asset_item as usize)
413+
.ok_or(pallet_xcm::Error::<Runtime>::Empty)?
414+
.clone()
415+
.id;
416+
417+
<PenpalA as PenpalAPallet>::PolkadotXcm::transfer_assets_using_type_and_then(
391418
t.signed_origin,
392419
bx!(t.args.dest.into()),
393-
bx!(t.args.beneficiary.into()),
394420
bx!(t.args.assets.into()),
395-
t.args.fee_asset_item,
421+
bx!(TransferType::DestinationReserve),
422+
bx!(remote_fee_id.into()),
423+
bx!(TransferType::DestinationReserve),
424+
bx!(VersionedXcm::from(
425+
Xcm::<()>::builder_unsafe()
426+
.deposit_asset(AllCounted(1), t.args.beneficiary)
427+
.build()
428+
)),
396429
t.args.weight_limit,
397430
)
398431
}
399432

400433
fn system_para_to_para_reserve_transfer_assets(t: SystemParaToParaTest) -> DispatchResult {
401-
<AssetHubPolkadot as AssetHubPolkadotPallet>::PolkadotXcm::limited_reserve_transfer_assets(
434+
type Runtime = <AssetHubPolkadot as Chain>::Runtime;
435+
let remote_fee_id: AssetId = t
436+
.args
437+
.assets
438+
.clone()
439+
.into_inner()
440+
.get(t.args.fee_asset_item as usize)
441+
.ok_or(pallet_xcm::Error::<Runtime>::Empty)?
442+
.clone()
443+
.id;
444+
445+
<AssetHubPolkadot as AssetHubPolkadotPallet>::PolkadotXcm::transfer_assets_using_type_and_then(
402446
t.signed_origin,
403447
bx!(t.args.dest.into()),
404-
bx!(t.args.beneficiary.into()),
405448
bx!(t.args.assets.into()),
406-
t.args.fee_asset_item,
449+
bx!(TransferType::LocalReserve),
450+
bx!(remote_fee_id.into()),
451+
bx!(TransferType::LocalReserve),
452+
bx!(VersionedXcm::from(
453+
Xcm::<()>::builder_unsafe()
454+
.deposit_asset(AllCounted(2), t.args.beneficiary)
455+
.build()
456+
)),
407457
t.args.weight_limit,
408458
)
409459
}
410460

411461
fn para_to_system_para_reserve_transfer_assets(t: ParaToSystemParaTest) -> DispatchResult {
412-
<PenpalB as PenpalBPallet>::PolkadotXcm::limited_reserve_transfer_assets(
462+
type Runtime = <PenpalB as Chain>::Runtime;
463+
let remote_fee_id: AssetId = t
464+
.args
465+
.assets
466+
.clone()
467+
.into_inner()
468+
.get(t.args.fee_asset_item as usize)
469+
.ok_or(pallet_xcm::Error::<Runtime>::Empty)?
470+
.clone()
471+
.id;
472+
473+
<PenpalB as PenpalBPallet>::PolkadotXcm::transfer_assets_using_type_and_then(
413474
t.signed_origin,
414475
bx!(t.args.dest.into()),
415-
bx!(t.args.beneficiary.into()),
416476
bx!(t.args.assets.into()),
417-
t.args.fee_asset_item,
477+
bx!(TransferType::DestinationReserve),
478+
bx!(remote_fee_id.into()),
479+
bx!(TransferType::DestinationReserve),
480+
bx!(VersionedXcm::from(
481+
Xcm::<()>::builder_unsafe()
482+
.deposit_asset(AllCounted(2), t.args.beneficiary)
483+
.build()
484+
)),
418485
t.args.weight_limit,
419486
)
420487
}
@@ -425,15 +492,33 @@ fn para_to_para_through_relay_limited_reserve_transfer_assets(
425492
let Parachain(para_id) = *t.args.dest.chain_location().last().unwrap() else {
426493
unimplemented!("Destination is not a parachain?")
427494
};
495+
type Runtime = <PenpalB as Chain>::Runtime;
496+
let remote_fee_id: AssetId = t
497+
.args
498+
.assets
499+
.clone()
500+
.into_inner()
501+
.get(t.args.fee_asset_item as usize)
502+
.ok_or(pallet_xcm::Error::<Runtime>::Empty)?
503+
.clone()
504+
.id;
505+
506+
let relay_location = VersionedLocation::from(Location::parent());
428507
Polkadot::ext_wrapper(|| {
429508
Dmp::make_parachain_reachable(para_id);
430509
});
431-
<PenpalB as PenpalBPallet>::PolkadotXcm::limited_reserve_transfer_assets(
510+
<PenpalB as PenpalBPallet>::PolkadotXcm::transfer_assets_using_type_and_then(
432511
t.signed_origin,
433512
bx!(t.args.dest.into()),
434-
bx!(t.args.beneficiary.into()),
435513
bx!(t.args.assets.into()),
436-
t.args.fee_asset_item,
514+
bx!(TransferType::RemoteReserve(relay_location.clone())),
515+
bx!(remote_fee_id.into()),
516+
bx!(TransferType::RemoteReserve(relay_location)),
517+
bx!(VersionedXcm::from(
518+
Xcm::<()>::builder_unsafe()
519+
.deposit_asset(AllCounted(1), t.args.beneficiary)
520+
.build()
521+
)),
437522
t.args.weight_limit,
438523
)
439524
}

0 commit comments

Comments
 (0)