This repository was archived by the owner on Nov 15, 2023. It is now read-only.
staking: Flexible generation of reward curve and associated tweaks#8327
Merged
26 commits merged intomasterfrom Mar 16, 2021
Merged
staking: Flexible generation of reward curve and associated tweaks#832726 commits merged intomasterfrom
26 commits merged intomasterfrom
Conversation
Member
Author
|
cc @kianenigma |
kianenigma
reviewed
Mar 15, 2021
Comment on lines
+101
to
+105
| /// Just the `Currency::Balance` type; we have this item to allow us to constrain it to | ||
| /// `From<u64>`. | ||
| type CurrencyBalance: | ||
| sp_runtime::traits::AtLeast32BitUnsigned + codec::FullCodec + Copy | ||
| + MaybeSerializeDeserialize + sp_std::fmt::Debug + Default + From<u64>; |
Contributor
There was a problem hiding this comment.
The only alternative that I can think of is to add a where <T::Currency as _>::Balance: From<u64> to most functions of this pallet, and while this is not pretty either, I guess it has less footprint than sprinkling wheres.
kianenigma
reviewed
Mar 15, 2021
kianenigma
reviewed
Mar 15, 2021
kianenigma
reviewed
Mar 15, 2021
kianenigma
reviewed
Mar 15, 2021
kianenigma
reviewed
Mar 15, 2021
| distribution: vec![ | ||
| (10u32, Perbill::from_fraction(0.5)), | ||
| (20, Perbill::from_fraction(0.5)), | ||
| (10u32, Perbill::from_float(0.5)), |
Contributor
There was a problem hiding this comment.
Would be good to ensure new names are consistent with FixedPointNumber. I think the only one needing revision os this ^^, it is still called from_fraction there. Can also be a follow up.
kianenigma
approved these changes
Mar 15, 2021
Contributor
kianenigma
left a comment
There was a problem hiding this comment.
Some naming and doc notes worth fixing here and there, but nothing major.
kianenigma
reviewed
Mar 15, 2021
gui1117
approved these changes
Mar 15, 2021
Co-authored-by: Kian Paimani <[email protected]>
Co-authored-by: Kian Paimani <[email protected]>
Co-authored-by: Kian Paimani <[email protected]>
…strate into gav-abstract-payout-curve
shawntabrizi
approved these changes
Mar 15, 2021
| distribution: vec![ | ||
| (10u32, Perbill::from_fraction(0.5)), | ||
| (20, Perbill::from_fraction(0.5)), | ||
| (10u32, Perbill::from_float(0.5)), |
| } | ||
| } | ||
|
|
||
| pub struct ConvertCurve<T>(sp_std::marker::PhantomData<T>); |
Member
There was a problem hiding this comment.
probably could use a description
Member
Author
|
bot merge |
|
Trying merge. |
hirschenberger
pushed a commit
to hirschenberger/substrate
that referenced
this pull request
Apr 14, 2021
…aritytech#8327) * Initial abstraction * Alter rest of APIs * Fixes * Some extra getters in Gilt pallet. * Refactor Gilt to avoid u128 conversions * Simplify and improve pow in per_things * Add scalar division to per_things * Renaming from_fraction -> from_float, drop _approximation * Fixes * Fixes * Fixes * Fixes * Make stuff build * Fixes * Fixes * Fixes * Fixes * Update .gitignore Co-authored-by: Kian Paimani <[email protected]> * Update frame/gilt/src/lib.rs Co-authored-by: Kian Paimani <[email protected]> * Update frame/gilt/src/mock.rs Co-authored-by: Kian Paimani <[email protected]> * Fixes * Fixes * Fixes Co-authored-by: Shawn Tabrizi <[email protected]> Co-authored-by: Kian Paimani <[email protected]>
This pull request was closed.
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Breaks the API, sadly, but it's easy to fix your impl. Just change the line:
into:
Also tweaks to
per_things.rs:from_rational_approximationbecomesfrom_rationalfrom_fractionbecomesfrom_floatpowopstraitsmulis correctly characterised as non-overflowingAlso some minor refactoring to the Gilt pallet to avoid collapsing into
u128.Polkadot companion: paritytech/polkadot#2610