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

[Consensus] Leader Election - Productionize the sortition algorithm #324

Open
16 tasks
Tracked by #890
jessicadaugherty opened this issue Oct 31, 2022 · 2 comments
Open
16 tasks
Tracked by #890
Assignees
Labels
consensus Consensus specific changes

Comments

@jessicadaugherty
Copy link
Contributor

jessicadaugherty commented Oct 31, 2022

Objective

Implement random leader election proportional to the Validator's total stake that is not susceptible to grinding attacks, while also productionizing the leader election process.

Origin Document

The algorithm for HotPOKT leader election algorithm can be found in the consensus specification. It is based on Section 5.1 in the Algorand whitepaper.

The leader election package in this repository implements most of the core business logic as a separate library to enable this.

The current leader election algorithm uses round robin defined in consensus/helpers.go:

func (m *consensusModule) electNextLeader(message *typesCons.HotstuffMessage) error {
	leaderId, err := m.leaderElectionMod.ElectNextLeader(message)
	if err != nil || leaderId == 0 {
    // ...
}

Goals

  • Enable node flow to use VRF/CDF functions in leader election
  • Ensure Validator selection probability is proportional to stake_tokens/total_stake_tokens
  • Identify next steps for leader election TODOs

Deliverable

  • Integrate the leader_election library in place of the current "round robin" leader election process
  • Ensure the node can assign a proper leader and monitor the leader election
  • Review the existing VRF & CDF functions to verify that there are no implementation gaps
  • Add logging and monitoring so the current leader can be easily tracked
  • Business logic to fallback to round-robin leader election if one is not found using the sortition algorithm
  • Identify all TODOs in the leader election package via grep -rl "TODO" ./consensus/leader_election and:
    • Delete impertinent TODOs
    • Document which TODOs require new issues

Non-goals / Non-deliverables

  • Tending to every TODO in the leader election package

General issue deliverables

  • Update the appropriate CHANGELOG
  • Update any relevant READMEs (local and/or global)
  • Update any relevant global documentation & references

Testing Methodology

  • Required: add new tests for the changes added here
  • VRF Tests: make test_vrf # Update if needed
  • Sortition Tests: make test_sortition # Update if needed
  • All tests: make test_all
  • LocalNet: verify a LocalNet is still functioning correctly by following the instructions at docs/development/README.md

Creator: @jessicadaugherty
Co-Owners: @Olshansk

@jessicadaugherty
Copy link
Contributor Author

@Olshansk define ty

@Olshansk Olshansk added the triage It requires some decision-making at team level (it can't be worked on as it stands) label Nov 3, 2022
@Olshansk Olshansk removed their assignment Nov 14, 2022
@Olshansk Olshansk added the consensus Consensus specific changes label Dec 6, 2022
@jessicadaugherty jessicadaugherty changed the title [Consensus] Leader Election - Validators Voting Power Proportional to stake_tokens/total_stake_tokens [Consensus] Proper Leader Election Feb 10, 2023
@jessicadaugherty
Copy link
Contributor Author

@gokutheengineer updated AC for review. Ty!

@Olshansk Olshansk changed the title [Consensus] Proper Leader Election [Consensus] Leader Election - Productionize the sortition algorithm Feb 15, 2023
@jessicadaugherty jessicadaugherty removed the triage It requires some decision-making at team level (it can't be worked on as it stands) label Mar 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
consensus Consensus specific changes
Projects
Status: Up Next
Development

No branches or pull requests

4 participants