diff --git a/code/driver/src/driver.rs b/code/driver/src/driver.rs index 5719bf437..9356da103 100644 --- a/code/driver/src/driver.rs +++ b/code/driver/src/driver.rs @@ -115,10 +115,14 @@ where } /// Return the proposer for the current round. - pub fn get_proposer(&self, round: Round) -> Result<&Ctx::Validator, Error> { + pub fn get_proposer( + &self, + height: Ctx::Height, + round: Round, + ) -> Result<&Ctx::Validator, Error> { let address = self .proposer_selector - .select_proposer(round, &self.validator_set); + .select_proposer(height, round, &self.validator_set); let proposer = self .validator_set @@ -267,7 +271,7 @@ where let round_state = core::mem::take(&mut self.round_state); let current_step = round_state.step; - let proposer = self.get_proposer(round_state.round)?; + let proposer = self.get_proposer(round_state.height, round_state.round)?; let info = Info::new(input_round, &self.address, proposer.address()); // Apply the input to the round state machine diff --git a/code/driver/src/proposer.rs b/code/driver/src/proposer.rs index 00819dcd6..89f2d35d0 100644 --- a/code/driver/src/proposer.rs +++ b/code/driver/src/proposer.rs @@ -14,5 +14,10 @@ where /// # Important /// This function must be deterministic! /// For a given round and validator set, it must always return the same proposer. - fn select_proposer(&self, round: Round, validator_set: &Ctx::ValidatorSet) -> Ctx::Address; + fn select_proposer( + &self, + height: Ctx::Height, + round: Round, + validator_set: &Ctx::ValidatorSet, + ) -> Ctx::Address; } diff --git a/code/test/src/utils.rs b/code/test/src/utils.rs index efac6cd8a..8fd4b6a1b 100644 --- a/code/test/src/utils.rs +++ b/code/test/src/utils.rs @@ -13,7 +13,12 @@ use crate::{ pub struct RotateProposer; impl ProposerSelector for RotateProposer { - fn select_proposer(&self, round: Round, validator_set: &ValidatorSet) -> Address { + fn select_proposer( + &self, + _height: Height, + round: Round, + validator_set: &ValidatorSet, + ) -> Address { let proposer_index = round.as_i64() as usize % validator_set.validators.len(); validator_set.validators[proposer_index].address } @@ -31,7 +36,12 @@ impl FixedProposer { } impl ProposerSelector for FixedProposer { - fn select_proposer(&self, _round: Round, _validator_set: &ValidatorSet) -> Address { + fn select_proposer( + &self, + _height: Height, + _round: Round, + _validator_set: &ValidatorSet, + ) -> Address { self.proposer } }