Skip to content

RC mana can no longer go negative.

Andrzej Lisak requested to merge abw_min_mana into develop

There was a limit on RC consumption in case of violation of RC rules (when some other node produced block that contained transaction burning more RC than payer had). The limit was down to two hours worth of regeneration. However that limit was only on RC consumption. If the user lost some of their regeneration power within those two hours (by their own power down, by losing delegation or by being denied HF23 HIVE airdrop), they could still have negative RC that now takes more than two hours of regeneration given smaller stake doing that regeneration.

Full replay with extra logging showed there were 27k instances of above "more than intended 2h regen" negative RC, the big ones mostly in early blocks after HF20 (introduction of RC) when RC code was affected by many changes, and then some after HF23 due to lack of HIVE airdrop. Vast majority were small differences (like 3 hour regen into negative instead of 2), that were result or retroactive changes in RC costs, so accounts that were payers weren't really affected. In all cases the longer regeneration period was already in the past, all but one: steem. This one is the one that sparked the bug hunt and change.

image

Even though it was not on purpose but a result of a bug, we can say the account user is actually to blame. The situation on the account is the effect of four factors:

  • the account had enormous amount of STEEM
  • when community witnesses were replaced by sock puppets, the account started to claim a lot of RC-expensive account tokens, in clear violation of RC rules (only enabled by sock puppets); as a result the account was running full 2h negative RC (which was very large number in absolute terms due to the amount of stake it had)
  • the account was denied HIVE airdrop, so it was left with only creation fee adjustment to regenerate RC

Final factor was the problem addressed by this MR, that is, the limit on negative RC was not enforced when account lost stake, which results in such horribly long time for regeneration.

RC is being prepared to become consensus. In the future there won't be any opportunity for RC to go negative, because such transactions will be treated as invalid, even if they come as part of block. Therefore it makes no sense to enforce old 2h regen rule in case account loses stake, because RC will never be negative. For this reason it was easier to just make it so RC can never be negative even before RC becomes consensus.

First commit of this MR removes some redundant checks on voting/downvote mana. Since these use default limit on minimum mana (zero) when calling use_mana, they already could never go negative, so there is no point to check if they did.

Note: replay is not strictly required, but without it situation of steem account won't change on its own. It is also preferable due to retroactive nature of the change. RC stats are slightly affected in payers part (affordability report - less payers are reported "under the line").

Edited by Andrzej Lisak

Merge request reports