git.delta.rocks / unique-network / refs/commits / aa49f021671b

difftreelog

feat use pallet-configuration

Yaroslav Bolyukin2022-08-15parent: #a7efb3e.patch.diff
in: master

11 files changed

addedpallets/configuration/Cargo.tomldiffbeforeafterboth
--- /dev/null
+++ b/pallets/configuration/Cargo.toml
@@ -0,0 +1,33 @@
+[package]
+name = "pallet-configuration"
+version = "0.1.0"
+edition = "2021"
+
+[dependencies]
+parity-scale-codec = { version = "3.1.5", features = [
+	"derive",
+], default-features = false }
+scale-info = { version = "2.0.1", default-features = false, features = [
+	"derive",
+] }
+frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" }
+frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" }
+sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" }
+sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" }
+sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" }
+sp-arithmetic = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" }
+fp-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.24" }
+smallvec = "1.6.1"
+
+[features]
+default = ["std"]
+std = [
+	"parity-scale-codec/std",
+	"frame-support/std",
+	"frame-system/std",
+	"sp-runtime/std",
+	"sp-std/std",
+	"sp-core/std",
+	"sp-arithmetic/std",
+	"fp-evm/std",
+]
addedpallets/configuration/src/lib.rsdiffbeforeafterboth
--- /dev/null
+++ b/pallets/configuration/src/lib.rs
@@ -0,0 +1,124 @@
+// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
+// This file is part of Unique Network.
+
+// Unique Network is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Unique Network is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
+
+#![cfg_attr(not(feature = "std"), no_std)]
+
+use core::marker::PhantomData;
+
+use frame_support::{
+	pallet,
+	weights::{WeightToFeePolynomial, WeightToFeeCoefficients, WeightToFeeCoefficient},
+	traits::Get,
+};
+use sp_arithmetic::traits::{BaseArithmetic, Unsigned};
+use smallvec::smallvec;
+
+pub use pallet::*;
+use sp_core::U256;
+use sp_runtime::Perbill;
+
+#[pallet]
+mod pallet {
+	use super::*;
+	use frame_support::{
+		traits::Get,
+		pallet_prelude::{StorageValue, ValueQuery, DispatchResult},
+	};
+	use frame_system::{pallet_prelude::OriginFor, ensure_root};
+
+	#[pallet::config]
+	pub trait Config: frame_system::Config {
+		#[pallet::constant]
+		type DefaultWeightToFeeCoefficient: Get<u32>;
+		#[pallet::constant]
+		type DefaultMinGasPrice: Get<u64>;
+	}
+
+	#[pallet::storage]
+	pub type WeightToFeeCoefficientOverride<T: Config> = StorageValue<
+		Value = u32,
+		QueryKind = ValueQuery,
+		OnEmpty = T::DefaultWeightToFeeCoefficient,
+	>;
+
+	#[pallet::storage]
+	pub type MinGasPriceOverride<T: Config> =
+		StorageValue<Value = u64, QueryKind = ValueQuery, OnEmpty = T::DefaultMinGasPrice>;
+
+	#[pallet::call]
+	impl<T: Config> Pallet<T> {
+		#[pallet::weight(T::DbWeight::get().writes(1))]
+		pub fn set_weight_to_fee_coefficient_override(
+			origin: OriginFor<T>,
+			coeff: Option<u32>,
+		) -> DispatchResult {
+			let _sender = ensure_root(origin)?;
+			if let Some(coeff) = coeff {
+				<WeightToFeeCoefficientOverride<T>>::set(coeff);
+			} else {
+				<WeightToFeeCoefficientOverride<T>>::kill();
+			}
+			Ok(())
+		}
+
+		#[pallet::weight(T::DbWeight::get().writes(1))]
+		pub fn set_min_gas_price_override(
+			origin: OriginFor<T>,
+			coeff: Option<u64>,
+		) -> DispatchResult {
+			let _sender = ensure_root(origin)?;
+			if let Some(coeff) = coeff {
+				<MinGasPriceOverride<T>>::set(coeff);
+			} else {
+				<MinGasPriceOverride<T>>::kill();
+			}
+			Ok(())
+		}
+	}
+
+	#[pallet::pallet]
+	#[pallet::generate_store(pub(super) trait Store)]
+	pub struct Pallet<T>(_);
+}
+
+pub struct WeightToFee<T, B>(PhantomData<(T, B)>);
+
+impl<T, B> WeightToFeePolynomial for WeightToFee<T, B>
+where
+	T: Config,
+	B: BaseArithmetic + From<u32> + Copy + Unsigned,
+{
+	type Balance = B;
+
+	fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
+		smallvec!(WeightToFeeCoefficient {
+			coeff_integer: <WeightToFeeCoefficientOverride<T>>::get().into(),
+			coeff_frac: Perbill::zero(),
+			negative: false,
+			degree: 1,
+		})
+	}
+}
+
+pub struct FeeCalculator<T>(PhantomData<T>);
+impl<T: Config> fp_evm::FeeCalculator for FeeCalculator<T> {
+	fn min_gas_price() -> (U256, u64) {
+		(
+			<MinGasPriceOverride<T>>::get().into(),
+			T::DbWeight::get().reads(1),
+		)
+	}
+}
modifiedprimitives/common/src/constants.rsdiffbeforeafterboth
--- a/primitives/common/src/constants.rs
+++ b/primitives/common/src/constants.rs
@@ -36,10 +36,10 @@
 pub const UNIQUE: Balance = 100 * CENTIUNIQUE;
 
 // Targeting 0.1 UNQ per transfer
-pub const WEIGHT_TO_FEE_COEFF: u32 = 207_890_902;
+pub const WEIGHT_TO_FEE_COEFF: u32 = /*<weight2fee>*/207_890_902/*</weight2fee>*/;
 
 // Targeting 0.15 UNQ per transfer via ETH
-pub const MIN_GAS_PRICE: u64 = 1_019_493_469_850;
+pub const MIN_GAS_PRICE: u64 = /*<mingasprice>*/1_019_493_469_850/*</mingasprice>*/;
 
 /// We assume that ~10% of the block weight is consumed by `on_initalize` handlers.
 /// This is used to limit the maximal weight of a single extrinsic.
modifiedruntime/common/config/ethereum.rsdiffbeforeafterboth
--- a/runtime/common/config/ethereum.rs
+++ b/runtime/common/config/ethereum.rs
@@ -50,13 +50,6 @@
 	}
 }
 
-pub struct FixedFee;
-impl pallet_evm::FeeCalculator for FixedFee {
-	fn min_gas_price() -> (U256, u64) {
-		(MIN_GAS_PRICE.into(), 0)
-	}
-}
-
 pub struct EthereumFindAuthor<F>(core::marker::PhantomData<F>);
 impl<F: FindAuthor<u32>> FindAuthor<H160> for EthereumFindAuthor<F> {
 	fn find_author<'a, I>(digests: I) -> Option<H160>
@@ -73,7 +66,7 @@
 
 impl pallet_evm::Config for Runtime {
 	type BlockGasLimit = BlockGasLimit;
-	type FeeCalculator = FixedFee;
+	type FeeCalculator = pallet_configuration::FeeCalculator<Self>;
 	type GasWeightMapping = FixedGasWeightMapping;
 	type BlockHashMapping = pallet_ethereum::EthereumBlockHashMapping<Self>;
 	type CallOrigin = EnsureAddressTruncated<Self>;
modifiedruntime/common/config/pallets/mod.rsdiffbeforeafterboth
--- a/runtime/common/config/pallets/mod.rs
+++ b/runtime/common/config/pallets/mod.rs
@@ -25,6 +25,7 @@
 	},
 	Runtime, Event, Call, Balances,
 };
