Skip to content

Commit d59e481

Browse files
gui1117kianenigma
andauthored
Bound Unsigned when signed is not supported. (#6367)
* bound unsigned when necessary * convert more type to AtLeast32BitUnsigned * Update primitives/arithmetic/src/traits.rs Co-authored-by: Kian Paimani <[email protected]> * doc refactor * line reorganize Co-authored-by: Kian Paimani <[email protected]>
1 parent c037be6 commit d59e481

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/inflation.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
//! The staking rate in NPoS is the total amount of tokens staked by nominators and validators,
2121
//! divided by the total token supply.
2222
23-
use sp_runtime::{Perbill, traits::AtLeast32Bit, curve::PiecewiseLinear};
23+
use sp_runtime::{Perbill, traits::AtLeast32BitUnsigned, curve::PiecewiseLinear};
2424

2525
/// The total payout to all validators (and their nominators) per era and maximum payout.
2626
///
@@ -34,7 +34,7 @@ pub fn compute_total_payout<N>(
3434
npos_token_staked: N,
3535
total_tokens: N,
3636
era_duration: u64
37-
) -> (N, N) where N: AtLeast32Bit + Clone {
37+
) -> (N, N) where N: AtLeast32BitUnsigned + Clone {
3838
// Milliseconds per year for the Julian year (365.25 days).
3939
const MILLISECONDS_PER_YEAR: u64 = 1000 * 3600 * 24 * 36525 / 100;
4040

src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,8 @@ use sp_runtime::{
306306
Percent, Perbill, PerU16, PerThing, RuntimeDebug, DispatchError,
307307
curve::PiecewiseLinear,
308308
traits::{
309-
Convert, Zero, StaticLookup, CheckedSub, Saturating, SaturatedConversion, AtLeast32Bit,
310-
Dispatchable,
309+
Convert, Zero, StaticLookup, CheckedSub, Saturating, SaturatedConversion,
310+
AtLeast32BitUnsigned, Dispatchable,
311311
},
312312
transaction_validity::{
313313
TransactionValidityError, TransactionValidity, ValidTransaction, InvalidTransaction,
@@ -493,7 +493,7 @@ pub struct StakingLedger<AccountId, Balance: HasCompact> {
493493

494494
impl<
495495
AccountId,
496-
Balance: HasCompact + Copy + Saturating + AtLeast32Bit,
496+
Balance: HasCompact + Copy + Saturating + AtLeast32BitUnsigned,
497497
> StakingLedger<AccountId, Balance> {
498498
/// Remove entries from `unlocking` that are sufficiently old and reduce the
499499
/// total by the sum of their balances.
@@ -544,7 +544,7 @@ impl<
544544
}
545545

546546
impl<AccountId, Balance> StakingLedger<AccountId, Balance> where
547-
Balance: AtLeast32Bit + Saturating + Copy,
547+
Balance: AtLeast32BitUnsigned + Saturating + Copy,
548548
{
549549
/// Slash the validator for a given amount of balance. This can grow the value
550550
/// of the slash in the case that the validator has less than `minimum_balance`

0 commit comments

Comments
 (0)