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.

serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 8, 2024
* remove dispatch_result field

* fix benchmarks
serban300 added a commit to serban300/polkadot-sdk that referenced this pull request Apr 8, 2024
* Use an actual Result inside MessageDispatchResult

We need this in order to distinguish between Ok and Err

* Revert paritytech#1660

* Fixes + simplifications

* Implement review suggestions
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 8, 2024
* remove dispatch_result field

* fix benchmarks
serban300 added a commit to serban300/polkadot-sdk that referenced this pull request Apr 8, 2024
* Use an actual Result inside MessageDispatchResult

We need this in order to distinguish between Ok and Err

* Revert paritytech#1660

* Fixes + simplifications

* Implement review suggestions
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 9, 2024
* remove dispatch_result field

* fix benchmarks
serban300 added a commit to serban300/polkadot-sdk that referenced this pull request Apr 9, 2024
* Use an actual Result inside MessageDispatchResult

We need this in order to distinguish between Ok and Err

* Revert paritytech#1660

* Fixes + simplifications

* Implement review suggestions
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 9, 2024
* remove dispatch_result field

* fix benchmarks
serban300 added a commit to serban300/polkadot-sdk that referenced this pull request Apr 9, 2024
* Use an actual Result inside MessageDispatchResult

We need this in order to distinguish between Ok and Err

* Revert paritytech#1660

* Fixes + simplifications

* Implement review suggestions
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 9, 2024
* remove dispatch_result field

* fix benchmarks
serban300 added a commit to serban300/polkadot-sdk that referenced this pull request Apr 9, 2024
* Use an actual Result inside MessageDispatchResult

We need this in order to distinguish between Ok and Err

* Revert paritytech#1660

* Fixes + simplifications

* Implement review suggestions
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 9, 2024
* remove dispatch_result field

* fix benchmarks
serban300 added a commit to serban300/polkadot-sdk that referenced this pull request Apr 9, 2024
* Use an actual Result inside MessageDispatchResult

We need this in order to distinguish between Ok and Err

* Revert paritytech#1660

* Fixes + simplifications

* Implement review suggestions
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 9, 2024
* remove dispatch_result field

* fix benchmarks
serban300 added a commit to serban300/polkadot-sdk that referenced this pull request Apr 9, 2024
* Use an actual Result inside MessageDispatchResult

We need this in order to distinguish between Ok and Err

* Revert paritytech#1660

* Fixes + simplifications

* Implement review suggestions
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 9, 2024
* remove dispatch_result field

* fix benchmarks
serban300 added a commit to serban300/polkadot-sdk that referenced this pull request Apr 9, 2024
* Use an actual Result inside MessageDispatchResult

We need this in order to distinguish between Ok and Err

* Revert paritytech#1660

* Fixes + simplifications

* Implement review suggestions
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 10, 2024
* remove dispatch_result field

* fix benchmarks
serban300 added a commit to serban300/polkadot-sdk 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 paritytech#1660

* Fixes + simplifications

* Implement review suggestions
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 10, 2024
* remove dispatch_result field

* fix benchmarks
serban300 added a commit to serban300/polkadot-sdk 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 paritytech#1660

* Fixes + simplifications

* Implement review suggestions
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