-
Notifications
You must be signed in to change notification settings - Fork 18
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
BLOCKBACK- 174 Roll in GPOS votes from 6th sub-period #202
Conversation
Ignore the voting test failure, it was fixed through #201 |
libraries/chain/db_maint.cpp
Outdated
@@ -780,6 +780,16 @@ double database::calculate_vesting_factor(const account_object& stake_account) | |||
uint32_t current_subperiod = get_gpos_current_subperiod(); | |||
|
|||
if(current_subperiod == 0 || current_subperiod > number_of_subperiods) return 0; | |||
|
|||
// On starting new vesting period, all votes become zero until some one votes, To avoid a situation of zero votes, | |||
// changes done to roll in GPOS rules, the vesting factor will be 1 for who ever votes in 6th sub-period of last vesting period |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
English is not my native language but it seems the text haves some problems. Maybe:
On starting A new vesting period, all votes become zero until SOMEONE votes. To avoid a situation of zero votes, changes WERE done to roll in GPOS rules, the vesting factor will be 1 for WHOEVER votes in 6th sub-period of last vesting period.
By the way, what are the changes done to GPOS rules you refer to ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GPOS rules in the sense that awarding vesting factor 1 without voting(based on voting status of 6th sub-period of last vesting period). I feel it is nothing but tweaking GPOS rules and roll the votes.
If required, I can update the comments.
libraries/chain/db_maint.cpp
Outdated
if(current_subperiod == 1 && this->head_block_time() >= HARDFORK_GPOS_TIME + vesting_period) //Applicable only from 2nd vesting period | ||
{ | ||
if(last_date_voted > period_start - vesting_subperiod) | ||
return 1; //return vesting factor as 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment is redundant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
tests/tests/gpos_tests.cpp
Outdated
@@ -640,18 +641,23 @@ BOOST_AUTO_TEST_CASE( voting ) | |||
BOOST_CHECK_EQUAL(db.get_global_properties().parameters.gpos_period_start(), now.sec_since_epoch()); | |||
|
|||
advance_x_maint(5); | |||
// a new GPOS period is in but vote from user is before the start so his voting power is 0 | |||
// a new GPOS period is in but vote from user is before the start. WHo ever votes in 6th sub-period, votes will carry |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WHo ever
can be Whoever
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
witness1 = witness_id_type(1)(db); | ||
witness2 = witness_id_type(2)(db); | ||
BOOST_CHECK_EQUAL(witness1.total_votes, 0); | ||
BOOST_CHECK_EQUAL(witness2.total_votes, 0); | ||
//It's critical here, since bob votes in 6th sub-period of last vesting period, witness2 should retain his votes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For clarity. Can you add some comment in the place where bob is voting in the 6th period ? I cant find where this is happening. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added for all sub-periods
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks.
On starting new vesting period, all votes become zero until someone votes, To avoid a situation of zero votes, changes done to roll in GPOS rules. The vesting factor will be 1 for whoever votes in 6th sub-period of last vesting period