-
Notifications
You must be signed in to change notification settings - Fork 19
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
Provider Boosting implementation #1694
Merged
Merged
Conversation
This file contains 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
Codecov ReportAttention: Patch coverage is
|
shannonwells
changed the title
Feat/capacity staking rewards impl
Provider Boosting implementation
Oct 4, 2023
github-actions
bot
added
metadata-changed
Metadata has changed since the latest full release
metadata-version-not-incremented
Metadata has changed since the latest full release, but the version has not been incremented
and removed
metadata-changed
Metadata has changed since the latest full release
metadata-version-not-incremented
Metadata has changed since the latest full release, but the version has not been incremented
labels
Oct 5, 2023
shannonwells
force-pushed
the
feat/capacity-staking-rewards-impl
branch
from
October 11, 2023 22:08
09ede24
to
164a197
Compare
github-actions
bot
removed
metadata-changed
Metadata has changed since the latest full release
metadata-version-not-incremented
Metadata has changed since the latest full release, but the version has not been incremented
labels
Oct 11, 2023
shannonwells
force-pushed
the
feat/capacity-staking-rewards-impl
branch
2 times, most recently
from
October 20, 2023 19:11
82610e5
to
ea9ccda
Compare
github-actions
bot
added
metadata-changed
Metadata has changed since the latest full release
metadata-version-not-incremented
Metadata has changed since the latest full release, but the version has not been incremented
labels
Oct 20, 2023
shannonwells
force-pushed
the
feat/capacity-staking-rewards-impl
branch
from
November 7, 2023 22:47
b80b627
to
977ad65
Compare
github-actions
bot
removed
metadata-changed
Metadata has changed since the latest full release
metadata-version-not-incremented
Metadata has changed since the latest full release, but the version has not been incremented
labels
Nov 7, 2023
shannonwells
force-pushed
the
feat/capacity-staking-rewards-impl
branch
from
December 21, 2023 01:31
977ad65
to
63f6651
Compare
shannonwells
force-pushed
the
feat/capacity-staking-rewards-impl
branch
3 times, most recently
from
April 22, 2024 18:02
0bf5c06
to
defdb39
Compare
github-actions
bot
added
the
metadata-changed
Metadata has changed since the latest full release
label
Apr 25, 2024
shannonwells
force-pushed
the
feat/capacity-staking-rewards-impl
branch
from
May 6, 2024 21:07
a159bb8
to
aaeec80
Compare
github-actions
bot
added
metadata-changed
Metadata has changed since the latest full release
metadata-version-not-incremented
Metadata has changed since the latest full release, but the version has not been incremented
and removed
metadata-changed
Metadata has changed since the latest full release
metadata-version-not-incremented
Metadata has changed since the latest full release, but the version has not been incremented
labels
May 6, 2024
The goal of this PR is to removed added getters Related to #2105
# Goal The goal of this PR is to address some feedbacks - added feature flags for test only methods - added a constant - small refactor
Reward eras were 1-indexed but this made things too confusing.
* Use unwrap_or_default for getting a reward pool chunk * warning for inserting a new chunk failure * code golf * linting in e2e * remove unnecessary change in helpers
…ists for a different provider (#2136) A user can stake to multiple providers, but the minimum staking amount is enforced only for the first staking action that the user submits. During the staking process, both for the `stake` and `provider_boost` extrinsics, a minimum staking amount should be enforced by the `Runtime::MinimumStakingAmount` parameter. The current implementation of [ensure_can_stake](https://github.com/frequency-chain/frequency/blob/9ef58185f2230aaf92dc166fb8eade56a78e4cf3/pallets/capacity/src/lib.rs#L638) verifies if the amount that the account is staking in total (the current active staking and the new staking amount) is greater than the `MinimumStakingAmount`: ```rust let new_active_staking_amount = staking_details .active .checked_add(&stakable_amount) .ok_or(ArithmeticError::Overflow)?; ensure!( new_active_staking_amount >= T::MinimumStakingAmount::get(), Error::<T>::StakingAmountBelowMinimum ); ``` This implies that the user has to stake the `MinimumStakingAmount` only when they first submit a stake for a provider, all the subsequent staking requests being accepted even with the amount of 1. The current implementation does not follow the intended use-case, as described in the design documentation. An attacker could stake the minimum required amount to a provider, and then stake 1 token to each of the other available providers, underpaying for the storage that they use. This can cause a storage bloating, slowing down the network in the long run. The `ensure_can_stake` function should verify that the `stakable_amount` is greater than `MinimumStakingAmount`, instead of verifying the `new_active_staking_amount`. Closes #2135 - `ensure_can_stake` updated to remove the addition of the existing stakes and check `stakable_amount` - `get_stakable_amount_for` updated to use `reducible_balance` as recommended by parity when using the `fungible` trait. `reducible_balance` requires an Existential Deposit, so the unit test values were updated. - `/designdocs/capacity.md` updated to the latest code, and reflects changes in language due to replacing `lock`s with `freeze`s. - CI Checks are not running on this branch, but the unit tests and e2e tests passed in local. - [ ] Updated Pallet Readme? - [ ] Updated js/api-augment for Custom RPC OR Runtime API? - [x] Design doc(s) updated? - [ ] Unit Tests added? - [ ] e2e Tests added? - [ ] Benchmarks added? - [x] Spec version incremented? --------- Co-authored-by: Wil Wade <wil.wade@amplica.io> Co-authored-by: Shannon Wells <shannonwells@users.noreply.github.com>
fix capacity import in api-augment remove unused constant use ProviderBoostHistoryLimit value set in parameter_types bump spec_version
JoeCap08055
approved these changes
Oct 30, 2024
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.
- reviewed changes since previous review
- built branch, ran unit & e2e tests
shannonwells
force-pushed
the
feat/capacity-staking-rewards-impl
branch
from
October 30, 2024 21:14
9a57c37
to
3358e70
Compare
github-actions
bot
removed
the
metadata-changed
Metadata has changed since the latest full release
label
Oct 30, 2024
remove console debug
github-actions
bot
added
the
metadata-changed
Metadata has changed since the latest full release
label
Oct 30, 2024
wilwade
reviewed
Oct 31, 2024
wilwade
reviewed
Oct 31, 2024
wilwade
reviewed
Oct 31, 2024
wilwade
reviewed
Oct 31, 2024
Co-authored-by: Wil Wade <wil.wade@projectliberty.io>
github-actions
bot
removed
the
metadata-changed
Metadata has changed since the latest full release
label
Oct 31, 2024
Co-authored-by: Wil Wade <wil.wade@projectliberty.io>
github-actions
bot
added
the
metadata-changed
Metadata has changed since the latest full release
label
Oct 31, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
Goal
Implement a Provider Boost feature, whereby token holders may support the network and a specific Provider by means of a custom staking model. Token holders lock up a certain amount of token, and receive a return in Frequency token for this support. The token holder chooses a Provider to receive some Capacity, which the Provider may use to pay for chain transactions.
Token holders may still stake for
MaximizedCapacity
and receive no token return. As before, the entire benefit for staking would go to the targeted Provider for this type.Discussion
Support the new staking type, Provider Boost
stake
transaction now specifies the Staking Type ofMaximizedCapacity
which is stored withStakingTargetDetails
.provider_boost
which specifies ProviderBoost staking type.claim_staking_rewards
which mints and transfers all eligible rewards in token to the staker.change_staking_target
which basically swaps your Provider Boost staking target from one Provider to another.StakingType
determines how much Capacity is generated for the targeted provider. ForProviderBoost
type, 50% of the Capacity forMaximizedCapacity
is generated when usingprovider_boost
.StakingType
also determines if there is a periodic return in token to the staker. ForProviderBoost
type, there is a periodic return. ForMaximizedCapacity
type, there isn't.Issue rewards to Provider Boost accounts
RewardEras
that the token holder has staked.RewardEra
is approximately two weeks of blocks.claim_staking_rewards
extrinsic succeeds.Allow a staking 'retarget'
A staker may change some or all of their staked token to target a different provider up to 16 times in a
RewardEra
without penalty. Otherwise, they must wait until the nextRewardEra
.For more details, please see the Capacity Staking Rewards Implementation design doc, which links to the economic model for this feature.
Checklist