diff --git a/runtime/common/src/fees.rs b/runtime/common/src/fees.rs index 9d7a166bbaf9ab4ca149a34fd211fa30da7f0623..aa4f24fe3597ab3930bdb4b005a0f736b34a9ad8 100644 --- a/runtime/common/src/fees.rs +++ b/runtime/common/src/fees.rs @@ -61,8 +61,8 @@ 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 and length are less than a fraction of the max block weight and length and the fee multiplier is one, - /// it returns a zero fee. Otherwise, it calculates the fee based on the length in bytes. + /// If the current block weight and length are less than a fraction of the max block weight and length, the fee multiplier is one, + /// and the extrinsic length is less than 256 bytes, no fees are applied. 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 { let weights = Runtime::BlockWeights::get(); @@ -76,16 +76,19 @@ where let length = Runtime::BlockLength::get(); let normal_max_length = *length.max.get(DispatchClass::Normal) as u64; let current_block_length = <frame_system::Pallet<Runtime>>::all_extrinsics_len() as u64; + // One remark extrinsic overhead is approximately 110 bytes + let max_extrinsic_length = 256; if current_block_weight .get(DispatchClass::Normal) .all_lt(Target::get() * normal_max_weight) && current_block_length < (Target::get() * normal_max_length) && fee_multiplier.is_one() + && length_in_bytes.ref_time() < max_extrinsic_length { 0u32.into() } else { - Self::Balance::saturated_from(length_in_bytes.ref_time() / 100u64) + Self::Balance::saturated_from(length_in_bytes.ref_time() / 10u64) } }