From 3847b08e348c03c70a01cf4c5d01fa51b5083de0 Mon Sep 17 00:00:00 2001
From: bgallois <benjamin@gallois.cc>
Date: Fri, 31 May 2024 14:04:08 +0200
Subject: [PATCH] add user documentation

---
 runtime/common/src/fees.rs           | 4 ++--
 runtime/common/src/pallets_config.rs | 2 +-
 runtime/gdev/tests/fee_tests.rs      | 4 +++-
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/runtime/common/src/fees.rs b/runtime/common/src/fees.rs
index 80310f2e1..acee3e2c2 100644
--- a/runtime/common/src/fees.rs
+++ b/runtime/common/src/fees.rs
@@ -64,7 +64,7 @@ where
     /// Function to convert weight to fee when "constant-fees" feature is not enabled.
     ///
     /// This function calculates the fee based on the length of the transaction in bytes.
-    /// If the current block weight is less than a fraction of the max block weight and the fee multiplier is zero,
+    /// If the current block weight is less than a fraction of the max block weight and the fee multiplier is one,
     /// it returns a zero fee. Otherwise, it calculates the fee based on the length in bytes.
     #[cfg(not(feature = "constant-fees"))]
     fn weight_to_fee(length_in_bytes: &Weight) -> Self::Balance {
@@ -120,7 +120,7 @@ where
     /// Function to get the polynomial coefficients for weight to fee conversion.
     ///
     /// This function calculates the polynomial coefficients for converting transaction weight to fee.
-    /// If the current block weight is less than a fraction of the block max weight and the fee multiplier is zero,
+    /// If the current block weight is less than a fraction of the block max weight and the fee multiplier is one,
     /// it returns zero. Otherwise, it calculates the coefficients based on the extrinsic base weight mapped to 5 cents.
     fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
         let weights = U::BlockWeights::get();
diff --git a/runtime/common/src/pallets_config.rs b/runtime/common/src/pallets_config.rs
index 4c03112ff..967139552 100644
--- a/runtime/common/src/pallets_config.rs
+++ b/runtime/common/src/pallets_config.rs
@@ -190,7 +190,7 @@ macro_rules! pallets_config {
         pub struct OnChargeTransaction;
 
         parameter_types! {
-        pub Target: Perquintill = Perquintill::from_percent(10);
+        pub Target: Perquintill = Perquintill::from_percent(25);
         pub MaxMultiplier: sp_runtime::FixedU128 = 10.into();
         }
         impl pallet_transaction_payment::Config for Runtime {
diff --git a/runtime/gdev/tests/fee_tests.rs b/runtime/gdev/tests/fee_tests.rs
index 8773c1580..99d7b8338 100644
--- a/runtime/gdev/tests/fee_tests.rs
+++ b/runtime/gdev/tests/fee_tests.rs
@@ -91,6 +91,8 @@ fn test_fees_full() {
                 Balances::free_balance(AccountKeyring::Alice.to_account_id()),
                 10_000 - 5 * transactions
             );
+            // Ensure that the next extrinsic exceeds the limit.
+            System::set_block_consumed_resources(Target::get() * normal_max_weight, 100_usize);
             // The block will reach the fee limit, so the next extrinsic should start incurring fees.
             let call = RuntimeCall::Balances(BalancesCall::transfer_allow_death {
                 dest: AccountKeyring::Eve.to_account_id().into(),
@@ -152,7 +154,7 @@ fn test_fees_multiplier() {
             let mut current = 10u128;
             for i in 20..50u32 {
                 run_to_block(i);
-                current = current.saturating_sub(1).max(1u128.into());
+                current = current.saturating_sub(1).max(1u128);
                 assert_eq!(
                     pallet_transaction_payment::Pallet::<Runtime>::next_fee_multiplier(),
                     current.into()
-- 
GitLab