From fd860501b07ae635c029dfd9a05ba934cc979f87 Mon Sep 17 00:00:00 2001 From: Gavin Wood <gavin@parity.io> Date: Fri, 19 Mar 2021 20:47:28 +0100 Subject: [PATCH] Make work for no_std (#8402) --- substrate/frame/staking/reward-fn/src/lib.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/substrate/frame/staking/reward-fn/src/lib.rs b/substrate/frame/staking/reward-fn/src/lib.rs index b697842fa69..6c54fec9239 100644 --- a/substrate/frame/staking/reward-fn/src/lib.rs +++ b/substrate/frame/staking/reward-fn/src/lib.rs @@ -15,6 +15,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![cfg_attr(not(feature = "std"), no_std)] + //! Useful function for inflation for nominated proof of stake. use sp_arithmetic::{Perquintill, PerThing, biguint::BigUint, traits::{Zero, SaturatedConversion}}; @@ -72,7 +74,7 @@ pub fn compute_inflation<P: PerThing>( a.lstrip(); a }; - + let mut falloff = BigUint::from(falloff.deconstruct().into()); falloff.lstrip(); @@ -228,7 +230,7 @@ fn div_by_stripped(mut a: BigUint, b: &BigUint) -> BigUint { .div_unit(100_000) .div_unit(100_000) } - + a.div(b, false) .map(|res| res.0) .unwrap_or_else(|| BigUint::zero()) -- GitLab