Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 0 additions & 31 deletions pallets/parachain-staking/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,30 +134,12 @@ benchmarks! {
assert_eq!(<Round<T>>::get().current, 1u32);
}

on_initialize_new_year {
let old = <InflationConfig<T>>::get();
assert_eq!(<LastRewardReduction<T>>::get(), T::BlockNumber::zero());
let block = (T::BLOCKS_PER_YEAR + 1u32.into()).saturated_into::<T::BlockNumber>();
}: { Pallet::<T>::on_initialize(block) }
verify {
let new = <InflationConfig<T>>::get();
assert_eq!(<LastRewardReduction<T>>::get(), T::BlockNumber::one());
assert_eq!(new.collator.max_rate, old.collator.max_rate);
assert_eq!(new.delegator.max_rate, old.delegator.max_rate);
assert!(new.collator.reward_rate.annual < old.collator.reward_rate.annual);
}

on_initialize_network_rewards {
let issuance = T::Currency::total_issuance();
// if we only add by one, we also initialize a new year
let block = T::NetworkRewardStart::get() + T::BlockNumber::one() * 2_u64.into();
}: { Pallet::<T>::on_initialize(block) }
verify {
let new_issuance = T::Currency::total_issuance();
let max_col_reward = InflationConfig::<T>::get().collator.reward_rate.per_block * MaxCollatorCandidateStake::<T>::get() * MaxSelectedCandidates::<T>::get().into();
let network_block_reward = T::NetworkRewardRate::get() * max_col_reward;
assert!(new_issuance > issuance);
assert_eq!(new_issuance - issuance, network_block_reward)
}

force_new_round {
Expand All @@ -184,19 +166,6 @@ benchmarks! {
assert!(!<ForceNewRound<T>>::get());
}

set_inflation {
let inflation = InflationInfo::new(
T::BLOCKS_PER_YEAR.saturated_into(),
Perquintill::from_percent(10),
Perquintill::from_percent(15),
Perquintill::from_percent(40),
Perquintill::from_percent(10)
);
}: _(RawOrigin::Root, inflation.collator.max_rate, inflation.collator.reward_rate.annual, inflation.delegator.max_rate, inflation.delegator.reward_rate.annual)
verify {
assert_eq!(<InflationConfig<T>>::get(), inflation);
}

set_max_selected_candidates {
let n in (T::MinCollators::get()) .. T::MaxTopCandidates::get();
let m in 0 .. T::MaxDelegatorsPerCollator::get();
Expand Down
2 changes: 1 addition & 1 deletion pallets/parachain-staking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ pub mod pallet {
/// - Reads: [Origin Account]
/// - Writes: ForceNewRound
/// # </weight>
#[pallet::weight(<T as pallet::Config>::WeightInfo::set_inflation())]
#[pallet::weight(<T as pallet::Config>::WeightInfo::force_new_round())]
pub fn force_new_round(origin: OriginFor<T>) -> DispatchResult {
ensure_root(origin)?;

Expand Down
3 changes: 0 additions & 3 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1175,10 +1175,7 @@ mod benches {
[pallet_scheduler, Scheduler]
[pallet_indices, Indices]
[pallet_balances, Balances]
[pallet_collator_selection, CollatorSelection]
[pallet_democracy, Democracy]
[pallet_aura, Aura]
[pallet_xcm, PolkadotXcm]
[pallet_collective::<Instance1>, Council]
[pallet_collective::<Instance2>, TechnicalCommittee]
[pallet_elections_phragmen, Elections]
Expand Down