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

Adding a new configuration to the model checking CI #5802

Merged
merged 9 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/tlaplus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ jobs:
cd tla/
./tlc.sh -workers auto consensus/MCccfraft.tla -dumpTrace tla MCccfraft.trace.tla -dumpTrace json MCccfraft.json
- name: MCccfraftAtomicReconfig.cfg
run: |
cd tla/
./tlc.sh -workers auto -config consensus/MCccfraftAtomicReconfig.cfg consensus/MCccfraft.tla -dumpTrace tla MCccfraftAtomicReconfig.trace.tla -dumpTrace json MCccfraftAtomicReconfig.json
- name: MCccfraftWithReconfig.cfg
run: |
cd tla/
Expand Down
32 changes: 27 additions & 5 deletions tla/consensus/MCccfraft.tla
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
EXTENDS ccfraft, TLC

1Configuration == <<{NodeOne, NodeTwo, NodeThree}>>
2Configurations == <<{NodeOne}, {NodeTwo}>>
3Configurations == <<{NodeOne}, {NodeOne, NodeTwo}, {NodeTwo}>>

CONSTANT Configurations
Expand All @@ -21,10 +22,13 @@ CCF == INSTANCE ccfraft
\* This file controls the constants as seen below.
\* In addition to basic settings of how many nodes are to be model checked,
\* the model allows to place additional limitations on the state space of the program.

\* Limit the reconfigurations to the next configuration in Configurations
MCChangeConfigurationInt(i, newConfiguration) ==
/\ reconfigurationCount < Len(Configurations)
/\ reconfigurationCount < Len(Configurations)-1
\* +1 because TLA+ sequences are 1-index
/\ newConfiguration = Configurations[reconfigurationCount+1]
\* +1 to get the next configuration
/\ newConfiguration = Configurations[reconfigurationCount+2]
/\ CCF!ChangeConfigurationInt(i, newConfiguration)

\* Limit the terms that can be reached. Needs to be set to at least 3 to
Expand All @@ -46,7 +50,7 @@ MCTimeout(i) ==
/\ CCF!Timeout(i)

\* Limit on client requests
RequestLimit == 2
RequestLimit == 3

\* Limit number of requests (new entries) that can be made
MCClientRequest(i) ==
Expand Down Expand Up @@ -90,7 +94,25 @@ MCNotifyCommit(i,j) ==
MCInMaxSimultaneousCandidates(i) ==
Cardinality({ s \in GetServerSetForIndex(i, commitIndex[i]) : state[s] = Candidate}) < 1

mc_spec == Spec
\* Alternative to CCF!InitReconfigurationVars that sets the initial configuration to the first config defined in Configurations
MCInitReconfigurationVars ==
/\ reconfigurationCount = 0
/\ removedFromConfiguration = {}
/\ configurations = [i \in Servers |-> 0 :> Configurations[1]]

\* Alternative to CCF!Init that uses the above MCInitReconfigurationVars
MCInit ==
/\ MCInitReconfigurationVars
/\ CCF!InitMessagesVars
/\ CCF!InitServerVars
/\ CCF!InitCandidateVars
/\ CCF!InitLeaderVars
/\ CCF!InitLogVars

\* Alternative to CCF!Spec that uses the above MCInit
mc_spec ==
/\ MCInit
/\ [][Next]_vars

\* Symmetry set over possible servers. May dangerous and is only enabled
\* via the Symmetry option in cfg file.
Expand All @@ -103,7 +125,7 @@ View == << reconfigurationVars, <<messages, commitsNotified>>, serverVars, candi

AllReconfigurationsCommitted ==
\E s \in ToServers:
\A c \in ToSet(Configurations):
\A c \in ToSet(Tail(Configurations)):
\E i \in DOMAIN Committed(s):
/\ HasTypeReconfiguration(Committed(s)[i])
/\ Committed(s)[i].configuration = c
Expand Down
80 changes: 80 additions & 0 deletions tla/consensus/MCccfraftAtomicReconfig.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
SPECIFICATION mc_spec

CONSTANTS
Configurations <- 2Configurations
Servers <- ToServers

MaxTermLimit = 4
MaxCommitsNotified = 2

Timeout <- MCTimeout
Send <- MCSend
ClientRequest <- MCClientRequest
SignCommittableMessages <- MCSignCommittableMessages
ChangeConfigurationInt <- MCChangeConfigurationInt
NotifyCommit <- MCNotifyCommit

Nil = Nil

Follower = Follower
Candidate = Candidate
Leader = Leader
RetiredLeader = RetiredLeader
Pending = Pending

RequestVoteRequest = RequestVoteRequest
RequestVoteResponse = RequestVoteResponse
AppendEntriesRequest = AppendEntriesRequest
AppendEntriesResponse = AppendEntriesResponse
NotifyCommitMessage = NotifyCommitMessage
ProposeVoteRequest = ProposeVoteRequest

OrderedNoDup = OrderedNoDup
Ordered = Ordered
ReorderedNoDup = ReorderedNoDup
Reordered = Reordered
Guarantee = OrderedNoDup

TypeEntry = Entry
TypeSignature = Signature
TypeReconfiguration = Reconfiguration

NodeOne = n1
NodeTwo = n2
NodeThree = n3
NodeFour = n4
heidihoward marked this conversation as resolved.
Show resolved Hide resolved
NodeFive = n5

SYMMETRY Symmetry
VIEW View

CHECK_DEADLOCK
FALSE

PROPERTIES
CommittedLogAppendOnlyProp
MonotonicTermProp
MonotonicMatchIndexProp
PermittedLogChangesProp
StateTransitionsProp
PendingBecomesFollowerProp
NeverCommitEntryPrevTermsProp

INVARIANTS
LogInv
MoreThanOneLeaderInv
CandidateTermNotInLogInv
ElectionSafetyInv
LogMatchingInv
QuorumLogInv
MoreUpToDateCorrectInv
LeaderCompletenessInv
SignatureInv
TypeInv
MonoTermInv
MonoLogInv
LogConfigurationConsistentInv
NoLeaderInTermZeroInv
MatchIndexLowerBoundNextIndexInv
CommitCommittableIndices
CommittableIndicesAreKnownSignaturesInv