From ccad5e830349e34a493b6cc7ff95ccd4aca6c931 Mon Sep 17 00:00:00 2001 From: Anca Zamfir Date: Thu, 11 Jan 2024 11:23:41 +0100 Subject: [PATCH] chore: Fix some of TODOs in code (#142) * Fix some of TODOs in code * No need for canaonical vote in tests --- code/common/src/signed_vote.rs | 2 -- code/driver/src/mux.rs | 7 ++++--- code/test/src/vote.rs | 1 - 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/code/common/src/signed_vote.rs b/code/common/src/signed_vote.rs index 3e9b6f52e..24226fd84 100644 --- a/code/common/src/signed_vote.rs +++ b/code/common/src/signed_vote.rs @@ -2,8 +2,6 @@ use core::fmt; use crate::{Context, Signature, Vote}; -// TODO: Do we need to abstract over `SignedVote` as well? - /// A signed vote, ie. a vote emitted by a validator and signed by its private key. pub struct SignedVote where diff --git a/code/driver/src/mux.rs b/code/driver/src/mux.rs index 022adac1a..a702f8f22 100644 --- a/code/driver/src/mux.rs +++ b/code/driver/src/mux.rs @@ -95,12 +95,14 @@ where // Store the proposal self.proposal = Some(proposal.clone()); + // Determine if there is a polka for the proposal let polka_for_pol = self.vote_keeper.is_threshold_met( &proposal.pol_round(), VoteType::Prevote, Threshold::Value(proposal.value().id()), ); + // Determine if the polka is for a previous round let polka_previous = proposal.pol_round().is_defined() && polka_for_pol && proposal.pol_round() < self.round_state.round; @@ -124,12 +126,12 @@ where // We have a valid proposal. // L49 - // TODO: check if not already decided if self.vote_keeper.is_threshold_met( &proposal.round(), VoteType::Precommit, Threshold::Value(proposal.value().id()), - ) { + ) && !self.round_state.step.eq(&Step::Commit) + { return Some(RoundInput::ProposalAndPrecommitValue(proposal)); } @@ -153,7 +155,6 @@ where // L28 if self.round_state.step == Step::Propose && polka_previous { - // TODO: Check proposal vr is equal to threshold vr return Some(RoundInput::ProposalAndPolkaPrevious(proposal)); } diff --git a/code/test/src/vote.rs b/code/test/src/vote.rs index dc2ee249b..31b9a250d 100644 --- a/code/test/src/vote.rs +++ b/code/test/src/vote.rs @@ -45,7 +45,6 @@ impl Vote { } } - // TODO: Use a canonical vote pub fn to_bytes(&self) -> Vec { let vtpe = match self.typ { VoteType::Prevote => 0,