Skip to content
This repository was archived by the owner on May 21, 2024. It is now read-only.
Merged
Prev Previous commit
Next Next commit
fmt
  • Loading branch information
valentinfernandez1 committed Jun 6, 2023
commit aa53b9d4ca5970be4923e04908d1cf8e3558f65b
12 changes: 7 additions & 5 deletions runtime/trappist/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ pub mod fee {
};
use polkadot_core_primitives::Balance;
use smallvec::smallvec;

pub use sp_runtime::Perbill;
use sp_runtime::SaturatedConversion;

use crate::impls::WeightCoefficientCalc;
use crate::impls::WeightCoefficientCalc;

/// The block saturation level. Fees will be updates based on this value.
pub const TARGET_BLOCK_FULLNESS: Perbill = Perbill::from_percent(25);
Expand All @@ -63,8 +63,10 @@ use crate::impls::WeightCoefficientCalc;
type Balance = Balance;

fn weight_to_fee(weight: &Weight) -> Self::Balance {
let ref_poly: smallvec::SmallVec<[WeightToFeeCoefficient<Balance>; 4]> = RefTimeToFee::polynomial();
let proof_poly: smallvec::SmallVec<[WeightToFeeCoefficient<Balance>; 4]> = ProofSizeToFee::polynomial();
let ref_poly: smallvec::SmallVec<[WeightToFeeCoefficient<Balance>; 4]> =
RefTimeToFee::polynomial();
let proof_poly: smallvec::SmallVec<[WeightToFeeCoefficient<Balance>; 4]> =
ProofSizeToFee::polynomial();

let ref_fee: Balance = ref_poly.iter().fold(0, |acc, term| {
term.saturating_eval(acc, Balance::saturated_from(weight.ref_time()))
Expand All @@ -78,7 +80,7 @@ use crate::impls::WeightCoefficientCalc;
ref_fee.max(proof_fee)
}
}

pub struct RefTimeToFee;
impl WeightToFeePolynomial for RefTimeToFee {
type Balance = Balance;
Expand Down
2 changes: 1 addition & 1 deletion runtime/trappist/src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ use frame_support::{
weights::{Weight, WeightToFeeCoefficient},
};
pub use log;
use sp_runtime::{DispatchResult, SaturatedConversion};
use sp_arithmetic::traits::{BaseArithmetic, Unsigned};
use sp_runtime::{DispatchResult, SaturatedConversion};

use sp_std::marker::PhantomData;

Expand Down