[][src]Struct pallet_transaction_payment::TargetedFeeAdjustment

pub struct TargetedFeeAdjustment<T, S, V, M>(_);

A struct to update the weight multiplier per block. It implements Convert<Multiplier, Multiplier>, meaning that it can convert the previous multiplier to the next one. This should be called on on_finalize of a block, prior to potentially cleaning the weight data from the system module.

given: s = previous block weight s'= ideal block weight m = maximum block weight diff = (s - s')/m v = 0.00001 t1 = (v * diff) t2 = (v * diff)^2 / 2 then: next_multiplier = prev_multiplier * (1 + t1 + t2)

Where (s', v) must be given as the Get implementation of the T generic type. Moreover, M must provide the minimum allowed value for the multiplier. Note that a runtime should ensure with tests that the combination of this M and V is not such that the multiplier can drop to zero and never recover.

note that s' is interpreted as a portion in the normal transaction capacity of the block. For example, given s' == 0.25 and AvailableBlockRatio = 0.75, then the target fullness is 0.25 of the normal capacity and 0.1875 of the entire block.

This implementation implies the bound:

where p is the amount of change over k blocks.

Hence:

For example, when all blocks are full and there are 28800 blocks per day (default in substrate-node) and v == 0.00001, s' == 0.1875, we'd have:

p >= 0.00001 * 28800 * 0.8125 p >= 0.234

Meaning that fees can change by around ~23% per day, given extreme congestion.

More info can be found at: https://w3f-research.readthedocs.io/en/latest/polkadot/Token%20Economics.html

Trait Implementations

impl<T, S, V, M> Convert<FixedU128, FixedU128> for TargetedFeeAdjustment<T, S, V, M> where
    T: Trait,
    S: Get<Perquintill>,
    V: Get<Multiplier>,
    M: Get<Multiplier>, 
[src]

impl<T, S, V, M> MultiplierUpdate for TargetedFeeAdjustment<T, S, V, M> where
    T: Trait,
    S: Get<Perquintill>,
    V: Get<Multiplier>,
    M: Get<Multiplier>, 
[src]

Auto Trait Implementations

impl<T, S, V, M> RefUnwindSafe for TargetedFeeAdjustment<T, S, V, M> where
    M: RefUnwindSafe,
    S: RefUnwindSafe,
    T: RefUnwindSafe,
    V: RefUnwindSafe

impl<T, S, V, M> Send for TargetedFeeAdjustment<T, S, V, M> where
    M: Send,
    S: Send,
    T: Send,
    V: Send

impl<T, S, V, M> Sync for TargetedFeeAdjustment<T, S, V, M> where
    M: Sync,
    S: Sync,
    T: Sync,
    V: Sync

impl<T, S, V, M> Unpin for TargetedFeeAdjustment<T, S, V, M> where
    M: Unpin,
    S: Unpin,
    T: Unpin,
    V: Unpin

impl<T, S, V, M> UnwindSafe for TargetedFeeAdjustment<T, S, V, M> where
    M: UnwindSafe,
    S: UnwindSafe,
    T: UnwindSafe,
    V: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> CheckedConversion for T[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> IsType<T> for T[src]

impl<T, Outer> IsWrappedBy<Outer> for T where
    Outer: AsRef<T> + AsMut<T> + From<T>,
    T: From<Outer>, 
[src]

fn from_ref(outer: &Outer) -> &T[src]

Get a reference to the inner from the outer.

fn from_mut(outer: &mut Outer) -> &mut T[src]

Get a mutable reference to the inner from the outer.

impl<T> MaybeRefUnwindSafe for T where
    T: RefUnwindSafe
[src]

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T> SaturatedConversion for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<S, T> UncheckedInto<T> for S where
    T: UncheckedFrom<S>, 
[src]

impl<T, S> UniqueSaturatedInto<T> for S where
    S: TryInto<T>,
    T: Bounded
[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]