difftreelog
fix remove known xcm locations -- unneeded due to limited opened hrmp channels
in: master
5 files changed
pallets/configuration/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/configuration/src/benchmarking.rs
+++ b/pallets/configuration/src/benchmarking.rs
@@ -19,8 +19,7 @@
use super::*;
use frame_benchmarking::benchmarks;
use frame_system::{EventRecord, RawOrigin};
-use frame_support::{assert_ok, BoundedVec, traits::Currency};
-use xcm::latest::MultiLocation;
+use frame_support::{assert_ok, traits::Currency};
fn assert_last_event<T: Config>(generic_event: <T as Config>::RuntimeEvent) {
let events = frame_system::Pallet::<T>::events();
@@ -46,14 +45,6 @@
}: {
assert_ok!(
<Pallet<T>>::set_min_gas_price_override(RawOrigin::Root.into(), Some(coeff))
- );
- }
-
- set_xcm_allowed_locations {
- let locations: BoundedVec<MultiLocation, T::MaxXcmAllowedLocations> = Default::default();
- }: {
- assert_ok!(
- <Pallet<T>>::set_xcm_allowed_locations(RawOrigin::Root.into(), Some(locations))
);
}
pallets/configuration/src/lib.rsdiffbeforeafterboth1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617#![cfg_attr(not(feature = "std"), no_std)]1819use core::marker::PhantomData;2021use frame_support::{22 pallet,23 weights::{WeightToFeePolynomial, WeightToFeeCoefficients, WeightToFeeCoefficient, Weight},24 traits::Get,25};26use codec::{Decode, Encode, MaxEncodedLen};27use scale_info::TypeInfo;28use sp_arithmetic::{29 per_things::{Perbill, PerThing},30 traits::{BaseArithmetic, Unsigned},31};32use smallvec::smallvec;3334pub use pallet::*;35use sp_core::U256;3637#[cfg(feature = "runtime-benchmarks")]38mod benchmarking;39pub mod weights;4041#[pallet]42mod pallet {43 use super::*;44 use frame_support::{45 traits::{Get, ReservableCurrency, Currency},46 pallet_prelude::{StorageValue, ValueQuery, DispatchResult, IsType, OptionQuery},47 BoundedVec, log,48 };49 use frame_system::{pallet_prelude::OriginFor, ensure_root, Config as SystemConfig};50 use xcm::latest::MultiLocation;5152 pub use crate::weights::WeightInfo;53 pub type BalanceOf<T> =54 <<T as Config>::Currency as Currency<<T as SystemConfig>::AccountId>>::Balance;5556 #[pallet::config]57 pub trait Config: frame_system::Config {58 /// Overarching event type.59 type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;6061 /// The currency mechanism.62 type Currency: ReservableCurrency<Self::AccountId>;6364 #[pallet::constant]65 type DefaultWeightToFeeCoefficient: Get<u64>;66 #[pallet::constant]67 type DefaultMinGasPrice: Get<u64>;6869 #[pallet::constant]70 type MaxXcmAllowedLocations: Get<u32>;71 #[pallet::constant]72 type AppPromotionDailyRate: Get<Perbill>;73 #[pallet::constant]74 type DayRelayBlocks: Get<Self::BlockNumber>;7576 #[pallet::constant]77 type DefaultCollatorSelectionMaxCollators: Get<u32>;78 #[pallet::constant]79 type DefaultCollatorSelectionLicenseBond: Get<BalanceOf<Self>>;80 #[pallet::constant]81 type DefaultCollatorSelectionKickThreshold: Get<Self::BlockNumber>;8283 /// The weight information of this pallet.84 type WeightInfo: WeightInfo;85 }8687 #[pallet::event]88 #[pallet::generate_deposit(pub(super) fn deposit_event)]89 pub enum Event<T: Config> {90 NewDesiredCollators {91 desired_collators: Option<u32>,92 },93 NewCollatorLicenseBond {94 bond_cost: Option<BalanceOf<T>>,95 },96 NewCollatorKickThreshold {97 length_in_blocks: Option<T::BlockNumber>,98 },99 }100101 #[pallet::error]102 pub enum Error<T> {103 InconsistentConfiguration,104 }105106 #[pallet::storage]107 pub type WeightToFeeCoefficientOverride<T: Config> = StorageValue<108 Value = u64,109 QueryKind = ValueQuery,110 OnEmpty = T::DefaultWeightToFeeCoefficient,111 >;112113 #[pallet::storage]114 pub type MinGasPriceOverride<T: Config> =115 StorageValue<Value = u64, QueryKind = ValueQuery, OnEmpty = T::DefaultMinGasPrice>;116117 #[pallet::storage]118 pub type XcmAllowedLocationsOverride<T: Config> = StorageValue<119 Value = BoundedVec<xcm::v3::MultiLocation, T::MaxXcmAllowedLocations>,120 QueryKind = OptionQuery,121 >;122123 #[pallet::storage]124 pub type AppPromomotionConfigurationOverride<T: Config> =125 StorageValue<Value = AppPromotionConfiguration<T::BlockNumber>, QueryKind = ValueQuery>;126127 #[pallet::storage]128 pub type CollatorSelectionDesiredCollatorsOverride<T: Config> = StorageValue<129 Value = u32,130 QueryKind = ValueQuery,131 OnEmpty = T::DefaultCollatorSelectionMaxCollators,132 >;133134 #[pallet::storage]135 pub type CollatorSelectionLicenseBondOverride<T: Config> = StorageValue<136 Value = BalanceOf<T>,137 QueryKind = ValueQuery,138 OnEmpty = T::DefaultCollatorSelectionLicenseBond,139 >;140141 #[pallet::storage]142 pub type CollatorSelectionKickThresholdOverride<T: Config> = StorageValue<143 Value = T::BlockNumber,144 QueryKind = ValueQuery,145 OnEmpty = T::DefaultCollatorSelectionKickThreshold,146 >;147148 #[pallet::call]149 impl<T: Config> Pallet<T> {150 #[pallet::call_index(0)]151 #[pallet::weight(T::WeightInfo::set_weight_to_fee_coefficient_override())]152 pub fn set_weight_to_fee_coefficient_override(153 origin: OriginFor<T>,154 coeff: Option<u64>,155 ) -> DispatchResult {156 ensure_root(origin)?;157 if let Some(coeff) = coeff {158 <WeightToFeeCoefficientOverride<T>>::set(coeff);159 } else {160 <WeightToFeeCoefficientOverride<T>>::kill();161 }162 Ok(())163 }164165 #[pallet::call_index(1)]166 #[pallet::weight(T::WeightInfo::set_min_gas_price_override())]167 pub fn set_min_gas_price_override(168 origin: OriginFor<T>,169 coeff: Option<u64>,170 ) -> DispatchResult {171 ensure_root(origin)?;172 if let Some(coeff) = coeff {173 <MinGasPriceOverride<T>>::set(coeff);174 } else {175 <MinGasPriceOverride<T>>::kill();176 }177 Ok(())178 }179180 #[pallet::call_index(2)]181 #[pallet::weight(T::WeightInfo::set_xcm_allowed_locations())]182 pub fn set_xcm_allowed_locations(183 origin: OriginFor<T>,184 locations: Option<BoundedVec<MultiLocation, T::MaxXcmAllowedLocations>>,185 ) -> DispatchResult {186 ensure_root(origin)?;187 <XcmAllowedLocationsOverride<T>>::set(locations);188 Ok(())189 }190191 #[pallet::call_index(3)]192 #[pallet::weight(T::WeightInfo::set_app_promotion_configuration_override())]193 pub fn set_app_promotion_configuration_override(194 origin: OriginFor<T>,195 mut configuration: AppPromotionConfiguration<T::BlockNumber>,196 ) -> DispatchResult {197 ensure_root(origin)?;198 if configuration.interval_income.is_some() {199 return Err(<Error<T>>::InconsistentConfiguration.into());200 }201202 configuration.interval_income = configuration.recalculation_interval.map(|b| {203 Perbill::from_rational(b, T::DayRelayBlocks::get())204 * T::AppPromotionDailyRate::get()205 });206207 <AppPromomotionConfigurationOverride<T>>::set(configuration);208209 Ok(())210 }211212 #[pallet::call_index(4)]213 #[pallet::weight(T::WeightInfo::set_collator_selection_desired_collators())]214 pub fn set_collator_selection_desired_collators(215 origin: OriginFor<T>,216 max: Option<u32>,217 ) -> DispatchResult {218 ensure_root(origin)?;219 if let Some(max) = max {220 // we trust origin calls, this is just a for more accurate benchmarking221 if max > T::DefaultCollatorSelectionMaxCollators::get() {222 log::warn!("max > T::DefaultCollatorSelectionMaxCollators; you might need to run benchmarks again");223 }224 <CollatorSelectionDesiredCollatorsOverride<T>>::set(max);225 } else {226 <CollatorSelectionDesiredCollatorsOverride<T>>::kill();227 }228 Self::deposit_event(Event::NewDesiredCollators {229 desired_collators: max,230 });231 Ok(())232 }233234 #[pallet::call_index(5)]235 #[pallet::weight(T::WeightInfo::set_collator_selection_license_bond())]236 pub fn set_collator_selection_license_bond(237 origin: OriginFor<T>,238 amount: Option<BalanceOf<T>>,239 ) -> DispatchResult {240 ensure_root(origin)?;241 if let Some(amount) = amount {242 <CollatorSelectionLicenseBondOverride<T>>::set(amount);243 } else {244 <CollatorSelectionLicenseBondOverride<T>>::kill();245 }246 Self::deposit_event(Event::NewCollatorLicenseBond { bond_cost: amount });247 Ok(())248 }249250 #[pallet::call_index(6)]251 #[pallet::weight(T::WeightInfo::set_collator_selection_kick_threshold())]252 pub fn set_collator_selection_kick_threshold(253 origin: OriginFor<T>,254 threshold: Option<T::BlockNumber>,255 ) -> DispatchResult {256 ensure_root(origin)?;257 if let Some(threshold) = threshold {258 <CollatorSelectionKickThresholdOverride<T>>::set(threshold);259 } else {260 <CollatorSelectionKickThresholdOverride<T>>::kill();261 }262 Self::deposit_event(Event::NewCollatorKickThreshold {263 length_in_blocks: threshold,264 });265 Ok(())266 }267 }268269 #[pallet::pallet]270 #[pallet::generate_store(pub(super) trait Store)]271 pub struct Pallet<T>(_);272}273274pub struct WeightToFee<T, B>(PhantomData<(T, B)>);275276impl<T, B> WeightToFeePolynomial for WeightToFee<T, B>277where278 T: Config,279 B: BaseArithmetic + From<u32> + From<u64> + Copy + Unsigned,280{281 type Balance = B;282283 fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {284 smallvec!(WeightToFeeCoefficient {285 coeff_integer: (<WeightToFeeCoefficientOverride<T>>::get() / Perbill::ACCURACY as u64)286 .into(),287 coeff_frac: Perbill::from_parts(288 (<WeightToFeeCoefficientOverride<T>>::get() % Perbill::ACCURACY as u64) as u32289 ),290 negative: false,291 degree: 1,292 })293 }294}295296pub struct FeeCalculator<T>(PhantomData<T>);297impl<T: Config> fp_evm::FeeCalculator for FeeCalculator<T> {298 fn min_gas_price() -> (U256, Weight) {299 (300 <MinGasPriceOverride<T>>::get().into(),301 T::DbWeight::get().reads(1),302 )303 }304}305306#[derive(Encode, Decode, Clone, Debug, Default, TypeInfo, MaxEncodedLen, PartialEq, PartialOrd)]307pub struct AppPromotionConfiguration<BlockNumber> {308 /// In relay blocks.309 pub recalculation_interval: Option<BlockNumber>,310 /// In parachain blocks.311 pub pending_interval: Option<BlockNumber>,312 /// Value for `RecalculationInterval` based on 0.05% per 24h.313 pub interval_income: Option<Perbill>,314 /// Maximum allowable number of stakers calculated per call of the `app-promotion::PayoutStakers` extrinsic.315 pub max_stakers_per_calculation: Option<u8>,316}1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617#![cfg_attr(not(feature = "std"), no_std)]1819use core::marker::PhantomData;2021use frame_support::{22 pallet,23 weights::{WeightToFeePolynomial, WeightToFeeCoefficients, WeightToFeeCoefficient, Weight},24 traits::Get,25};26use codec::{Decode, Encode, MaxEncodedLen};27use scale_info::TypeInfo;28use sp_arithmetic::{29 per_things::{Perbill, PerThing},30 traits::{BaseArithmetic, Unsigned},31};32use smallvec::smallvec;3334pub use pallet::*;35use sp_core::U256;3637#[cfg(feature = "runtime-benchmarks")]38mod benchmarking;39pub mod weights;4041#[pallet]42mod pallet {43 use super::*;44 use frame_support::{45 traits::{Get, ReservableCurrency, Currency},46 pallet_prelude::{StorageValue, ValueQuery, DispatchResult, IsType}, log,47 };48 use frame_system::{pallet_prelude::OriginFor, ensure_root, Config as SystemConfig};4950 pub use crate::weights::WeightInfo;51 pub type BalanceOf<T> =52 <<T as Config>::Currency as Currency<<T as SystemConfig>::AccountId>>::Balance;5354 #[pallet::config]55 pub trait Config: frame_system::Config {56 /// Overarching event type.57 type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;5859 /// The currency mechanism.60 type Currency: ReservableCurrency<Self::AccountId>;6162 #[pallet::constant]63 type DefaultWeightToFeeCoefficient: Get<u64>;64 #[pallet::constant]65 type DefaultMinGasPrice: Get<u64>;6667 #[pallet::constant]68 type MaxXcmAllowedLocations: Get<u32>;69 #[pallet::constant]70 type AppPromotionDailyRate: Get<Perbill>;71 #[pallet::constant]72 type DayRelayBlocks: Get<Self::BlockNumber>;7374 #[pallet::constant]75 type DefaultCollatorSelectionMaxCollators: Get<u32>;76 #[pallet::constant]77 type DefaultCollatorSelectionLicenseBond: Get<BalanceOf<Self>>;78 #[pallet::constant]79 type DefaultCollatorSelectionKickThreshold: Get<Self::BlockNumber>;8081 /// The weight information of this pallet.82 type WeightInfo: WeightInfo;83 }8485 #[pallet::event]86 #[pallet::generate_deposit(pub(super) fn deposit_event)]87 pub enum Event<T: Config> {88 NewDesiredCollators {89 desired_collators: Option<u32>,90 },91 NewCollatorLicenseBond {92 bond_cost: Option<BalanceOf<T>>,93 },94 NewCollatorKickThreshold {95 length_in_blocks: Option<T::BlockNumber>,96 },97 }9899 #[pallet::error]100 pub enum Error<T> {101 InconsistentConfiguration,102 }103104 #[pallet::storage]105 pub type WeightToFeeCoefficientOverride<T: Config> = StorageValue<106 Value = u64,107 QueryKind = ValueQuery,108 OnEmpty = T::DefaultWeightToFeeCoefficient,109 >;110111 #[pallet::storage]112 pub type MinGasPriceOverride<T: Config> =113 StorageValue<Value = u64, QueryKind = ValueQuery, OnEmpty = T::DefaultMinGasPrice>;114115 #[pallet::storage]116 pub type AppPromomotionConfigurationOverride<T: Config> =117 StorageValue<Value = AppPromotionConfiguration<T::BlockNumber>, QueryKind = ValueQuery>;118119 #[pallet::storage]120 pub type CollatorSelectionDesiredCollatorsOverride<T: Config> = StorageValue<121 Value = u32,122 QueryKind = ValueQuery,123 OnEmpty = T::DefaultCollatorSelectionMaxCollators,124 >;125126 #[pallet::storage]127 pub type CollatorSelectionLicenseBondOverride<T: Config> = StorageValue<128 Value = BalanceOf<T>,129 QueryKind = ValueQuery,130 OnEmpty = T::DefaultCollatorSelectionLicenseBond,131 >;132133 #[pallet::storage]134 pub type CollatorSelectionKickThresholdOverride<T: Config> = StorageValue<135 Value = T::BlockNumber,136 QueryKind = ValueQuery,137 OnEmpty = T::DefaultCollatorSelectionKickThreshold,138 >;139140 #[pallet::call]141 impl<T: Config> Pallet<T> {142 #[pallet::call_index(0)]143 #[pallet::weight(T::WeightInfo::set_weight_to_fee_coefficient_override())]144 pub fn set_weight_to_fee_coefficient_override(145 origin: OriginFor<T>,146 coeff: Option<u64>,147 ) -> DispatchResult {148 ensure_root(origin)?;149 if let Some(coeff) = coeff {150 <WeightToFeeCoefficientOverride<T>>::set(coeff);151 } else {152 <WeightToFeeCoefficientOverride<T>>::kill();153 }154 Ok(())155 }156157 #[pallet::call_index(1)]158 #[pallet::weight(T::WeightInfo::set_min_gas_price_override())]159 pub fn set_min_gas_price_override(160 origin: OriginFor<T>,161 coeff: Option<u64>,162 ) -> DispatchResult {163 ensure_root(origin)?;164 if let Some(coeff) = coeff {165 <MinGasPriceOverride<T>>::set(coeff);166 } else {167 <MinGasPriceOverride<T>>::kill();168 }169 Ok(())170 }171172 #[pallet::call_index(3)]173 #[pallet::weight(T::WeightInfo::set_app_promotion_configuration_override())]174 pub fn set_app_promotion_configuration_override(175 origin: OriginFor<T>,176 mut configuration: AppPromotionConfiguration<T::BlockNumber>,177 ) -> DispatchResult {178 ensure_root(origin)?;179 if configuration.interval_income.is_some() {180 return Err(<Error<T>>::InconsistentConfiguration.into());181 }182183 configuration.interval_income = configuration.recalculation_interval.map(|b| {184 Perbill::from_rational(b, T::DayRelayBlocks::get())185 * T::AppPromotionDailyRate::get()186 });187188 <AppPromomotionConfigurationOverride<T>>::set(configuration);189190 Ok(())191 }192193 #[pallet::call_index(4)]194 #[pallet::weight(T::WeightInfo::set_collator_selection_desired_collators())]195 pub fn set_collator_selection_desired_collators(196 origin: OriginFor<T>,197 max: Option<u32>,198 ) -> DispatchResult {199 ensure_root(origin)?;200 if let Some(max) = max {201 // we trust origin calls, this is just a for more accurate benchmarking202 if max > T::DefaultCollatorSelectionMaxCollators::get() {203 log::warn!("max > T::DefaultCollatorSelectionMaxCollators; you might need to run benchmarks again");204 }205 <CollatorSelectionDesiredCollatorsOverride<T>>::set(max);206 } else {207 <CollatorSelectionDesiredCollatorsOverride<T>>::kill();208 }209 Self::deposit_event(Event::NewDesiredCollators {210 desired_collators: max,211 });212 Ok(())213 }214215 #[pallet::call_index(5)]216 #[pallet::weight(T::WeightInfo::set_collator_selection_license_bond())]217 pub fn set_collator_selection_license_bond(218 origin: OriginFor<T>,219 amount: Option<BalanceOf<T>>,220 ) -> DispatchResult {221 ensure_root(origin)?;222 if let Some(amount) = amount {223 <CollatorSelectionLicenseBondOverride<T>>::set(amount);224 } else {225 <CollatorSelectionLicenseBondOverride<T>>::kill();226 }227 Self::deposit_event(Event::NewCollatorLicenseBond { bond_cost: amount });228 Ok(())229 }230231 #[pallet::call_index(6)]232 #[pallet::weight(T::WeightInfo::set_collator_selection_kick_threshold())]233 pub fn set_collator_selection_kick_threshold(234 origin: OriginFor<T>,235 threshold: Option<T::BlockNumber>,236 ) -> DispatchResult {237 ensure_root(origin)?;238 if let Some(threshold) = threshold {239 <CollatorSelectionKickThresholdOverride<T>>::set(threshold);240 } else {241 <CollatorSelectionKickThresholdOverride<T>>::kill();242 }243 Self::deposit_event(Event::NewCollatorKickThreshold {244 length_in_blocks: threshold,245 });246 Ok(())247 }248 }249250 #[pallet::pallet]251 #[pallet::generate_store(pub(super) trait Store)]252 pub struct Pallet<T>(_);253}254255pub struct WeightToFee<T, B>(PhantomData<(T, B)>);256257impl<T, B> WeightToFeePolynomial for WeightToFee<T, B>258where259 T: Config,260 B: BaseArithmetic + From<u32> + From<u64> + Copy + Unsigned,261{262 type Balance = B;263264 fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {265 smallvec!(WeightToFeeCoefficient {266 coeff_integer: (<WeightToFeeCoefficientOverride<T>>::get() / Perbill::ACCURACY as u64)267 .into(),268 coeff_frac: Perbill::from_parts(269 (<WeightToFeeCoefficientOverride<T>>::get() % Perbill::ACCURACY as u64) as u32270 ),271 negative: false,272 degree: 1,273 })274 }275}276277pub struct FeeCalculator<T>(PhantomData<T>);278impl<T: Config> fp_evm::FeeCalculator for FeeCalculator<T> {279 fn min_gas_price() -> (U256, Weight) {280 (281 <MinGasPriceOverride<T>>::get().into(),282 T::DbWeight::get().reads(1),283 )284 }285}286287#[derive(Encode, Decode, Clone, Debug, Default, TypeInfo, MaxEncodedLen, PartialEq, PartialOrd)]288pub struct AppPromotionConfiguration<BlockNumber> {289 /// In relay blocks.290 pub recalculation_interval: Option<BlockNumber>,291 /// In parachain blocks.292 pub pending_interval: Option<BlockNumber>,293 /// Value for `RecalculationInterval` based on 0.05% per 24h.294 pub interval_income: Option<Perbill>,295 /// Maximum allowable number of stakers calculated per call of the `app-promotion::PayoutStakers` extrinsic.296 pub max_stakers_per_calculation: Option<u8>,297}runtime/common/config/xcm/mod.rsdiffbeforeafterboth--- a/runtime/common/config/xcm/mod.rs
+++ b/runtime/common/config/xcm/mod.rs
@@ -148,38 +148,6 @@
}
}
-// Allow xcm exchange only with locations in list
-pub struct DenyExchangeWithUnknownLocation<T>(PhantomData<T>);
-impl<T: Get<Vec<MultiLocation>>> TryPass for DenyExchangeWithUnknownLocation<T> {
- fn try_pass<Call>(origin: &MultiLocation, message: &mut [Instruction<Call>]) -> Result<(), ()> {
- let allowed_locations = T::get();
-
- // Check if deposit or transfer belongs to allowed parachains
- let mut allowed = allowed_locations.contains(origin);
-
- message.iter().for_each(|inst| match inst {
- DepositReserveAsset { dest: dst, .. }
- | TransferReserveAsset { dest: dst, .. }
- | InitiateReserveWithdraw { reserve: dst, .. } => {
- allowed |= allowed_locations.contains(&dst);
- }
- // ? There are more instructions worth checking
- _ => {}
- });
-
- if allowed {
- return Ok(());
- }
-
- log::warn!(
- target: "xcm::barrier",
- "Unexpected deposit or transfer location"
- );
- // Deny
- Err(())
- }
-}
-
pub type Weigher = FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;
pub struct XcmExecutorConfig<T>(PhantomData<T>);
runtime/quartz/src/xcm_barrier.rsdiffbeforeafterboth--- a/runtime/quartz/src/xcm_barrier.rs
+++ b/runtime/quartz/src/xcm_barrier.rs
@@ -15,23 +15,16 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
use frame_support::{
- match_types, parameter_types,
- traits::{Get, Everything},
+ match_types,
+ traits::Everything,
};
-use sp_std::{vec, vec::Vec};
-use xcm::latest::{Junction::*, Junctions::*, MultiLocation};
+use xcm::latest::{Junctions::*, MultiLocation};
use xcm_builder::{
AllowKnownQueryResponses, AllowSubscriptionsFrom, TakeWeightCredit,
AllowTopLevelPaidExecutionFrom,
};
-use crate::{
- Runtime, ParachainInfo, PolkadotXcm,
- runtime_common::{
- config::xcm::{DenyThenTry, DenyExchangeWithUnknownLocation},
- xcm::OverridableAllowedLocations,
- },
-};
+use crate::PolkadotXcm;
match_types! {
pub type ParentOrSiblings: impl Contains<MultiLocation> = {
@@ -40,51 +33,11 @@
};
}
-parameter_types! {
- pub QuartzDefaultAllowedLocations: Vec<MultiLocation> = vec![
- // Self location
- MultiLocation {
- parents: 0,
- interior: Here,
- },
- // Parent location
- MultiLocation {
- parents: 1,
- interior: Here,
- },
- // Statemint/Statemint location
- MultiLocation {
- parents: 1,
- interior: X1(Parachain(1000)),
- },
- // Karura/Acala location
- MultiLocation {
- parents: 1,
- interior: X1(Parachain(2000)),
- },
- // Moonriver location
- MultiLocation {
- parents: 1,
- interior: X1(Parachain(2023)),
- },
- // Self parachain address
- MultiLocation {
- parents: 1,
- interior: X1(Parachain(ParachainInfo::get().into())),
- },
- ];
-}
-
-pub type Barrier = DenyThenTry<
- DenyExchangeWithUnknownLocation<
- OverridableAllowedLocations<Runtime, QuartzDefaultAllowedLocations>,
- >,
- (
- TakeWeightCredit,
- AllowTopLevelPaidExecutionFrom<Everything>,
- // Expected responses are OK.
- AllowKnownQueryResponses<PolkadotXcm>,
- // Subscriptions for version tracking are OK.
- AllowSubscriptionsFrom<ParentOrSiblings>,
- ),
->;
+pub type Barrier = (
+ TakeWeightCredit,
+ AllowTopLevelPaidExecutionFrom<Everything>,
+ // Expected responses are OK.
+ AllowKnownQueryResponses<PolkadotXcm>,
+ // Subscriptions for version tracking are OK.
+ AllowSubscriptionsFrom<ParentOrSiblings>,
+);
runtime/unique/src/xcm_barrier.rsdiffbeforeafterboth--- a/runtime/unique/src/xcm_barrier.rs
+++ b/runtime/unique/src/xcm_barrier.rs
@@ -15,23 +15,16 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
use frame_support::{
- match_types, parameter_types,
- traits::{Get, Everything},
+ match_types,
+ traits::Everything,
};
-use sp_std::{vec, vec::Vec};
-use xcm::latest::{Junction::*, Junctions::*, MultiLocation};
+use xcm::latest::{Junctions::*, MultiLocation};
use xcm_builder::{
AllowKnownQueryResponses, AllowSubscriptionsFrom, TakeWeightCredit,
AllowTopLevelPaidExecutionFrom,
};
-use crate::{
- Runtime, ParachainInfo, PolkadotXcm,
- runtime_common::{
- config::xcm::{DenyThenTry, DenyExchangeWithUnknownLocation},
- xcm::OverridableAllowedLocations,
- },
-};
+use crate::PolkadotXcm;
match_types! {
pub type ParentOrSiblings: impl Contains<MultiLocation> = {
@@ -40,51 +33,11 @@
};
}
-parameter_types! {
- pub UniqueDefaultAllowedLocations: Vec<MultiLocation> = vec![
- // Self location
- MultiLocation {
- parents: 0,
- interior: Here,
- },
- // Parent location
- MultiLocation {
- parents: 1,
- interior: Here,
- },
- // Statemint/Statemint location
- MultiLocation {
- parents: 1,
- interior: X1(Parachain(1000)),
- },
- // Karura/Acala location
- MultiLocation {
- parents: 1,
- interior: X1(Parachain(2000)),
- },
- // Moonbeam location
- MultiLocation {
- parents: 1,
- interior: X1(Parachain(2004)),
- },
- // Self parachain address
- MultiLocation {
- parents: 1,
- interior: X1(Parachain(ParachainInfo::get().into())),
- },
- ];
-}
-
-pub type Barrier = DenyThenTry<
- DenyExchangeWithUnknownLocation<
- OverridableAllowedLocations<Runtime, UniqueDefaultAllowedLocations>,
- >,
- (
- TakeWeightCredit,
- AllowTopLevelPaidExecutionFrom<Everything>,
- // Expected responses are OK.
- AllowKnownQueryResponses<PolkadotXcm>,
- // Subscriptions for version tracking are OK.
- AllowSubscriptionsFrom<ParentOrSiblings>,
- ),
->;
+pub type Barrier = (
+ TakeWeightCredit,
+ AllowTopLevelPaidExecutionFrom<Everything>,
+ // Expected responses are OK.
+ AllowKnownQueryResponses<PolkadotXcm>,
+ // Subscriptions for version tracking are OK.
+ AllowSubscriptionsFrom<ParentOrSiblings>,
+);