Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 4 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions cumulus/parachains/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,17 @@ runtime-benchmarks = [
"xcm-executor/runtime-benchmarks",
"xcm/runtime-benchmarks",
]

try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"pallet-asset-tx-payment/try-runtime",
"pallet-assets/try-runtime",
"pallet-authorship/try-runtime",
"pallet-balances/try-runtime",
"pallet-collator-selection/try-runtime",
"pallet-message-queue/try-runtime",
"pallet-xcm/try-runtime",
"parachain-info/try-runtime",
"sp-runtime/try-runtime",
]
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ sp-runtime.default-features = true
sp-runtime.workspace = true
xcm-emulator.default-features = true
xcm-emulator.workspace = true
xcm-executor.default-features = true
xcm-executor.workspace = true
xcm-simulator.default-features = true
xcm-simulator.workspace = true
xcm.default-features = true
Expand Down
27 changes: 17 additions & 10 deletions cumulus/parachains/integration-tests/emulated/common/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,15 @@ pub use polkadot_runtime_parachains::dmp::Pallet as Dmp;
pub use xcm::{
prelude::{
AccountId32, All, Asset, AssetId, BuyExecution, DepositAsset, ExpectTransactStatus,
Fungible, Here, Location, MaybeErrorCode, OriginKind, RefundSurplus, Transact, Unlimited,
VersionedAssets, VersionedXcm, WeightLimit, WithdrawAsset, Xcm,
Fungible, Here, Junction, Location, MaybeErrorCode, OriginKind, Parent, RefundSurplus,
Transact, Unlimited, VersionedAssetId, VersionedAssets, VersionedLocation, VersionedXcm,
WeightLimit, WithdrawAsset, Xcm,
},
v3::Location as V3Location,
};

pub use xcm_executor::traits::TransferType;

