Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ancazamfir committed Nov 2, 2023
1 parent 594a6f9 commit 139c5b6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 16 deletions.
18 changes: 8 additions & 10 deletions Code/consensus/src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
10 changes: 5 additions & 5 deletions Code/round/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ pub enum Event<Ctx>
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<Ctx>), // 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<Ctx>), // Receive +2/3 precommits for ValueId. L51
PrecommitValue(ValueId<Ctx>), // 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
Expand Down
2 changes: 1 addition & 1 deletion Code/round/src/state_machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 139c5b6

Please sign in to comment.