Remove native price usage in dAppStaking#1595
Conversation
|
/bench astar,shibuya,shiden pallet_inflation,pallet_dapp_staking |
|
Benchmarks job is scheduled at https://github.com/AstarNetwork/Astar/actions/runs/22304207265. |
pallets/dapp-staking/src/types.rs
Outdated
| // It must always be at least 1 slot. | ||
| let base_number_of_slots = T::number_of_slots(P::get(), params.slot_number_args).max(1); | ||
| let new_number_of_slots = T::number_of_slots(native_price, params.slot_number_args).max(1); | ||
| let number_of_slots = T::number_of_slots(P::get(), FIXED_TIER_SLOTS_ARGS).max(1); |
There was a problem hiding this comment.
This is also redundant - there's nothing to calculate if it is fixed const.
It's better to just define a runtime const and use it here.
There was a problem hiding this comment.
I've created FIXED_NUMBER_OF_TIER_SLOTS runtime const and removed StandardTierSlots and its associated TierSlotsFunc trait for slot-number dynamic calculation. The generic type bounded to TierSlotsFunc was skipped in TiersConfiguration encoding, so no migration needed.
| let tier_thresholds_with_max = BoundedVec::<TierThreshold, TiersNum>::try_from(vec![ | ||
| // Thresholds with explicit min/max clamping behavior. | ||
| let tier_thresholds = BoundedVec::<TierThreshold, TiersNum>::try_from(vec![ | ||
| TierThreshold::DynamicPercentage { |
There was a problem hiding this comment.
It would also be good to remove this - right now it's dead code but you could still use it somewhere.
EDIT: I mean the type itself, DynamicPercentage.
There was a problem hiding this comment.
DynamicPercentage is not directly related to the native-price or slot-number dynamics removal. Removing it completely requires a storage migration, I will do it in #1589 after dAppStaking revamp rollout, as extra cleanup. It's not harmful to have it in the hot-path for now.
|
Benchmarks have been finished. |
|
/bench astar,shibuya,shiden pallet_inflation,pallet_dapp_staking |
|
Benchmarks job is scheduled at https://github.com/AstarNetwork/Astar/actions/runs/22309790095. |
|
Benchmarks have been finished. |
Minimum allowed line rate is |
Pull Request Summary
This PR removes native-price dependency from hot-path dApp staking tier recalculation.
slot_number_argsis kept for for now given the dAppStaking revamp rollout has already been applied on Shibuya/Shiden. It will be cleanup in the follow-up task #1589 with a dedicated migration.Check list**