Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NPoS] Mint fixed portion of inflation directly into the treasury #403

Closed
gpestana opened this issue Aug 8, 2023 · 4 comments · Fixed by #1660
Closed

[NPoS] Mint fixed portion of inflation directly into the treasury #403

gpestana opened this issue Aug 8, 2023 · 4 comments · Fixed by #1660
Assignees

Comments

@gpestana
Copy link
Contributor

gpestana commented Aug 8, 2023

It's been proposed and discussed a change to the current inflation model where a fixed portion of the inflation is minted directly into the treasury, while the remaining portion is distributed as rewards as per the current mechanism. The main goal is to ensure the sustainability of the treasury in the long term (more info in this thread).

In addition, it would be helpful to allow governance to change the percentage of inflation minted into the treasury.

Implementation suggestions

  1. fn era_payout calculates the portion of payout that is distributed among stakers (validator_payout) and the treasury based on perthing TreasuryFraction, in storage.
  2. The validator payout stored in ErasValidatorReward is total_payout - total_payout * TreasuryFraction. From here on, the logic of the stakers' rewards remains the same.
  3. The treasury portion for that era is minted at the end of the era into Treasury::account_id() (another option would be to cache treasury rewards and mint into the treasury pot every X eras, but probably not worth the effort/storage).
  4. New extrinsic to update TreasuryFraction perthing, gated by root.
@gpestana gpestana changed the title Mint fixed portion of inflation directly into the treasure Mint fixed portion of inflation directly into the treasury Aug 8, 2023
@kianenigma
Copy link
Contributor

It would be good to be more forward looking and design something for that that would also work for a parachain. Would probably mean taking away the minting from staking and doing it elsewhere.

@juangirini juangirini transferred this issue from paritytech/substrate Aug 24, 2023
@kianenigma kianenigma changed the title Mint fixed portion of inflation directly into the treasury [NPoS] Mint fixed portion of inflation directly into the treasury Aug 30, 2023
@Polkadot-Forum
Copy link

This issue has been mentioned on Polkadot Forum. There might be relevant details there:

https://forum.polkadot.network/t/revising-polkadots-ideal-staking-rate-calculation/3897/1

@Polkadot-Forum
Copy link

This issue has been mentioned on Polkadot Forum. There might be relevant details there:

https://forum.polkadot.network/t/adjusting-polkadots-ideal-staking-rate-calculation/3897/6

@gpestana
Copy link
Contributor Author

gpestana commented Nov 6, 2023

For the record, we'll implement these changes using the parameters pallet (under development) (#2061) so that the era payout parameters can be changed using selected origins.

github-merge-queue bot pushed a commit that referenced this issue Feb 15, 2024
This PR implements an (optional) cap of the era inflation that is
allocated to staking rewards. The remaining is minted directly into the
[`RewardRemainder`](https://github.com/paritytech/polkadot-sdk/blob/fb0fd3e62445eb2dee2b2456a0c8574d1ecdcc73/substrate/frame/staking/src/pallet/mod.rs#L160)
account, which is the treasury pot account in Polkadot and Kusama.

The staking pallet now has a percent storage item, `MaxStakersRewards`,
which defines the max percentage of the era inflation that should be
allocated to staking rewards. The remaining era inflation (i.e.
`remaining = max_era_payout - staking_payout.min(staking_payout *
MaxStakersRewards))` is minted directly into the treasury.

The `MaxStakersRewards` can be set by a privileged origin through the
`set_staking_configs` extrinsic.

**To finish**
- [x] run benchmarks for westend-runtime

Replaces #1483
Closes #403

---------

Co-authored-by: command-bot <>
@github-project-automation github-project-automation bot moved this from Draft to Closed in Parity Roadmap Feb 15, 2024
@github-project-automation github-project-automation bot moved this from ⌛️ Sometime-soon to ✅ Done in (Nominated) Proof of Stake Feb 15, 2024
bgallois pushed a commit to duniter/duniter-polkadot-sdk that referenced this issue Mar 25, 2024
…#1660)

This PR implements an (optional) cap of the era inflation that is
allocated to staking rewards. The remaining is minted directly into the
[`RewardRemainder`](https://github.com/paritytech/polkadot-sdk/blob/d349b45d086199af7ad0195534e2b913ba9b6827/substrate/frame/staking/src/pallet/mod.rs#L160)
account, which is the treasury pot account in Polkadot and Kusama.

The staking pallet now has a percent storage item, `MaxStakersRewards`,
which defines the max percentage of the era inflation that should be
allocated to staking rewards. The remaining era inflation (i.e.
`remaining = max_era_payout - staking_payout.min(staking_payout *
MaxStakersRewards))` is minted directly into the treasury.

The `MaxStakersRewards` can be set by a privileged origin through the
`set_staking_configs` extrinsic.

**To finish**
- [x] run benchmarks for westend-runtime

Replaces paritytech#1483
Closes paritytech#403

---------

Co-authored-by: command-bot <>
jonathanudd pushed a commit to jonathanudd/polkadot-sdk that referenced this issue Apr 10, 2024
* extract ChainBase to bp-runtime

* post-merge fixes

* cargo fmt --all

* compilation fixes

* reexport BlockNumberOf, HashOf, HeaderOf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment