diff --git a/pallets/inflation-rewards/src/lib.rs b/pallets/inflation-rewards/src/lib.rs index f197ce75e..55448bced 100644 --- a/pallets/inflation-rewards/src/lib.rs +++ b/pallets/inflation-rewards/src/lib.rs @@ -16,7 +16,7 @@ //! # Inflation Rewards Pallet //! -//! This pallet handle native token inflation and rewards dsitribution. +//! This pallet handle native token inflation and rewards distribution. #![cfg_attr(not(feature = "std"), no_std)] @@ -38,7 +38,10 @@ use { }, }, frame_system::pallet_prelude::*, - sp_runtime::{traits::Get, Perbill}, + sp_runtime::{ + traits::{Get, Saturating}, + Perbill, + }, tp_core::{BlockNumber, ParaId}, tp_traits::{AuthorNotingHook, DistributeRewards, GetCurrentContainerChains}, }; @@ -66,8 +69,9 @@ pub mod pallet { let not_distributed_rewards = if let Some(chains_to_reward) = ChainsToReward::::take() { // Collect and sum all undistributed rewards - let rewards_not_distributed: BalanceOf = chains_to_reward.rewards_per_chain - * (chains_to_reward.para_ids.len() as u32).into(); + let rewards_not_distributed: BalanceOf = chains_to_reward + .rewards_per_chain + .saturating_mul((chains_to_reward.para_ids.len() as u32).into()); T::Currency::withdraw( &T::PendingRewardsAccount::get(), rewards_not_distributed, @@ -80,10 +84,9 @@ pub mod pallet { CreditOf::::zero() }; - // Get the number of chains at this block + // Get the number of chains at this block (tanssi + container chain blocks) weight += T::DbWeight::get().reads_writes(1, 1); let registered_para_ids = T::ContainerChains::current_container_chains(); - let number_of_chains: BalanceOf = ((registered_para_ids.len() as u32).saturating_add(1)).into(); @@ -138,9 +141,6 @@ pub mod pallet { /// Inflation rate per relay block (proportion of the total issuance) type InflationRate: Get; - /// The maximum number of block authors - type MaxAuthors: Get; - /// What to do with the new supply not dedicated to staking type OnUnbalanced: OnUnbalanced>; diff --git a/pallets/invulnerables/src/benchmarking.rs b/pallets/invulnerables/src/benchmarking.rs index a238f9e91..4665b9f1d 100644 --- a/pallets/invulnerables/src/benchmarking.rs +++ b/pallets/invulnerables/src/benchmarking.rs @@ -22,7 +22,6 @@ use super::*; #[allow(unused)] use crate::Pallet as InvulnerablesPallet; -use sp_runtime::traits::AtLeast32BitUnsigned; use { frame_benchmarking::{account, impl_benchmark_test_suite, v2::*, BenchmarkError}, frame_support::{ @@ -31,6 +30,7 @@ use { }, frame_system::{EventRecord, RawOrigin}, pallet_session::{self as session, SessionManager}, + sp_runtime::traits::AtLeast32BitUnsigned, sp_std::prelude::*, tp_traits::DistributeRewards, }; diff --git a/pallets/invulnerables/src/lib.rs b/pallets/invulnerables/src/lib.rs index e2941fdc9..57695c468 100644 --- a/pallets/invulnerables/src/lib.rs +++ b/pallets/invulnerables/src/lib.rs @@ -298,8 +298,7 @@ pub struct InvulnerableRewardDistribution( PhantomData<(Runtime, Currency, Fallback)>, ); -use frame_support::pallet_prelude::Weight; -use sp_runtime::traits::Get; +use {frame_support::pallet_prelude::Weight, sp_runtime::traits::Get}; type CreditOf = frame_support::traits::fungible::Credit<::AccountId, Currency>; diff --git a/pallets/pooled-staking/src/pools.rs b/pallets/pooled-staking/src/pools.rs index fb28e0cbc..d761e3300 100644 --- a/pallets/pooled-staking/src/pools.rs +++ b/pallets/pooled-staking/src/pools.rs @@ -455,7 +455,6 @@ impl ManualRewards { /// AutoCompounding shares. This can lead to some rounding, which will be /// absorbed in the ManualRewards distribution, which simply consist of /// transfering the funds to the candidate account. -#[allow(dead_code)] #[frame_support::transactional] pub fn distribute_rewards( candidate: &Candidate, diff --git a/runtime/dancebox/src/lib.rs b/runtime/dancebox/src/lib.rs index d6e3dcc50..79059fea1 100644 --- a/runtime/dancebox/src/lib.rs +++ b/runtime/dancebox/src/lib.rs @@ -1135,8 +1135,7 @@ parameter_types! { pub const RewardsPortion: Perbill = Perbill::from_percent(70); } -use nimbus_primitives::SlotBeacon; -use tp_traits::GetContainerChainAuthor; +use {nimbus_primitives::SlotBeacon, tp_traits::GetContainerChainAuthor}; pub struct GetSelfChainBlockAuthor; impl Get for GetSelfChainBlockAuthor { diff --git a/runtime/dancebox/tests/common/mod.rs b/runtime/dancebox/tests/common/mod.rs index 4954b2807..c1d711b37 100644 --- a/runtime/dancebox/tests/common/mod.rs +++ b/runtime/dancebox/tests/common/mod.rs @@ -123,8 +123,10 @@ pub fn set_parachain_inherent_data() { } pub fn set_parachain_inherent_data_random_seed(random_seed: [u8; 32]) { - use cumulus_primitives_core::relay_chain::well_known_keys; - use cumulus_test_relay_sproof_builder::RelayStateSproofBuilder; + use { + cumulus_primitives_core::relay_chain::well_known_keys, + cumulus_test_relay_sproof_builder::RelayStateSproofBuilder, + }; let (relay_parent_storage_root, relay_chain_state) = { let mut sproof = RelayStateSproofBuilder::default();