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.rsdiffbeforeafterboth43 use super::*;43 use super::*;44 use frame_support::{44 use frame_support::{45 traits::{Get, ReservableCurrency, Currency},45 traits::{Get, ReservableCurrency, Currency},46 pallet_prelude::{StorageValue, ValueQuery, DispatchResult, IsType, OptionQuery},46 pallet_prelude::{StorageValue, ValueQuery, DispatchResult, IsType}, log,47 BoundedVec, log,48 };47 };49 use frame_system::{pallet_prelude::OriginFor, ensure_root, Config as SystemConfig};48 use frame_system::{pallet_prelude::OriginFor, ensure_root, Config as SystemConfig};50 use xcm::latest::MultiLocation;514952 pub use crate::weights::WeightInfo;50 pub use crate::weights::WeightInfo;53 pub type BalanceOf<T> =51 pub type BalanceOf<T> =114 pub type MinGasPriceOverride<T: Config> =112 pub type MinGasPriceOverride<T: Config> =115 StorageValue<Value = u64, QueryKind = ValueQuery, OnEmpty = T::DefaultMinGasPrice>;113 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 >;122114123 #[pallet::storage]115 #[pallet::storage]124 pub type AppPromomotionConfigurationOverride<T: Config> =116 pub type AppPromomotionConfigurationOverride<T: Config> =177 Ok(())169 Ok(())178 }170 }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 }190171191 #[pallet::call_index(3)]172 #[pallet::call_index(3)]192 #[pallet::weight(T::WeightInfo::set_app_promotion_configuration_override())]173 #[pallet::weight(T::WeightInfo::set_app_promotion_configuration_override())]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>,
+);