Skip to content

Commit

Permalink
chore: Fix some of TODOs in code (#142)
Browse files Browse the repository at this point in the history
* Fix some of TODOs in code

* No need for canaonical vote in tests
  • Loading branch information
ancazamfir authored Jan 11, 2024
1 parent 242f22d commit ccad5e8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 0 additions & 2 deletions code/common/src/signed_vote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Ctx>
where
Expand Down
7 changes: 4 additions & 3 deletions code/driver/src/mux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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));
}

Expand All @@ -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));
}

Expand Down
1 change: 0 additions & 1 deletion code/test/src/vote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ impl Vote {
}
}

// TODO: Use a canonical vote
pub fn to_bytes(&self) -> Vec<u8> {
let vtpe = match self.typ {
VoteType::Prevote => 0,
Expand Down

0 comments on commit ccad5e8

Please sign in to comment.