From fa68ca6ff536393446b93022d9c4768d1d6be33d Mon Sep 17 00:00:00 2001 From: Tsvetomir Dimitrov Date: Tue, 22 Nov 2022 22:29:07 +0200 Subject: [PATCH] Code review feedback - fix vote count --- runtime/parachains/src/disputes.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/runtime/parachains/src/disputes.rs b/runtime/parachains/src/disputes.rs index aba935b5369f..443e1add74f9 100644 --- a/runtime/parachains/src/disputes.rs +++ b/runtime/parachains/src/disputes.rs @@ -1041,8 +1041,8 @@ impl Pallet { } // 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 } @@ -1211,9 +1211,8 @@ impl Pallet { // 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::::UnconfirmedDispute, );