@@ -26,7 +26,7 @@ use frame_support::{
2626 ConstBool , ConstU32 , Contains , EqualPrivilegeOnly , EstimateNextSessionRotation ,
2727 InstanceFilter , SortedMembers , WithdrawReasons ,
2828 } ,
29- weights:: constants:: WEIGHT_REF_TIME_PER_MILLIS ,
29+ weights:: { constants:: WEIGHT_REF_TIME_PER_MILLIS , WeightToFee } ,
3030 PalletId ,
3131} ;
3232use frame_system:: { EnsureRoot , EnsureSignedBy } ;
@@ -59,7 +59,7 @@ use sp_runtime::{
5959 AccountIdLookup , BlakeTwo256 , Block as BlockT , Bounded , ConvertInto , One , OpaqueKeys ,
6060 } ,
6161 transaction_validity:: { TransactionSource , TransactionValidity } ,
62- ApplyExtrinsicResult , FixedU128 , RuntimeDebug ,
62+ ApplyExtrinsicResult , FixedU128 , RuntimeDebug , SaturatedConversion ,
6363} ;
6464pub use sp_runtime:: { FixedPointNumber , Perbill , Permill } ;
6565use sp_staking:: { currency_to_vote:: U128CurrencyToVote , EraIndex } ;
@@ -261,8 +261,8 @@ parameter_types! {
261261 // a "virtual tip" that's equal to the `OperationalFeeMultiplier * final_fee`.
262262 // follows polkadot : https://github.com/paritytech/polkadot/blob/9ce5f7ef5abb1a4291454e8c9911b304d80679f9/runtime/polkadot/src/lib.rs#L369
263263 pub const OperationalFeeMultiplier : u8 = 5 ;
264- // We expect that on average 25 % of the normal capacity will be occupied with normal txs.
265- pub const TargetSaturationLevel : Perquintill = Perquintill :: from_percent( 25 ) ;
264+ // We expect that on average 50 % of the normal capacity will be occupied with normal txs.
265+ pub const TargetSaturationLevel : Perquintill = Perquintill :: from_percent( 50 ) ;
266266 // During 20 blocks the fee may not change more than by 100%. This, together with the
267267 // `TargetSaturationLevel` value, results in variability ~0.067. For the corresponding
268268 // formulas please refer to Substrate code at `frame/transaction-payment/src/lib.rs`.
@@ -272,11 +272,21 @@ parameter_types! {
272272 pub MaximumMultiplier : Multiplier = Bounded :: max_value( ) ;
273273}
274274
275+ pub struct DivideFeeBy < const N : Balance > ;
276+
277+ impl < const N : Balance > WeightToFee for DivideFeeBy < N > {
278+ type Balance = Balance ;
279+
280+ fn weight_to_fee ( weight : & Weight ) -> Self :: Balance {
281+ Balance :: saturated_from ( weight. ref_time ( ) ) . saturating_div ( N )
282+ }
283+ }
284+
275285impl pallet_transaction_payment:: Config for Runtime {
276286 type RuntimeEvent = RuntimeEvent ;
277287 type OnChargeTransaction = CurrencyAdapter < Balances , EverythingToTheTreasury > ;
278- type LengthToFee = IdentityFee < Balance > ;
279- type WeightToFee = IdentityFee < Balance > ;
288+ type LengthToFee = DivideFeeBy < 10 > ;
289+ type WeightToFee = DivideFeeBy < 10 > ;
280290 type FeeMultiplierUpdate = TargetedFeeAdjustment <
281291 Self ,
282292 TargetSaturationLevel ,
0 commit comments