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

claim staking rewards 1747 | will be split up into multiple PRs #2065

Conversation

shannonwells
Copy link
Collaborator

Goal

The goal of this PR is to implement runtime api for capacity with list_unclamed_rewards function, and to add end to end tests for new extrinsics.

Relates to #1747
Relates to #1972

Discussion

Checklist

  • Chain spec updated
  • Custom RPC OR Runtime API added/changed? Updated js/api-augment.
  • Tests added

shannonwells and others added 29 commits June 25, 2024 13:31
updates to impl design doc
Implement the basic functionality of tracking and rotating Reward Era. Closes #1567
Does not include anything to do with the Reward Pool.

- [x] Chain spec updated
- [x] Design doc(s) updated
- [x] Tests added
The goal of this PR is to implement a really basic version of the
StakingRewardsProvider in the Capacity pallet and in the test mock,
neither of which is actively used.

Closes #1572

Does not include anything to do with setting and storing RewardPoolInfo
when each new Era starts.

- [x] Design doc(s) updated
- [x] Tests added
* Make some functions pass by reference (performance)
* fix broken tests & calls
* Performance: move non-db checks to top when retargeting
* Lots more tests
* Fix a bug where we weren't setting the staking type on a retarget
* Remove staking type from StakingAccountDetails
* Fix broken tests from last commit
The goal of this PR is to implement storage of reward pool history.

Closes #1710
The goal of this PR is to split the `stake` extrinsic into two: `stake` and `provider_boost`
Closes #1707
The goal of this PR is to split up storage of boosting and maximized staking accounts,
as well as store retarget history separately, which can store retargeting events for
any type of staking.

Closes #1726

* Lots of rattle, causing several helper functions to be split up -
rather than having a bunch of conditionals due to type differences.
* In the interest of limiting the size of this PR/merge into the branch
I left a lot of TODOs for when reward pool updates on a
stake/boost/unstake is resumed
* set the amount of capacity generated by a provider boost to the final amount, 50% of what is generated by MaximizedCapacity staking.
* Also Fixes some tests broken from the last rebase with main.
Closes #1569
The goal of this PR is to update the StakingRewardPool on a `provider_boost` or `unstake` extrinsic call.

Closes #1699

Also includes a bunch of lint changes

- [x] Design doc(s) updated
- [x] Tests added
- [x] Benchmarks corrected and updated
- [x] Weights updated
The goal of this PR is to implement (but not really use yet) the chosen
formula for calculation of a reward in a single Provider Boost Reward
Era.

Closes #1941
The goal of this PR is to add and use storage for individual staking history so that rewards can be calculated and paid out.  Benchmarks run to update capacity weights.

Relates to #1699
The goal of this PR is to update the benchmark for `on_initialize` to include the weight when a new RewardEra must be created.

Closes #1949
The goal of this PR is to implement `list_unclaimed_rewards`, and also
one that is lighter weight, `has_unclaimed_rewards`, which returns a
`bool` and which `unstake` extrinsic uses. Unstake now fails if there
are any unclaimed rewards.

Closes #1969
Closes #1578
The goal of this PR is to implement a "chunk" version of the overall
reward pool history to reduce read/write load and hence weight for
transactions and `on_initialize` when a new `RewardEra` needs to start.

Part of #1976

Co-authored-by: Wil Wade <[email protected]>
# Goal
The goal of this PR is to review and update the implementation design doc in light of the chosen economic model, and to reflect some changes in behavior.  Review of the design doc also fed back into the code itself. Some code
is no longer needed.

Closes #2016 
---------

Co-authored-by: Aramik <[email protected]>
@shannonwells shannonwells changed the base branch from main to feat/capacity-staking-rewards-impl July 10, 2024 18:02
@shannonwells shannonwells mentioned this pull request Jul 10, 2024
1 task
@shannonwells shannonwells changed the title Feat/claim staking rewards 1747 claim staking rewards 1747 | will be split up into multiple PRs Jul 11, 2024
# Goal
The goal of this PR is to add some e2e tests for the `provider_boost` extrinsic, and update the `change_staking_target` extrinsic after a rebase with main.
# Goal
The goal of this PR is primarily to pull RewardEra out of the Capacity Config and make it the same type everywhere.

Other changes in this PR that were incidental to this refactor
* I renamed staking_events in testing_utils, because it captures all the events from the pallet.
* I pulled out RewardEraLength into constants so it could be different for different environments.

Related to #1970
* Fixes for removing RewardEra from Config (including ctor for RetargetInfo struct)
* Set up different values for EraLength in Test and on testnet
* Linting changes
* Working list_unclaimed_rewards runtime_api call
@shannonwells shannonwells force-pushed the feat/claim_staking_rewards-1747 branch from 20914f7 to 137daeb Compare July 12, 2024 23:41
@shannonwells shannonwells force-pushed the feat/capacity-staking-rewards-impl branch from ad63363 to ec2b7ac Compare July 18, 2024 23:06
@shannonwells
Copy link
Collaborator Author

Finished splitting this up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant