-
Notifications
You must be signed in to change notification settings - Fork 18
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
base: main
Are you sure you want to change the base?
Commits on Jul 23, 2024
-
Configuration menu - View commit details
-
Copy full SHA for ac64e47 - Browse repository at this point
Copy the full SHA ac64e47View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8f9b426 - Browse repository at this point
Copy the full SHA 8f9b426View commit details -
updates to design docs to use a capacity rewards interface
Prototypes, make check working
Configuration menu - View commit details
-
Copy full SHA for 042c7c7 - Browse repository at this point
Copy the full SHA 042c7c7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 82ea1b8 - Browse repository at this point
Copy the full SHA 82ea1b8View commit details -
remove economic model design doc until further notice
refinements to design doc
Configuration menu - View commit details
-
Copy full SHA for 0dbcb90 - Browse repository at this point
Copy the full SHA 0dbcb90View commit details -
Implement Staking Reward Eras basics (#1589)
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
Configuration menu - View commit details
-
Copy full SHA for 076c6ff - Browse repository at this point
Copy the full SHA 076c6ffView commit details -
Feat/staking rewards rewards provider #1572 (#1598)
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
Configuration menu - View commit details
-
Copy full SHA for e871a27 - Browse repository at this point
Copy the full SHA e871a27View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7cfc638 - Browse repository at this point
Copy the full SHA 7cfc638View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4e6465b - Browse repository at this point
Copy the full SHA 4e6465bView commit details -
* Refactor staking type to go in StakingTargetDetails
* Make some functions pass by reference (performance) * fix broken tests & calls
Configuration menu - View commit details
-
Copy full SHA for 928dc4c - Browse repository at this point
Copy the full SHA 928dc4cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 71b51d8 - Browse repository at this point
Copy the full SHA 71b51d8View commit details -
* Check from/to aren't the same when retargeting
* 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
Configuration menu - View commit details
-
Copy full SHA for e6c22e8 - Browse repository at this point
Copy the full SHA e6c22e8View commit details -
Feat/reward pool history (#1710)
The goal of this PR is to implement storage of reward pool history. Closes #1710
Configuration menu - View commit details
-
Copy full SHA for 699471d - Browse repository at this point
Copy the full SHA 699471dView commit details -
Feat/split stake extrinsic #1699 (#1717)
The goal of this PR is to split the `stake` extrinsic into two: `stake` and `provider_boost` Closes #1707
Configuration menu - View commit details
-
Copy full SHA for 4a29295 - Browse repository at this point
Copy the full SHA 4a29295View commit details -
Feat/split storage #1726 (#1744)
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
Configuration menu - View commit details
-
Copy full SHA for ef48e8e - Browse repository at this point
Copy the full SHA ef48e8eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 318c4ce - Browse repository at this point
Copy the full SHA 318c4ceView commit details -
Configuration menu - View commit details
-
Copy full SHA for 169e0a4 - Browse repository at this point
Copy the full SHA 169e0a4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1414262 - Browse repository at this point
Copy the full SHA 1414262View commit details -
Set ProviderBoost capacity generated and fix tests (#1947)
* 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
Configuration menu - View commit details
-
Copy full SHA for cd0e239 - Browse repository at this point
Copy the full SHA cd0e239View commit details -
Update reward pool on
provider_boost
orunstake
#1699 (#1948)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
Configuration menu - View commit details
-
Copy full SHA for 85d1d90 - Browse repository at this point
Copy the full SHA 85d1d90View commit details -
Implement rewards calculation formula #1941 (#1956)
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
Configuration menu - View commit details
-
Copy full SHA for b2360de - Browse repository at this point
Copy the full SHA b2360deView commit details -
Configuration menu - View commit details
-
Copy full SHA for fb7c153 - Browse repository at this point
Copy the full SHA fb7c153View commit details -
upsert staking history #1699 (#1963)
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
Configuration menu - View commit details
-
Copy full SHA for 5354673 - Browse repository at this point
Copy the full SHA 5354673View commit details -
Chores/update capacity benchmarks #1949 (#1966)
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
Configuration menu - View commit details
-
Copy full SHA for b94bd78 - Browse repository at this point
Copy the full SHA b94bd78View commit details -
Configuration menu - View commit details
-
Copy full SHA for 863e26a - Browse repository at this point
Copy the full SHA 863e26aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 69f5198 - Browse repository at this point
Copy the full SHA 69f5198View commit details -
Configuration menu - View commit details
-
Copy full SHA for 869cb1a - Browse repository at this point
Copy the full SHA 869cb1aView commit details -
Feat/reward pool refactor #1976 (#2005)
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]>
Configuration menu - View commit details
-
Copy full SHA for b9466a8 - Browse repository at this point
Copy the full SHA b9466a8View commit details -
Revise Provider Boost implementation design doc #2016 (#2020)
# 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]>
Configuration menu - View commit details
-
Copy full SHA for 078d412 - Browse repository at this point
Copy the full SHA 078d412View commit details -
E2e for new extrinsics (#2067)
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.
Configuration menu - View commit details
-
Copy full SHA for 07599e9 - Browse repository at this point
Copy the full SHA 07599e9View commit details -
# 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
Configuration menu - View commit details
-
Copy full SHA for 0b35226 - Browse repository at this point
Copy the full SHA 0b35226View commit details -
claim_staking_rewards
extrinsic (#2080)The goal of this PR is to implement the claim_staking_rewards extrinsic, its benchmarks, and tests. Closes #1970
Configuration menu - View commit details
-
Copy full SHA for 6ed6217 - Browse repository at this point
Copy the full SHA 6ed6217View commit details -
Configuration menu - View commit details
-
Copy full SHA for f70d1aa - Browse repository at this point
Copy the full SHA f70d1aaView commit details -
Capacity runtime api with list_unclaimed_rewards endpoint (#2088)
# Goal The goal of this PR is to implement a capacity runtime api for the `list_unclaimed_rewards` endpoint. Following the current recommendation of Parity, there is no custom RPC matching this runtime API endpoint; instead, use state.call to access the endpoint. For examples using either Observable or APIPromise, see the e2e tests. Closes #1698
Configuration menu - View commit details
-
Copy full SHA for 6a2a150 - Browse repository at this point
Copy the full SHA 6a2a150View commit details -
Configuration menu - View commit details
-
Copy full SHA for 233496b - Browse repository at this point
Copy the full SHA 233496bView commit details -
Configuration menu - View commit details
-
Copy full SHA for fe94fcf - Browse repository at this point
Copy the full SHA fe94fcfView commit details -
Configuration menu - View commit details
-
Copy full SHA for ae0236b - Browse repository at this point
Copy the full SHA ae0236bView commit details -
Configuration menu - View commit details
-
Copy full SHA for ffb5a7f - Browse repository at this point
Copy the full SHA ffb5a7fView commit details -
Remove TODO since it's already been addressed.
Add a minor test case to unstaking tests Add new extrinsics to Capacity README
Configuration menu - View commit details
-
Copy full SHA for 78ee1ca - Browse repository at this point
Copy the full SHA 78ee1caView commit details
Commits on Jul 30, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 8e26370 - Browse repository at this point
Copy the full SHA 8e26370View commit details -
Configuration menu - View commit details
-
Copy full SHA for 276fbf1 - Browse repository at this point
Copy the full SHA 276fbf1View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4cf9e2f - Browse repository at this point
Copy the full SHA 4cf9e2fView commit details -
Configuration menu - View commit details
-
Copy full SHA for c842471 - Browse repository at this point
Copy the full SHA c842471View commit details -
Configuration menu - View commit details
-
Copy full SHA for bc111d7 - Browse repository at this point
Copy the full SHA bc111d7View commit details -
Merge remote-tracking branch 'origin/main' into feat/capacity-staking…
…-rewards-impl # Conflicts: # runtime/frequency/src/lib.rs
Configuration menu - View commit details
-
Copy full SHA for 2d8cc0f - Browse repository at this point
Copy the full SHA 2d8cc0fView commit details
Commits on Jul 31, 2024
-
Merge remote-tracking branch 'origin/main' into feat/capacity-staking…
…-rewards-impl # Conflicts: # runtime/frequency/src/lib.rs
Configuration menu - View commit details
-
Copy full SHA for b7bed08 - Browse repository at this point
Copy the full SHA b7bed08View commit details
Commits on Aug 2, 2024
-
Merge remote-tracking branch 'origin/main' into feat/capacity-staking…
…-rewards-impl # Conflicts: # e2e/package-lock.json # pallets/capacity/src/weights.rs # runtime/frequency/src/lib.rs
Configuration menu - View commit details
-
Copy full SHA for 5ee47ab - Browse repository at this point
Copy the full SHA 5ee47abView commit details -
Configuration menu - View commit details
-
Copy full SHA for c68a698 - Browse repository at this point
Copy the full SHA c68a698View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5b7b213 - Browse repository at this point
Copy the full SHA 5b7b213View commit details -
Configuration menu - View commit details
-
Copy full SHA for 29e68c4 - Browse repository at this point
Copy the full SHA 29e68c4View commit details -
Bug fix capacity e2e test (#2110)
# Goal The goal of this PR is to fix a flaky e2e test for `capacityRuntimeApi.listUnclaimedRewards` # Discussion - Remove redundant definitions in api-augment for Capacity - Updated the test to not be dependent on starting just before an era
Configuration menu - View commit details
-
Copy full SHA for b45c8c2 - Browse repository at this point
Copy the full SHA b45c8c2View commit details
Commits on Aug 5, 2024
-
Update e2e/capacity/change_staking_target.test.ts
Co-authored-by: Puneet Saraswat <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 35dc097 - Browse repository at this point
Copy the full SHA 35dc097View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9ec30fb - Browse repository at this point
Copy the full SHA 9ec30fbView commit details -
Configuration menu - View commit details
-
Copy full SHA for 40f3910 - Browse repository at this point
Copy the full SHA 40f3910View commit details -
Boosting: removed added getters (#2112)
# Goal The goal of this PR is to removed added getters Related to #2105
Configuration menu - View commit details
-
Copy full SHA for 65df923 - Browse repository at this point
Copy the full SHA 65df923View commit details -
Merge remote-tracking branch 'origin/main' into feat/capacity-staking…
…-rewards-impl # Conflicts: # designdocs/provider_boosting_implementation.md # pallets/capacity/src/lib.rs # pallets/capacity/src/tests/stake_and_deposit_tests.rs # pallets/capacity/src/tests/unstaking_tests.rs # pallets/capacity/src/tests/withdraw_unstaked_tests.rs
Configuration menu - View commit details
-
Copy full SHA for 556fe38 - Browse repository at this point
Copy the full SHA 556fe38View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2223e4a - Browse repository at this point
Copy the full SHA 2223e4aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 6d94da0 - Browse repository at this point
Copy the full SHA 6d94da0View commit details -
Passkey check only balance not nonce and don't pre-fund it Working consistently
Configuration menu - View commit details
-
Copy full SHA for 14271c8 - Browse repository at this point
Copy the full SHA 14271c8View commit details
Commits on Aug 6, 2024
-
# Goal The goal of this PR is to address some feedbacks - added feature flags for test only methods - added a constant - small refactor
Configuration menu - View commit details
-
Copy full SHA for eb68e65 - Browse repository at this point
Copy the full SHA eb68e65View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3480405 - Browse repository at this point
Copy the full SHA 3480405View commit details -
Make RewardEras zero-indexed (#2115)
# Goal Reward eras were 1-indexed but this made things too confusing.
Configuration menu - View commit details
-
Copy full SHA for 56df16d - Browse repository at this point
Copy the full SHA 56df16dView commit details -
Configuration menu - View commit details
-
Copy full SHA for c2bef19 - Browse repository at this point
Copy the full SHA c2bef19View commit details -
* New alias for ChunkIndex = u32
* 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
Configuration menu - View commit details
-
Copy full SHA for abe5066 - Browse repository at this point
Copy the full SHA abe5066View commit details
Commits on Aug 26, 2024
-
[Capacity] MinimumStakingAmount is not enforced if a stake already ex…
…ists for a different provider (#2136) ## Summary A user can stake to multiple providers, but the minimum staking amount is enforced only for the first staking action that the user submits. ## Issue details 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. ## Risk 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. ## Mitigation 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 # Discussion - `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. # Checklist - [ ] 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 <[email protected]> Co-authored-by: Shannon Wells <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for e3ae518 - Browse repository at this point
Copy the full SHA e3ae518View commit details