mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 10:31:04 +00:00
Separate WeightToFee calculation for Kusama and Polkadot (#854)
* Separate `WeightToFee` calculation for Kusama and Polkadot * Bump spec
This commit is contained in:
@@ -16,10 +16,8 @@
|
||||
|
||||
//! Auxillary struct/enums for polkadot runtime.
|
||||
|
||||
use primitives::Balance;
|
||||
use sp_runtime::traits::{Convert, Saturating};
|
||||
use sp_runtime::{Fixed64, Perbill};
|
||||
use frame_support::weights::Weight;
|
||||
use frame_support::traits::{OnUnbalanced, Imbalance, Currency, Get};
|
||||
use crate::{MaximumBlockWeight, NegativeImbalance};
|
||||
|
||||
@@ -75,25 +73,6 @@ where
|
||||
fn convert(x: u128) -> u128 { x * Self::factor() }
|
||||
}
|
||||
|
||||
/// Handles converting a weight scalar to a fee value, based on the scale and granularity of the
|
||||
/// node's balance type.
|
||||
///
|
||||
/// This should typically create a mapping between the following ranges:
|
||||
/// - [0, system::MaximumBlockWeight]
|
||||
/// - [Balance::min, Balance::max]
|
||||
///
|
||||
/// Yet, it can be used for any other sort of change to weight-fee. Some examples being:
|
||||
/// - Setting it to `0` will essentially disable the weight fee.
|
||||
/// - Setting it to `1` will cause the literal `#[weight = x]` values to be charged.
|
||||
pub struct WeightToFee;
|
||||
impl Convert<Weight, Balance> for WeightToFee {
|
||||
fn convert(x: Weight) -> Balance {
|
||||
// in Polkadot a weight of 10_000 (smallest non-zero weight) to be mapped to 10^7 units of
|
||||
// fees (1/10 CENT), hence:
|
||||
Balance::from(x).saturating_mul(1_000)
|
||||
}
|
||||
}
|
||||
|
||||
/// Update the given multiplier based on the following formula
|
||||
///
|
||||
/// diff = (target_weight - previous_block_weight)
|
||||
|
||||
Reference in New Issue
Block a user