Struct pallet_transaction_payment::TargetedFeeAdjustment [−][src]
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:
v ≤ p / k * (s − s')
- or, solving for
p
:p >= v * k * (s - s')
where p
is the amount of change over k
blocks.
Hence:
- in a fully congested chain:
p >= v * k * (1 - s')
. - in an empty chain:
p >= v * k * (-s')
.
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]
T: Trait,
S: Get<Perquintill>,
V: Get<Multiplier>,
M: Get<Multiplier>,
fn convert(previous: Multiplier) -> 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]
T: Trait,
S: Get<Perquintill>,
V: Get<Multiplier>,
M: Get<Multiplier>,
Auto Trait Implementations
impl<T, S, V, M> RefUnwindSafe for TargetedFeeAdjustment<T, S, V, M> where
M: RefUnwindSafe,
S: RefUnwindSafe,
T: RefUnwindSafe,
V: RefUnwindSafe,
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,
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,
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,
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,
M: UnwindSafe,
S: UnwindSafe,
T: UnwindSafe,
V: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CheckedConversion for T
[src]
pub fn checked_from<T>(t: T) -> Option<Self> where
Self: TryFrom<T>,
[src]
Self: TryFrom<T>,
pub fn checked_into<T>(self) -> Option<T> where
Self: TryInto<T>,
[src]
Self: TryInto<T>,
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> IsType<T> for T
[src]
pub fn from_ref(t: &T) -> &T
[src]
pub fn into_ref(&self) -> &T
[src]
pub fn from_mut(t: &mut T) -> &mut T
[src]
pub fn into_mut(&mut self) -> &mut T
[src]
impl<T, Outer> IsWrappedBy<Outer> for T where
T: From<Outer>,
Outer: AsRef<T> + AsMut<T> + From<T>,
[src]
T: From<Outer>,
Outer: AsRef<T> + AsMut<T> + From<T>,
pub fn from_ref(outer: &Outer) -> &T
[src]
Get a reference to the inner from the outer.
pub 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]
T: RefUnwindSafe,
impl<T> Pointable for T
[src]
pub const ALIGN: usize
[src]
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
[src]
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
[src]
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
[src]
pub unsafe fn drop(ptr: usize)
[src]
impl<T> Same<T> for T
[src]
type Output = T
Should always be Self
impl<T> SaturatedConversion for T
[src]
pub fn saturated_from<T>(t: T) -> Self where
Self: UniqueSaturatedFrom<T>,
[src]
Self: UniqueSaturatedFrom<T>,
pub fn saturated_into<T>(self) -> T where
Self: UniqueSaturatedInto<T>,
[src]
Self: UniqueSaturatedInto<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<S, T> UncheckedInto<T> for S where
T: UncheckedFrom<S>,
[src]
T: UncheckedFrom<S>,
pub fn unchecked_into(self) -> T
[src]
impl<T, S> UniqueSaturatedInto<T> for S where
T: Bounded,
S: TryInto<T>,
[src]
T: Bounded,
S: TryInto<T>,
pub fn unique_saturated_into(self) -> T
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,