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
blockchain: Add fullblock tests for voting. #562
Conversation
8c1ed35
to
1269bc3
Compare
This adds a series of full block tests which exercise the new voting functionality exposed via PoS votebits and a threshold state machine. As with other full block tests, these involve generating a completely valid chain starting with genesis block and methodically reaching various thresholds. To achieve this, the tests creates two stake version 4 test dummy deployments that are carried out at the same time to also ensure voting on multiple agendas concurrently works as intended. The first agenda is voted in via a majority yes vote while the second is rejected via a majority no vote. The following is an overview of the progression of the tests: - Generate enough block to reach one block before the first stake version interval using v3 blocks and v3 votes in order to trigger stake version enforcement - Generate enough blocks to reach one block before the next rule change interval using v3 blocks and v3 votes - Ensure that voting on the agendas does not start due to lack of majority proof-of-work upgrade, lack of majority proof-of-stake upgrade, and not being on a rule change interval - Generate enough blocks to reach one block before the next stake version interval using v3 blocks and v4 votes in order to achieve stake version 4 enforcement - Ensure that voting on the agendas does not start due to lack of majority proof-of-work upgrade and not being on a rule change interval - Generate enough blocks to reach the next rule change interval while still using a majority of v3 blocks and v4 votes, but set the last two blocks to v4 - Ensure that voting on the agendas does not start due to lack of majority proof-of-work upgrade and not being on a rule change interval - Generate enough blocks to achieve proof-of-work block version lockin using v4 blocks and v4 votes - Ensure that voting on the agendas does not start even though all upgrade conditions have been met due to not having reached a rule change interval - Generate enough blocks to reach the next rule change interval using v4 blocks and v4 votes such that the majority votes vote yes to the first agenda and no to the second agenda - Ensure that the voting on agendas begins, but that the yes and no votes do not count yet since the voting had not started yet until this rule change interval was reached - Generate enough blocks to reach the next rule change interval using v4 blocks and v4 votes such that the majority votes vote yes to the first agenda and no to the second agenda - Ensure the first agenda becomes locked in since it was voted in with a majority yes and the second agenda fails since it was rejected with a majority no - Generate enough blocks to reach the next rule change interval using v4 blocks and v4 votes such that the majority votes vote the opposite way they previously did (no to first agenda and yes to second agenda) - Ensure the first agenda becomes active and the second agenda remains failed since a rule change can't be undone once it has achieved lockedin status or has failed
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.
OK
Assuming travis passes this one looks good to me. Do you want a @marcopeereboom OK as well since he was working on this stuff with you? |
I assigned @marcopeereboom for a review as well. |
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.
I went over this albeit not with a fine toothed comb. I replicated these test in the synthetic test package and arrived at the same result though.
This requires PR #542
This adds a series of full block tests which exercise the new voting functionality exposed via PoS votebits and a threshold state machine. As with other full block tests, these involve generating a completely
valid chain starting with genesis block and methodically reaching various thresholds.
To achieve this, the tests creates two stake version 4 test dummy deployments that are carried out at the same time to also ensure voting on multiple agendas concurrently works as intended. The first agenda is voted in via a majority yes vote while the second is rejected via a majority no vote.
The following is an overview of the progression of the tests: