Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
3d7e24a
feat(xcm): add PayFees instruction
franciscoaguirre Aug 20, 2024
0a88320
chore(xcm-executor): clean up executor unit test and move everything …
franciscoaguirre Aug 21, 2024
0b16ca5
Merge branch 'xcm-v5' into xcm-pay-fees
franciscoaguirre Aug 21, 2024
2393087
feat(xcm-executor): tests for delivery fees and old BuyExecution
franciscoaguirre Aug 21, 2024
b9ca9e0
feat(xcm-executor): interaction between PayFees and RefundSurplus
franciscoaguirre Aug 21, 2024
22efce5
fix(xcm): add builder(pays_fees) to old xcm versions
franciscoaguirre Aug 21, 2024
49f63a4
chore(xcm-executor): unhappy tests for PayFees
franciscoaguirre Aug 21, 2024
50b06d6
chore(xcm-executor): test that leftover fees are also trapped
franciscoaguirre Aug 23, 2024
738a8c1
chore: add made-up benchmarks to all runtimes
franciscoaguirre Aug 26, 2024
995cc09
feat(xcm-builder): allow PayFees in AllowTopLevelPaidExecutionFrom ba…
franciscoaguirre Aug 26, 2024
679c3c7
feat(xcm-executor): use fees register in DepositReserveAsset
franciscoaguirre Aug 26, 2024
d934c64
feat(xcm-emulator): add set_call method for dispatching calls
franciscoaguirre Aug 26, 2024
52f3ba1
test(asset-hub-westend-integration-tests): add xcm estimation test wi…
franciscoaguirre Aug 26, 2024
900bb46
fix: fmt
franciscoaguirre Aug 26, 2024
56bcd4d
fix(xcm-executor): remove unnecessary clones
franciscoaguirre Aug 27, 2024
c062c0c
chore(asset-hub-westend-integration-tests): refactor test to decl macro
franciscoaguirre Aug 27, 2024
94f831f
feat(asset-hub-rococo-integration-tests): add PayFees test
franciscoaguirre Aug 27, 2024
3198950
fix: fmt
franciscoaguirre Aug 27, 2024
6bf562b
".git/.scripts/commands/bench/bench.sh" --subcommand=xcm --runtime=ro…
Aug 27, 2024
15a5333
".git/.scripts/commands/bench/bench.sh" --subcommand=xcm --runtime=we…
Aug 27, 2024
fb79e69
".git/.scripts/commands/bench/bench.sh" --subcommand=xcm --runtime=co…
Aug 27, 2024
4c9dddc
".git/.scripts/commands/bench/bench.sh" --subcommand=xcm --runtime=as…
Aug 27, 2024
a8d5d1d
".git/.scripts/commands/bench/bench.sh" --subcommand=xcm --runtime=as…
Aug 27, 2024
c1c95dc
".git/.scripts/commands/bench/bench.sh" --subcommand=xcm --runtime=co…
Aug 27, 2024
0c5afe3
".git/.scripts/commands/bench/bench.sh" --subcommand=xcm --runtime=br…
Aug 27, 2024
338d8de
".git/.scripts/commands/bench/bench.sh" --subcommand=xcm --runtime=br…
Aug 27, 2024
12164f8
".git/.scripts/commands/bench/bench.sh" --subcommand=xcm --runtime=pe…
Aug 27, 2024
c3b6bd0
chore: add missing benchmark and made up benchmarks for all runtimes
franciscoaguirre Aug 27, 2024
e2c620e
fix: remove duplicated weight
franciscoaguirre Aug 27, 2024
86b151c
fix: remove unused imports
franciscoaguirre Aug 27, 2024
2937662
Merge branch 'xcm-v5' into xcm-pay-fees
franciscoaguirre Aug 27, 2024
0eaa9fb
".git/.scripts/commands/bench/bench.sh" --subcommand=xcm --runtime=we…
Aug 27, 2024
39cf7b1
".git/.scripts/commands/bench/bench.sh" --subcommand=xcm --runtime=ro…
Aug 27, 2024
abe36c3
".git/.scripts/commands/bench/bench.sh" --subcommand=xcm --runtime=co…
Aug 27, 2024
a60172c
".git/.scripts/commands/bench/bench.sh" --subcommand=xcm --runtime=as…
Aug 27, 2024
8470fca
".git/.scripts/commands/bench/bench.sh" --subcommand=xcm --runtime=as…
Aug 27, 2024
6a59c1d
".git/.scripts/commands/bench/bench.sh" --subcommand=xcm --runtime=br…
Aug 27, 2024
bdae9ec
".git/.scripts/commands/bench/bench.sh" --subcommand=xcm --runtime=co…
Aug 27, 2024
6b339a0
".git/.scripts/commands/bench/bench.sh" --subcommand=xcm --runtime=br…
Aug 27, 2024
02b0fbb
".git/.scripts/commands/bench/bench.sh" --subcommand=xcm --runtime=pe…
Aug 27, 2024
ec92154
".git/.scripts/commands/bench/bench.sh" --subcommand=xcm --runtime=pe…
Aug 27, 2024
1091ac7
doc: add prdoc
franciscoaguirre Aug 30, 2024
f0f1aac
fix: prdoc
franciscoaguirre Aug 30, 2024
3b8ca9b
Added SetAssetClaimer instruction
x3c41a Aug 20, 2024
62bbed2
added prdoc
x3c41a Aug 20, 2024
3530dac
added missing column
x3c41a Aug 20, 2024
55334d4
fixed prdoc: added crates
x3c41a Aug 20, 2024
70def18
Update SetAssetClaimer description
x3c41a Aug 20, 2024
7f01c81
Formated SetAssetClaimer
x3c41a Aug 20, 2024
7e66a0b
Removed v3::MultiLocation
x3c41a Aug 20, 2024
50ce92a
changed asset claimer variable name from camel case to snake case
x3c41a Aug 20, 2024
ae2aeea
initialized XCMExecutor with an empty asset_claimer
x3c41a Aug 20, 2024
9f631d6
Added missing instructions coverter
x3c41a Aug 20, 2024
6c87c89
applied linter suggestions
x3c41a Aug 20, 2024
f6577d3
applied linter suggestions[2]
x3c41a Aug 20, 2024
00afd7d
fixed type mismatch and other compilation errs
x3c41a Aug 21, 2024
c85431a
added missing implementation (or todo!() ) for AssetHubWestendXcmWeight
x3c41a Aug 21, 2024
0909796
few minor refactors
x3c41a Aug 21, 2024
cd955b0
unit tests in progress
x3c41a Aug 26, 2024
ff094a7
Added unit test for SetAssetClaimer
x3c41a Aug 26, 2024
05f84d6
[WIP] set_asset_claimer e2e test
x3c41a Aug 28, 2024
774575e
Implemented pay_fees for the testnets
x3c41a Aug 28, 2024
9251243
WIP e2e tests - claimAssets step
x3c41a Aug 30, 2024
d023326
Fixed dispatch
x3c41a Aug 30, 2024
fb470f0
finished first SAC e2e single chain test
x3c41a Sep 2, 2024
54eb55d
benchmarks initial commit
x3c41a Sep 2, 2024
846f109
Reverted cumulus/parachains/runtimes/assets/asset-hub-westend/src/wei…
x3c41a Sep 3, 2024
22db776
add made-up benchmarks to all runtimes
x3c41a Sep 3, 2024
defa01b
removed commented instruction
x3c41a Sep 3, 2024
7873850
added set_asset_claimer to pallet_xcm WeightInfo trait and implemente…
x3c41a Sep 3, 2024
16ef4d3
resolved merge conflicts
x3c41a Sep 3, 2024
5fa7734
Added unit test for SetAssetClaimer
x3c41a Aug 26, 2024
33676d5
resolved merge conflicts[3]
x3c41a Sep 3, 2024
9b5f639
resolved merge conflicts[4]
x3c41a Sep 3, 2024
fd0807b
reverted cumulus/parachains/runtimes/assets/asset-hub-westend/src/wei…
x3c41a Sep 3, 2024
d5e98b4
fixed benchmark
x3c41a Sep 3, 2024
358544e
merged into xcm-pay-fees branch
x3c41a Sep 4, 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/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -651,8 +651,8 @@ mod tests {
assert_eq!(
XcmBridgeHubRouter::get_messages(),
vec![(
VersionedLocation::V4((Parent, Parachain(1002)).into()),
vec![VersionedXcm::V4(
VersionedLocation::V5((Parent, Parachain(1002)).into()),
vec![VersionedXcm::V5(
Xcm::builder()
.withdraw_asset((Parent, 1_002_000))
.buy_execution((Parent, 1_002_000), Unlimited)
Expand Down
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 @@ -137,8 +137,8 @@ impl InspectMessageQueues for TestToBridgeHubSender {
.iter()
.map(|(location, message)| {
(
VersionedLocation::V4(location.clone()),
vec![VersionedXcm::V4(message.clone())],
VersionedLocation::V5(location.clone()),
vec![VersionedXcm::V5(message.clone())],
)
})
.collect()
Expand Down
2 changes: 1 addition & 1 deletion cumulus/pallets/parachain-system/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1548,7 +1548,7 @@ impl<T: Config> InspectMessageQueues for Pallet<T> {
.map(|encoded_message| VersionedXcm::<()>::decode(&mut &encoded_message[..]).unwrap())
.collect();

vec![(VersionedLocation::V4(Parent.into()), messages)]
vec![(VersionedLocation::V5(Parent.into()), messages)]
}
}

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 @@ -1031,7 +1031,7 @@ impl<T: Config> InspectMessageQueues for Pallet<T> {
}

(
VersionedLocation::V4((Parent, Parachain(para_id.into())).into()),
VersionedLocation::V5((Parent, Parachain(para_id.into())).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::V5(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::V5(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::V5(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::V5(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::V5(other_destination),
vec![
VersionedXcm::V4(Xcm(vec![ClearOrigin])),
VersionedXcm::V4(Xcm(vec![ClearOrigin])),
VersionedXcm::V5(Xcm(vec![ClearOrigin])),
VersionedXcm::V5(Xcm(vec![ClearOrigin])),
],
),
(
VersionedLocation::V4(destination),
VersionedLocation::V5(destination),
vec![
VersionedXcm::V4(Xcm(vec![ClearOrigin])),
VersionedXcm::V4(Xcm(vec![ClearOrigin])),
VersionedXcm::V4(Xcm(vec![ClearOrigin])),
VersionedXcm::V5(Xcm(vec![ClearOrigin])),
VersionedXcm::V5(Xcm(vec![ClearOrigin])),
VersionedXcm::V5(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
11 changes: 6 additions & 5 deletions cumulus/parachains/integration-tests/emulated/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,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 @@ -63,11 +64,11 @@ pub const PENPAL_ID: u32 = 2000;
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();
Expand Down
224 changes: 224 additions & 0 deletions cumulus/parachains/integration-tests/emulated/common/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,3 +403,227 @@ macro_rules! test_chain_can_claim_assets {
}
};
}

#[macro_export]
macro_rules! test_can_estimate_and_pay_exact_fees {
( $sender_para:ty, $asset_hub:ty, $receiver_para:ty, ($asset_id:expr, $amount:expr), $owner_prefix:ty ) => {
$crate::macros::paste::paste! {
// We first define the call we'll use throughout the test.
fn get_call(
estimated_local_fees: impl Into<Asset>,
estimated_intermediate_fees: impl Into<Asset>,
estimated_remote_fees: impl Into<Asset>,
) -> <$sender_para as Chain>::RuntimeCall {
type RuntimeCall = <$sender_para as Chain>::RuntimeCall;

let beneficiary = [<$receiver_para Receiver>]::get();
let xcm_in_destination = Xcm::<()>::builder_unsafe()
.pay_fees(estimated_remote_fees)
.deposit_asset(AllCounted(1), beneficiary)
.build();
let ah_to_receiver = $asset_hub::sibling_location_of($receiver_para::para_id());
let xcm_in_reserve = Xcm::<()>::builder_unsafe()
.pay_fees(estimated_intermediate_fees)
.deposit_reserve_asset(
AllCounted(1),
ah_to_receiver,
xcm_in_destination,
)
.build();
let sender_to_ah = $sender_para::sibling_location_of($asset_hub::para_id());
let local_xcm = Xcm::<<$sender_para as Chain>::RuntimeCall>::builder()
.withdraw_asset(($asset_id, $amount))
.pay_fees(estimated_local_fees)
.initiate_reserve_withdraw(AllCounted(1), sender_to_ah, xcm_in_reserve)
.build();

RuntimeCall::PolkadotXcm(pallet_xcm::Call::execute {
message: bx!(VersionedXcm::from(local_xcm)),
max_weight: Weight::from_parts(10_000_000_000, 500_000),
})
}

let destination = $sender_para::sibling_location_of($receiver_para::para_id());
let sender = [<$sender_para Sender>]::get();
let sender_as_seen_by_ah = $asset_hub::sibling_location_of($sender_para::para_id());
let sov_of_sender_on_ah = $asset_hub::sovereign_account_id_of(sender_as_seen_by_ah.clone());
let asset_owner = [<$owner_prefix AssetOwner>]::get();

// Fund parachain's sender account.
$sender_para::mint_foreign_asset(
<$sender_para as Chain>::RuntimeOrigin::signed(asset_owner.clone()),
$asset_id.clone().into(),
sender.clone(),
$amount * 2,
);

// Fund the parachain origin's SA on Asset Hub with the native tokens.
$asset_hub::fund_accounts(vec![(sov_of_sender_on_ah.clone(), $amount * 2)]);

let beneficiary_id = [<$receiver_para Receiver>]::get();

let test_args = TestContext {
sender: sender.clone(),
receiver: beneficiary_id.clone(),
args: TestArgs::new_para(
destination,
beneficiary_id.clone(),
$amount,
($asset_id, $amount).into(),
None,
0,
),
};
let mut test = ParaToParaThroughAHTest::new(test_args);

// We get these from the closure.
let mut local_execution_fees = 0;
let mut local_delivery_fees = 0;
let mut remote_message = VersionedXcm::from(Xcm::<()>(Vec::new()));
<$sender_para as TestExt>::execute_with(|| {
type Runtime = <$sender_para as Chain>::Runtime;
type OriginCaller = <$sender_para as Chain>::OriginCaller;

let call = get_call(
(Parent, 100_000_000_000u128),
(Parent, 100_000_000_000u128),
(Parent, 100_000_000_000u128),
);
let origin = OriginCaller::system(RawOrigin::Signed(sender.clone()));
let result = Runtime::dry_run_call(origin, call).unwrap();
let local_xcm = result.local_xcm.unwrap().clone();
let local_xcm_weight = Runtime::query_xcm_weight(local_xcm).unwrap();
local_execution_fees = Runtime::query_weight_to_asset_fee(
local_xcm_weight,
VersionedAssetId::V5(Location::parent().into()),
)
.unwrap();
// We filter the result to get only the messages we are interested in.
let (destination_to_query, messages_to_query) = &result
.forwarded_xcms
.iter()
.find(|(destination, _)| {
*destination == VersionedLocation::V5(Location::new(1, [Parachain(1000)]))
})
.unwrap();
assert_eq!(messages_to_query.len(), 1);
remote_message = messages_to_query[0].clone();
let delivery_fees =
Runtime::query_delivery_fees(destination_to_query.clone(), remote_message.clone())
.unwrap();
local_delivery_fees = $crate::xcm_helpers::get_amount_from_versioned_assets(delivery_fees);
});

// These are set in the AssetHub closure.
let mut intermediate_execution_fees = 0;
let mut intermediate_delivery_fees = 0;
let mut intermediate_remote_message = VersionedXcm::V5(Xcm::<()>(Vec::new()));
<$asset_hub as TestExt>::execute_with(|| {
type Runtime = <$asset_hub as Chain>::Runtime;
type RuntimeCall = <$asset_hub as Chain>::RuntimeCall;

// First we get the execution fees.
let weight = Runtime::query_xcm_weight(remote_message.clone()).unwrap();
intermediate_execution_fees = Runtime::query_weight_to_asset_fee(
weight,
VersionedAssetId::V5(Location::new(1, []).into()),
)
.unwrap();

// We have to do this to turn `VersionedXcm<()>` into `VersionedXcm<RuntimeCall>`.
let xcm_program =
VersionedXcm::V5(Xcm::<RuntimeCall>::from(remote_message.clone().try_into().unwrap()));

// Now we get the delivery fees to the final destination.
let result =
Runtime::dry_run_xcm(sender_as_seen_by_ah.clone().into(), xcm_program).unwrap();
let (destination_to_query, messages_to_query) = &result
.forwarded_xcms
.iter()
.find(|(destination, _)| {
*destination == VersionedLocation::V5(Location::new(1, [Parachain(2001)]))
})
.unwrap();
// There's actually two messages here.
// One created when the message we sent from `$sender_para` arrived and was executed.
// The second one when we dry-run the xcm.
// We could've gotten the message from the queue without having to dry-run, but
// offchain applications would have to dry-run, so we do it here as well.
intermediate_remote_message = messages_to_query[0].clone();
let delivery_fees = Runtime::query_delivery_fees(
destination_to_query.clone(),
intermediate_remote_message.clone(),
)
.unwrap();
intermediate_delivery_fees = $crate::xcm_helpers::get_amount_from_versioned_assets(delivery_fees);
});

// Get the final execution fees in the destination.
let mut final_execution_fees = 0;
<$receiver_para as TestExt>::execute_with(|| {
type Runtime = <$sender_para as Chain>::Runtime;

let weight = Runtime::query_xcm_weight(intermediate_remote_message.clone()).unwrap();
final_execution_fees =
Runtime::query_weight_to_asset_fee(weight, VersionedAssetId::V5(Parent.into()))
.unwrap();
});

// Dry-running is done.
$sender_para::reset_ext();
$asset_hub::reset_ext();
$receiver_para::reset_ext();

// Fund accounts again.
$sender_para::mint_foreign_asset(
<$sender_para as Chain>::RuntimeOrigin::signed(asset_owner),
$asset_id.clone().into(),
sender.clone(),
$amount * 2,
);
$asset_hub::fund_accounts(vec![(sov_of_sender_on_ah, $amount * 2)]);

// Actually run the extrinsic.
let sender_assets_before = $sender_para::execute_with(|| {
type ForeignAssets = <$sender_para as [<$sender_para Pallet>]>::ForeignAssets;
<ForeignAssets as Inspect<_>>::balance($asset_id.clone().into(), &sender)
});
let receiver_assets_before = $receiver_para::execute_with(|| {
type ForeignAssets = <$receiver_para as [<$receiver_para Pallet>]>::ForeignAssets;
<ForeignAssets as Inspect<_>>::balance($asset_id.clone().into(), &beneficiary_id)
});

test.set_assertion::<$sender_para>(sender_assertions);
test.set_assertion::<$asset_hub>(hop_assertions);
test.set_assertion::<$receiver_para>(receiver_assertions);
let call = get_call(
(Parent, local_execution_fees + local_delivery_fees),
(Parent, intermediate_execution_fees + intermediate_delivery_fees),
(Parent, final_execution_fees),
);
test.set_call(call);
test.assert();

let sender_assets_after = $sender_para::execute_with(|| {
type ForeignAssets = <$sender_para as [<$sender_para Pallet>]>::ForeignAssets;
<ForeignAssets as Inspect<_>>::balance($asset_id.clone().into(), &sender)
});
let receiver_assets_after = $receiver_para::execute_with(|| {
type ForeignAssets = <$receiver_para as [<$receiver_para Pallet>]>::ForeignAssets;
<ForeignAssets as Inspect<_>>::balance($asset_id.into(), &beneficiary_id)
});

// We know the exact fees on every hop.
assert_eq!(sender_assets_after, sender_assets_before - $amount);
assert_eq!(
receiver_assets_after,
receiver_assets_before + $amount -
local_execution_fees -
local_delivery_fees -
intermediate_execution_fees -
intermediate_delivery_fees -
final_execution_fees
);
}
};
}
Loading