Skip to content

Commit

Permalink
Add LengthToFee to runtimes (#1152)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
notlesh and shawntabrizi authored Apr 7, 2022
1 parent 8d0e422 commit 669e1c1
Show file tree
Hide file tree
Showing 8 changed files with 411 additions and 415 deletions.
794 changes: 395 additions & 399 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions parachain-template/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ use frame_support::{
construct_runtime, parameter_types,
traits::Everything,
weights::{
constants::WEIGHT_PER_SECOND, DispatchClass, Weight, WeightToFeeCoefficient,
WeightToFeeCoefficients, WeightToFeePolynomial,
constants::WEIGHT_PER_SECOND, ConstantMultiplier, DispatchClass, Weight,
WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial,
},
PalletId,
};
Expand Down Expand Up @@ -354,8 +354,8 @@ parameter_types! {

impl pallet_transaction_payment::Config for Runtime {
type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, ()>;
type TransactionByteFee = TransactionByteFee;
type WeightToFee = WeightToFee;
type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;
type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>;
type OperationalFeeMultiplier = OperationalFeeMultiplier;
}
Expand Down
6 changes: 3 additions & 3 deletions polkadot-parachains/canvas-kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ use constants::{currency::*, fee::WeightToFee};
use frame_support::{
construct_runtime, parameter_types,
traits::{ConstU128, ConstU16, ConstU32, ConstU64, ConstU8, Everything},
weights::DispatchClass,
weights::{ConstantMultiplier, DispatchClass},
PalletId,
};
use frame_system::limits::{BlockLength, BlockWeights};
Expand Down Expand Up @@ -208,9 +208,9 @@ impl pallet_balances::Config for Runtime {
impl pallet_transaction_payment::Config for Runtime {
type OnChargeTransaction =
pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees<Runtime>>;
/// Relay Chain `TransactionByteFee` / 10
type TransactionByteFee = ConstU128<MILLICENTS>;
type WeightToFee = WeightToFee;
/// Relay Chain `TransactionByteFee` / 10
type LengthToFee = ConstantMultiplier<Balance, ConstU128<MILLICENTS>>;
type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>;
type OperationalFeeMultiplier = ConstU8<5>;
}
Expand Down
4 changes: 2 additions & 2 deletions polkadot-parachains/rococo-parachain/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub use frame_support::{
traits::{EnsureOneOf, Everything, IsInVec, Randomness},
weights::{
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
DispatchClass, IdentityFee, Weight,
ConstantMultiplier, DispatchClass, IdentityFee, Weight,
},
StorageValue,
};
Expand Down Expand Up @@ -240,8 +240,8 @@ parameter_types! {

impl pallet_transaction_payment::Config for Runtime {
type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, ()>;
type TransactionByteFee = TransactionByteFee;
type WeightToFee = IdentityFee<Balance>;
type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;
type FeeMultiplierUpdate = ();
type OperationalFeeMultiplier = OperationalFeeMultiplier;
}
Expand Down
4 changes: 2 additions & 2 deletions polkadot-parachains/statemine/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ use constants::{currency::*, fee::WeightToFee};
use frame_support::{
construct_runtime, parameter_types,
traits::{AsEnsureOriginWithArg, EnsureOneOf, InstanceFilter},
weights::{DispatchClass, Weight},
weights::{ConstantMultiplier, DispatchClass, Weight},
PalletId, RuntimeDebug,
};
use frame_system::{
Expand Down Expand Up @@ -200,8 +200,8 @@ parameter_types! {
impl pallet_transaction_payment::Config for Runtime {
type OnChargeTransaction =
pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees<Runtime>>;
type TransactionByteFee = TransactionByteFee;
type WeightToFee = WeightToFee;
type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;
type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>;
type OperationalFeeMultiplier = OperationalFeeMultiplier;
}
Expand Down
4 changes: 2 additions & 2 deletions polkadot-parachains/statemint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ use constants::{currency::*, fee::WeightToFee};
use frame_support::{
construct_runtime, parameter_types,
traits::{AsEnsureOriginWithArg, EnsureOneOf, InstanceFilter},
weights::{DispatchClass, Weight},
weights::{ConstantMultiplier, DispatchClass, Weight},
PalletId, RuntimeDebug,
};
use frame_system::{
Expand Down Expand Up @@ -201,8 +201,8 @@ parameter_types! {
impl pallet_transaction_payment::Config for Runtime {
type OnChargeTransaction =
pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees<Runtime>>;
type TransactionByteFee = TransactionByteFee;
type WeightToFee = WeightToFee;
type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;
type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>;
type OperationalFeeMultiplier = OperationalFeeMultiplier;
}
Expand Down
4 changes: 2 additions & 2 deletions polkadot-parachains/westmint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ use constants::{currency::*, fee::WeightToFee};
use frame_support::{
construct_runtime, parameter_types,
traits::{AsEnsureOriginWithArg, InstanceFilter},
weights::{DispatchClass, Weight},
weights::{ConstantMultiplier, DispatchClass, Weight},
PalletId, RuntimeDebug,
};
use frame_system::{
Expand Down Expand Up @@ -198,8 +198,8 @@ parameter_types! {
impl pallet_transaction_payment::Config for Runtime {
type OnChargeTransaction =
pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees<Runtime>>;
type TransactionByteFee = TransactionByteFee;
type WeightToFee = WeightToFee;
type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;
type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>;
type OperationalFeeMultiplier = OperationalFeeMultiplier;
}
Expand Down
4 changes: 2 additions & 2 deletions test/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub use frame_support::{
traits::Randomness,
weights::{
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
DispatchClass, IdentityFee, Weight,
ConstantMultiplier, DispatchClass, IdentityFee, Weight,
},
StorageValue,
};
Expand Down Expand Up @@ -245,8 +245,8 @@ parameter_types! {

impl pallet_transaction_payment::Config for Runtime {
type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, ()>;
type TransactionByteFee = TransactionByteFee;
type WeightToFee = IdentityFee<Balance>;
type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;
type FeeMultiplierUpdate = ();
type OperationalFeeMultiplier = OperationalFeeMultiplier;
}
Expand Down

0 comments on commit 669e1c1

Please sign in to comment.