Implement VoteAccumulator

Description

1. Add a new struct called VoteAccumulator to a separate module, src/vote_accumulator.rs:

2. Define an enum that will hold the voting result:

3. Implement public API for VoteAccumulator:

The implementation logic for the methods should be the following:

3.1. We’ll keep adding votes for a given block to the accumulator. Once the block becomes valid it is returned to be added to the chain. If the block is already valid and the vote is valid, then the vote corresponding proof is returned to be added to the chain.
3.2. -Blocks are held until there are G + (G - Q) (because some who are no longer supposed to vote (e.g. a demoted elder) haven’t yet realised so they vote too) votes and can then be silently dropped.- Each block is held there for a set length of time. If at timeout the block has < G votes, it is returned so that non-voters can be identified. If at timeout the block has >= G votes then it can be silently dropped.
3.3. When anything apart from a live block becomes valid the accumulator should remove all votes from that node.

Environment

None

Assignee

Fraser Hutchison

Reporter

Nikita Baksalyar

Labels

Start date

2018/01/31

End date

2018/04/26

Task progress

None

Baseline start date

None

Baseline end date

None

Story Points

5

Components

Priority

Major
Configure