+use frame_support::traits::{ConstU32, ConstU64};
 use up_common::{
 	types::{AccountId, Balance, BlockNumber},
 	constants::*,
@@ -91,3 +92,8 @@
 	type CommonWeightInfo = CommonWeights<Self>;
 	type RefungibleExtensionsWeightInfo = CommonWeights<Self>;
 }
+
+impl pallet_configuration::Config for Runtime {
+	type DefaultWeightToFeeCoefficient = ConstU32<{ up_common::constants::WEIGHT_TO_FEE_COEFF }>;
+	type DefaultMinGasPrice = ConstU64<{ up_common::constants::MIN_GAS_PRICE }>;
+}
modifiedruntime/common/config/substrate.rsdiffbeforeafterboth
before · runtime/common/config/substrate.rs
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/>.1617use frame_support::{18	traits::{Everything, ConstU32},19	weights::{20		constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight},21		DispatchClass, WeightToFeePolynomial, WeightToFeeCoefficients, ConstantMultiplier,22		WeightToFeeCoefficient,23	},24	parameter_types, PalletId,25};26use sp_runtime::{27	generic,28	traits::{BlakeTwo256, AccountIdLookup},29	Perbill, Permill, Percent,30};31use frame_system::{32	limits::{BlockLength, BlockWeights},33	EnsureRoot,34};35use sp_arithmetic::traits::{BaseArithmetic, Unsigned};36use smallvec::smallvec;37use crate::{38	runtime_common::DealWithFees, Runtime, Event, Call, Origin, PalletInfo, System, Balances,39	Treasury, SS58Prefix, Version,40};41use up_common::{types::*, constants::*};4243parameter_types! {44	pub const BlockHashCount: BlockNumber = 2400;45	pub RuntimeBlockLength: BlockLength =46		BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);47	pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);48	pub const MaximumBlockLength: u32 = 5 * 1024 * 1024;49	pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder()50		.base_block(BlockExecutionWeight::get())51		.for_class(DispatchClass::all(), |weights| {52			weights.base_extrinsic = ExtrinsicBaseWeight::get();53		})54		.for_class(DispatchClass::Normal, |weights| {55			weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);56		})57		.for_class(DispatchClass::Operational, |weights| {58			weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT);59			// Operational transactions have some extra reserved space, so that they60			// are included even if block reached `MAXIMUM_BLOCK_WEIGHT`.61			weights.reserved = Some(62				MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT63			);64		})65		.avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)66		.build_or_panic();67}6869impl frame_system::Config for Runtime {70	/// The data to be stored in an account.71	type AccountData = pallet_balances::AccountData<Balance>;72	/// The identifier used to distinguish between accounts.73	type AccountId = AccountId;74	/// The basic call filter to use in dispatchable.75	type BaseCallFilter = Everything;76	/// Maximum number of block number to block hash mappings to keep (oldest pruned first).77	type BlockHashCount = BlockHashCount;78	/// The maximum length of a block (in bytes).79	type BlockLength = RuntimeBlockLength;80	/// The index type for blocks.81	type BlockNumber = BlockNumber;82	/// The weight of the overhead invoked on the block import process, independent of the extrinsics included in that block.83	type BlockWeights = RuntimeBlockWeights;84	/// The aggregated dispatch type that is available for extrinsics.85	type Call = Call;86	/// The weight of database operations that the runtime can invoke.87	type DbWeight = RocksDbWeight;88	/// The ubiquitous event type.89	type Event = Event;90	/// The type for hashing blocks and tries.91	type Hash = Hash;92	/// The hashing algorithm used.93	type Hashing = BlakeTwo256;94	/// The header type.95	type Header = generic::Header<BlockNumber, BlakeTwo256>;96	/// The index type for storing how many extrinsics an account has signed.97	type Index = Index;98	/// The lookup mechanism to get account ID from whatever is passed in dispatchers.99	type Lookup = AccountIdLookup<AccountId, ()>;100	/// What to do if an account is fully reaped from the system.101	type OnKilledAccount = ();102	/// What to do if a new account is created.103	type OnNewAccount = ();104	type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;105	/// The ubiquitous origin type.106	type Origin = Origin;107	/// This type is being generated by `construct_runtime!`.108	type PalletInfo = PalletInfo;109	/// This is used as an identifier of the chain. 42 is the generic substrate prefix.110	type SS58Prefix = SS58Prefix;111	/// Weight information for the extrinsics of this pallet.112	type SystemWeightInfo = frame_system::weights::SubstrateWeight<Self>;113	/// Version of the runtime.114	type Version = Version;115	type MaxConsumers = ConstU32<16>;116}117118impl pallet_randomness_collective_flip::Config for Runtime {}119120parameter_types! {121	pub const MinimumPeriod: u64 = SLOT_DURATION / 2;122}123124impl pallet_timestamp::Config for Runtime {125	/// A timestamp: milliseconds since the unix epoch.126	type Moment = u64;127	type OnTimestampSet = ();128	type MinimumPeriod = MinimumPeriod;129	type WeightInfo = ();130}131132parameter_types! {133	// pub const ExistentialDeposit: u128 = 500;134	pub const ExistentialDeposit: u128 = 0;135	pub const MaxLocks: u32 = 50;136	pub const MaxReserves: u32 = 50;137}138139impl pallet_balances::Config for Runtime {140	type MaxLocks = MaxLocks;141	type MaxReserves = MaxReserves;142	type ReserveIdentifier = [u8; 16];143	/// The type for recording an account's balance.144	type Balance = Balance;145	/// The ubiquitous event type.146	type Event = Event;147	type DustRemoval = Treasury;148	type ExistentialDeposit = ExistentialDeposit;149	type AccountStore = System;150	type WeightInfo = pallet_balances::weights::SubstrateWeight<Self>;151}152153parameter_types! {154	/// This value increases the priority of `Operational` transactions by adding155	/// a "virtual tip" that's equal to the `OperationalFeeMultiplier * final_fee`.156	pub const OperationalFeeMultiplier: u8 = 5;157}158159/// Linear implementor of `WeightToFeePolynomial`160pub struct LinearFee<T>(sp_std::marker::PhantomData<T>);161162impl<T> WeightToFeePolynomial for LinearFee<T>163where164	T: BaseArithmetic + From<u32> + Copy + Unsigned,165{166	type Balance = T;167168	fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {169		smallvec!(WeightToFeeCoefficient {170			coeff_integer: WEIGHT_TO_FEE_COEFF.into(),171			coeff_frac: Perbill::zero(),172			negative: false,173			degree: 1,174		})175	}176}177178impl pallet_transaction_payment::Config for Runtime {179	type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees>;180	type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;181	type OperationalFeeMultiplier = OperationalFeeMultiplier;182	type WeightToFee = LinearFee<Balance>;183	type FeeMultiplierUpdate = ();184}185186parameter_types! {187	pub const ProposalBond: Permill = Permill::from_percent(5);188	pub const ProposalBondMinimum: Balance = 1 * UNIQUE;189	pub const ProposalBondMaximum: Balance = 1000 * UNIQUE;190	pub const SpendPeriod: BlockNumber = 5 * MINUTES;191	pub const Burn: Permill = Permill::from_percent(0);192	pub const TipCountdown: BlockNumber = 1 * DAYS;193	pub const TipFindersFee: Percent = Percent::from_percent(20);194	pub const TipReportDepositBase: Balance = 1 * UNIQUE;195	pub const DataDepositPerByte: Balance = 1 * CENTIUNIQUE;196	pub const BountyDepositBase: Balance = 1 * UNIQUE;197	pub const BountyDepositPayoutDelay: BlockNumber = 1 * DAYS;198	pub const TreasuryModuleId: PalletId = PalletId(*b"py/trsry");199	pub const BountyUpdatePeriod: BlockNumber = 14 * DAYS;200	pub const MaximumReasonLength: u32 = 16384;201	pub const BountyCuratorDeposit: Permill = Permill::from_percent(50);202	pub const BountyValueMinimum: Balance = 5 * UNIQUE;203	pub const MaxApprovals: u32 = 100;204}205206impl pallet_treasury::Config for Runtime {207	type PalletId = TreasuryModuleId;208	type Currency = Balances;209	type ApproveOrigin = EnsureRoot<AccountId>;210	type RejectOrigin = EnsureRoot<AccountId>;211	type Event = Event;212	type OnSlash = ();213	type ProposalBond = ProposalBond;214	type ProposalBondMinimum = ProposalBondMinimum;215	type ProposalBondMaximum = ProposalBondMaximum;216	type SpendPeriod = SpendPeriod;217	type Burn = Burn;218	type BurnDestination = ();219	type SpendFunds = ();220	type WeightInfo = pallet_treasury::weights::SubstrateWeight<Self>;221	type MaxApprovals = MaxApprovals;222}223224impl pallet_sudo::Config for Runtime {225	type Event = Event;226	type Call = Call;227}228229parameter_types! {230	pub const MaxAuthorities: u32 = 100_000;231}232233impl pallet_aura::Config for Runtime {234	type AuthorityId = AuraId;235	type DisabledValidators = ();236	type MaxAuthorities = MaxAuthorities;237}
after · runtime/common/config/substrate.rs
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/>.1617use frame_support::{18	traits::{Everything, ConstU32},19	weights::{20		constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight},21		DispatchClass, ConstantMultiplier,22	},23	parameter_types, PalletId,24};25use sp_runtime::{26	generic,27	traits::{BlakeTwo256, AccountIdLookup},28	Perbill, Permill, Percent,29};30use frame_system::{31	limits::{BlockLength, BlockWeights},32	EnsureRoot,33};34use crate::{35	runtime_common::DealWithFees, Runtime, Event, Call, Origin, PalletInfo, System, Balances,36	Treasury, SS58Prefix, Version,37};38use up_common::{types::*, constants::*};3940parameter_types! {41	pub const BlockHashCount: BlockNumber = 2400;42	pub RuntimeBlockLength: BlockLength =43		BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);44	pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);45	pub const MaximumBlockLength: u32 = 5 * 1024 * 1024;46	pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder()47		.base_block(BlockExecutionWeight::get())48		.for_class(DispatchClass::all(), |weights| {49			weights.base_extrinsic = ExtrinsicBaseWeight::get();50		})51		.for_class(DispatchClass::Normal, |weights| {52			weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);53		})54		.for_class(DispatchClass::Operational, |weights| {55			weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT);56			// Operational transactions have some extra reserved space, so that they57			// are included even if block reached `MAXIMUM_BLOCK_WEIGHT`.58			weights.reserved = Some(59				MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT60			);61		})62		.avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)63		.build_or_panic();64}6566impl frame_system::Config for Runtime {67	/// The data to be stored in an account.68	type AccountData = pallet_balances::AccountData<Balance>;69	/// The identifier used to distinguish between accounts.70	type AccountId = AccountId;71	/// The basic call filter to use in dispatchable.72	type BaseCallFilter = Everything;73	/// Maximum number of block number to block hash mappings to keep (oldest pruned first).74	type BlockHashCount = BlockHashCount;75	/// The maximum length of a block (in bytes).76	type BlockLength = RuntimeBlockLength;77	/// The index type for blocks.78	type BlockNumber = BlockNumber;79	/// The weight of the overhead invoked on the block import process, independent of the extrinsics included in that block.80	type BlockWeights = RuntimeBlockWeights;81	/// The aggregated dispatch type that is available for extrinsics.82	type Call = Call;83	/// The weight of database operations that the runtime can invoke.84	type DbWeight = RocksDbWeight;85	/// The ubiquitous event type.86	type Event = Event;87	/// The type for hashing blocks and tries.88	type Hash = Hash;89	/// The hashing algorithm used.90	type Hashing = BlakeTwo256;91	/// The header type.92	type Header = generic::Header<BlockNumber, BlakeTwo256>;93	/// The index type for storing how many extrinsics an account has signed.94	type Index = Index;95	/// The lookup mechanism to get account ID from whatever is passed in dispatchers.96	type Lookup = AccountIdLookup<AccountId, ()>;97	/// What to do if an account is fully reaped from the system.98	type OnKilledAccount = ();99	/// What to do if a new account is created.100	type OnNewAccount = ();101	type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;102	/// The ubiquitous origin type.103	type Origin = Origin;104	/// This type is being generated by `construct_runtime!`.105	type PalletInfo = PalletInfo;106	/// This is used as an identifier of the chain. 42 is the generic substrate prefix.107	type SS58Prefix = SS58Prefix;108	/// Weight information for the extrinsics of this pallet.109	type SystemWeightInfo = frame_system::weights::SubstrateWeight<Self>;110	/// Version of the runtime.111	type Version = Version;112	type MaxConsumers = ConstU32<16>;113}114115impl pallet_randomness_collective_flip::Config for Runtime {}116117parameter_types! {118	pub const MinimumPeriod: u64 = SLOT_DURATION / 2;119}120121impl pallet_timestamp::Config for Runtime {122	/// A timestamp: milliseconds since the unix epoch.123	type Moment = u64;124	type OnTimestampSet = ();125	type MinimumPeriod = MinimumPeriod;126	type WeightInfo = ();127}128129parameter_types! {130	// pub const ExistentialDeposit: u128 = 500;131	pub const ExistentialDeposit: u128 = 0;132	pub const MaxLocks: u32 = 50;133	pub const MaxReserves: u32 = 50;134}135136impl pallet_balances::Config for Runtime {137	type MaxLocks = MaxLocks;138	type MaxReserves = MaxReserves;139	type ReserveIdentifier = [u8; 16];140	/// The type for recording an account's balance.141	type Balance = Balance;142	/// The ubiquitous event type.143	type Event = Event;144	type DustRemoval = Treasury;145	type ExistentialDeposit = ExistentialDeposit;146	type AccountStore = System;147	type WeightInfo = pallet_balances::weights::SubstrateWeight<Self>;148}149150parameter_types! {151	/// This value increases the priority of `Operational` transactions by adding152	/// a "virtual tip" that's equal to the `OperationalFeeMultiplier * final_fee`.153	pub const OperationalFeeMultiplier: u8 = 5;154}155156impl pallet_transaction_payment::Config for Runtime {157	type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees>;158	type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;159	type OperationalFeeMultiplier = OperationalFeeMultiplier;160	type WeightToFee = pallet_configuration::WeightToFee<Self, Balance>;161	type FeeMultiplierUpdate = ();162}163164parameter_types! {165	pub const ProposalBond: Permill = Permill::from_percent(5);166	pub const ProposalBondMinimum: Balance = 1 * UNIQUE;167	pub const ProposalBondMaximum: Balance = 1000 * UNIQUE;168	pub const SpendPeriod: BlockNumber = 5 * MINUTES;169	pub const Burn: Permill = Permill::from_percent(0);170	pub const TipCountdown: BlockNumber = 1 * DAYS;171	pub const TipFindersFee: Percent = Percent::from_percent(20);172	pub const TipReportDepositBase: Balance = 1 * UNIQUE;173	pub const DataDepositPerByte: Balance = 1 * CENTIUNIQUE;174	pub const BountyDepositBase: Balance = 1 * UNIQUE;175	pub const BountyDepositPayoutDelay: BlockNumber = 1 * DAYS;176	pub const TreasuryModuleId: PalletId = PalletId(*b"py/trsry");177	pub const BountyUpdatePeriod: BlockNumber = 14 * DAYS;178	pub const MaximumReasonLength: u32 = 16384;179	pub const BountyCuratorDeposit: Permill = Permill::from_percent(50);180	pub const BountyValueMinimum: Balance = 5 * UNIQUE;181	pub const MaxApprovals: u32 = 100;182}183184impl pallet_treasury::Config for Runtime {185	type PalletId = TreasuryModuleId;186	type Currency = Balances;187	type ApproveOrigin = EnsureRoot<AccountId>;188	type RejectOrigin = EnsureRoot<AccountId>;189	type Event = Event;190	type OnSlash = ();191	type ProposalBond = ProposalBond;192	type ProposalBondMinimum = ProposalBondMinimum;193	type ProposalBondMaximum = ProposalBondMaximum;194	type SpendPeriod = SpendPeriod;195	type Burn = Burn;196	type BurnDestination = ();197	type SpendFunds = ();198	type WeightInfo = pallet_treasury::weights::SubstrateWeight<Self>;199	type MaxApprovals = MaxApprovals;200}201202impl pallet_sudo::Config for Runtime {203	type Event = Event;204	type Call = Call;205}206207parameter_types! {208	pub const MaxAuthorities: u32 = 100_000;209}210211impl pallet_aura::Config for Runtime {212	type AuthorityId = AuraId;213	type DisabledValidators = ();214	type MaxAuthorities = MaxAuthorities;215}
modifiedruntime/common/config/xcm.rsdiffbeforeafterboth
--- a/runtime/common/config/xcm.rs
+++ b/runtime/common/config/xcm.rs
@@ -44,8 +44,7 @@
 use xcm_executor::{Config, XcmExecutor, Assets};
 use sp_std::marker::PhantomData;
 use crate::{
-	runtime_common::config::substrate::LinearFee, Runtime, Call, Event, Origin, Balances,
-	ParachainInfo, ParachainSystem, PolkadotXcm, XcmpQueue,
+	Runtime, Call, Event, Origin, Balances, ParachainInfo, ParachainSystem, PolkadotXcm, XcmpQueue,
 };
 use up_common::{
 	types::{AccountId, Balance},
@@ -234,8 +233,11 @@
 	}
 }
 
