Skip to content

Remove native price usage in dAppStaking#1595

Merged
ipapandinas merged 5 commits intomasterfrom
remove/dapp-staking-native-price
Feb 24, 2026
Merged

Remove native price usage in dAppStaking#1595
ipapandinas merged 5 commits intomasterfrom
remove/dapp-staking-native-price

Conversation

@ipapandinas
Copy link
Contributor

@ipapandinas ipapandinas commented Feb 23, 2026

Pull Request Summary

This PR removes native-price dependency from hot-path dApp staking tier recalculation.

slot_number_args is 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**

  • added or updated unit tests
  • updated Astar official documentation
  • update weights

@ipapandinas ipapandinas added astar Related to Astar runtime This PR/Issue is related to the topic “runtime”. labels Feb 23, 2026
@ipapandinas
Copy link
Contributor Author

/bench astar,shibuya,shiden pallet_inflation,pallet_dapp_staking

@github-actions
Copy link

Benchmarks job is scheduled at https://github.com/AstarNetwork/Astar/actions/runs/22304207265.
Please wait for a while.
Branch: remove/dapp-staking-native-price
SHA: 821cbd5

// 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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 {
Copy link
Contributor

@Dinonard Dinonard Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@github-actions
Copy link

Benchmarks have been finished.
You can download artifacts if exists https://github.com/AstarNetwork/Astar/actions/runs/22304207265.

@ipapandinas
Copy link
Contributor Author

/bench astar,shibuya,shiden pallet_inflation,pallet_dapp_staking

Dinonard
Dinonard previously approved these changes Feb 23, 2026
@github-actions
Copy link

Benchmarks job is scheduled at https://github.com/AstarNetwork/Astar/actions/runs/22309790095.
Please wait for a while.
Branch: remove/dapp-staking-native-price
SHA: a460cf5

@github-actions
Copy link

Benchmarks have been finished.
You can download artifacts if exists https://github.com/AstarNetwork/Astar/actions/runs/22309790095.

@ipapandinas ipapandinas merged commit 2b9603e into master Feb 24, 2026
9 checks passed
@ipapandinas ipapandinas deleted the remove/dapp-staking-native-price branch February 24, 2026 08:31
@github-actions
Copy link

Code Coverage

Package Line Rate Branch Rate Health
precompiles/sr25519/src 69% 0%
pallets/ethereum-checked/src 76% 0%
pallets/collator-selection/src 82% 0%
pallets/dapp-staking/rpc/runtime-api/src 0% 0%
precompiles/unified-accounts/src 100% 0%
chain-extensions/pallet-assets/src 55% 0%
chain-extensions/unified-accounts/src 0% 0%
primitives/src/xcm 66% 0%
pallets/dapp-staking/src 77% 0%
pallets/astar-xcm-benchmarks/src/fungible 100% 0%
pallets/democracy-mbm/src 30% 0%
pallets/astar-xcm-benchmarks/src 86% 0%
pallets/price-aggregator/src 75% 0%
precompiles/xcm/src 69% 0%
precompiles/dapp-staking/src 89% 0%
chain-extensions/types/assets/src 0% 0%
pallets/collective-proxy/src 94% 0%
pallets/dapp-staking/src/benchmarking 95% 0%
pallets/vesting-mbm/src 87% 0%
pallets/dapp-staking/src/test 0% 0%
primitives/src 55% 0%
precompiles/dapp-staking/src/test 0% 0%
pallets/astar-xcm-benchmarks/src/generic 100% 0%
precompiles/assets-erc20/src 77% 0%
precompiles/substrate-ecdsa/src 74% 0%
chain-extensions/types/unified-accounts/src 0% 0%
pallets/inflation/src 58% 0%
pallets/static-price-provider/src 91% 0%
pallets/unified-accounts/src 80% 0%
precompiles/dispatch-lockdrop/src 89% 0%
pallets/dynamic-evm-base-fee/src 85% 0%
pallets/xc-asset-config/src 57% 0%
Summary 71% (3852 / 5415) 0% (0 / 0)

Minimum allowed line rate is 50%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

astar Related to Astar runtime This PR/Issue is related to the topic “runtime”.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants