Skip to content

Commit 5ade62b

Browse files
committed
IPC-541: Add link to the quorum formula and change it to >=
1 parent 8a494d3 commit 5ade62b

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

fendermint/vm/topdown/src/voting.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,13 @@ where
107107
}
108108

109109
/// Calculate the minimum weight needed for a proposal to pass with the current membership.
110+
///
111+
/// This is inclusive, that is, if the sum of weight is greater or equal to this, it should pass.
112+
/// The equivalent formula can be found in CometBFT [here](https://github.com/cometbft/cometbft/blob/a8991d63e5aad8be82b90329b55413e3a4933dc0/types/vote_set.go#L307).
110113
pub fn quorum_threshold(&self) -> Stm<Weight> {
111114
let total_weight: Weight = self.power_table.read().map(|pt| pt.values().sum())?;
112115

113-
Ok(total_weight * 2 / 3)
116+
Ok(total_weight * 2 / 3 + 1)
114117
}
115118

116119
/// Return the height of the first entry in the chain.
@@ -262,7 +265,7 @@ where
262265
}
263266
}
264267

265-
if weight > quorum_threshold {
268+
if weight >= quorum_threshold {
266269
return Ok(Some((*block_height, block_hash.clone())));
267270
}
268271
}

0 commit comments

Comments
 (0)