Skip to content

Commit

Permalink
(chore): cargo fmt and clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
talhadaar committed Sep 16, 2024
1 parent 7f301e3 commit 7e0b410
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
6 changes: 3 additions & 3 deletions pallets/parachain-staking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2841,10 +2841,10 @@ pub mod pallet {

pub(crate) fn pot_issuance() -> BalanceOf<T> {
let pot = Self::account_id();
let total_issuance = T::Currency::free_balance(&pot)

T::Currency::free_balance(&pot)
.checked_sub(&T::Currency::minimum_balance())
.unwrap_or_else(Zero::zero);
total_issuance
.unwrap_or_else(Zero::zero)
}

/// Prepare delayed rewards for the next session
Expand Down
2 changes: 1 addition & 1 deletion pallets/parachain-staking/src/migrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::{
AtStake, CandidatePool, CollatorBlocks, ForceNewRound,
};
use frame_support::{
pallet_prelude::{GetStorageVersion, ValueQuery, StorageVersion},
pallet_prelude::{GetStorageVersion, StorageVersion, ValueQuery},
storage_alias,
traits::{Get, LockableCurrency, WithdrawReasons},
weights::Weight,
Expand Down
14 changes: 4 additions & 10 deletions pallets/parachain-staking/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3419,7 +3419,7 @@ fn check_claim_block_normal_wo_delegator() {
(3, origin_balance),
(4, origin_balance),
])
.with_collators(vec![(1, 1 * stake), (2, 2 * stake)])
.with_collators(vec![(1, stake), (2, 2 * stake)])
.build()
.execute_with(|| {
let authors: Vec<Option<AccountId>> = vec![
Expand Down Expand Up @@ -3485,7 +3485,7 @@ fn check_claim_block_normal_wi_delegator() {
(9, origin_balance),
(10, origin_balance),
])
.with_collators(vec![(1, 1 * stake), (2, 2 * stake)])
.with_collators(vec![(1, stake), (2, 2 * stake)])
.with_delegators(vec![(5, 1, 5 * stake), (6, 1, 6 * stake), (7, 2, 7 * stake)])
.build()
.execute_with(|| {
Expand Down Expand Up @@ -3623,17 +3623,11 @@ fn collator_reward_per_session_with_delegator() {
let rewards = StakePallet::get_delgators_reward_per_session(&state, 10, 50000, 1000);
assert_eq!(
rewards[0],
Reward {
owner: 2,
amount: Perquintill::from_rational(10 as u64 * 600, 50000) * 1000
}
Reward { owner: 2, amount: Perquintill::from_rational(10_u64 * 600, 50000) * 1000 }
);
assert_eq!(
rewards[1],
Reward {
owner: 3,
amount: Perquintill::from_rational(10 as u64 * 400, 50000) * 1000
}
Reward { owner: 3, amount: Perquintill::from_rational(10_u64 * 400, 50000) * 1000 }
);
});
}
Expand Down

0 comments on commit 7e0b410

Please sign in to comment.