Skip to content

Commit

Permalink
feat(consensus): proposer rotates across validators
Browse files Browse the repository at this point in the history
  • Loading branch information
matan-starkware committed Dec 2, 2024
1 parent b110cc3 commit 906d4b6
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,12 @@ impl ConsensusContext for SequencerConsensusContext {
self.validators.clone()
}

fn proposer(&self, _height: BlockNumber, _round: Round) -> ValidatorId {
*self.validators.first().expect("there should be at least one validator")
fn proposer(&self, height: BlockNumber, round: Round) -> ValidatorId {
let index = height.0 as usize + round as usize;
*self
.validators
.get(index % self.validators.len())
.expect("There should be at least one validator")
}

async fn broadcast(&mut self, message: ConsensusMessage) -> Result<(), ConsensusError> {
Expand Down

0 comments on commit 906d4b6

Please sign in to comment.