mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 14:37:57 +00:00
Fix the broken weight multiplier update function (#6334)
* Initial draft, has some todos left * remove ununsed import * Apply suggestions from code review * Some refactors with migration * Fix more test and cleanup * Fix for companion * Apply suggestions from code review Co-authored-by: Alexander Popiak <alexander.popiak@parity.io> * Update bin/node/runtime/src/impls.rs * Fix weight * Add integrity test * length is not affected. Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
This commit is contained in:
@@ -372,6 +372,23 @@ macro_rules! implement_fixed {
|
||||
}
|
||||
}
|
||||
|
||||
impl $name {
|
||||
/// const version of `FixedPointNumber::from_inner`.
|
||||
pub const fn from_inner(inner: $inner_type) -> Self {
|
||||
Self(inner)
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "std", test))]
|
||||
pub fn from_fraction(x: f64) -> Self {
|
||||
Self((x * (<Self as FixedPointNumber>::DIV as f64)) as $inner_type)
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "std", test))]
|
||||
pub fn to_fraction(self) -> f64 {
|
||||
self.0 as f64 / <Self as FixedPointNumber>::DIV as f64
|
||||
}
|
||||
}
|
||||
|
||||
impl Saturating for $name {
|
||||
fn saturating_add(self, rhs: Self) -> Self {
|
||||
Self(self.0.saturating_add(rhs.0))
|
||||
|
||||
Reference in New Issue
Block a user