-
Notifications
You must be signed in to change notification settings - Fork 2.6k
staking: Flexible generation of reward curve and associated tweaks #8327
Conversation
cc @kianenigma |
@@ -95,15 +95,15 @@ mod tests { | |||
Assignment { | |||
who: 1u32, | |||
distribution: vec![ | |||
(10u32, Perbill::from_fraction(0.5)), | |||
(20, Perbill::from_fraction(0.5)), | |||
(10u32, Perbill::from_float(0.5)), |
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.
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.
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.
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.
Some naming and doc notes worth fixing here and there, but nothing major.
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
…strate into gav-abstract-payout-curve
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.
lgtm
@@ -95,15 +95,15 @@ mod tests { | |||
Assignment { | |||
who: 1u32, | |||
distribution: vec![ | |||
(10u32, Perbill::from_fraction(0.5)), | |||
(20, Perbill::from_fraction(0.5)), | |||
(10u32, Perbill::from_float(0.5)), |
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.
} | ||
} | ||
|
||
pub struct ConvertCurve<T>(sp_std::marker::PhantomData<T>); |
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.
probably could use a description
bot merge |
Trying merge. |
…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 <5588131+kianenigma@users.noreply.github.com> * Update frame/gilt/src/lib.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Update frame/gilt/src/mock.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Fixes * Fixes * Fixes Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com> Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
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_approximation
becomesfrom_rational
from_fraction
becomesfrom_float
pow
ops
traitsmul
is correctly characterised as non-overflowingAlso some minor refactoring to the Gilt pallet to avoid collapsing into
u128
.Polkadot companion: paritytech/polkadot#2610