From b13c73f16c1e1f7a63c83c6f8b9ce93cb05a4f92 Mon Sep 17 00:00:00 2001 From: Nazar Mokrynskyi Date: Fri, 15 Apr 2022 04:30:15 +0300 Subject: [PATCH] More efficient identity and multiplier weight to fee --- frame/support/src/weights.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/frame/support/src/weights.rs b/frame/support/src/weights.rs index 4c3fcaa0fd423..5b4a13e7f9457 100644 --- a/frame/support/src/weights.rs +++ b/frame/support/src/weights.rs @@ -710,6 +710,10 @@ where degree: 1, }) } + + fn calc(weight: &Weight) -> Self::Balance { + Self::Balance::saturated_from(*weight) + } } /// Implementor of [`WeightToFeePolynomial`] that uses a constant multiplier. @@ -738,6 +742,10 @@ where degree: 1, }) } + + fn calc(weight: &Weight) -> Self::Balance { + Self::Balance::saturated_from(*weight).saturating_mul(M::get()) + } } /// A struct holding value for each `DispatchClass`.