[steem][0.20.7-9] 14-week powerdown - powerdown can't finish in 13 weeks
Project Information
- Repository: https://github.com/steemit/steem
- Project Name: Steem
I reported the issue and made the fix and PR.
Expected behavior
Powerdown should finish in 13 weeks.
Actual behavior
Powerdown may take 14 weeks due to an error from the floor operation.
How to reproduce
- Pick any amount of powerdown such that 1/13 of its VESTS isn't an integer.
- Start powerdown.
- Wait 13 weeks (This may be unrealistic, so see the Recording Of The Bug).
- Check if there is any pending withdrawal.
- steem version: 0.20.7-9 (but may applicable to earlier versions)
- Browser/App version: Any
- Operating system: Any
Recording Of The Bug
https://steemd.com/@ned Ned had finished the 13 week powerdown last week! But steemd says that Ned is still powering down.
Steemit also says that Ned's still powering down.
Cause and Fix
This bug is due to the floor operation in the calculation of weekly powerdown amount, as shown below.
Here is the Ned's 13 week powerdown that should have finished last week, 2019-01-17.
2019-01-17T23:09:06: 140713.254 STEEM 282571030.409516 VESTS
2019-01-10T23:09:06: 140658.536 STEEM 282571030.409516 VESTS
2019-01-03T23:09:06: 140603.702 STEEM 282571030.409516 VESTS
2018-12-27T23:09:06: 140548.951 STEEM 282571030.409516 VESTS
2018-12-20T23:09:06: 140494.342 STEEM 282571030.409516 VESTS
2018-12-13T23:09:06: 140439.801 STEEM 282571030.409516 VESTS
2018-12-06T23:09:06: 140385.066 STEEM 282571030.409516 VESTS
2018-11-29T23:09:06: 140330.198 STEEM 282571030.409516 VESTS
2018-11-22T23:09:06: 140275.269 STEEM 282571030.409516 VESTS
2018-11-15T23:09:06: 140221.320 STEEM 282571030.409516 VESTS
2018-11-08T23:09:06: 140168.509 STEEM 282571030.409516 VESTS
2018-11-01T23:09:06: 140115.866 STEEM 282571030.409516 VESTS
2018-10-25T23:09:06: 140063.249 STEEM 282571030.409516 VESTS
Total withdrawn: 1,825,018.063 STEEM
Total withdrawn: 3673423395.323708 VESTS
Total requested: 3673423395.323719 VESTS
Note that "3673423395.323719 VESTS" is actually in MVESTS so it is in fact 3673423395323719 VESTS (integer).
Thus, total requested vests/13 should be 3673423395323719/13 = 282571030409516.9xxx but 0.9xxx is discarded by the floor operation. And 282571030409516*13 = 3673423395323708 (not 3673423395323719), so 11 vests still needs to be powered down for 1 additional week.
Basically what we need is ceiling, which can be implemented without importing math library in my PR. For efficiency, I've also combined it with the existing code that prevents 0 weekly withdrawal.
Hi @blockchainstudio, thanks for making this contribution.
As always, you first find the bug and then you submit a fix.
Unfortunately, the PO says this is intentional and not a bug. His reasons are very well explained here - https://github.com/steemit/steem/issues/3237#issuecomment-456884589
While your fix was not completely out of order, the PO has affirmed that the current implementation has 0 impacts on the end user. Also, it does not affect the power down in any negative way.
I am sorry for any inconvenience experienced as a result, your efforts were not in vain. At least it brings to light the reason behind the power down lasting 14 weeks instead of the supposed 13.
I know most times the project owners are too busy and do not respond in reasonable time and so you are pushed to post on utopian without them first acknowledging the bug. It can be frustrating but I'd still advise that in future contributions you wait for the PO's thoughts, especially in cases where the details behind the implementation in question are sketchy.
Do not be deterred by this. You're still one of the best hunters on the blockchain :). We look forward to more of your reports.
Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.
To view those questions and the relevant answers related to your post, click here.
Need help? Chat with us on Discord.
[utopian-moderator]
Thank you for your comment :) Yes, I understand though whether it's a bug or not really depends. Actually it's a bug since steemit says powerdown takes 13 weeks. And this leads UIs have a wrong information including Busy, which I also fixed here: https://steemit.com/@blockchainstudio/wrong-powerdown-information Hope you (if you will review it) give more credit to this work :)
I'm not saying that the 14-week powerdown bug has a large impact, but if it can be easily fixed, then it should be fixed. But STINC doesn't have enough resource in that direction sadly. Thanks!
Thank you for your review, @fego! Keep up the good work!
In Korean: 파워다운이 소수점 오차로 인해서 13주에 못 끝나는 경우가 생기는 것을 발견해서 고쳐둔 상태입니다. 대표적인 예: 네드ㅎㅎ 그래서 이미 13주 다 했는데도 파워다운 중인 것으로 나옵니다^^ 아주 미미한 11 vests가 14주차인 이틀뒤쯤 파워다운될 예정ㅎㅎ
Great. As you said, very strictly the power down period was 14 weeks? :)
Haha, thanks for great cartoon :)
곰돌이가 @lostmine27님의 소중한 댓글에 $0.019을 보팅해서 $0.004을 살려드리고 가요. 곰돌이가 지금까지 총 2732번 $33.602을 보팅해서 $33.917을 구했습니다. @gomdory 곰도뤼~
짱짱맨 호출에 응답하여 보팅하였습니다.
Congratulations @blockchainstudio! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :
Click here to view your Board
If you no longer want to receive notifications, reply to this comment with the word
STOP
To support your work, I also upvoted your post!
@blockchainstudio You have received a 100% upvote from @intro.bot because this post did not use any bidbots and you have not used bidbots in the last 30 days!
Upvoting this comment will help keep this service running.
nTOPAZ 생태계에 참여하기 ② (최대 $5.25 👍)
임대 감사합니다 😊
보상 지원 ①