Skip to content

Conversation

@cjen1-msft
Copy link
Contributor

@cjen1-msft cjen1-msft commented Oct 23, 2025

Put succinctly, pre-vote requires that a follower must prove that it could be elected before becoming a candidate.

This is implemented as a special follower state: PreVoteCandidate where the follower sends speculative requestVote messages.
These RequestVotes do not have any actual change on the receiving node, but notify the PreVoteCandidate that that node would have voted for it.

This is a minimal PR to start getting model checking of this.

The current PR has:

  • PreVote for simulation, by nondeterministically choosing the state of the preVoteEnabled variable during init to check both paths.
  • PreVote for model checking

@cjen1-msft cjen1-msft marked this pull request as ready for review October 27, 2025 12:41
@cjen1-msft cjen1-msft requested a review from a team as a code owner October 27, 2025 12:42
Copilot AI review requested due to automatic review settings October 27, 2025 12:42
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements PreVote support in the TLA+ model checking specification for CCF Raft consensus. PreVote is a mechanism where followers must first prove they could be elected (via a speculative vote round) before becoming actual candidates, helping prevent disruptive election attempts.

Key changes:

  • Added PreVoteCandidate leadership state between Follower and Candidate
  • Introduced preVoteEnabled configuration variable to allow testing both with and without PreVote
  • Modified election logic to require majority pre-votes before transitioning to full candidacy

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tla/consensus/ccfraft.tla Core PreVote implementation: new state, configuration variable, updated transitions and message handlers
tla/consensus/Traceccfraft.tla Updated trace validation to include configVars in UNCHANGED clauses
tla/consensus/Traceccfraft.cfg Added PreVoteCandidate constant mapping
tla/consensus/SIMccfraft.tla Added simulation init to non-deterministically set preVoteEnabled
tla/consensus/SIMccfraft.cfg Configured simulation to use new init function
tla/consensus/MCccfraft.tla Added model checking init and debug invariant for PreVote
tla/consensus/MCccfraft.cfg Added PreVoteCandidate constant and debug invariant

@achamayou achamayou added the run-long-verification Run Long Verification jobs label Oct 28, 2025
@cjen1-msft cjen1-msft marked this pull request as draft October 28, 2025 14:19
@cjen1-msft cjen1-msft marked this pull request as ready for review October 29, 2025 10:39
@cjen1-msft
Copy link
Contributor Author

This should be ready for review. I've cancelled the CI for now. Will rebase on main when the CI is quieter.

@achamayou achamayou merged commit 064aeb4 into microsoft:main Oct 29, 2025
28 of 29 checks passed
@achamayou achamayou deleted the pre-vote-tla branch October 29, 2025 23:58
@cjen1-msft cjen1-msft added 2.x-todo PRs which should be backported to 2.x 6.x-todo PRs which should be backported to 6.x and removed 2.x-todo PRs which should be backported to 2.x labels Nov 5, 2025
cjen1-msft added a commit to cjen1-msft/CCF that referenced this pull request Nov 5, 2025
Co-authored-by: Amaury Chamayou <amchamay@microsoft.com>
cjen1-msft added a commit to cjen1-msft/CCF that referenced this pull request Nov 5, 2025
Co-authored-by: Amaury Chamayou <amchamay@microsoft.com>
@eddyashton eddyashton added backported This PR was successfully backported to LTS branch and removed run-long-verification Run Long Verification jobs labels Dec 3, 2025
@eddyashton
Copy link
Member

Adding backported label - this was backported in #7436.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.x-todo PRs which should be backported to 6.x backported This PR was successfully backported to LTS branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants