-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[Staking] Move reward minting to DAP; payouts from drip-funded era pots #11616
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
Merged
Merged
Changes from all commits
Commits
Show all changes
98 commits
Select commit
Hold shift + click to select a range
fe413cf
Era REward Manager
Ank4n ef58054
default impl staker reward calculator
Ank4n de58f7e
new pallet apis
Ank4n ec33c18
impls
Ank4n 986390f
session rotation
Ank4n 9c8e724
remove default impl for account id provider
Ank4n bf84f15
staking test compile
Ank4n d8ff407
integration test compiles
Ank4n 87891e4
fmt
Ank4n eee0f27
fix tests minimal change
Ank4n 2f74354
update EraPaid rustdoc
Ank4n 6059429
fix all test
Ank4n 1f76881
reward remainder can be removed
Ank4n ec5bdad
really remove RewardRemainder
Ank4n ea5bd79
Merge branch 'master' into ankn-staker-reward-from-pot
Ank4n ebe54cd
max commission tests
Ank4n c6e7a45
integrate runtime
Ank4n 0ce1167
fmt
Ank4n 2bf54f1
prdoc
Ank4n 1bca7fc
zepter
Ank4n 83a890e
taplo
Ank4n e839931
todo for dap bench
Ank4n d44646a
Update from github-actions[bot] running command 'bench --pallet palle…
github-actions[bot] 7028a80
add missing bench for max commission
Ank4n 04c002b
Merge branch 'master' into ankn-staker-reward-from-pot
Ank4n 869a3b2
fix test-delegate-stake compile
Ank4n 3283c72
dev weight for staking async
Ank4n 4912afb
fix drip issuance bench
Ank4n 5e17025
weights
Ank4n 0a4040e
taplo
Ank4n dda4321
add dap bench to WAH
Ank4n 07b2840
fix weight run with frame template
Ank4n 1aa31ea
Update from github-actions[bot] running command 'bench --pallet palle…
github-actions[bot] 8706c6c
ensure pot is created
Ank4n a811db6
disable legacy minting
Ank4n c939bc2
Merge branch 'master' into ankn-staker-reward-from-pot
Ank4n e77d44e
failing test
Ank4n cb16275
the fix
Ank4n e733237
remove staked rewards
Ank4n d6e23b8
feedback
Ank4n aa13771
fmt
Ank4n 82aa08e
Merge branch 'master' into ankn-staker-reward-from-pot
Ank4n ff0de15
fix benchmarking compilation after removal of max_staked_rewards
sigurpol 4dfa78c
Update from github-actions[bot] running command 'bench --pallet palle…
github-actions[bot] e83c03b
Merge branch 'master' into ankn-staker-reward-from-pot
Ank4n fd11b55
dap in kitchensink
Ank4n f0ca2a0
Update from github-actions[bot] running command 'bench --pallet palle…
github-actions[bot] 6ed99ab
Merge branch 'master' into ankn-staker-reward-from-pot
Ank4n 2456443
kusama compat
Ank4n d22f812
bench fix
Ank4n 6ab8071
Merge branch 'master' into ankn-staker-reward-from-pot
Ank4n 2b04c3a
fmt
Ank4n 6f7b2b9
license file
Ank4n 48e67bf
disable mint integrity test
Ank4n 9bd2cb9
disable minting try state check
Ank4n a850691
minimise diff
Ank4n 7b42139
fix nominator reward part
Ank4n 1aa1d07
esnure nominator underpay is detected
Ank4n a123a1e
cosmetic
Ank4n e5e7120
update prdoc
Ank4n 9c20c9a
Merge branch 'master' into ankn-staker-reward-from-pot
Ank4n 864f440
guard against destroy if pot was never created
Ank4n 39caae0
rename ValidatorMissingPayee to just MissingPayee
Ank4n 6ededb6
add stash to missing payee
Ank4n 2552fb6
fmt
Ank4n 4007ee1
ensure if guard set, disable minting in config is always set
Ank4n 520eddf
e2e tests
Ank4n c01c326
improve legacy -> dap mode test
Ank4n 8b14681
fmt
Ank4n 8f43b97
mock setup to switch impls
Ank4n 14980ee
fmt
Ank4n 45afe25
Merge branch 'master' into ankn-staker-reward-from-pot
Ank4n 29c8ee5
papi e2e test
Ank4n 0bfd62c
more assertions
Ank4n b71f5b3
hard assertion
Ank4n fd3cfe7
assert for era 0
Ank4n 87f6e3f
assert on all events
Ank4n da0fb80
check all era events
Ank4n f85c6dc
assert on all events
Ank4n 5be95b0
rename to IssuanceCurve
Ank4n f953b6d
fix comments
Ank4n 0686742
fmt
Ank4n 229300f
remove misleading hard-pressure curve comment
Ank4n 032b4f2
Merge branch 'master' into ankn-staker-reward-from-pot
Ank4n e9bac74
pr feedbacks
Ank4n 3b1ca1d
fmt
Ank4n eba58d9
debug assert exact
Ank4n 407adc5
Merge branch 'master' into ankn-staker-reward-from-pot
Ank4n a24b233
combine enum for general and era pots
Ank4n b98a8a5
fix compile
Ank4n 27941b4
fmt
Ank4n 7c0fd96
update rustdoc for force apply commission
Ank4n dcf973b
emit missing payee in legacy path
Ank4n 7715bb3
update ErasValidatorReward rustdoc
Ank4n 769339d
fix test delegate stake mock
Ank4n 7975c74
fix rustdoc
Ank4n a3a6045
dap mode in integration test
Ank4n 282a851
fmt
Ank4n File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_dap.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| // Copyright (C) Parity Technologies (UK) Ltd. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| //! Autogenerated weights for `pallet_dap` | ||
| //! | ||
| //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 | ||
| //! DATE: 2026-04-03, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` | ||
| //! WORST CASE MAP SIZE: `1000000` | ||
| //! HOSTNAME: `5851f50484f3`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` | ||
| //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 | ||
|
|
||
| // Executed Command: | ||
| // frame-omni-bencher | ||
| // v1 | ||
| // benchmark | ||
| // pallet | ||
| // --extrinsic=* | ||
| // --runtime=target/production/wbuild/asset-hub-westend-runtime/asset_hub_westend_runtime.wasm | ||
| // --pallet=pallet_dap | ||
| // --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt | ||
| // --output=./cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights | ||
| // --wasm-execution=compiled | ||
| // --steps=50 | ||
| // --repeat=20 | ||
| // --heap-pages=4096 | ||
| // --no-storage-info | ||
| // --no-min-squares | ||
| // --no-median-slopes | ||
|
|
||
| #![cfg_attr(rustfmt, rustfmt_skip)] | ||
| #![allow(unused_parens)] | ||
| #![allow(unused_imports)] | ||
| #![allow(missing_docs)] | ||
|
|
||
| use frame_support::{traits::Get, weights::Weight}; | ||
| use core::marker::PhantomData; | ||
|
|
||
| /// Weight functions for `pallet_dap`. | ||
| pub struct WeightInfo<T>(PhantomData<T>); | ||
| impl<T: frame_system::Config> pallet_dap::WeightInfo for WeightInfo<T> { | ||
| /// Storage: `Dap::BudgetAllocation` (r:0 w:1) | ||
| /// Proof: `Dap::BudgetAllocation` (`max_values`: Some(1), `max_size`: Some(593), added: 1088, mode: `MaxEncodedLen`) | ||
| fn set_budget_allocation() -> Weight { | ||
| // Proof Size summary in bytes: | ||
| // Measured: `0` | ||
| // Estimated: `0` | ||
| // Minimum execution time: 7_979_000 picoseconds. | ||
| Weight::from_parts(8_699_000, 0) | ||
| .saturating_add(Weight::from_parts(0, 0)) | ||
| .saturating_add(T::DbWeight::get().writes(1)) | ||
| } | ||
| /// Storage: `Timestamp::Now` (r:1 w:0) | ||
| /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) | ||
| /// Storage: `Dap::LastIssuanceTimestamp` (r:1 w:1) | ||
| /// Proof: `Dap::LastIssuanceTimestamp` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) | ||
| /// Storage: `Dap::BudgetAllocation` (r:1 w:0) | ||
| /// Proof: `Dap::BudgetAllocation` (`max_values`: Some(1), `max_size`: Some(593), added: 1088, mode: `MaxEncodedLen`) | ||
| /// Storage: `System::Account` (r:2 w:2) | ||
| /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) | ||
| fn drip_issuance() -> Weight { | ||
| // Proof Size summary in bytes: | ||
| // Measured: `2541` | ||
| // Estimated: `6196` | ||
| // Minimum execution time: 62_672_000 picoseconds. | ||
| Weight::from_parts(65_724_000, 0) | ||
| .saturating_add(Weight::from_parts(0, 6196)) | ||
| .saturating_add(T::DbWeight::get().reads(5)) | ||
| .saturating_add(T::DbWeight::get().writes(3)) | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's still a bit unclear how we are going to handle treasury (are we going to drain that account minus the expected budget for next period or what?) - but if this is meant to be an almost no-op replacement of current logic by end of May waiting for a followup referendum to set budget for stakers / incentive / buffer, then this is a breaking change. I am fine with that, and doesn't need to be solved here maybe. But a more "no-op" solution would be to already create a budget component for treasury and do 85% stakers - 15% treasury - 0% DAP as 1st step until the referendum.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also it's a bit unclear to me what we want to do for Kusama. For our mental sanity, it would be nicer to have just one code to maintain and so have also for Kusama configure DAP to mint and assign a budget etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, true this is not completely no-op. Its no-op for stakers. But treasury funds stop. I think this is fine as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Damn, I have ignored Kusama too long.
Okay, kusama's inflation still depends on
total_staked, whichIssuanceCurve(the new trait replacingEraPayout) doesn't know about.One option: make IssuanceCurve return two balances -- the first goes through DAP budget distribution, the second goes directly to treasury (DAP passes it through but can't override it).
For Polkadot: second part is 0, treasury gets its share via DAP budget allocation.
For Kusama: second part is the treasury portion, and DAP budget only handles the staker portion.
It's a bit messy but keeps backward compatibility. Wdyt? Any better ideas?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a good solution in mind yet for Kusama 😢
Maybe, together with dual path at payout time, this PR could introduce a dual path (DAP-runtimes vs Kusama) for
end_eratoo. So in "DAP mode", we snapshot the general pot -> we fund era_pot etc like you are doing now. For "legacy" mode, we fallback to old EraPayout + Reward reminder.This maybe buy us a bit of time until we model Treasury budget component explicitly and maybe by then (and not now) we can make DAP work with it both for Polkadot (static) and for Kusama (dynamic - don't know how the dynamic part would be, something where Staking updates the budget allocation at each era boundary based on the staking ratio or so, but doesn't sound trivial at all).
Not sure if we want to tackle in a separate PR with the scope of being "Kusama" friendly -or in this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for treasury vs Polkadot, I am fine too but maybe needs some extra communication towards community (out of scope of this PR ofc) and we would need a budget component for treasury eventually
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Preserved the legacy mode.
So if EraPayout is set in pallet-staking-async (and DisableMinting set to false) then it should work as before with Staking managing inflation. Otherwise, the DAP flow. I have put integrity tests and try state checks to ensure its not easy to configure this wrongly. But please double check this. Bit messy to support both, but I guess this is the best path forward.