difftreelog
feat add overridable xcm allowed locations
in: master
8 files changed
Cargo.lockdiffbeforeafterboth5934 "sp-core",5934 "sp-core",5935 "sp-runtime",5935 "sp-runtime",5936 "sp-std",5936 "sp-std",5937 "xcm",5937]5938]593859395939[[package]]5940[[package]]pallets/configuration/Cargo.tomldiffbeforeafterboth18sp-arithmetic = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }18sp-arithmetic = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }19fp-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.30-2" }19fp-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.30-2" }20smallvec = "1.6.1"20smallvec = "1.6.1"21xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" }212222[features]23[features]23default = ["std"]24default = ["std"]pallets/configuration/src/lib.rsdiffbeforeafterboth35 use super::*;35 use super::*;36 use frame_support::{36 use frame_support::{37 traits::Get,37 traits::Get,38 pallet_prelude::{StorageValue, ValueQuery, DispatchResult},38 pallet_prelude::{StorageValue, ValueQuery, DispatchResult, OptionQuery}, BoundedVec,39 };39 };40 use frame_system::{pallet_prelude::OriginFor, ensure_root};40 use frame_system::{pallet_prelude::OriginFor, ensure_root};41 use xcm::v1::MultiLocation;414242 #[pallet::config]43 #[pallet::config]43 pub trait Config: frame_system::Config {44 pub trait Config: frame_system::Config {46 #[pallet::constant]48 #[pallet::constant]47 type DefaultMinGasPrice: Get<u64>;49 type DefaultMinGasPrice: Get<u64>;5051 #[pallet::constant]52 type MaxOverridedAllowedLocations: Get<u32>;48 }53 }495450 #[pallet::storage]55 #[pallet::storage]58 pub type MinGasPriceOverride<T: Config> =63 pub type MinGasPriceOverride<T: Config> =59 StorageValue<Value = u64, QueryKind = ValueQuery, OnEmpty = T::DefaultMinGasPrice>;64 StorageValue<Value = u64, QueryKind = ValueQuery, OnEmpty = T::DefaultMinGasPrice>;6566 #[pallet::storage]67 pub type XcmAllowedLocationsOverride<T: Config> = StorageValue<68 Value = BoundedVec<MultiLocation, T::MaxOverridedAllowedLocations>,69 QueryKind = OptionQuery,70 >;607161 #[pallet::call]72 #[pallet::call]62 impl<T: Config> Pallet<T> {73 impl<T: Config> Pallet<T> {88 Ok(())99 Ok(())89 }100 }101102 #[pallet::weight(T::DbWeight::get().writes(1))]103 pub fn set_xcm_allowed_locations(104 origin: OriginFor<T>,105 locations: Option<BoundedVec<MultiLocation, T::MaxOverridedAllowedLocations>>,106 ) -> DispatchResult {107 let _sender = ensure_root(origin)?;108 <XcmAllowedLocationsOverride<T>>::set(locations);109 Ok(())110 }90 }111 }9111292 #[pallet::pallet]113 #[pallet::pallet]runtime/common/config/pallets/mod.rsdiffbeforeafterboth102impl pallet_configuration::Config for Runtime {102impl pallet_configuration::Config for Runtime {103 type DefaultWeightToFeeCoefficient = ConstU32<{ up_common::constants::WEIGHT_TO_FEE_COEFF }>;103 type DefaultWeightToFeeCoefficient = ConstU32<{ up_common::constants::WEIGHT_TO_FEE_COEFF }>;104 type DefaultMinGasPrice = ConstU64<{ up_common::constants::MIN_GAS_PRICE }>;104 type DefaultMinGasPrice = ConstU64<{ up_common::constants::MIN_GAS_PRICE }>;105 type MaxOverridedAllowedLocations = ConstU32<16>;105}106}106107107impl pallet_maintenance::Config for Runtime {108impl pallet_maintenance::Config for Runtime {runtime/common/mod.rsdiffbeforeafterboth21pub mod instance;21pub mod instance;22pub mod maintenance;22pub mod maintenance;23pub mod runtime_apis;23pub mod runtime_apis;24pub mod xcm;242525#[cfg(feature = "scheduler")]26#[cfg(feature = "scheduler")]26pub mod scheduler;27pub mod scheduler;runtime/common/xcm.rsdiffbeforeafterbothno changes
runtime/quartz/src/xcm_barrier.rsdiffbeforeafterboth26};26};272728use crate::{28use crate::{29 ParachainInfo, PolkadotXcm,29 Runtime, ParachainInfo, PolkadotXcm,30 runtime_common::config::xcm::{DenyThenTry, DenyTransact, DenyExchangeWithUnknownLocation},30 runtime_common::{31 config::xcm::{DenyThenTry, DenyTransact, DenyExchangeWithUnknownLocation},32 xcm::OverridableAllowedLocations,33 }31};34};323533match_types! {36match_types! {38}41}394240parameter_types! {43parameter_types! {41 pub QuartzAllowedLocations: Vec<MultiLocation> = vec![44 pub QuartzDefaultAllowedLocations: Vec<MultiLocation> = vec![42 // Self location45 // Self location43 MultiLocation {46 MultiLocation {44 parents: 0,47 parents: 0,70pub type Barrier = DenyThenTry<73pub type Barrier = DenyThenTry<71 (74 (72 DenyTransact,75 DenyTransact,73 DenyExchangeWithUnknownLocation<QuartzAllowedLocations>,76 DenyExchangeWithUnknownLocation<77 OverridableAllowedLocations<Runtime, QuartzDefaultAllowedLocations>78 >,74 ),79 ),75 (80 (runtime/unique/src/xcm_barrier.rsdiffbeforeafterboth26};26};272728use crate::{28use crate::{29 ParachainInfo, PolkadotXcm,29 Runtime, ParachainInfo, PolkadotXcm,30 runtime_common::config::xcm::{DenyThenTry, DenyTransact, DenyExchangeWithUnknownLocation},30 runtime_common::{31 config::xcm::{DenyThenTry, DenyTransact, DenyExchangeWithUnknownLocation},32 xcm::OverridableAllowedLocations,33 }31};34};323533match_types! {36match_types! {38}41}394240parameter_types! {43parameter_types! {41 pub UniqueAllowedLocations: Vec<MultiLocation> = vec![44 pub UniqueDefaultAllowedLocations: Vec<MultiLocation> = vec![42 // Self location45 // Self location43 MultiLocation {46 MultiLocation {44 parents: 0,47 parents: 0,70pub type Barrier = DenyThenTry<73pub type Barrier = DenyThenTry<71 (74 (72 DenyTransact,75 DenyTransact,73 DenyExchangeWithUnknownLocation<UniqueAllowedLocations>,76 DenyExchangeWithUnknownLocation<77 OverridableAllowedLocations<Runtime, UniqueDefaultAllowedLocations>78 >,74 ),79 ),75 (80 (