From 139c5b6ee93fd3df74aecbe31b6ec65f8ad61069 Mon Sep 17 00:00:00 2001 From: Anca Zamfir Date: Wed, 1 Nov 2023 22:44:08 -0400 Subject: [PATCH] Fix formatting --- Code/consensus/src/executor.rs | 18 ++++++++---------- Code/round/src/events.rs | 10 +++++----- Code/round/src/state_machine.rs | 2 +- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/Code/consensus/src/executor.rs b/Code/consensus/src/executor.rs index 76d51d5dd..7012e03b7 100644 --- a/Code/consensus/src/executor.rs +++ b/Code/consensus/src/executor.rs @@ -239,19 +239,17 @@ where // Multiplex the event with the round state. let mux_event = match event { - RoundEvent::PolkaValue(value_id) => { - match round_state.proposal { - Some(ref proposal) if proposal.value().id() == value_id => - RoundEvent::ProposalAndPolkaCurrent(proposal.clone()), - _ => RoundEvent::PolkaAny, + RoundEvent::PolkaValue(value_id) => match round_state.proposal { + Some(ref proposal) if proposal.value().id() == value_id => { + RoundEvent::ProposalAndPolkaCurrent(proposal.clone()) } + _ => RoundEvent::PolkaAny, }, - RoundEvent::PrecommitValue(value_id) => { - match round_state.proposal { - Some(ref proposal) if proposal.value().id() == value_id => - RoundEvent::ProposalAndPrecommitValue(proposal.clone()), - _ => RoundEvent::PrecommitAny, + RoundEvent::PrecommitValue(value_id) => match round_state.proposal { + Some(ref proposal) if proposal.value().id() == value_id => { + RoundEvent::ProposalAndPrecommitValue(proposal.clone()) } + _ => RoundEvent::PrecommitAny, }, _ => event, }; diff --git a/Code/round/src/events.rs b/Code/round/src/events.rs index 5ed0929e0..8ac2374ec 100644 --- a/Code/round/src/events.rs +++ b/Code/round/src/events.rs @@ -5,18 +5,18 @@ pub enum Event where Ctx: Context, { - NewRound, // Start a new round, not as proposer.L20 - NewRoundProposer(Ctx::Value), // Start a new round and propose the Value.L14 - Proposal(Ctx::Proposal), // Receive a proposal. L22 + L23 (valid) + NewRound, // Start a new round, not as proposer.L20 + NewRoundProposer(Ctx::Value), // Start a new round and propose the Value.L14 + Proposal(Ctx::Proposal), // Receive a proposal. L22 + L23 (valid) ProposalAndPolkaPrevious(Ctx::Proposal), // Recieved a proposal and a polka value from a previous round. L28 + L29 (valid) ProposalInvalid, // Receive an invalid proposal. L26 + L32 (invalid) PolkaValue(ValueId), // Receive +2/3 prevotes for valueId. L44 PolkaAny, // Receive +2/3 prevotes for anything. L34 PolkaNil, // Receive +2/3 prevotes for nil. L44 ProposalAndPolkaCurrent(Ctx::Proposal), // Receive +2/3 prevotes for Value in current round. L36 - PrecommitAny, // Receive +2/3 precommits for anything. L47 + PrecommitAny, // Receive +2/3 precommits for anything. L47 ProposalAndPrecommitValue(Ctx::Proposal), // Receive +2/3 precommits for Value. L49 - PrecommitValue(ValueId), // Receive +2/3 precommits for ValueId. L51 + PrecommitValue(ValueId), // Receive +2/3 precommits for ValueId. L51 RoundSkip, // Receive +1/3 messages from a higher round. OneCorrectProcessInHigherRound, L55 TimeoutPropose, // Timeout waiting for proposal. L57 TimeoutPrevote, // Timeout waiting for prevotes. L61 diff --git a/Code/round/src/state_machine.rs b/Code/round/src/state_machine.rs index a809bba37..dd9350b1c 100644 --- a/Code/round/src/state_machine.rs +++ b/Code/round/src/state_machine.rs @@ -121,7 +121,7 @@ where (_, Event::PrecommitAny) if this_round => schedule_timeout_precommit(state), // L47 (_, Event::TimeoutPrecommit) if this_round => round_skip(state, data.round.increment()), // L65 (_, Event::RoundSkip) if state.round < data.round => round_skip(state, data.round), // L55 - (_, Event::ProposalAndPrecommitValue(proposal)) => commit(state, data.round, proposal), // L49 + (_, Event::ProposalAndPrecommitValue(proposal)) => commit(state, data.round, proposal), // L49 // Invalid transition. _ => Transition::invalid(state),