git.delta.rocks / unique-network / refs/commits / 44d02634621c

difftreelog

feat add overridable xcm allowed locations

Daniel Shiposha2022-12-12parent: #489f7f3.patch.diff
in: master

8 files changed

modifiedCargo.lockdiffbeforeafterboth
5934 "sp-core",5934 "sp-core",
5935 "sp-runtime",5935 "sp-runtime",
5936 "sp-std",5936 "sp-std",
5937 "xcm",
5937]5938]
59385939
5939[[package]]5940[[package]]
modifiedpallets/configuration/Cargo.tomldiffbeforeafterboth
18sp-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" }
2122
22[features]23[features]
23default = ["std"]24default = ["std"]
modifiedpallets/configuration/src/lib.rsdiffbeforeafterboth
35 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;
4142
42 #[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>;
50
51 #[pallet::constant]
52 type MaxOverridedAllowedLocations: Get<u32>;
48 }53 }
4954
50 #[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>;
65
66 #[pallet::storage]
67 pub type XcmAllowedLocationsOverride<T: Config> = StorageValue<
68 Value = BoundedVec<MultiLocation, T::MaxOverridedAllowedLocations>,
69 QueryKind = OptionQuery,
70 >;
6071
61 #[pallet::call]72 #[pallet::call]
62 impl<T: Config> Pallet<T> {73 impl<T: Config> Pallet<T> {
88 Ok(())99 Ok(())
89 }100 }
101
102 #[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 }
91112
92 #[pallet::pallet]113 #[pallet::pallet]
modifiedruntime/common/config/pallets/mod.rsdiffbeforeafterboth
102impl 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}
106107
107impl pallet_maintenance::Config for Runtime {108impl pallet_maintenance::Config for Runtime {
modifiedruntime/common/mod.rsdiffbeforeafterboth
21pub mod instance;21pub mod instance;
22pub mod maintenance;22pub mod maintenance;
23pub mod runtime_apis;23pub mod runtime_apis;
24pub mod xcm;
2425
25#[cfg(feature = "scheduler")]26#[cfg(feature = "scheduler")]
26pub mod scheduler;27pub mod scheduler;
addedruntime/common/xcm.rsdiffbeforeafterboth

no changes

modifiedruntime/quartz/src/xcm_barrier.rsdiffbeforeafterboth
26};26};
2727
28use 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};
3235
33match_types! {36match_types! {
38}41}
3942
40parameter_types! {43parameter_types! {
41 pub QuartzAllowedLocations: Vec<MultiLocation> = vec![44 pub QuartzDefaultAllowedLocations: Vec<MultiLocation> = vec![
42 // Self location45 // Self location
43 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 (
modifiedruntime/unique/src/xcm_barrier.rsdiffbeforeafterboth
26};26};
2727
28use 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};
3235
33match_types! {36match_types! {
38}41}
3942
40parameter_types! {43parameter_types! {
41 pub UniqueAllowedLocations: Vec<MultiLocation> = vec![44 pub UniqueDefaultAllowedLocations: Vec<MultiLocation> = vec![
42 // Self location45 // Self location
43 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 (