Skip to content

Commit 954e1b6

Browse files
authored
fix(xcm): remove waived locations (#456)
* fix(xcm): no locations are waived * test(xcm): improved waived_location test changes after rebase * style(xcm): clarify that we are not waiving fees for any location
1 parent ec55623 commit 954e1b6

File tree

1 file changed

+26
-10
lines changed
  • runtime/mainnet/src/config

1 file changed

+26
-10
lines changed

runtime/mainnet/src/config/xcm.rs

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ use frame_system::EnsureRoot;
1313
use pallet_xcm::XcmPassthrough;
1414
use parachains_common::{
1515
message_queue::{NarrowOriginToSibling, ParaIdToSibling},
16-
xcm_config::{
17-
AllSiblingSystemParachains, ParentRelayOrSiblingParachains, RelayOrOtherSystemParachains,
18-
},
16+
xcm_config::ParentRelayOrSiblingParachains,
1917
};
2018
use polkadot_parachain_primitives::primitives::Sibling;
2119
use polkadot_runtime_common::xcm_sender::NoPriceForMessageDelivery;
@@ -156,11 +154,6 @@ impl<T: Get<Location>> Contains<(Location, Vec<Asset>)> for NativeAssetFrom<T> {
156154
/// Combinations of (Asset, Location) pairs which we trust as reserves.
157155
pub type TrustedReserves = NativeAssetFrom<AssetHub>;
158156

159-
/// Locations that will not be charged fees in the executor,
160-
/// either execution or delivery.
161-
/// We only waive fees for system functions, which these locations represent.
162-
pub type WaivedLocations = (RelayOrOtherSystemParachains<AllSiblingSystemParachains, Runtime>,);
163-
164157
parameter_types! {
165158
// One XCM operation is 1_000_000_000 weight - almost certainly a conservative estimate.
166159
pub UnitWeightCost: Weight = Weight::from_parts(1_000_000_000, 64 * 1024);
@@ -179,8 +172,9 @@ impl xcm_executor::Config for XcmConfig {
179172
type AssetTrap = PolkadotXcm;
180173
type Barrier = Barrier;
181174
type CallDispatcher = RuntimeCall;
175+
// No locations have waived fees.
182176
type FeeManager = XcmFeeManagerFromComponents<
183-
WaivedLocations,
177+
(),
184178
SendXcmFeeToAccount<Self::AssetTransactor, TreasuryAccount>,
185179
>;
186180
type HrmpChannelAcceptedHandler = ();
@@ -278,6 +272,8 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime {
278272
mod tests {
279273
use std::any::TypeId;
280274

275+
use xcm_executor::traits::{FeeManager, FeeReason};
276+
281277
use super::*;
282278

283279
mod reserves_config {
@@ -563,7 +559,7 @@ mod tests {
563559
TypeId::of::<<XcmConfig as xcm_executor::Config>::FeeManager>(),
564560
TypeId::of::<
565561
XcmFeeManagerFromComponents<
566-
WaivedLocations,
562+
(),
567563
SendXcmFeeToAccount<
568564
<XcmConfig as xcm_executor::Config>::AssetTransactor,
569565
TreasuryAccount,
@@ -573,6 +569,26 @@ mod tests {
573569
);
574570
}
575571

572+
#[test]
573+
fn no_locations_are_waived() {
574+
let locations = [
575+
Location::here(),
576+
Location::parent(),
577+
Location::new(1, [Parachain(1000)]),
578+
Location::new(1, [Parachain(1000), PalletInstance(50), GeneralIndex(1984)]),
579+
Location::new(
580+
1,
581+
[Parachain(1000), AccountId32 { network: None, id: Default::default() }],
582+
),
583+
];
584+
for location in locations {
585+
assert!(!<<XcmConfig as xcm_executor::Config>::FeeManager>::is_waived(
586+
Some(&location),
587+
FeeReason::TransferReserveAsset
588+
));
589+
}
590+
}
591+
576592
#[test]
577593
fn hrmp_accepted_handler_is_disabled() {
578594
assert_eq!(

0 commit comments

Comments
 (0)