Skip to content

Commit f7d10b7

Browse files
committed
fix(integration-tests): handle delivery_fees only with mainnet feature on
fmt after rebase fmt
1 parent 390b6c3 commit f7d10b7

File tree

2 files changed

+51
-42
lines changed

2 files changed

+51
-42
lines changed

integration-tests/src/lib.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ use emulated_integration_tests_common::{
2222
};
2323
use frame_support::{pallet_prelude::Weight, sp_runtime::DispatchResult};
2424
use pop_runtime_common::Balance;
25+
#[cfg(not(feature = "mainnet"))]
26+
use pop_runtime_devnet::config::xcm::XcmConfig as PopNetworkXcmConfig;
27+
#[cfg(feature = "mainnet")]
2528
use pop_runtime_mainnet::config::xcm::XcmConfig as PopNetworkXcmConfig;
2629
use xcm::prelude::*;
2730

@@ -318,11 +321,15 @@ fn reserve_transfer_native_asset_from_para_to_system_para() {
318321
let delivery_fees = PopNetworkPara::execute_with(|| {
319322
xcm_helpers::teleport_assets_delivery_fees::<
320323
<PopNetworkXcmConfig as xcm_executor::Config>::XcmSender,
321-
>(assets, 0, Unlimited, Location::from(beneficiary_id.clone()), destination.clone())
324+
>(
325+
assets.clone(), 0, Unlimited, Location::from(beneficiary_id.clone()), destination.clone()
326+
)
322327
});
323-
328+
#[cfg(feature = "mainnet")]
324329
let amount_to_send = amount_to_send - (ASSET_HUB_ED + delivery_fees);
330+
#[cfg(feature = "mainnet")]
325331
let assets: Assets = (Parent, amount_to_send).into();
332+
326333
let test_args = TestContext {
327334
sender: PopNetworkParaReceiver::get(), // bob on pop
328335
receiver: AssetHubParaReceiver::get(), // bob on asset hub
@@ -352,6 +359,7 @@ fn reserve_transfer_native_asset_from_para_to_system_para() {
352359
// Sender's balance is reduced
353360
assert_eq!(sender_balance_before - amount_to_send - delivery_fees, sender_balance_after);
354361
// Sender's balance is the remaining ED.
362+
#[cfg(feature = "mainnet")]
355363
assert_eq!(ASSET_HUB_ED, sender_balance_after);
356364
// Receiver's balance is increased
357365
assert!(receiver_balance_after > receiver_balance_before);

runtime/mainnet/src/config/xcm.rs

Lines changed: 41 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,6 @@ mod tests {
276276
use sp_runtime::FixedPointNumber;
277277

278278
use super::*;
279-
280-
mod reserves_config {
281-
use super::*;
282279
use crate::System;
283280

284281
fn new_test_ext() -> sp_io::TestExternalities {
@@ -287,6 +284,9 @@ mod tests {
287284
ext
288285
}
289286

287+
mod reserves_config {
288+
use super::*;
289+
290290
// Only reserve accepted is the relay asset from Asset Hub.
291291
#[test]
292292
fn reserves() {
@@ -872,13 +872,13 @@ mod tests {
872872
);
873873
}
874874

875-
#[test]
876-
fn reserve_transfer_filter_only_allows_dot_from_ah() {
877-
assert_eq!(
878-
TypeId::of::<<Runtime as pallet_xcm::Config>::XcmReserveTransferFilter>(),
879-
TypeId::of::<NativeAssetFrom<AssetHub>>(),
880-
);
881-
}
875+
#[test]
876+
fn reserve_transfer_filter_only_allows_dot_from_ah() {
877+
assert_eq!(
878+
TypeId::of::<<Runtime as pallet_xcm::Config>::XcmReserveTransferFilter>(),
879+
TypeId::of::<Everything>(),
880+
);
881+
}
882882

883883
#[test]
884884
fn router_uses_ump_for_relay_and_xcmp_for_para() {
@@ -964,36 +964,37 @@ mod tests {
964964
);
965965
}
966966

967-
#[test]
968-
fn price_for_sibling_delivery() {
969-
assert_eq!(
970-
TypeId::of::<<Runtime as cumulus_pallet_xcmp_queue::Config>::PriceForSiblingDelivery>(),
971-
TypeId::of::<
972-
ExponentialPrice<RelayLocation, BaseDeliveryFee, TransactionByteFee, XcmpQueue>,
973-
>()
974-
);
975-
976-
new_test_ext().execute_with(|| {
977-
type ExponentialDeliveryPrice =
978-
ExponentialPrice<RelayLocation, BaseDeliveryFee, TransactionByteFee, XcmpQueue>;
979-
let id: ParaId = 420.into();
980-
let b: u128 = BaseDeliveryFee::get();
981-
let m: u128 = TransactionByteFee::get();
982-
983-
// F * (B + msg_length * M)
984-
// A: RelayLocation
985-
// B: BaseDeliveryFee
986-
// M: TransactionByteFee
987-
// F: XcmpQueue
988-
//
989-
// message_length = 1
990-
let result: u128 = XcmpQueue::get_fee_factor(id).saturating_mul_int(b + m);
991-
assert_eq!(
992-
ExponentialDeliveryPrice::price_for_delivery(id, &Xcm(vec![])),
993-
(RelayLocation::get(), result).into()
994-
);
995-
})
996-
}
967+
#[test]
968+
fn price_for_sibling_delivery() {
969+
assert_eq!(
970+
TypeId::of::<<Runtime as cumulus_pallet_xcmp_queue::Config>::PriceForSiblingDelivery>(
971+
),
972+
TypeId::of::<
973+
ExponentialPrice<RelayLocation, BaseDeliveryFee, TransactionByteFee, XcmpQueue>,
974+
>()
975+
);
976+
977+
new_test_ext().execute_with(|| {
978+
type ExponentialDeliveryPrice =
979+
ExponentialPrice<RelayLocation, BaseDeliveryFee, TransactionByteFee, XcmpQueue>;
980+
let id: ParaId = 420.into();
981+
let b: u128 = BaseDeliveryFee::get();
982+
let m: u128 = TransactionByteFee::get();
983+
984+
// F * (B + msg_length * M)
985+
// A: RelayLocation
986+
// B: BaseDeliveryFee
987+
// M: TransactionByteFee
988+
// F: XcmpQueue
989+
//
990+
// message_length = 1
991+
let result: u128 = XcmpQueue::get_fee_factor(id).saturating_mul_int(b + m);
992+
assert_eq!(
993+
ExponentialDeliveryPrice::price_for_delivery(id, &Xcm(vec![])),
994+
(RelayLocation::get(), result).into()
995+
);
996+
})
997+
}
997998

998999
#[test]
9991000
fn versions_xcm() {

0 commit comments

Comments
 (0)