Skip to content

Commit

Permalink
lower upgrade threshold (#3676)
Browse files Browse the repository at this point in the history
  • Loading branch information
ss-es authored Sep 13, 2024
1 parent 2bd0696 commit 210afa1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions crates/hotshot/src/traits/election/static_committee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
// You should have received a copy of the MIT License
// along with the HotShot repository. If not, see <https://mit-license.org/>.

use std::collections::BTreeMap;
use std::num::NonZeroU64;
use std::{cmp::max, collections::BTreeMap, num::NonZeroU64};

use ethereum_types::U256;
use hotshot_types::{
Expand Down Expand Up @@ -183,6 +182,10 @@ impl<TYPES: NodeType> Membership<TYPES> for GeneralStaticCommittee<TYPES> {

/// Get the voting upgrade threshold for the committee
fn upgrade_threshold(&self) -> NonZeroU64 {
NonZeroU64::new(((self.stake_table.len() as u64 * 9) / 10) + 1).unwrap()
NonZeroU64::new(max(
(self.stake_table.len() as u64 * 9) / 10,
((self.stake_table.len() as u64 * 2) / 3) + 1,
))
.unwrap()
}
}

0 comments on commit 210afa1

Please sign in to comment.