Steem: Powerdown can't finish in 13 weeks.

Created on 23 Jan 2019  路  8Comments  路  Source: steemit/steem

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.

https://github.com/steemit/steem/blob/c6b865b6f27999cba38f3840151c8306f14f3371/libraries/chain/steem_evaluator.cpp#L1157


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 week.

Basically what we need is ceiling. I made the fix without importing math library. For efficiency, I've also combined it with the existing code that prevents 0 weekly withdrawal

HARDFORK projechf21

Most helpful comment

I agree with previous discussion that this is very low impact and does not need to be fixed (and would instead suggest updating the documentation, at least for now). I would only support fixing it in a hard fork if the developer team is very confident that there are sufficient resources for careful review and testing, otherwise I do not see the risks of the change being outweighed by the benefits from the change.

All 8 comments

This behavior is not a bug and is intentional.

VESTS are not only a smart contract on the Steem Blockchain, but a social contract as well that you will keep your STEEM staked as VESTS for a certain period of time and can only power them down at a certain rate. When the amount of VESTS are not evenly divisible by the power down period, you have some extra satoshi VESTS that need to go somewhere. You can either spread those VESTS across the earlier weeks (your proposal) or add one more week that contains the leftovers (the current implementation). We decided to better align with the social contract of VESTS that we should slightly under withdraw than over.

This is also an extraordinarily small "issue". Due to rounding, the most satoshi VESTS that can be withdrawn on week 14 are 12. At a current vesting ratio of 0.0004981 S/V and STEEM price of $0.401196, that equates to $2.39e-9 in value that we are talking about moving, which will round on the blockchain to 0.

Because the code is already designed to work with the extra week and there is 0 impact on the end user, I am inclined to not change the code to completely avoid unforeseen bugs.

Thanks for your comment. I agree that it's a minor bug in terms of impact. But whether it's a bug or not depends. Actually most users including me know that powerdown takes 13 weeks, which, I believe, should be called a social contract. In that sense, it might be too much that it was intentional. If it could be done in 13 weeks, then that should be intended. Steemit.com condenser also says powerdown takes 13 weeks when users request, and has no explanation about potential 14th week.

Even technically, in the 14th week, what the original code (see explanation in my PR #3238) is trying is to withdraw the same (i.e., a big amount, e.g., Ned's trying to withdraw 140K SP from 7K SP, which sounds very dangerous) weekly vest, but it is capped by the remaining vest from total withdrawal requested. So I believe the suggested PR is safe (in any case, it only increases by 1 vest, which is already done for 0 weekly withdrawal). But it's up to STINC. I think this is similar to 1% SBD print rate during the haircut #3184 While both have a minor impact, they're related to money. Hope both will be fixed when STINC has some extra resource (and the current one can be very easily fixed). Thanks!

The return on investment of this proposed change is 0. It is so inconsequential it is not worth discussing it further.

I understand though "The return on investment of this proposed change is 0" is not a good wording :) especially considering that I'm not an even employee there. How about "While it's better to be finished in 13 weeks, it's a tiny difference, so I prefer not to change, if you don't mind."?

I'm perfectly fine STINC doesn't consider this anymore but more encouraging wording to users who're actively trying to help and participate would be much better. Please consider that condenser has more informative message then, since it still says powerdown takes 13 weeks, which may not be true. Thanks.

I agree with previous discussion that this is very low impact and does not need to be fixed (and would instead suggest updating the documentation, at least for now). I would only support fixing it in a hard fork if the developer team is very confident that there are sufficient resources for careful review and testing, otherwise I do not see the risks of the change being outweighed by the benefits from the change.

thanks @mvandeberg for including in the future plan. thank @iamsmooth for your comment too, which is similar to mvandeberg's previous (potentially current as well) opinion.

I'm also sympathetic to the idea and know Steemit Inc has very limited resources now, so it's entirely up to Steemit, but this is in fact a very simple fix to check. and imho, money-related problem (another such is #3184) should be fixed even if it's "practical" impact is small. If this kind of simple problem exists and cannot be fixed easily for long, then users may also lose their confidence in other more important functions. Thank you for considering this.

I still believe the economic impact of this is insignificant. You can at most receive a power down of 0.000012 VESTS on week 14. At current value, that equates to 0.0000000060096 STEEM, which will be rounded to 0.000 STEEM.

Your proposed change increases the power down of VESTS each week by 0.000001 VESTS and would decrease the last week by 0.00012 VESTS. Again, with proper rounding, each week will provide 0 STEEM more but will get rid of the 14th week power down of 0 STEEM.

Economically speaking, this change has no impact. But I will concede that on a fork of Steem, with different economic conditions, this could have an impact.

I am only in favor of the change because of user perception of a 14th week during a documented 13 week power down. This really should be changed in UI, but requires coding for a very specific corner case to display properly in a UI. Changing it in the blockchain fixes it for all UIs.

@mvandeberg, I agree with you. Thank you for reconsidering this and hope this will be merged. Come on, it's really easy to check :)

ps. I'm very glad to see the recent change of Steemit Inc on community PR after wallet split. (Two of my PRs have been finally merged after 3 months :) While there are several good alternative UIs, probably most outside people consider steemit.com as the main UI, so I sincerely hope Steemit Inc would put some more efforts to improve that. Thank you.

Was this page helpful?
0 / 5 - 0 ratings