pub trait WeightToFeePolynomial {
    type Balance: BaseArithmetic + From<u32> + Copy + Unsigned;

    // Required method
    fn polynomial() -> SmallVec<[WeightToFeeCoefficient<Self::Balance>; 4]>;
}
Expand description

A trait that describes the weight to fee calculation as polynomial.

An implementor should only implement the polynomial function.

Required Associated Types§

type Balance: BaseArithmetic + From<u32> + Copy + Unsigned

The type that is returned as result from polynomial evaluation.

Required Methods§

fn polynomial() -> SmallVec<[WeightToFeeCoefficient<Self::Balance>; 4]>

Returns a polynomial that describes the weight to fee conversion.

This is the only function that should be manually implemented. Please note that all calculation is done in the probably unsigned Balance type. This means that the order of coefficients is important as putting the negative coefficients first will most likely saturate the result to zero mid evaluation.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<Balance, Runtime, Target> WeightToFeePolynomial for WeightToFeeImpl<Balance, Runtime, Target>
where Balance: BaseArithmetic + From<u64> + Copy + Unsigned + From<u32> + MultiplyRational, Runtime: Config + Config, Target: Get<Perquintill>,

Trait implementation for converting transaction weight to fee.

This implementation is only included when the “constant-fees” feature is not enabled.

source§

fn polynomial( ) -> SmallVec<[WeightToFeeCoefficient<<WeightToFeeImpl<Balance, Runtime, Target> as WeightToFeePolynomial>::Balance>; 4]>

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 and length are less than a fraction of the block max weight and length, and the fee multiplier is one, it returns zero. Otherwise, it calculates the coefficients based on the extrinsic base weight mapped to 5 cents.

§

type Balance = Balance

Implementors§