Add LengthToFee to runtimes (#1152)

* Add LengthToFee to runtimes

* update lockfile for {"polkadot"}

* fmt

* Update Cargo.lock

Co-authored-by: parity-processbot <>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
Stephen Shelton
2022-04-07 14:05:27 +00:00
committed by GitHub
parent e7d8a0803c
commit 6b7b4a011d
8 changed files with 429 additions and 433 deletions
+413 -417
View File
File diff suppressed because it is too large Load Diff
@@ -28,8 +28,8 @@ use frame_support::{
construct_runtime, parameter_types, construct_runtime, parameter_types,
traits::Everything, traits::Everything,
weights::{ weights::{
constants::WEIGHT_PER_SECOND, DispatchClass, Weight, WeightToFeeCoefficient, constants::WEIGHT_PER_SECOND, ConstantMultiplier, DispatchClass, Weight,
WeightToFeeCoefficients, WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial,
}, },
PalletId, PalletId,
}; };
@@ -354,8 +354,8 @@ parameter_types! {
impl pallet_transaction_payment::Config for Runtime { impl pallet_transaction_payment::Config for Runtime {
type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, ()>; type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, ()>;
type TransactionByteFee = TransactionByteFee;
type WeightToFee = WeightToFee; type WeightToFee = WeightToFee;
type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;
type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>; type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>;
type OperationalFeeMultiplier = OperationalFeeMultiplier; type OperationalFeeMultiplier = OperationalFeeMultiplier;
} }
@@ -44,7 +44,7 @@ use constants::{currency::*, fee::WeightToFee};
use frame_support::{ use frame_support::{
construct_runtime, parameter_types, construct_runtime, parameter_types,
traits::{ConstU128, ConstU16, ConstU32, ConstU64, ConstU8, Everything}, traits::{ConstU128, ConstU16, ConstU32, ConstU64, ConstU8, Everything},
weights::DispatchClass, weights::{ConstantMultiplier, DispatchClass},
PalletId, PalletId,
}; };
use frame_system::limits::{BlockLength, BlockWeights}; use frame_system::limits::{BlockLength, BlockWeights};
@@ -208,9 +208,9 @@ impl pallet_balances::Config for Runtime {
impl pallet_transaction_payment::Config for Runtime { impl pallet_transaction_payment::Config for Runtime {
type OnChargeTransaction = type OnChargeTransaction =
pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees<Runtime>>; pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees<Runtime>>;
/// Relay Chain `TransactionByteFee` / 10
type TransactionByteFee = ConstU128<MILLICENTS>;
type WeightToFee = WeightToFee; type WeightToFee = WeightToFee;
/// Relay Chain `TransactionByteFee` / 10
type LengthToFee = ConstantMultiplier<Balance, ConstU128<MILLICENTS>>;
type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>; type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>;
type OperationalFeeMultiplier = ConstU8<5>; type OperationalFeeMultiplier = ConstU8<5>;
} }
@@ -41,7 +41,7 @@ pub use frame_support::{
traits::{EnsureOneOf, Everything, IsInVec, Randomness}, traits::{EnsureOneOf, Everything, IsInVec, Randomness},
weights::{ weights::{
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND}, constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
DispatchClass, IdentityFee, Weight, ConstantMultiplier, DispatchClass, IdentityFee, Weight,
}, },
StorageValue, StorageValue,
}; };
@@ -240,8 +240,8 @@ parameter_types! {
impl pallet_transaction_payment::Config for Runtime { impl pallet_transaction_payment::Config for Runtime {
type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, ()>; type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, ()>;
type TransactionByteFee = TransactionByteFee;
type WeightToFee = IdentityFee<Balance>; type WeightToFee = IdentityFee<Balance>;
type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;
type FeeMultiplierUpdate = (); type FeeMultiplierUpdate = ();
type OperationalFeeMultiplier = OperationalFeeMultiplier; type OperationalFeeMultiplier = OperationalFeeMultiplier;
} }
@@ -45,7 +45,7 @@ use constants::{currency::*, fee::WeightToFee};
use frame_support::{ use frame_support::{
construct_runtime, parameter_types, construct_runtime, parameter_types,
traits::{AsEnsureOriginWithArg, EnsureOneOf, InstanceFilter}, traits::{AsEnsureOriginWithArg, EnsureOneOf, InstanceFilter},
weights::{DispatchClass, Weight}, weights::{ConstantMultiplier, DispatchClass, Weight},
PalletId, RuntimeDebug, PalletId, RuntimeDebug,
}; };
use frame_system::{ use frame_system::{
@@ -200,8 +200,8 @@ parameter_types! {
impl pallet_transaction_payment::Config for Runtime { impl pallet_transaction_payment::Config for Runtime {
type OnChargeTransaction = type OnChargeTransaction =
pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees<Runtime>>; pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees<Runtime>>;
type TransactionByteFee = TransactionByteFee;
type WeightToFee = WeightToFee; type WeightToFee = WeightToFee;
type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;
type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>; type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>;
type OperationalFeeMultiplier = OperationalFeeMultiplier; type OperationalFeeMultiplier = OperationalFeeMultiplier;
} }
@@ -45,7 +45,7 @@ use constants::{currency::*, fee::WeightToFee};
use frame_support::{ use frame_support::{
construct_runtime, parameter_types, construct_runtime, parameter_types,
traits::{AsEnsureOriginWithArg, EnsureOneOf, InstanceFilter}, traits::{AsEnsureOriginWithArg, EnsureOneOf, InstanceFilter},
weights::{DispatchClass, Weight}, weights::{ConstantMultiplier, DispatchClass, Weight},
PalletId, RuntimeDebug, PalletId, RuntimeDebug,
}; };
use frame_system::{ use frame_system::{
@@ -201,8 +201,8 @@ parameter_types! {
impl pallet_transaction_payment::Config for Runtime { impl pallet_transaction_payment::Config for Runtime {
type OnChargeTransaction = type OnChargeTransaction =
pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees<Runtime>>; pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees<Runtime>>;
type TransactionByteFee = TransactionByteFee;
type WeightToFee = WeightToFee; type WeightToFee = WeightToFee;
type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;
type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>; type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>;
type OperationalFeeMultiplier = OperationalFeeMultiplier; type OperationalFeeMultiplier = OperationalFeeMultiplier;
} }
@@ -45,7 +45,7 @@ use constants::{currency::*, fee::WeightToFee};
use frame_support::{ use frame_support::{
construct_runtime, parameter_types, construct_runtime, parameter_types,
traits::{AsEnsureOriginWithArg, InstanceFilter}, traits::{AsEnsureOriginWithArg, InstanceFilter},
weights::{DispatchClass, Weight}, weights::{ConstantMultiplier, DispatchClass, Weight},
PalletId, RuntimeDebug, PalletId, RuntimeDebug,
}; };
use frame_system::{ use frame_system::{
@@ -198,8 +198,8 @@ parameter_types! {
impl pallet_transaction_payment::Config for Runtime { impl pallet_transaction_payment::Config for Runtime {
type OnChargeTransaction = type OnChargeTransaction =
pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees<Runtime>>; pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees<Runtime>>;
type TransactionByteFee = TransactionByteFee;
type WeightToFee = WeightToFee; type WeightToFee = WeightToFee;
type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;
type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>; type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>;
type OperationalFeeMultiplier = OperationalFeeMultiplier; type OperationalFeeMultiplier = OperationalFeeMultiplier;
} }
+2 -2
View File
@@ -49,7 +49,7 @@ pub use frame_support::{
traits::Randomness, traits::Randomness,
weights::{ weights::{
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND}, constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
DispatchClass, IdentityFee, Weight, ConstantMultiplier, DispatchClass, IdentityFee, Weight,
}, },
StorageValue, StorageValue,
}; };
@@ -245,8 +245,8 @@ parameter_types! {
impl pallet_transaction_payment::Config for Runtime { impl pallet_transaction_payment::Config for Runtime {
type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, ()>; type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, ()>;
type TransactionByteFee = TransactionByteFee;
type WeightToFee = IdentityFee<Balance>; type WeightToFee = IdentityFee<Balance>;
type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;
type FeeMultiplierUpdate = (); type FeeMultiplierUpdate = ();
type OperationalFeeMultiplier = OperationalFeeMultiplier; type OperationalFeeMultiplier = OperationalFeeMultiplier;
} }