Skip to content

Conversation

ipapandinas
Copy link
Contributor

@ipapandinas ipapandinas commented Sep 3, 2025

Pull Request Summary

Closes #1520

This PR introduces a configurable per-block decay factor to Astar's inflation system.

Key changes:

  • decay_rate and decay_factor fields (Perquintill) to InflationParameters and InflationConfiguration structs,
  • decay_factor is updated in on_initialize,
  • all reward payouts now apply the current decay_factor,
  • decay_rate is updated like the other inflation params

It also migrates storages for all runtimes with no decay (decay_rate = Perquintill::one() & decay_factor = Perquintill::one()) and includes extra tests + weights update.

Check list**

  • added or updated unit tests
  • added OnRuntimeUpgrade hook for migration
  • added benchmarks & weights for any modified runtime logics.
  • updated Astar official documentation

@ipapandinas ipapandinas added shiden related to shiden runtime astar Related to Astar shibuya related to shibuya runtime This PR/Issue is related to the topic “runtime”. labels Sep 3, 2025
@ipapandinas ipapandinas marked this pull request as ready for review September 4, 2025 15:06
@ipapandinas
Copy link
Contributor Author

/bench astar-dev,shibuya-dev,shiden-dev pallet_inflation

Copy link

github-actions bot commented Sep 4, 2025

Benchmarks job is scheduled at https://github.com/AstarNetwork/Astar/actions/runs/17468312364.
Please wait for a while.
Branch: feat/inflation-decay-factor
SHA: ba281d9

Copy link

github-actions bot commented Sep 4, 2025

Benchmark job failed.
Please check https://github.com/AstarNetwork/Astar/actions/runs/17468312364.

@ipapandinas
Copy link
Contributor Author

/bench astar,shibuya,shiden pallet_inflation

Copy link

github-actions bot commented Sep 4, 2025

Benchmarks job is scheduled at https://github.com/AstarNetwork/Astar/actions/runs/17469034746.
Please wait for a while.
Branch: feat/inflation-decay-factor
SHA: ba281d9

Copy link

github-actions bot commented Sep 4, 2025

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

@ipapandinas
Copy link
Contributor Author

/bench astar,shibuya,shiden pallet_inflation

Copy link

Benchmarks job is scheduled at https://github.com/AstarNetwork/Astar/actions/runs/17737782722.
Please wait for a while.
Branch: feat/inflation-decay-factor
SHA: ecc129b

Copy link

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

Copy link
Contributor

@Dinonard Dinonard left a comment

Choose a reason for hiding this comment

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

Thanks for the updates.
I'm only looking at the core inflation pallet logic for now.

Right now to me it seems there are still plenty of unnecessary changes.
And we should strive to keep them to the bare minimum.

I've left some comments, and feel free to correct me if I'm wrong somewhere.
The solution described in the Github issue should need minimal changes with only:

  • decay factor update in on_initialize
  • decay factor application when paying out rewards
    (+ the extra extrinsic & types update)

Copy link

Benchmarks job is scheduled at https://github.com/AstarNetwork/Astar/actions/runs/17771149640.
Please wait for a while.
Branch: feat/inflation-decay-factor
SHA: 735fbfa

Copy link

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

Copy link
Contributor

@Dinonard Dinonard left a comment

Choose a reason for hiding this comment

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

Looks good, some suggestions & questions.

About the benchmarking part though - this now impacts the dApp staking benchmarks as well since it relies on the inflation pallet for reward numbers. I'd suggest to run benchmarks for it as well - with decay factor < 1.

@ipapandinas
Copy link
Contributor Author

/bench astar,shibuya,shiden pallet_inflation,pallet_dapp_staking

Copy link

Benchmarks job is scheduled at https://github.com/AstarNetwork/Astar/actions/runs/17805829771.
Please wait for a while.
Branch: feat/inflation-decay-factor
SHA: 4791ba2

Copy link

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

Copy link
Contributor

@Dinonard Dinonard left a comment

Choose a reason for hiding this comment

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

One more thing came up (sorry) - did you test how it works when factor is zero?

All reward payout & calculation is still possible?
(for pallet inflation logic & dApp staking)

@ipapandinas
Copy link
Contributor Author

@Dinonard Yes, I tested this before with Chopsticks, storage migration as well. However to ensure it works as expected in the long run, I added the following e2e test AstarNetwork/e2e-tests#150

@Dinonard
Copy link
Contributor

@Dinonard Yes, I tested this before with Chopsticks, storage migration as well. However to ensure it works as expected in the long run, I added the following e2e test AstarNetwork/e2e-tests#150

Great to hear.
I would have still suggested unit or integration level test since it's something to ensure works on the pallet level, e.g. no arithmetic error in case factor is zero.

Dinonard
Dinonard previously approved these changes Sep 18, 2025
@ipapandinas
Copy link
Contributor Author

/bench astar,shibuya,shiden pallet_inflation,pallet_dapp_staking

Copy link

Benchmarks job is scheduled at https://github.com/AstarNetwork/Astar/actions/runs/17834841280.
Please wait for a while.
Branch: feat/inflation-decay-factor
SHA: f055f9d

Copy link

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

@ipapandinas
Copy link
Contributor Author

I would have still suggested unit or integration level test since it's something to ensure works on the pallet level, e.g. no arithmetic error in case factor is zero.

@Dinonard I completely forgot about the integration tests, so I added one that also check for bonus rewards payouts. Weights are updated again.

Copy link

Code Coverage

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

Minimum allowed line rate is 50%

@ipapandinas ipapandinas merged commit a52c2fd into master Sep 19, 2025
8 checks passed
@ipapandinas ipapandinas deleted the feat/inflation-decay-factor branch September 19, 2025 08:11
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”. shibuya related to shibuya shiden related to shiden runtime
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inflation decay factor
3 participants