-
Notifications
You must be signed in to change notification settings - Fork 28
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
feat: Make voter electing staisfy finality #120
Conversation
libs/rand/sampling.go
Outdated
|
||
// sortVoters is function to sort voters in descending votingPower/stakingPower | ||
func sortVoters(candidates []Candidate) []Candidate { | ||
temp := make([]Candidate, len(candidates)) |
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.
You can sort this in-place. And the caller sortVoters(voters)
has no effect with out-place sorting.
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 i see, it can solve for changing caller sortVoters(voters)
to voters = sortVoters(voters)
When we first created the Sampling function, we implemented it in libs/land/sampling.go for general use, but now it doensn't need to be in the libs module anymore because it refers to a lot of voter-related contents such as 'voting power'. How about to move this implementation into voter_set.go and get rid of the |
thanks for your review, I'll give it a try. |
Let's talk about this in next weekly. |
Create new PR without private branch to use Circle CI Large docker plan #124 |
Closes: #115
Description
Change voter election to satisfy finality.
changes
Sort voters in descending voting power/staking power.
Pick up a voter in order until total staking power of voters equal to total staking power of validators
If total voting power of voters picked up less than 1/3 of total voting power then stop electing
change and write test code to fit new election
For contributor use:
docs/
) and code commentsFiles changed
in the Github PR explorer