Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

round+executor: Use finer-grained state machine events #26

Closed
romac opened this issue Oct 27, 2023 · 1 comment
Closed

round+executor: Use finer-grained state machine events #26

romac opened this issue Oct 27, 2023 · 1 comment
Assignees
Milestone

Comments

@romac
Copy link
Member

romac commented Oct 27, 2023

Based on this diff by @ancazamfir:

diff --git a/Code/round/src/state_machine.rs b/Code/round/src/state_machine.rs
index fc6c7ad..4bafc68 100644
--- a/Code/round/src/state_machine.rs
+++ b/Code/round/src/state_machine.rs
@@ -99,12 +99,12 @@ pub fn apply_event(mut state: State, round: Round, event: Event) -> Transition {
         // From Prevote. Event must be for current round.
         (Step::Prevote, Event::PolkaAny) if this_round => schedule_timeout_prevote(state), // L34
         (Step::Prevote, Event::PolkaNil) if this_round => precommit_nil(state),            // L44
-        (Step::Prevote, Event::PolkaValue(value_id)) if this_round => precommit(state, value_id), // L36/L37 - NOTE: only once?
+        (Step::Prevote, Event::ProposalAndPolkaCurrent(value)) if this_round => precommit(state, value), // L36/L37 - NOTE: only once?
         (Step::Prevote, Event::TimeoutPrevote) if this_round => precommit_nil(state), // L61

         // From Precommit. Event must be for current round.
-        (Step::Precommit, Event::PolkaValue(value_id)) if this_round => {
-            set_valid_value(state, value_id)
+        (Step::Precommit, Event::ProposalAndPolkaCurrent(value)) if this_round => {
+            set_valid_value(state, value)
:
-    TimeoutPrevote,          // Timeout waiting for prevotes.
-    TimeoutPrecommit,        // Timeout waiting for precommits.
+    NewRound,                // Start a new round, not as proposer.L20
+    NewRoundProposer(Value), // Start a new round and propose the Value.L14
+    Proposal(Proposal),      // Receive a proposal. L22 + L23 (valid)
+    ProposalAndPolkaPrevious(Value), // Recieved a proposal and a polka value from a previous round. L28 + L29 (valid)
+    ProposalInvalid,         // Receive an invalid proposal. L26 + L32 (invalid)
+    PolkaAny,                // Receive +2/3 prevotes for anything. L34
+    PolkaNil,                // Receive +2/3 prevotes for nil. L44
+    ProposalAndPolkaCurrent(Value),     // Receive +2/3 prevotes for Value in current round. L36
+    PrecommitAny,            // Receive +2/3 precommits for anything. L47
+    ProposalAndPrecommitValue(Value), // Receive +2/3 precommits for Value. L49
+    RoundSkip,               // Receive +1/3 messages from a higher round. OneCorrectProcessInHigherRound, L55
+    TimeoutPropose,          // Timeout waiting for proposal. L57
+    TimeoutPrevote,          // Timeout waiting for prevotes. L61
+    TimeoutPrecommit,        // Timeout waiting for precommits. L65
 }
@romac romac changed the title Use finer-grained state machine events round+executor: Use finer-grained state machine events Oct 27, 2023
@romac romac added this to the v0.1 milestone Nov 2, 2023
@romac
Copy link
Member Author

romac commented Nov 7, 2023

Done in #19

@romac romac closed this as completed Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants