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

DefaultLeaderElector::elect_leader panics for party_weights summing to 1 #12

Open
matteojug opened this issue Sep 26, 2024 · 0 comments

Comments

@matteojug
Copy link

DefaultLeaderElector::elect_leader (specifically, hash_to_range) panics for party_weights = vec![1] (or summing to 1):

#[test]
fn test_total_weight_1() {
   let mut party = MockParty::default();
   party.cfg.party_weights = vec![1];

   let elector = DefaultLeaderElector::new();
   dbg!(elector.elect_leader(&party).unwrap());
}

Note that while some of the scenarios above may not be really realistic in terms of BPCon, still given the general purpose of this it would be better to have safeguards in place to avoid runtime panics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant