-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
R4R F1 mechanism rounding fix #3788
R4R F1 mechanism rounding fix #3788
Conversation
unforch the a test case now fails due to the correction factor - so we should patch it however that's a bit ugly - a better solution here may be to fundamentally modify how F1 works so this form of rounding error doesn't show up... at least we know what's causing it. feel free to push to dis branch @cwgoes |
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.
A few questions, also this doesn't seem to fix the simulator.
Simulations are failing due to division-by-zero on line 72 of x/stake/keeper/delegation.go: roundingCorrectionFactor := currentStake.QuoTruncate(currentStakeF1) |
FYI @rigelrozanski - once the division by zero is removed, this fixes the simulator except for import/export - #3798 (comment). I prefer the approach in #3788 (comment) though - and I even prefer just the |
@cwgoes we're in agreement I will implement now |
Codecov Report
@@ Coverage Diff @@
## cwgoes/outstanding-per-validator #3788 +/- ##
===================================================================
- Coverage 61.33% 61.3% -0.04%
===================================================================
Files 189 189
Lines 14156 14167 +11
===================================================================
+ Hits 8683 8685 +2
- Misses 4913 4922 +9
Partials 560 560 |
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.
Basic logic looks good; a few minor comments & the import/export sim still fails.
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.
Changes look reasonable to me and @cwgoes covers anything I'd have to add :)
Co-Authored-By: rigelrozanski <rigel.rozanski@gmail.com>
…/cosmos/cosmos-sdk into rigel/outstanding-per-validator2
Alright so I finally got to the bottom of the bug seen in see the solution in commit Basically what is happening is because we switched to storing outstanding per validator instead of per the whole network, when we initialized for My solution just has these scraps donated to the community pool during zero-height export. |
REF #3750
due to order of operations F1 was actually calculating stake slightly differently than staking... see the diff in the code comments for more explanation
fixes problem found here:
#3750 (comment)
Also added a defensive minimum if rewards > outstanding (which could occur in the old code if everyone withdrew in the same block)
(feel free to push to this branch)