Skip to content

Commit

Permalink
small refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Ank4n committed Nov 19, 2024
1 parent ce55a7f commit 5407bf4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions substrate/frame/nomination-pools/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3585,13 +3585,13 @@ impl<T: Config> Pallet<T> {
let pending_slash =
Self::member_pending_slash(Member::from(member_account.clone()), member.clone())?;

// ensure there is something to slash.
ensure!(!pending_slash.is_zero(), Error::<T>::NothingToSlash);

if enforce_min_slash {
// ensure slashed amount is at least the minimum balance.
ensure!(pending_slash >= T::Currency::minimum_balance(), Error::<T>::SlashTooLow);
} else {
// in any case ensure there is something to slash.
ensure!(!pending_slash.is_zero(), Error::<T>::NothingToSlash);
};
}

T::StakeAdapter::member_slash(
Member::from(member_account.clone()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ fn pool_slash_proportional() {
// and therefore applying slash fails
assert_noop!(
Pools::apply_slash(RuntimeOrigin::signed(10), 21),
PoolsError::<Runtime>::SlashTooLow
PoolsError::<Runtime>::NothingToSlash
);

hypothetically!({
Expand Down

0 comments on commit 5407bf4

Please sign in to comment.