Skip to content
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

Fix sbd print rate #3415

Merged
merged 6 commits into from
Jul 24, 2019
Merged

Fix sbd print rate #3415

merged 6 commits into from
Jul 24, 2019

Conversation

mvandeberg
Copy link
Contributor

Closes #3409

Local PR for #3410

A previous fix was submitted in #3291
However that solution creates new problems: The sbd print rate jumps from 5% to 0%.

In this PR I propose calculate percent_sbd by rounding the number instead of getting the floor (which is a intrinsic characteristic of integers). To do that I use the function described here.

This closes #3409 and #3184

@mvandeberg mvandeberg requested a review from sgerbino July 23, 2019 19:14
@@ -3901,9 +3900,15 @@ void database::update_virtual_supply()
auto percent_sbd = uint16_t( ( ( fc::uint128_t( ( dgp.current_sbd_supply * get_feed_history().current_median_history ).amount.value ) * STEEM_100_PERCENT )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this statement would be unnecessary after hardfork 21 and should probably go in an else statement.

@mvandeberg mvandeberg requested a review from sgerbino July 24, 2019 15:28
}
else
{
percent_sbd = uint16_t( ( ( fc::uint128_t( ( dgp.current_sbd_supply * get_feed_history().current_median_history ).amount.value ) * STEEM_100_PERCENT )

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about the HF20 behavior? It looks like it isn't happening here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The else block is the HF 20 behavior. What about this looks wrong to you?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The buffer of 5 for the stop print rate gap that was specific to HF20. And then HF19 had that parameter set to zero. Isn't this going to behave differently for the HF20 blocks?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This buffer of 5 was only for the HF21. Not present in HF20 or HF19.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah that's what I was missing. Thanks!

@mvandeberg mvandeberg merged commit ae7a39c into master Jul 24, 2019
@mvandeberg mvandeberg deleted the 3410-PR branch July 24, 2019 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sbd_print_rate is 1% in the haircut
4 participants