Skip to content
Merged
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
36 changes: 26 additions & 10 deletions runtime/mainnet/src/config/xcm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
use pallet_xcm::XcmPassthrough;
use parachains_common::{
message_queue::{NarrowOriginToSibling, ParaIdToSibling},
xcm_config::{
AllSiblingSystemParachains, ParentRelayOrSiblingParachains, RelayOrOtherSystemParachains,
},
xcm_config::ParentRelayOrSiblingParachains,
};
use polkadot_parachain_primitives::primitives::Sibling;
use polkadot_runtime_common::xcm_sender::NoPriceForMessageDelivery;
Expand Down Expand Up @@ -118,7 +116,7 @@
XcmPassthrough<RuntimeOrigin>,
);

pub type Barrier = TrailingSetTopicAsId<(

Check warning on line 119 in runtime/mainnet/src/config/xcm.rs

View workflow job for this annotation

GitHub Actions / clippy

missing documentation for a type alias

warning: missing documentation for a type alias --> runtime/mainnet/src/config/xcm.rs:119:1 | 119 | pub type Barrier = TrailingSetTopicAsId<( | ^^^^^^^^^^^^^^^^
TakeWeightCredit,
AllowKnownQueryResponses<PolkadotXcm>,
WithComputedOrigin<
Expand Down Expand Up @@ -156,11 +154,6 @@
/// Combinations of (Asset, Location) pairs which we trust as reserves.
pub type TrustedReserves = NativeAssetFrom<AssetHub>;

/// Locations that will not be charged fees in the executor,
/// either execution or delivery.
/// We only waive fees for system functions, which these locations represent.
pub type WaivedLocations = (RelayOrOtherSystemParachains<AllSiblingSystemParachains, Runtime>,);

parameter_types! {
// One XCM operation is 1_000_000_000 weight - almost certainly a conservative estimate.
pub UnitWeightCost: Weight = Weight::from_parts(1_000_000_000, 64 * 1024);
Expand All @@ -168,7 +161,7 @@
pub const MaxAssetsIntoHolding: u32 = 64;
}

pub struct XcmConfig;

Check warning on line 164 in runtime/mainnet/src/config/xcm.rs

View workflow job for this annotation

GitHub Actions / clippy

missing documentation for a struct

warning: missing documentation for a struct --> runtime/mainnet/src/config/xcm.rs:164:1 | 164 | pub struct XcmConfig; | ^^^^^^^^^^^^^^^^^^^^
impl xcm_executor::Config for XcmConfig {
type Aliasers = Nothing;
type AssetClaims = PolkadotXcm;
Expand All @@ -179,8 +172,9 @@
type AssetTrap = PolkadotXcm;
type Barrier = Barrier;
type CallDispatcher = RuntimeCall;
// No locations have waived fees.
type FeeManager = XcmFeeManagerFromComponents<
WaivedLocations,
(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a simple comment saying: "No locations have waived fees".

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SendXcmFeeToAccount<Self::AssetTransactor, TreasuryAccount>,
>;
type HrmpChannelAcceptedHandler = ();
Expand Down Expand Up @@ -211,7 +205,7 @@
type XcmSender = XcmRouter;
}

pub type LocalOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, RelayNetwork>;

Check warning on line 208 in runtime/mainnet/src/config/xcm.rs

View workflow job for this annotation

GitHub Actions / clippy

missing documentation for a type alias

warning: missing documentation for a type alias --> runtime/mainnet/src/config/xcm.rs:208:1 | 208 | pub type LocalOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, RelayNetwork>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

/// The means for routing XCM messages which are not for local execution into the right message
/// queues.
Expand Down Expand Up @@ -278,6 +272,8 @@
mod tests {
use std::any::TypeId;

use xcm_executor::traits::{FeeManager, FeeReason};

use super::*;

mod reserves_config {
Expand Down Expand Up @@ -563,7 +559,7 @@
TypeId::of::<<XcmConfig as xcm_executor::Config>::FeeManager>(),
TypeId::of::<
XcmFeeManagerFromComponents<
WaivedLocations,
(),
SendXcmFeeToAccount<
<XcmConfig as xcm_executor::Config>::AssetTransactor,
TreasuryAccount,
Expand All @@ -573,6 +569,26 @@
);
}

#[test]
fn no_locations_are_waived() {
let locations = [
Location::here(),
Location::parent(),
Location::new(1, [Parachain(1000)]),
Location::new(1, [Parachain(1000), PalletInstance(50), GeneralIndex(1984)]),
Location::new(
1,
[Parachain(1000), AccountId32 { network: None, id: Default::default() }],
),
];
for location in locations {
assert!(!<<XcmConfig as xcm_executor::Config>::FeeManager>::is_waived(
Some(&location),
FeeReason::TransferReserveAsset
));
}
}

#[test]
fn hrmp_accepted_handler_is_disabled() {
assert_eq!(
Expand Down
Loading