Skip to content

Commit

Permalink
fix: use saturating_add()
Browse files Browse the repository at this point in the history
  • Loading branch information
prxgr4mm3r committed Mar 12, 2024
1 parent 734cf5f commit e335087
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
6 changes: 3 additions & 3 deletions frame/balances/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ mod benchmarks {
let recipient: T::AccountId = account("recipient", 0, SEED);
let recipient_lookup = T::Lookup::unlookup(recipient.clone());
let transfer_amount =
existential_deposit.saturating_mul((ED_MULTIPLIER - 1).into()) + 1u32.into();
existential_deposit.saturating_mul((ED_MULTIPLIER - 1).into()).saturating_add(1u32.into());

#[extrinsic_call]
_(RawOrigin::Root, source_lookup, recipient_lookup, transfer_amount);
Expand Down Expand Up @@ -232,7 +232,7 @@ mod benchmarks {

// Give some multiple of the existential deposit
let ed = T::ExistentialDeposit::get();
let balance = ed + ed;
let balance = ed.saturating_add(ed);
let _ = <Balances<T, I> as Currency<_>>::make_free_balance_be(&user, balance);

// Reserve the balance
Expand All @@ -244,7 +244,7 @@ mod benchmarks {
_(RawOrigin::Root, user_lookup, balance);

assert!(Balances::<T, I>::reserved_balance(&user).is_zero());
assert_eq!(Balances::<T, I>::free_balance(&user), ed + ed);
assert_eq!(Balances::<T, I>::free_balance(&user), ed.saturating_add(ed));

Ok(())
}
Expand Down
1 change: 0 additions & 1 deletion runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ use frame_system::{
EnsureSigned,
};
pub use pallet_balances::Call as BalancesCall;
// pub use pallet_chain_extension_assets::weights::WeightInfo as ChainExtensionWeightInfo;
pub use pallet_timestamp::Call as TimestampCall;
use pallet_transaction_payment::CurrencyAdapter;

Expand Down

0 comments on commit e335087

Please sign in to comment.