// Cumulus
pub use asset_test_utils;
pub use cumulus_pallet_xcmp_queue;
Expand Down Expand Up @@ -657,17 +660,21 @@ macro_rules! test_dry_run_transfer_across_pk_bridge {
// Give some initial funds.
<Balances as fungible::Mutate<_>>::set_balance(&who, initial_balance);

let call = RuntimeCall::PolkadotXcm(pallet_xcm::Call::transfer_assets {
dest: Box::new(VersionedLocation::from($destination)),
beneficiary: Box::new(VersionedLocation::from(Junction::AccountId32 {
let beneficiary: $crate::macros::Location = $crate::macros::Junction::AccountId32 {
id: who.clone().into(),
network: None,
})),
assets: Box::new(VersionedAssets::from(vec![
(Parent, transfer_amount).into(),
}.into();

let call = RuntimeCall::PolkadotXcm($crate::macros::pallet_xcm::Call::transfer_assets_using_type_and_then {
dest: Box::new($crate::macros::VersionedLocation::from($destination)),
assets: Box::new($crate::macros::VersionedAssets::from(vec![
($crate::macros::Parent, transfer_amount).into(),
])),
fee_asset_item: 0,
weight_limit: Unlimited,
assets_transfer_type: Box::new($crate::macros::TransferType::LocalReserve),
remote_fees_id: Box::new($crate::macros::VersionedAssetId::from($crate::macros::Parent)),
fees_transfer_type: Box::new($crate::macros::TransferType::LocalReserve),
custom_xcm_on_dest: Box::new($crate::macros::VersionedXcm::<()>::from($crate::macros::Xcm::<()>::builder_unsafe().deposit_asset(AllCounted(1), beneficiary).build())),
weight_limit: $crate::macros::Unlimited,
});
let result = Runtime::dry_run_call(OriginCaller::system(RawOrigin::Signed(who)), call, XCM_VERSION).unwrap();
// We assert the dry run succeeds and sends only one message to the local bridge hub.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,23 +180,57 @@ fn system_para_limited_teleport_assets(t: SystemParaToRelayTest) -> DispatchResu
}

fn para_to_system_para_transfer_assets(t: ParaToSystemParaTest) -> DispatchResult {
<PenpalA as PenpalAPallet>::PolkadotXcm::transfer_assets(
type Runtime = <PenpalA as Chain>::Runtime;
let remote_fee_id: AssetId = t
.args
.assets
.clone()
.into_inner()
.get(t.args.fee_asset_item as usize)
.ok_or(pallet_xcm::Error::<Runtime>::Empty)?
.clone()
.id;

<PenpalA as PenpalAPallet>::PolkadotXcm::transfer_assets_using_type_and_then(
t.signed_origin,
bx!(t.args.dest.into()),
bx!(t.args.beneficiary.into()),
bx!(t.args.assets.into()),
t.args.fee_asset_item,
bx!(TransferType::Teleport),
bx!(remote_fee_id.into()),
bx!(TransferType::DestinationReserve),
bx!(VersionedXcm::from(
Xcm::<()>::builder_unsafe()
.deposit_asset(AllCounted(2), t.args.beneficiary)
.build()
)),
t.args.weight_limit,
)
}

fn system_para_to_para_transfer_assets(t: SystemParaToParaTest) -> DispatchResult {
<AssetHubRococo as AssetHubRococoPallet>::PolkadotXcm::transfer_assets(
type Runtime = <AssetHubRococo as Chain>::Runtime;
let remote_fee_id: AssetId = t
.args
.assets
.clone()
.into_inner()
.get(t.args.fee_asset_item as usize)
.ok_or(pallet_xcm::Error::<Runtime>::Empty)?
.clone()
.id;

<AssetHubRococo as AssetHubRococoPallet>::PolkadotXcm::transfer_assets_using_type_and_then(
t.signed_origin,
bx!(t.args.dest.into()),
bx!(t.args.beneficiary.into()),
bx!(t.args.assets.into()),
t.args.fee_asset_item,
bx!(TransferType::Teleport),
bx!(remote_fee_id.into()),
bx!(TransferType::LocalReserve),
bx!(VersionedXcm::from(
Xcm::<()>::builder_unsafe()
.deposit_asset(AllCounted(2), t.args.beneficiary)
.build()
)),
t.args.weight_limit,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ mod set_xcm_versions;
mod swap;
mod teleport;
mod transact;
mod transfer_assets_validation;
mod treasury;
mod xcm_fee_estimation;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,23 +169,57 @@ fn system_para_limited_teleport_assets(t: SystemParaToRelayTest) -> DispatchResu
}

fn para_to_system_para_transfer_assets(t: ParaToSystemParaTest) -> DispatchResult {
<PenpalA as PenpalAPallet>::PolkadotXcm::transfer_assets(
type Runtime = <PenpalA as Chain>::Runtime;
let remote_fee_id: AssetId = t
.args
.assets
.clone()
.into_inner()
.get(t.args.fee_asset_item as usize)
.ok_or(pallet_xcm::Error::<Runtime>::Empty)?
.clone()
.id;

<PenpalA as PenpalAPallet>::PolkadotXcm::transfer_assets_using_type_and_then(
t.signed_origin,
bx!(t.args.dest.into()),
bx!(t.args.beneficiary.into()),
bx!(t.args.assets.into()),
t.args.fee_asset_item,
bx!(TransferType::Teleport),
bx!(remote_fee_id.into()),
bx!(TransferType::DestinationReserve),
bx!(VersionedXcm::from(
Xcm::<()>::builder_unsafe()
.deposit_asset(AllCounted(2), t.args.beneficiary)
.build()
)),
t.args.weight_limit,
)
}

fn system_para_to_para_transfer_assets(t: SystemParaToParaTest) -> DispatchResult {
<AssetHubWestend as AssetHubWestendPallet>::PolkadotXcm::transfer_assets(
type Runtime = <AssetHubWestend as Chain>::Runtime;
let remote_fee_id: AssetId = t
.args
.assets
.clone()
.into_inner()
.get(t.args.fee_asset_item as usize)
.ok_or(pallet_xcm::Error::<Runtime>::Empty)?
.clone()
.id;

<AssetHubWestend as AssetHubWestendPallet>::PolkadotXcm::transfer_assets_using_type_and_then(
t.signed_origin,
bx!(t.args.dest.into()),
bx!(t.args.beneficiary.into()),
bx!(t.args.assets.into()),
t.args.fee_asset_item,
bx!(TransferType::Teleport),
bx!(remote_fee_id.into()),
bx!(TransferType::LocalReserve),
bx!(VersionedXcm::from(
Xcm::<()>::builder_unsafe()
.deposit_asset(AllCounted(2), t.args.beneficiary)
.build()
)),
t.args.weight_limit,
)
}
Expand Down
Loading
Loading