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 a bug on minimum voting mana requirement #3034

Closed
wants to merge 3 commits into from

Conversation

sydneyitguy
Copy link

@sydneyitguy sydneyitguy commented Oct 5, 2018

image

A new user will have 0 SP and 0 VP, but votings should go through even though it has zero effect on the rewards.

Currently the code change was missing, so new users are getting
{“error”:“server_error”,“error_description”:“voter.voting_manabar.current_mana > 0: Account does not have enough mana to vote.“} when they vote.

Temporary work-around: Delegate 0.001 SP to the new account

Copy link
Contributor

@TimCliff TimCliff left a comment

Choose a reason for hiding this comment

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

This will likely need to be done as a hardfork change (with a hardfork condition check before the difference) otherwise it could cause a fork between nodes running the new vs. old code.

@iamsmooth
Copy link

Is it even possible for voting mana to be negative? Perhaps a simpler change is to remove the test altogether, which seems more consistent with the current rules about 'dust votes'. Agree this needs to be a hard fork.

@mvandeberg
Copy link
Contributor

Voting mana cannot be negative be the amount consumed is a percentage of the remaining mana. In fact, I think it is impossible for voting mana to actually go to 0 if the user non-zero SP. This change is needed for the corner case of an account with SP, but does need to be gated by a hardfork check.

Copy link
Contributor

@mvandeberg mvandeberg left a comment

Choose a reason for hiding this comment

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

Needs hardfork check

@youkaicountry
Copy link
Contributor

@sydneyitguy Please make the requested changes from code review, otherwise this PR will be closed in two weeks. We're trying to tidy up the open PRs, thanks for your understanding!

@sydneyitguy
Copy link
Author

@youkaicountry

I'm not a blockchain developer, so I don't know how I can do "hardfork check".
However, I think this is a critical issue because new users cannot even vote once at the moment, so someone has to fix..

Can anyone help? (or should I re-create this as an issue ticket?)

@mvandeberg
Copy link
Contributor

A hardfork check is:

if( db.has_hardfork( STEEM_HARDFORK_0_21 ) )
{
   // new logic
}
else
{
   // old logic
}

If you make such a change without this check then an upgraded node might have different acceptance criteria for an operation or might even have a different result in a calculation. In either case, this leads to a blockchain fork between new nodes and old nodes.

You can see this throughout the codebase. Ideally, this would also be filed as a bug report and the hardfork constant would include the issue number as well.

An example:

if( _db.has_hardfork( STEEM_HARDFORK_0_20__1764 ) )
{
abs_rshares -= STEEM_VOTE_DUST_THRESHOLD;
abs_rshares = std::max( int64_t(0), abs_rshares );
}
else if( _db.has_hardfork( STEEM_HARDFORK_0_14__259 ) )
{
FC_ASSERT( abs_rshares > STEEM_VOTE_DUST_THRESHOLD || o.weight == 0, "Voting weight is too small, please accumulate more voting power or steem power." );
}
else if( _db.has_hardfork( STEEM_HARDFORK_0_13__248 ) )
{
FC_ASSERT( abs_rshares > STEEM_VOTE_DUST_THRESHOLD || abs_rshares == 1, "Voting weight is too small, please accumulate more voting power or steem power." );
}

This contains all previous iterations of logic surrounding the STEEM_VOTE_DUST_THRESHOLD over several hardforks (13, 14, and 20). You can go back to the issues (#248, #259, and #1764) to see the motivation behind each change.

@sydneyitguy
Copy link
Author

@mvandeberg Thank you for your kind explanation 🙂
I have added a hard-fork check, and just removed the assertion on HF21 as you pointed out (voting mana cannot be negative value anyway).

@mvandeberg
Copy link
Contributor

Related to #3004

@mvandeberg
Copy link
Contributor

Fixed in #3004

@mvandeberg mvandeberg closed this May 17, 2019
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.

None yet

5 participants