-pub struct XcmConfig;
-impl Config for XcmConfig {
+pub struct XcmConfig<T>(PhantomData<T>);
+impl<T> Config for XcmConfig<T>
+where
+	T: pallet_configuration::Config,
+{
 	type Call = Call;
 	type XcmSender = XcmRouter;
 	// How to withdraw and deposit an asset.
@@ -246,8 +248,13 @@
 	type LocationInverter = LocationInverter<Ancestry>;
 	type Barrier = Barrier;
 	type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
-	type Trader =
-		UsingOnlySelfCurrencyComponents<LinearFee<Balance>, RelayLocation, AccountId, Balances, ()>;
+	type Trader = UsingOnlySelfCurrencyComponents<
+		pallet_configuration::WeightToFee<T, Balance>,
+		RelayLocation,
+		AccountId,
+		Balances,
+		(),
+	>;
 	type ResponseHandler = (); // Don't handle responses for now.
 	type SubscriptionService = PolkadotXcm;
 
@@ -261,7 +268,7 @@
 	type XcmRouter = XcmRouter;
 	type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;
 	type XcmExecuteFilter = Everything;
-	type XcmExecutor = XcmExecutor<XcmConfig>;
+	type XcmExecutor = XcmExecutor<XcmConfig<Self>>;
 	type XcmTeleportFilter = Everything;
 	type XcmReserveTransferFilter = Everything;
 	type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
@@ -274,13 +281,13 @@
 
 impl cumulus_pallet_xcm::Config for Runtime {
 	type Event = Event;
-	type XcmExecutor = XcmExecutor<XcmConfig>;
+	type XcmExecutor = XcmExecutor<XcmConfig<Self>>;
 }
 
 impl cumulus_pallet_xcmp_queue::Config for Runtime {
 	type WeightInfo = ();
 	type Event = Event;
-	type XcmExecutor = XcmExecutor<XcmConfig>;
+	type XcmExecutor = XcmExecutor<XcmConfig<Self>>;
 	type ChannelInfo = ParachainSystem;
 	type VersionWrapper = ();
 	type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;
@@ -290,6 +297,6 @@
 
 impl cumulus_pallet_dmp_queue::Config for Runtime {
 	type Event = Event;
-	type XcmExecutor = XcmExecutor<XcmConfig>;
+	type XcmExecutor = XcmExecutor<XcmConfig<Self>>;
 	type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;
 }
modifiedruntime/common/construct_runtime/mod.rsdiffbeforeafterboth
--- a/runtime/common/construct_runtime/mod.rs
+++ b/runtime/common/construct_runtime/mod.rs
@@ -57,7 +57,7 @@
                 #[runtimes(opal)]
                 Scheduler: pallet_unique_scheduler::{Pallet, Call, Storage, Event<T>} = 62,
 
-                // free = 63
+                Configuration: pallet_configuration::{Pallet, Call, Storage} = 63,
 
                 Charging: pallet_charge_transaction::{Pallet, Call, Storage } = 64,
                 // ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,
modifiedruntime/opal/Cargo.tomldiffbeforeafterboth
--- a/runtime/opal/Cargo.toml
+++ b/runtime/opal/Cargo.toml
@@ -87,6 +87,7 @@
     'parachain-info/std',
     'serde',
     'pallet-inflation/std',
+    'pallet-configuration/std',
     'pallet-common/std',
     'pallet-structure/std',
     'pallet-fungible/std',
@@ -414,6 +415,7 @@
 fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.24" }
 pallet-inflation = { path = '../../pallets/inflation', default-features = false }
 up-data-structs = { path = '../../primitives/data-structs', default-features = false }
+pallet-configuration = { default-features = false, path = "../../pallets/configuration" }
 pallet-common = { default-features = false, path = "../../pallets/common" }
 pallet-structure = { default-features = false, path = "../../pallets/structure" }
 pallet-fungible = { default-features = false, path = "../../pallets/fungible" }
modifiedruntime/quartz/Cargo.tomldiffbeforeafterboth
--- a/runtime/quartz/Cargo.toml
+++ b/runtime/quartz/Cargo.toml
@@ -87,6 +87,7 @@
     'parachain-info/std',
     'serde',
     'pallet-inflation/std',
+    'pallet-configuration/std',
     'pallet-common/std',
     'pallet-structure/std',
     'pallet-fungible/std',
@@ -418,6 +419,7 @@
 fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.24" }
 pallet-inflation = { path = '../../pallets/inflation', default-features = false }
 up-data-structs = { path = '../../primitives/data-structs', default-features = false }
+pallet-configuration = { default-features = false, path = "../../pallets/configuration" }
 pallet-common = { default-features = false, path = "../../pallets/common" }
 pallet-structure = { default-features = false, path = "../../pallets/structure" }
 pallet-fungible = { default-features = false, path = "../../pallets/fungible" }
modifiedruntime/unique/Cargo.tomldiffbeforeafterboth
--- a/runtime/unique/Cargo.toml
+++ b/runtime/unique/Cargo.toml
@@ -88,6 +88,7 @@
     'parachain-info/std',
     'serde',
     'pallet-inflation/std',
+    'pallet-configuration/std',
     'pallet-common/std',
     'pallet-structure/std',
     'pallet-fungible/std',
@@ -411,6 +412,7 @@
 rmrk-rpc = { path = "../../primitives/rmrk-rpc", default-features = false }
 pallet-inflation = { path = '../../pallets/inflation', default-features = false }
 up-data-structs = { path = '../../primitives/data-structs', default-features = false }
+pallet-configuration = { default-features = false, path = "../../pallets/configuration" }
 pallet-common = { default-features = false, path = "../../pallets/common" }
 pallet-structure = { default-features = false, path = "../../pallets/structure" }
 pallet-fungible = { default-features = false, path = "../../pallets/fungible" }