Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for 0 existential deposit in benchmarks for pallet_staking, pallet_session, and pallet_balances #4346

Merged
merged 8 commits into from
May 2, 2024
2 changes: 1 addition & 1 deletion substrate/frame/balances/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ mod benchmarks {
let caller = whitelisted_caller();

// Give some multiple of the existential deposit
let balance = existential_deposit.saturating_mul(ED_MULTIPLIER.into());
let balance = existential_deposit.saturating_mul(ED_MULTIPLIER.into()).max(1u32.into());
let _ = <Balances<T, I> as Currency<_>>::make_free_balance_be(&caller, balance);

// Transfer `e - 1` existential deposits + 1 unit, which guarantees to create one account,
Expand Down
3 changes: 2 additions & 1 deletion substrate/frame/staking/src/testing_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ pub fn create_stash_controller<T: Config>(
destination: RewardDestination<T::AccountId>,
) -> Result<(T::AccountId, T::AccountId), &'static str> {
let staker = create_funded_user::<T>("stash", n, balance_factor);
let amount = T::Currency::minimum_balance() * (balance_factor / 10).max(1).into();
let amount =
T::Currency::minimum_balance().max(1u64.into()) * (balance_factor / 10).max(1).into();
Staking::<T>::bond(RawOrigin::Signed(staker.clone()).into(), amount, destination)?;
Ok((staker.clone(), staker))
}
Expand Down
Loading