Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Code review feedback - fix vote count
Browse files Browse the repository at this point in the history
  • Loading branch information
tdimitrov committed Dec 1, 2022
1 parent 4e40c77 commit fa68ca6
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions runtime/parachains/src/disputes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1041,8 +1041,8 @@ impl<T: Config> Pallet<T> {
}

// Reject disputes containing less votes than needed for confirmation.
if summary.state.validators_for.count_ones() + summary.state.validators_against.count_ones() <
supermajority_threshold(summary.state.validators_for.len())
if (summary.state.validators_for.clone() | &summary.state.validators_against).count_ones() <=
byzantine_threshold(summary.state.validators_for.len())
{
return StatementSetFilter::RemoveAll
}
Expand Down Expand Up @@ -1211,9 +1211,8 @@ impl<T: Config> Pallet<T> {

// Reject disputes containing less votes than needed for confirmation.
ensure!(
summary.state.validators_for.count_ones() +
summary.state.validators_against.count_ones() >=
supermajority_threshold(summary.state.validators_for.len()),
(summary.state.validators_for.clone() | &summary.state.validators_against).count_ones() >
byzantine_threshold(summary.state.validators_for.len()),
Error::<T>::UnconfirmedDispute,
);

Expand Down

0 comments on commit fa68ca6

Please sign in to comment.