difftreelog
feat use pallet-configuration
in: master
11 files changed
pallets/configuration/Cargo.tomldiffbeforeafterbothno changes
pallets/configuration/src/lib.rsdiffbeforeafterbothno changes
primitives/common/src/constants.rsdiffbeforeafterboth36pub const UNIQUE: Balance = 100 * CENTIUNIQUE;36pub const UNIQUE: Balance = 100 * CENTIUNIQUE;373738// Targeting 0.1 UNQ per transfer38// Targeting 0.1 UNQ per transfer39pub const WEIGHT_TO_FEE_COEFF: u32 = 207_890_902;39pub const WEIGHT_TO_FEE_COEFF: u32 = /*<weight2fee>*/207_890_902/*</weight2fee>*/;404041// Targeting 0.15 UNQ per transfer via ETH41// Targeting 0.15 UNQ per transfer via ETH42pub const MIN_GAS_PRICE: u64 = 1_019_493_469_850;42pub const MIN_GAS_PRICE: u64 = /*<mingasprice>*/1_019_493_469_850/*</mingasprice>*/;434344/// We assume that ~10% of the block weight is consumed by `on_initalize` handlers.44/// We assume that ~10% of the block weight is consumed by `on_initalize` handlers.45/// This is used to limit the maximal weight of a single extrinsic.45/// This is used to limit the maximal weight of a single extrinsic.runtime/common/config/ethereum.rsdiffbeforeafterboth50 }50 }51}51}5253pub struct FixedFee;54impl pallet_evm::FeeCalculator for FixedFee {55 fn min_gas_price() -> (U256, u64) {56 (MIN_GAS_PRICE.into(), 0)57 }58}595260pub struct EthereumFindAuthor<F>(core::marker::PhantomData<F>);53pub struct EthereumFindAuthor<F>(core::marker::PhantomData<F>);61impl<F: FindAuthor<u32>> FindAuthor<H160> for EthereumFindAuthor<F> {54impl<F: FindAuthor<u32>> FindAuthor<H160> for EthereumFindAuthor<F> {736674impl pallet_evm::Config for Runtime {67impl pallet_evm::Config for Runtime {75 type BlockGasLimit = BlockGasLimit;68 type BlockGasLimit = BlockGasLimit;76 type FeeCalculator = FixedFee;69 type FeeCalculator = pallet_configuration::FeeCalculator<Self>;77 type GasWeightMapping = FixedGasWeightMapping;70 type GasWeightMapping = FixedGasWeightMapping;78 type BlockHashMapping = pallet_ethereum::EthereumBlockHashMapping<Self>;71 type BlockHashMapping = pallet_ethereum::EthereumBlockHashMapping<Self>;79 type CallOrigin = EnsureAddressTruncated<Self>;72 type CallOrigin = EnsureAddressTruncated<Self>;runtime/common/config/pallets/mod.rsdiffbeforeafterboth25 },25 },26 Runtime, Event, Call, Balances,26 Runtime, Event, Call, Balances,27};27};28use frame_support::traits::{ConstU32, ConstU64};28use up_common::{29use up_common::{29 types::{AccountId, Balance, BlockNumber},30 types::{AccountId, Balance, BlockNumber},30 constants::*,31 constants::*,92 type RefungibleExtensionsWeightInfo = CommonWeights<Self>;93 type RefungibleExtensionsWeightInfo = CommonWeights<Self>;93}94}9596impl pallet_configuration::Config for Runtime {97 type DefaultWeightToFeeCoefficient = ConstU32<{ up_common::constants::WEIGHT_TO_FEE_COEFF }>;98 type DefaultMinGasPrice = ConstU64<{ up_common::constants::MIN_GAS_PRICE }>;99}94100runtime/common/config/substrate.rsdiffbeforeafterboth18 traits::{Everything, ConstU32},18 traits::{Everything, ConstU32},19 weights::{19 weights::{20 constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight},20 constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight},21 DispatchClass, WeightToFeePolynomial, WeightToFeeCoefficients, ConstantMultiplier,21 DispatchClass, ConstantMultiplier,22 WeightToFeeCoefficient,23 },22 },24 parameter_types, PalletId,23 parameter_types, PalletId,25};24};32 limits::{BlockLength, BlockWeights},31 limits::{BlockLength, BlockWeights},33 EnsureRoot,32 EnsureRoot,34};33};35use sp_arithmetic::traits::{BaseArithmetic, Unsigned};36use smallvec::smallvec;37use crate::{34use crate::{38 runtime_common::DealWithFees, Runtime, Event, Call, Origin, PalletInfo, System, Balances,35 runtime_common::DealWithFees, Runtime, Event, Call, Origin, PalletInfo, System, Balances,39 Treasury, SS58Prefix, Version,36 Treasury, SS58Prefix, Version,156 pub const OperationalFeeMultiplier: u8 = 5;153 pub const OperationalFeeMultiplier: u8 = 5;157}154}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}177155178impl pallet_transaction_payment::Config for Runtime {156impl pallet_transaction_payment::Config for Runtime {179 type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees>;157 type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees>;180 type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;158 type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;181 type OperationalFeeMultiplier = OperationalFeeMultiplier;159 type OperationalFeeMultiplier = OperationalFeeMultiplier;182 type WeightToFee = LinearFee<Balance>;160 type WeightToFee = pallet_configuration::WeightToFee<Self, Balance>;183 type FeeMultiplierUpdate = ();161 type FeeMultiplierUpdate = ();184}162}185163runtime/common/config/xcm.rsdiffbeforeafterboth44use xcm_executor::{Config, XcmExecutor, Assets};44use xcm_executor::{Config, XcmExecutor, Assets};45use sp_std::marker::PhantomData;45use sp_std::marker::PhantomData;46use crate::{46use crate::{47 runtime_common::config::substrate::LinearFee, Runtime, Call, Event, Origin, Balances,47 Runtime, Call, Event, Origin, Balances, ParachainInfo, ParachainSystem, PolkadotXcm, XcmpQueue,48 ParachainInfo, ParachainSystem, PolkadotXcm, XcmpQueue,49};48};50use up_common::{49use up_common::{234 }233 }235}234}236235237pub struct XcmConfig;236pub struct XcmConfig<T>(PhantomData<T>);238impl Config for XcmConfig {237impl<T> Config for XcmConfig<T>238where239 T: pallet_configuration::Config,240{239 type Call = Call;241 type Call = Call;240 type XcmSender = XcmRouter;242 type XcmSender = XcmRouter;247 type Barrier = Barrier;249 type Barrier = Barrier;248 type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;250 type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;249 type Trader =251 type Trader = UsingOnlySelfCurrencyComponents<250 UsingOnlySelfCurrencyComponents<LinearFee<Balance>, RelayLocation, AccountId, Balances, ()>;252 pallet_configuration::WeightToFee<T, Balance>,253 RelayLocation,254 AccountId,255 Balances,256 (),257 >;251 type ResponseHandler = (); // Don't handle responses for now.258 type ResponseHandler = (); // Don't handle responses for now.252 type SubscriptionService = PolkadotXcm;259 type SubscriptionService = PolkadotXcm;261 type XcmRouter = XcmRouter;268 type XcmRouter = XcmRouter;262 type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;269 type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;263 type XcmExecuteFilter = Everything;270 type XcmExecuteFilter = Everything;264 type XcmExecutor = XcmExecutor<XcmConfig>;271 type XcmExecutor = XcmExecutor<XcmConfig<Self>>;265 type XcmTeleportFilter = Everything;272 type XcmTeleportFilter = Everything;266 type XcmReserveTransferFilter = Everything;273 type XcmReserveTransferFilter = Everything;267 type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;274 type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;274281275impl cumulus_pallet_xcm::Config for Runtime {282impl cumulus_pallet_xcm::Config for Runtime {276 type Event = Event;283 type Event = Event;277 type XcmExecutor = XcmExecutor<XcmConfig>;284 type XcmExecutor = XcmExecutor<XcmConfig<Self>>;278}285}279286280impl cumulus_pallet_xcmp_queue::Config for Runtime {287impl cumulus_pallet_xcmp_queue::Config for Runtime {281 type WeightInfo = ();288 type WeightInfo = ();282 type Event = Event;289 type Event = Event;283 type XcmExecutor = XcmExecutor<XcmConfig>;290 type XcmExecutor = XcmExecutor<XcmConfig<Self>>;284 type ChannelInfo = ParachainSystem;291 type ChannelInfo = ParachainSystem;285 type VersionWrapper = ();292 type VersionWrapper = ();286 type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;293 type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;290297291impl cumulus_pallet_dmp_queue::Config for Runtime {298impl cumulus_pallet_dmp_queue::Config for Runtime {292 type Event = Event;299 type Event = Event;293 type XcmExecutor = XcmExecutor<XcmConfig>;300 type XcmExecutor = XcmExecutor<XcmConfig<Self>>;294 type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;301 type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;295}302}296303runtime/common/construct_runtime/mod.rsdiffbeforeafterboth57 #[runtimes(opal)]57 #[runtimes(opal)]58 Scheduler: pallet_unique_scheduler::{Pallet, Call, Storage, Event<T>} = 62,58 Scheduler: pallet_unique_scheduler::{Pallet, Call, Storage, Event<T>} = 62,595960 // free = 6360 Configuration: pallet_configuration::{Pallet, Call, Storage} = 63,616162 Charging: pallet_charge_transaction::{Pallet, Call, Storage } = 64,62 Charging: pallet_charge_transaction::{Pallet, Call, Storage } = 64,63 // ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,63 // ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,runtime/opal/Cargo.tomldiffbeforeafterboth87 'parachain-info/std',87 'parachain-info/std',88 'serde',88 'serde',89 'pallet-inflation/std',89 'pallet-inflation/std',90 'pallet-configuration/std',90 'pallet-common/std',91 'pallet-common/std',91 'pallet-structure/std',92 'pallet-structure/std',92 'pallet-fungible/std',93 'pallet-fungible/std',414fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.24" }415fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.24" }415pallet-inflation = { path = '../../pallets/inflation', default-features = false }416pallet-inflation = { path = '../../pallets/inflation', default-features = false }416up-data-structs = { path = '../../primitives/data-structs', default-features = false }417up-data-structs = { path = '../../primitives/data-structs', default-features = false }418pallet-configuration = { default-features = false, path = "../../pallets/configuration" }417pallet-common = { default-features = false, path = "../../pallets/common" }419pallet-common = { default-features = false, path = "../../pallets/common" }418pallet-structure = { default-features = false, path = "../../pallets/structure" }420pallet-structure = { default-features = false, path = "../../pallets/structure" }419pallet-fungible = { default-features = false, path = "../../pallets/fungible" }421pallet-fungible = { default-features = false, path = "../../pallets/fungible" }runtime/quartz/Cargo.tomldiffbeforeafterboth87 'parachain-info/std',87 'parachain-info/std',88 'serde',88 'serde',89 'pallet-inflation/std',89 'pallet-inflation/std',90 'pallet-configuration/std',90 'pallet-common/std',91 'pallet-common/std',91 'pallet-structure/std',92 'pallet-structure/std',92 'pallet-fungible/std',93 'pallet-fungible/std',418fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.24" }419fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.24" }419pallet-inflation = { path = '../../pallets/inflation', default-features = false }420pallet-inflation = { path = '../../pallets/inflation', default-features = false }420up-data-structs = { path = '../../primitives/data-structs', default-features = false }421up-data-structs = { path = '../../primitives/data-structs', default-features = false }422pallet-configuration = { default-features = false, path = "../../pallets/configuration" }421pallet-common = { default-features = false, path = "../../pallets/common" }423pallet-common = { default-features = false, path = "../../pallets/common" }422pallet-structure = { default-features = false, path = "../../pallets/structure" }424pallet-structure = { default-features = false, path = "../../pallets/structure" }423pallet-fungible = { default-features = false, path = "../../pallets/fungible" }425pallet-fungible = { default-features = false, path = "../../pallets/fungible" }runtime/unique/Cargo.tomldiffbeforeafterboth88 'parachain-info/std',88 'parachain-info/std',89 'serde',89 'serde',90 'pallet-inflation/std',90 'pallet-inflation/std',91 'pallet-configuration/std',91 'pallet-common/std',92 'pallet-common/std',92 'pallet-structure/std',93 'pallet-structure/std',93 'pallet-fungible/std',94 'pallet-fungible/std',411rmrk-rpc = { path = "../../primitives/rmrk-rpc", default-features = false }412rmrk-rpc = { path = "../../primitives/rmrk-rpc", default-features = false }412pallet-inflation = { path = '../../pallets/inflation', default-features = false }413pallet-inflation = { path = '../../pallets/inflation', default-features = false }413up-data-structs = { path = '../../primitives/data-structs', default-features = false }414up-data-structs = { path = '../../primitives/data-structs', default-features = false }415pallet-configuration = { default-features = false, path = "../../pallets/configuration" }414pallet-common = { default-features = false, path = "../../pallets/common" }416pallet-common = { default-features = false, path = "../../pallets/common" }415pallet-structure = { default-features = false, path = "../../pallets/structure" }417pallet-structure = { default-features = false, path = "../../pallets/structure" }416pallet-fungible = { default-features = false, path = "../../pallets/fungible" }418pallet-fungible = { default-features = false, path = "../../pallets/fungible" }