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

Commit 16e1b95

Browse files
committed
Remove dead code in filter_dispute_data
1 parent 052cde6 commit 16e1b95

1 file changed

Lines changed: 8 additions & 37 deletions

File tree

runtime/parachains/src/disputes.rs

Lines changed: 8 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -885,24 +885,21 @@ impl<T: Config> Pallet<T> {
885885
let n_validators = session_info.validators.len();
886886

887887
// Check for ancient.
888-
let (first_votes, dispute_state) = {
888+
let dispute_state = {
889889
if let Some(dispute_state) = <Disputes<T>>::get(&set.session, &set.candidate_hash) {
890890
if dispute_state.concluded_at.as_ref().map_or(false, |c| c < &oldest_accepted) {
891891
return StatementSetFilter::RemoveAll
892892
}
893893

894-
(false, dispute_state)
894+
dispute_state
895895
} else {
896896
// No state in storage, this indicates it's the first dispute statement set as well.
897-
(
898-
true,
899-
DisputeState {
900-
validators_for: bitvec![u8, BitOrderLsb0; 0; n_validators],
901-
validators_against: bitvec![u8, BitOrderLsb0; 0; n_validators],
902-
start: now,
903-
concluded_at: None,
904-
},
905-
)
897+
DisputeState {
898+
validators_for: bitvec![u8, BitOrderLsb0; 0; n_validators],
899+
validators_against: bitvec![u8, BitOrderLsb0; 0; n_validators],
900+
start: now,
901+
concluded_at: None,
902+
}
906903
}
907904
};
908905

@@ -971,32 +968,6 @@ impl<T: Config> Pallet<T> {
971968
return StatementSetFilter::RemoveAll
972969
}
973970

974-
let is_local = <Included<T>>::contains_key(&set.session, &set.candidate_hash);
975-
if !is_local {
976-
// This is only relevant in cases where it's the first vote and the state
977-
// would hence hold a onesided dispute. If a onesided dispute can never be
978-
// started, by induction, we can never enter a state of a one sided dispute.
979-
if first_votes {
980-
let mut vote_for_count = 0_u64;
981-
let mut vote_against_count = 0_u64;
982-
// Since this is the first set of statements for the dispute,
983-
// it's sufficient to count the votes in the statement set after they
984-
set.statements.iter().for_each(|(statement, v_i, _signature)| {
985-
if Some(true) ==
986-
summary.new_participants.get(v_i.0 as usize).map(|b| *b.as_ref())
987-
{
988-
match statement {
989-
// Note that this does not distinguish between pro or con votes,
990-
// since allowing both of them.
991-
// Overflow of the counters is no concern, disputes are limited by weight.
992-
DisputeStatement::Valid(_) => vote_for_count += 1,
993-
DisputeStatement::Invalid(_) => vote_against_count += 1,
994-
}
995-
}
996-
});
997-
}
998-
}
999-
1000971
filter
1001972
}
1002973

0 commit comments

Comments
 (0)