diff --git a/polkadot/runtime/rococo/src/lib.rs b/polkadot/runtime/rococo/src/lib.rs index 503057aeb5..a0916f0ebb 100644 --- a/polkadot/runtime/rococo/src/lib.rs +++ b/polkadot/runtime/rococo/src/lib.rs @@ -602,6 +602,39 @@ pub type XcmRouter = ( xcm_sender::ChildParachainRouter, ); +use xcm::v0::{MultiAsset, MultiAsset::AllConcreteFungible, MultiLocation::{Null, X1}, Junction::Parachain}; +parameter_types! { + pub const RococoForTick: (MultiAsset, MultiLocation) = (AllConcreteFungible { id: Null }, X1(Parachain{id: 100})); + pub const RococoForTrick: (MultiAsset, MultiLocation) = (AllConcreteFungible { id: Null }, X1(Parachain{id: 110})); + pub const RococoForTrack: (MultiAsset, MultiLocation) = (AllConcreteFungible { id: Null }, X1(Parachain{id: 120})); +} +pub type TrustedTeleporters = ( + xcm_builder::Case, + xcm_builder::Case, + xcm_builder::Case, +); + +parameter_types! { + pub AllowUnpaidFrom: Vec = vec![ X1(Parachain{id: 100}), X1(Parachain{id: 110}), X1(Parachain{id: 120}) ]; +} + +pub struct All(sp_std::marker::PhantomData); +impl frame_support::traits::Contains for All { + fn contains(_: &T) -> bool { true } + fn sorted_members() -> Vec { vec![] } +} +pub struct IsInVec(sp_std::marker::PhantomData); +impl>> frame_support::traits::Contains for IsInVec { + fn sorted_members() -> Vec { let mut r = T::get(); r.sort(); r } +} + +use xcm_builder::{TakeWeightCredit, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom}; +pub type Barrier = ( + TakeWeightCredit, + AllowTopLevelPaidExecutionFrom>, + AllowUnpaidExecutionFrom>, // <- Trusted parachains get free execution +); + pub struct XcmConfig; impl xcm_executor::Config for XcmConfig { type Call = Call; @@ -609,9 +642,9 @@ impl xcm_executor::Config for XcmConfig { type AssetTransactor = LocalAssetTransactor; type OriginConverter = LocalOriginConverter; type IsReserve = (); - type IsTeleporter = (); + type IsTeleporter = TrustedTeleporters; type LocationInverter = LocationInverter; - type Barrier = (); + type Barrier = Barrier; type Weigher = FixedWeightBounds; type Trader = FixedRateOfConcreteFungible; type ResponseHandler = (); diff --git a/polkadot/xcm/xcm-builder/src/filter_asset_location.rs b/polkadot/xcm/xcm-builder/src/filter_asset_location.rs index ffd334ff75..edf67b0296 100644 --- a/polkadot/xcm/xcm-builder/src/filter_asset_location.rs +++ b/polkadot/xcm/xcm-builder/src/filter_asset_location.rs @@ -26,11 +26,10 @@ impl FilterAssetLocation for NativeAsset { } } - pub struct Case(PhantomData); impl> FilterAssetLocation for Case { fn filter_asset_location(asset: &MultiAsset, origin: &MultiLocation) -> bool { let (a, o) = T::get(); - &a == asset && &o == origin + a.contains(asset) && &o == origin } }