This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Compute yearly inflation on-chain allowing to change x_ideal according to number of slots. #8332
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
gui1117
force-pushed
the
gui-on-chain-curve
branch
from
March 11, 2021 18:12
4508a34
to
a738f2a
Compare
github-actions
bot
added
the
A3-in_progress
Pull request is in progress. No review needed at this stage.
label
Mar 11, 2021
gui1117
force-pushed
the
gui-on-chain-curve
branch
from
March 16, 2021 16:37
a738f2a
to
6b7107a
Compare
gui1117
force-pushed
the
gui-on-chain-curve
branch
from
March 17, 2021 14:31
6b7107a
to
a32903b
Compare
gui1117
added
A0-please_review
Pull request needs code review.
B0-silent
Changes should not be mentioned in any release notes
C1-low
PR touches the given topic and has a low impact on builders.
D9-needsaudit 👮
PR contains changes to fund-managing logic that should be properly reviewed and externally audited
and removed
A3-in_progress
Pull request is in progress. No review needed at this stage.
labels
Mar 17, 2021
gui1117
changed the title
WIP: Compute yearly inflation on-chain allowing to change x_ideal according to number of slots.
Compute yearly inflation on-chain allowing to change x_ideal according to number of slots.
Mar 17, 2021
gui1117
commented
Mar 17, 2021
|
||
let error = (res - expect).abs(); | ||
|
||
if error > 8f64 / accuracy_f64 && error > 8.0 * f64::EPSILON { |
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.
this accuracy with EPSILON is at least needed because f64 doesn't have enough precision compare to perquintillion.
gui1117
commented
Mar 17, 2021
/// Compute a div b. | ||
/// | ||
/// requires `b` to be stripped and have no leading zeros. | ||
fn div_by_stripped(mut a: BigUint, b: &BigUint) -> BigUint { |
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.
cc @kianenigma I'm finally using this implementation to be able to divide by any stripped biguint.
gavofyork
reviewed
Mar 17, 2021
Co-authored-by: Gavin Wood <[email protected]>
gavofyork
approved these changes
Mar 19, 2021
hirschenberger
pushed a commit
to hirschenberger/substrate
that referenced
this pull request
Apr 14, 2021
…g to number of slots. (paritytech#8332) * new crate * Update frame/staking/reward-fn/src/lib.rs Co-authored-by: Gavin Wood <[email protected]> * fix doc Co-authored-by: Gavin Wood <[email protected]>
redzsina
added
D1-audited 👍
PR contains changes to fund-managing logic that has been properly reviewed and externally audited
and removed
D9-needsaudit 👮
PR contains changes to fund-managing logic that should be properly reviewed and externally audited
labels
Apr 20, 2021
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
A0-please_review
Pull request needs code review.
B0-silent
Changes should not be mentioned in any release notes
C1-low
PR touches the given topic and has a low impact on builders.
D1-audited 👍
PR contains changes to fund-managing logic that has been properly reviewed and externally audited
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.
Related: #6469
Intruduce a new crate which expose:
compute_inflation
allowing to compute yearly inflation directly usingcurrent_stake_rate
,ideal_stake_rate
andfalloff
.NOTE: we don't support falloff lower than 0.01, if we want to support it I think we can. If falloff is less than 0.01 the curve fall down very very fast, and we should probably return inflation = 0 and not compute taylor serie when stake is a bit far form ideal_stake.