Skip to content

Commit

Permalink
clippy·
Browse files Browse the repository at this point in the history
  • Loading branch information
girazoki committed Sep 4, 2024
1 parent abdd641 commit 7718896
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 7 deletions.
4 changes: 2 additions & 2 deletions runtime/common/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
use {
frame_support::traits::Currency, pallet_treasury::ArgumentsFactory, sp_std::marker::PhantomData,
};
pub struct TreasurtBenchmarkHelper<T>(PhantomData<T>);
pub struct TreasuryBenchmarkHelper<T>(PhantomData<T>);

impl<T> ArgumentsFactory<(), T::AccountId> for TreasurtBenchmarkHelper<T>
impl<T> ArgumentsFactory<(), T::AccountId> for TreasuryBenchmarkHelper<T>
where
T: pallet_treasury::Config,
T::AccountId: From<[u8; 32]>,
Expand Down
2 changes: 1 addition & 1 deletion runtime/dancebox/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1811,7 +1811,7 @@ impl pallet_treasury::Config for Runtime {
type BalanceConverter = UnityAssetBalanceConversion;
type PayoutPeriod = ConstU32<{ 30 * DAYS }>;
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkHelper = tanssi_runtime_common::benchmarking::TreasurtBenchmarkHelper<Runtime>;
type BenchmarkHelper = tanssi_runtime_common::benchmarking::TreasuryBenchmarkHelper<Runtime>;
}

parameter_types! {
Expand Down
2 changes: 1 addition & 1 deletion runtime/flashbox/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1557,7 +1557,7 @@ impl pallet_treasury::Config for Runtime {
type BalanceConverter = UnityAssetBalanceConversion;
type PayoutPeriod = ConstU32<{ 30 * DAYS }>;
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkHelper = tanssi_runtime_common::benchmarking::TreasurtBenchmarkHelper<Runtime>;
type BenchmarkHelper = tanssi_runtime_common::benchmarking::TreasuryBenchmarkHelper<Runtime>;
}

parameter_types! {
Expand Down
24 changes: 21 additions & 3 deletions solo-chains/runtime/starlight/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ use {
traits::{
fungible::Inspect,
tokens::{PayFromAccount, UnityAssetBalanceConversion},
ConstBool,
ConstBool, Currency,
},
},
frame_system::{pallet_prelude::BlockNumberFor, EnsureNever},
Expand All @@ -48,6 +48,7 @@ use {
pallet_registrar_runtime_api::ContainerChainGenesisData,
pallet_services_payment::{ProvideBlockProductionCost, ProvideCollatorAssignmentCost},
pallet_session::ShouldEndSession,
pallet_treasury::ArgumentsFactory,
parachains_scheduler::common::Assignment,
parity_scale_codec::{Decode, Encode, MaxEncodedLen},
primitives::{
Expand Down Expand Up @@ -484,6 +485,23 @@ parameter_types! {
pub TreasuryAccount: AccountId = Treasury::account_id();
}

pub struct TreasuryBenchmarkHelper<T>(PhantomData<T>);

impl<T> ArgumentsFactory<(), T::AccountId> for TreasuryBenchmarkHelper<T>
where
T: pallet_treasury::Config,
T::AccountId: From<[u8; 32]>,
{
fn create_asset_kind(_seed: u32) {}

fn create_beneficiary(seed: [u8; 32]) -> T::AccountId {
let account: T::AccountId = seed.into();
let balance = T::Currency::minimum_balance();
let _ = T::Currency::make_free_balance_be(&account, balance);
account
}
}

impl pallet_treasury::Config for Runtime {
type PalletId = TreasuryPalletId;
type Currency = Balances;
Expand All @@ -503,7 +521,7 @@ impl pallet_treasury::Config for Runtime {
type BalanceConverter = UnityAssetBalanceConversion;
type PayoutPeriod = PayoutSpendPeriod;
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkHelper = runtime_common::impls::benchmarks::TreasuryArguments;
type BenchmarkHelper = TreasuryBenchmarkHelper<Runtime>;
}

impl pallet_offences::Config for Runtime {
Expand Down Expand Up @@ -1154,7 +1172,7 @@ impl pallet_asset_rate::Config for Runtime {
type Currency = Balances;
type AssetKind = <Runtime as pallet_treasury::Config>::AssetKind;
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkHelper = runtime_common::impls::benchmarks::AssetRateArguments;
type BenchmarkHelper = ();
}

parameter_types! {
Expand Down

0 comments on commit 7718896

Please sign in to comment.