diff --git a/Cargo.lock b/Cargo.lock index 25d079afcd..45602c41db 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11585,6 +11585,7 @@ dependencies = [ "pallet-timestamp", "pallet-utility", "pallet-xcm", + "parachains-common", "parity-scale-codec", "polkadot-parachain-primitives", "polkadot-primitives", diff --git a/runtime/acala/src/xcm_config.rs b/runtime/acala/src/xcm_config.rs index 1effa5959d..f51145b01b 100644 --- a/runtime/acala/src/xcm_config.rs +++ b/runtime/acala/src/xcm_config.rs @@ -116,8 +116,7 @@ impl xcm_executor::Config for XcmConfig { type AssetTransactor = LocalAssetTransactor; type OriginConverter = XcmOriginToCallOrigin; type IsReserve = MultiNativeAsset; - // Teleporting is disabled. - type IsTeleporter = (); + type IsTeleporter = runtime_common::xcm_config::TrustedTeleporters; type UniversalLocation = UniversalLocation; type Barrier = Barrier; type Weigher = FixedWeightBounds; diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index 5b6502c6b3..a57a79a0fb 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -40,11 +40,12 @@ cumulus-pallet-xcm = { workspace = true } # polkadot pallet-xcm = { workspace = true } +parachains-common = { workspace = true } polkadot-parachain-primitives = { workspace = true } polkadot-primitives = { workspace = true } xcm = { workspace = true } -xcm-executor = { workspace = true } xcm-builder = { workspace = true } +xcm-executor = { workspace = true } # modules module-currencies = { workspace = true } @@ -109,12 +110,13 @@ std = [ "cumulus-pallet-parachain-system/std", + "pallet-xcm/std", + "parachains-common/std", "polkadot-parachain-primitives/std", "polkadot-primitives/std", - "pallet-xcm/std", - "xcm/std", - "xcm-executor/std", "xcm-builder/std", + "xcm-executor/std", + "xcm/std", "wasm-bencher/std", "orml-currencies/std", diff --git a/runtime/common/src/xcm_config.rs b/runtime/common/src/xcm_config.rs index dc4e6c1927..bd6aa786fc 100644 --- a/runtime/common/src/xcm_config.rs +++ b/runtime/common/src/xcm_config.rs @@ -18,11 +18,12 @@ use crate::{xcm_impl::AccountKey20Aliases, AccountId, Balance, Convert, CurrencyId}; use frame_support::{ - match_types, + parameter_types, traits::{ConstU32, Everything, Get}, }; use orml_traits::MultiCurrency; use pallet_xcm::XcmPassthrough; +use parachains_common::xcm_config::{ConcreteAssetFromSystem, ParentRelayOrSiblingParachains}; use polkadot_parachain_primitives::primitives::Sibling; use xcm::latest::prelude::*; use xcm_builder::{ @@ -69,13 +70,6 @@ pub type XcmOriginToCallOrigin, ); -match_types! { - pub type ParentOrSiblings: impl Contains = { - MultiLocation { parents: 1, interior: Here } | - MultiLocation { parents: 1, interior: X1(_) } - }; -} - pub type Barrier = TrailingSetTopicAsId<( TakeWeightCredit, // Expected responses are OK. @@ -87,7 +81,7 @@ pub type Barrier = TrailingSetTopicAsId<( // allow it. AllowTopLevelPaidExecutionFrom, // Subscriptions for version tracking are OK. - AllowSubscriptionsFrom, + AllowSubscriptionsFrom, ), UniversalLocation, ConstU32<8>, @@ -130,3 +124,13 @@ impl Convert for AccountIdToMultiLocation { .into() } } + +parameter_types! { + pub const RelayLocation: MultiLocation = MultiLocation::parent(); +} + +// define assets that can be trusted to teleport by remotes +pub type TrustedTeleporters = ( + // relay token from relaychain or system parachain + ConcreteAssetFromSystem, +); diff --git a/runtime/karura/src/xcm_config.rs b/runtime/karura/src/xcm_config.rs index b4656d4df0..ce12c6c0de 100644 --- a/runtime/karura/src/xcm_config.rs +++ b/runtime/karura/src/xcm_config.rs @@ -163,8 +163,7 @@ impl xcm_executor::Config for XcmConfig { type AssetTransactor = LocalAssetTransactor; type OriginConverter = XcmOriginToCallOrigin; type IsReserve = MultiNativeAsset; - // Teleporting is disabled. - type IsTeleporter = (); + type IsTeleporter = runtime_common::xcm_config::TrustedTeleporters; type UniversalLocation = UniversalLocation; type Barrier = Barrier; type Weigher = FixedWeightBounds; diff --git a/runtime/mandala/src/xcm_config.rs b/runtime/mandala/src/xcm_config.rs index 88cce7abc8..3b59e23af9 100644 --- a/runtime/mandala/src/xcm_config.rs +++ b/runtime/mandala/src/xcm_config.rs @@ -104,8 +104,7 @@ impl xcm_executor::Config for XcmConfig { type AssetTransactor = LocalAssetTransactor; type OriginConverter = XcmOriginToCallOrigin; type IsReserve = MultiNativeAsset; - // Teleporting is disabled. - type IsTeleporter = (); + type IsTeleporter = runtime_common::xcm_config::TrustedTeleporters; type UniversalLocation = UniversalLocation; type Barrier = Barrier; type Weigher = FixedWeightBounds;