Skip to content

Commit

Permalink
Cleanup & benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
Dinonard committed Feb 5, 2025
1 parent e1a91d1 commit 80e92bb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
16 changes: 16 additions & 0 deletions pallets/dapp-staking/src/benchmarking/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1137,6 +1137,22 @@ mod benchmarks {
);
}

#[benchmark]
fn set_static_tier_params() {
initial_config::<T>();

let mut tier_params = StaticTierParams::<T>::get();
assert!(tier_params.is_valid(), "Sanity check");

// Modify them so they aren't the same anymore
tier_params.reward_portion[0] = Permill::zero();

#[extrinsic_call]
_(RawOrigin::Root, tier_params.clone());

assert_eq!(StaticTierParams::<T>::get(), tier_params);
}

impl_benchmark_test_suite!(
Pallet,
crate::benchmarking::tests::new_test_ext(),
Expand Down
2 changes: 1 addition & 1 deletion pallets/dapp-staking/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1535,7 +1535,7 @@ impl TierThreshold {
CloneNoBound,
TypeInfo,
)]
#[scale_info(skip_type_params(NT, SN))]
#[scale_info(skip_type_params(NT))]
pub struct TierParameters<NT: Get<u32>> {
/// Reward distribution per tier, in percentage.
/// First entry refers to the first tier, and so on.
Expand Down
2 changes: 1 addition & 1 deletion precompiles/dapp-staking/src/test/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ use astar_primitives::{
dapp_staking::{
CycleConfiguration, EraNumber, PeriodNumber, SmartContract, StakingRewardHandler,
StandardTierSlots, STANDARD_TIER_SLOTS_ARGS,
},
},
oracle::PriceProvider,
AccountId, Balance, BlockNumber,
};
Expand Down

0 comments on commit 80e92bb

Please sign in to comment.