diff --git a/runtimes/common/src/xcm_config.rs b/runtimes/common/src/xcm_config.rs index dcb71522ac..bcdad794c1 100644 --- a/runtimes/common/src/xcm_config.rs +++ b/runtimes/common/src/xcm_config.rs @@ -72,8 +72,8 @@ pub type XcmBarrier = DenyThenTry< // * TakeWeightCredit // * AllowTopLevelPaidExecutionFrom - // We allow everything from the relay chain if it was send by the relay chain legislative. - // Since the relaychain doesn't own KILTs and missing fees shouldn't prevent calls from the relaychain + // We allow everything from the relay chain if it was sent by the relay chain legislative (i.e., democracy + // vote). Since the relaychain doesn't own KILTs and missing fees shouldn't prevent calls from the relaychain // legislative, we allow unpaid execution. AllowUnpaidExecutionFrom, ), @@ -146,23 +146,23 @@ parameter_types! { /// `AccountId`. This is used when determining ownership of accounts for asset /// transacting and when attempting to use XCM `Transact` in order to determine /// the dispatch Origin. -pub type LocationToAccountId = ( - // The parent (Relay-chain) origin converts to the parent `AccountId`. +pub type LocationToAccountId = ( + // The parent (Relay-chain) origin converts to the b"parent" `AccountId`. ParentIsPreset, // Sibling parachain origins convert to AccountId via the `ParaId::into`. SiblingParachainConvertsVia, // Straight up local `AccountId32` origins just alias directly to `AccountId`. - AccountId32Aliases, + AccountId32Aliases, ); /// Means for transacting assets on this chain. -pub type LocalAssetTransactor = CurrencyAdapter< +pub type LocalAssetTransactor = CurrencyAdapter< // Use this currency: Currency, // Use this currency when it is a fungible asset matching the given location or name: IsConcrete, // Do a simple punn to convert an AccountId32 MultiLocation into a native chain account ID: - LocationToAccountId, + LocationToAccountId, // Our chain's account ID type (we can't get away without mentioning it explicitly): AccountId, // We don't track any teleports. diff --git a/runtimes/peregrine/src/xcm_config.rs b/runtimes/peregrine/src/xcm_config.rs index 951e85fb40..eddc0e7a70 100644 --- a/runtimes/peregrine/src/xcm_config.rs +++ b/runtimes/peregrine/src/xcm_config.rs @@ -21,20 +21,17 @@ use super::{ RuntimeOrigin, Treasury, WeightToFee, XcmpQueue, }; -use frame_support::{ - parameter_types, - traits::{Everything, Nothing}, -}; +use frame_support::{parameter_types, traits::Nothing}; use pallet_xcm::XcmPassthrough; use xcm::latest::prelude::*; use xcm_builder::{ - EnsureXcmOrigin, FixedWeightBounds, LocationInverter, NativeAsset, RelayChainAsNative, SiblingParachainAsNative, + EnsureXcmOrigin, FixedWeightBounds, LocationInverter, RelayChainAsNative, SiblingParachainAsNative, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, UsingComponents, }; use xcm_executor::XcmExecutor; use runtime_common::xcm_config::{ - LocalAssetTransactor, LocationToAccountId, MaxInstructions, RelayLocation, UnitWeightCost, XcmBarrier, + HereLocation, LocalAssetTransactor, LocationToAccountId, MaxInstructions, UnitWeightCost, XcmBarrier, }; parameter_types! { @@ -75,8 +72,8 @@ impl xcm_executor::Config for XcmConfig { // How to withdraw and deposit an asset. type AssetTransactor = LocalAssetTransactor; type OriginConverter = XcmOriginToTransactDispatchOrigin; - // We only trust our own KILT asset reserve. - type IsReserve = NativeAsset; + // Reserving is disabled. + type IsReserve = (); // Teleporting is disabled. type IsTeleporter = (); // Invert a location. @@ -92,7 +89,7 @@ impl xcm_executor::Config for XcmConfig { // How weight is transformed into fees. The fees are not taken out of the // Balances pallet here. Balances is only used if fees are dropped without being // used. In that case they are put into the treasury. - type Trader = UsingComponents, RelayLocation, AccountId, Balances, Treasury>; + type Trader = UsingComponents, HereLocation, AccountId, Balances, Treasury>; type ResponseHandler = PolkadotXcm; // What happens with assets that are left in the register after the XCM message // was processed. PolkadotXcm has an AssetTrap that stores a hash of the asset @@ -102,7 +99,8 @@ impl xcm_executor::Config for XcmConfig { type SubscriptionService = PolkadotXcm; } -/// No local origins on this chain are allowed to dispatch XCM sends/executions. +/// Allows only local `Signed` origins to be converted into `MultiLocation`s by +/// the XCM executor. pub type LocalOriginToLocation = SignedToAccountId32; /// The means for routing XCM messages which are not for local execution into @@ -122,9 +120,9 @@ impl pallet_xcm::Config for Runtime { // Disable dispatchable execution on the XCM pallet. // NOTE: For local testing this needs to be `Everything`. type XcmExecuteFilter = Nothing; - type XcmExecutor = XcmExecutor; - type XcmTeleportFilter = Everything; + type XcmTeleportFilter = Nothing; type XcmReserveTransferFilter = Nothing; + type XcmExecutor = XcmExecutor; type Weigher = FixedWeightBounds; type LocationInverter = LocationInverter; type RuntimeOrigin = RuntimeOrigin; diff --git a/runtimes/spiritnet/src/xcm_config.rs b/runtimes/spiritnet/src/xcm_config.rs index 5fd40e9d38..a4fb84ab14 100644 --- a/runtimes/spiritnet/src/xcm_config.rs +++ b/runtimes/spiritnet/src/xcm_config.rs @@ -21,19 +21,16 @@ use super::{ RuntimeOrigin, Treasury, WeightToFee, XcmpQueue, }; -use frame_support::{ - parameter_types, - traits::{Everything, Nothing}, -}; +use frame_support::{parameter_types, traits::Nothing}; use pallet_xcm::XcmPassthrough; use xcm::latest::prelude::*; use xcm_builder::{ - EnsureXcmOrigin, FixedWeightBounds, LocationInverter, NativeAsset, RelayChainAsNative, SiblingParachainAsNative, + EnsureXcmOrigin, FixedWeightBounds, LocationInverter, RelayChainAsNative, SiblingParachainAsNative, SignedAccountId32AsNative, SignedToAccountId32, UsingComponents, }; use xcm_executor::XcmExecutor; -use runtime_common::xcm_config::{LocalAssetTransactor, MaxInstructions, RelayLocation, UnitWeightCost, XcmBarrier}; +use runtime_common::xcm_config::{HereLocation, LocalAssetTransactor, MaxInstructions, UnitWeightCost, XcmBarrier}; parameter_types! { pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); @@ -70,8 +67,8 @@ impl xcm_executor::Config for XcmConfig { // How to withdraw and deposit an asset. type AssetTransactor = LocalAssetTransactor; type OriginConverter = XcmOriginToTransactDispatchOrigin; - // We only trust our own KILT asset reserve. - type IsReserve = NativeAsset; + // Reserving is disabled. + type IsReserve = (); // Teleporting is disabled. type IsTeleporter = (); // Invert a location. @@ -87,7 +84,7 @@ impl xcm_executor::Config for XcmConfig { // How weight is transformed into fees. The fees are not taken out of the // Balances pallet here. Balances is only used if fees are dropped without being // used. In that case they are put into the treasury. - type Trader = UsingComponents, RelayLocation, AccountId, Balances, Treasury>; + type Trader = UsingComponents, HereLocation, AccountId, Balances, Treasury>; type ResponseHandler = PolkadotXcm; // What happens with assets that are left in the register after the XCM message // was processed. PolkadotXcm has an AssetTrap that stores a hash of the asset @@ -97,7 +94,8 @@ impl xcm_executor::Config for XcmConfig { type SubscriptionService = PolkadotXcm; } -/// No local origins on this chain are allowed to dispatch XCM sends/executions. +/// Allows only local `Signed` origins to be converted into `MultiLocation`s by +/// the XCM executor. pub type LocalOriginToLocation = SignedToAccountId32; /// The means for routing XCM messages which are not for local execution into @@ -117,9 +115,9 @@ impl pallet_xcm::Config for Runtime { // Disable dispatchable execution on the XCM pallet. // NOTE: For local testing this needs to be `Everything`. type XcmExecuteFilter = Nothing; - type XcmExecutor = XcmExecutor; - type XcmTeleportFilter = Everything; + type XcmTeleportFilter = Nothing; type XcmReserveTransferFilter = Nothing; + type XcmExecutor = XcmExecutor; type Weigher = FixedWeightBounds; type LocationInverter = LocationInverter; type RuntimeOrigin = RuntimeOrigin;