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

Implements a % cap on staking rewards from era inflation #1660

Merged
merged 28 commits into from
Feb 15, 2024

Conversation

gpestana
Copy link
Contributor

@gpestana gpestana commented Sep 21, 2023

This PR implements an (optional) cap of the era inflation that is allocated to staking rewards. The remaining is minted directly into the RewardRemainder 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

  • run benchmarks for westend-runtime

Replaces #1483
Closes #403

@gpestana gpestana requested review from a team September 21, 2023 09:22
@gpestana gpestana self-assigned this Sep 21, 2023
@gpestana gpestana marked this pull request as draft September 21, 2023 09:22
@gpestana gpestana changed the title Adds minimum treasury inflation per era Implements minimum era inflation minting to treasury Sep 21, 2023
@gpestana
Copy link
Contributor Author

bot bench polkadot-pallet --pallet=pallet_staking --runtime polkadot

@command-bot
Copy link

command-bot bot commented Sep 22, 2023

@gpestana https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/3769934 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" --subcommand=runtime --runtime=polkadot --target_dir=polkadot --pallet=pallet_staking. Check out https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/pipelines?page=1&scope=all&username=group_605_bot to know what else is being executed currently.

Comment bot cancel 2-6299fd2d-fa31-4702-9017-568fa5162db5 to cancel this command or bot cancel to cancel all commands in this pull request.

@gpestana gpestana added T2-pallets This PR/Issue is related to a particular pallet. T8-polkadot This PR/Issue is related to/affects the Polkadot network. labels Sep 22, 2023
@gpestana gpestana marked this pull request as ready for review September 22, 2023 11:00
@gpestana gpestana changed the title Implements minimum era inflation minting to treasury Implements minimum era inflation minting as remainder Sep 22, 2023
@command-bot
Copy link

command-bot bot commented Sep 22, 2023

@gpestana Command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" --subcommand=runtime --runtime=polkadot --target_dir=polkadot --pallet=pallet_staking has finished. Result: https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/3769934 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/3769934/artifacts/download.

@gpestana
Copy link
Contributor Author

bot bench substrate-pallet --pallet=pallet_staking

@command-bot
Copy link

command-bot bot commented Sep 22, 2023

"$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" --subcommand=pallet --runtime=dev --target_dir=substrate --pallet=pallet_staking was queued.

Comment bot cancel 6-b22a5e88-1858-41be-8925-d7eb4628e672 to cancel this command or bot cancel to cancel all commands in this pull request.

@command-bot
Copy link

command-bot bot commented Sep 22, 2023

@gpestana Command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" --subcommand=pallet --runtime=dev --target_dir=substrate --pallet=pallet_staking has finished. Result:

ValidationError: "id" is required
ValidationError: "id" is required
{"message":{"base":["Reference not found"]}}

polkadot/runtime/common/src/impls.rs Outdated Show resolved Hide resolved
substrate/frame/staking/src/lib.rs Outdated Show resolved Hide resolved
substrate/frame/staking/src/mock.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@Ank4n Ank4n left a comment

Choose a reason for hiding this comment

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

A small nit but otherwise looks good.

polkadot/runtime/common/src/impls.rs Outdated Show resolved Hide resolved
substrate/frame/staking/src/mock.rs Outdated Show resolved Hide resolved
substrate/frame/staking/src/pallet/mod.rs Outdated Show resolved Hide resolved
@gpestana
Copy link
Contributor Author

bot bench substrate-pallet --pallet=pallet_staking

@command-bot
Copy link

command-bot bot commented Sep 23, 2023

@gpestana https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/3779467 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" --subcommand=pallet --runtime=dev --target_dir=substrate --pallet=pallet_staking. Check out https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/pipelines?page=1&scope=all&username=group_605_bot to know what else is being executed currently.

Comment bot cancel 10-d6dfa0ed-f1ee-4795-8a98-728b4882ee01 to cancel this command or bot cancel to cancel all commands in this pull request.

@gpestana
Copy link
Contributor Author

bot fmt

@command-bot
Copy link

command-bot bot commented Jan 28, 2024

@gpestana https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/5050625 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/fmt/fmt.sh". Check out https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/pipelines?page=1&scope=all&username=group_605_bot to know what else is being executed currently.

Comment bot cancel 1-01761a0a-8767-4774-890e-f36344c7ec51 to cancel this command or bot cancel to cancel all commands in this pull request.

@command-bot
Copy link

command-bot bot commented Jan 28, 2024

@gpestana Command "$PIPELINE_SCRIPTS_DIR/commands/fmt/fmt.sh" has finished. Result: https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/5050625 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/5050625/artifacts/download.

@gpestana
Copy link
Contributor Author

bot bench polkadot-pallet --pallet=pallet_staking --runtime westend

@command-bot
Copy link

command-bot bot commented Jan 28, 2024

@gpestana "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" --subcommand=pallet --runtime=westend --target_dir=polkadot --pallet=pallet_staking (https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/5050764) was cancelled in #1660 (comment)

@gpestana
Copy link
Contributor Author

bot cancel 2-50f51a7a-9fe2-4098-a268-af52c5e61823

@command-bot
Copy link

command-bot bot commented Jan 28, 2024

@gpestana Command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" --subcommand=pallet --runtime=westend --target_dir=polkadot --pallet=pallet_staking has finished. Result: https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/5050764 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/5050764/artifacts/download.

@gpestana
Copy link
Contributor Author

bot bench polkadot-pallet --pallet=pallet_staking --runtime westend

@command-bot
Copy link

command-bot bot commented Jan 28, 2024

@gpestana https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/5050797 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" --subcommand=pallet --runtime=westend --target_dir=polkadot --pallet=pallet_staking. Check out https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/pipelines?page=1&scope=all&username=group_605_bot to know what else is being executed currently.

Comment bot cancel 3-3beb4642-622f-491f-939c-7feff4df7dbd to cancel this command or bot cancel to cancel all commands in this pull request.

@command-bot
Copy link

command-bot bot commented Jan 28, 2024

@gpestana Command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" --subcommand=pallet --runtime=westend --target_dir=polkadot --pallet=pallet_staking has finished. Result: https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/5050797 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/5050797/artifacts/download.

@gpestana gpestana enabled auto-merge February 14, 2024 17:19
@gpestana gpestana added this pull request to the merge queue Feb 15, 2024
Merged via the queue into master with commit fde4447 Feb 15, 2024
128 of 129 checks passed
@gpestana gpestana deleted the gpestana/403-treasury_mint_remainder branch February 15, 2024 19:38
bgallois pushed a commit to duniter/duniter-polkadot-sdk that referenced this pull request 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 <>
bkchr pushed a commit that referenced this pull request Apr 10, 2024
* remove dispatch_result field

* fix benchmarks
bkchr pushed a commit that referenced this pull request Apr 10, 2024
* Use an actual Result inside MessageDispatchResult

We need this in order to distinguish between Ok and Err

* Revert #1660

* Fixes + simplifications

* Implement review suggestions
@Polkadot-Forum
Copy link

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

https://forum.polkadot.network/t/polkadots-economics-tools-to-shape-the-forseeable-future/8708/1

@Polkadot-Forum
Copy link

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

https://forum.polkadot.network/t/proposal-for-adjusting-polkadots-inflation-system-reducing-issuance-and-complexity/9157/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T2-pallets This PR/Issue is related to a particular pallet. T8-polkadot This PR/Issue is related to/affects the Polkadot network.
Projects
Status: Done
Status: Audited
Development

Successfully merging this pull request may close these issues.

[NPoS] Mint fixed portion of inflation directly into the treasury
6 participants