From 11961de82d74eb3fc1c1814dd8272326a33f44f5 Mon Sep 17 00:00:00 2001 From: Romain Ruetschi Date: Mon, 18 Dec 2023 15:38:35 +0100 Subject: [PATCH] Rename `Step::NewRound` to `Step::Unstarted` --- Code/driver/src/mux.rs | 2 +- Code/itf/src/types.rs | 2 +- Code/round/src/state.rs | 8 ++++---- Code/round/src/state_machine.rs | 6 +++--- Code/test/src/utils.rs | 6 +++--- Code/test/tests/driver.rs | 6 +++--- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Code/driver/src/mux.rs b/Code/driver/src/mux.rs index fb2c0a962..1fba7bcd7 100644 --- a/Code/driver/src/mux.rs +++ b/Code/driver/src/mux.rs @@ -185,7 +185,7 @@ where round: Round, ) -> Option> { match pending_step { - Step::NewRound => None, // Some(RoundInput::NewRound), + Step::Unstarted => None, Step::Propose => None, diff --git a/Code/itf/src/types.rs b/Code/itf/src/types.rs index 2918decd8..c62bd5424 100644 --- a/Code/itf/src/types.rs +++ b/Code/itf/src/types.rs @@ -86,7 +86,7 @@ impl Step { pub fn to_round_step(&self) -> Option { match self { Step::None => None, - Step::NewRound => Some(RoundStep::NewRound), + Step::NewRound => Some(RoundStep::Unstarted), Step::Propose => Some(RoundStep::Propose), Step::Prevote => Some(RoundStep::Prevote), Step::Precommit => Some(RoundStep::Precommit), diff --git a/Code/round/src/state.rs b/Code/round/src/state.rs index f70d9230b..02f626de9 100644 --- a/Code/round/src/state.rs +++ b/Code/round/src/state.rs @@ -27,10 +27,10 @@ impl RoundValue { /// The step of consensus in this round #[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] pub enum Step { - /// The round has just started - NewRound, + /// The round has not started yet + Unstarted, - /// We are at the propose step. + /// Propose step. /// Either we are the proposer or we are waiting for a proposal. Propose, @@ -74,7 +74,7 @@ where Self { height, round, - step: Step::NewRound, + step: Step::Unstarted, locked: None, valid: None, } diff --git a/Code/round/src/state_machine.rs b/Code/round/src/state_machine.rs index a7e9d7705..53688cd07 100644 --- a/Code/round/src/state_machine.rs +++ b/Code/round/src/state_machine.rs @@ -70,7 +70,7 @@ where // // L18 - (Step::NewRound, Input::NewRound(round)) if info.is_proposer() => { + (Step::Unstarted, Input::NewRound(round)) if info.is_proposer() => { // Update the round state.round = round; @@ -79,7 +79,7 @@ where } // L11/L20 - (Step::NewRound, Input::NewRound(round)) => { + (Step::Unstarted, Input::NewRound(round)) => { // Update the round state.round = round; @@ -426,7 +426,7 @@ pub fn round_skip(state: State, round: Round) -> Transition where Ctx: Context, { - let new_state = state.with_round(round).with_step(Step::NewRound); + let new_state = state.with_round(round).with_step(Step::Unstarted); Transition::to(new_state).with_output(Output::NewRound(round)) } diff --git a/Code/test/src/utils.rs b/Code/test/src/utils.rs index fc962cf44..600062364 100644 --- a/Code/test/src/utils.rs +++ b/Code/test/src/utils.rs @@ -329,7 +329,7 @@ pub fn new_round(round: Round) -> State { State { height: Height::new(1), round, - step: Step::NewRound, + step: Step::Unstarted, valid: None, locked: None, } @@ -339,7 +339,7 @@ pub fn new_round_with_proposal_and_valid(round: Round, proposal: Proposal) -> St State { height: Height::new(1), round, - step: Step::NewRound, + step: Step::Unstarted, valid: Some(RoundValue { value: proposal.value, round: Round::new(0), @@ -355,7 +355,7 @@ pub fn new_round_with_proposal_and_locked_and_valid( State { height: Height::new(1), round, - step: Step::NewRound, + step: Step::Unstarted, valid: Some(RoundValue { value: proposal.value, round: Round::new(0), diff --git a/Code/test/tests/driver.rs b/Code/test/tests/driver.rs index 199378ccd..9a8aac5c1 100644 --- a/Code/test/tests/driver.rs +++ b/Code/test/tests/driver.rs @@ -868,7 +868,7 @@ fn driver_steps_not_proposer_timeout_multiple_rounds() { new_state: State { height: Height::new(1), round: Round::new(1), - step: Step::NewRound, + step: Step::Unstarted, locked: None, valid: None, }, @@ -1105,7 +1105,7 @@ fn driver_steps_skip_round_skip_threshold() { new_state: State { height, round: Round::new(1), - step: Step::NewRound, + step: Step::Unstarted, locked: None, valid: None, }, @@ -1206,7 +1206,7 @@ fn driver_steps_skip_round_quorum_threshold() { new_state: State { height, round: Round::new(1), - step: Step::NewRound, + step: Step::Unstarted, locked: None, valid: None, },