Skip to content

Commit

Permalink
Refactor hardcoded set of all Servers out of ccfraft.
Browse files Browse the repository at this point in the history
  • Loading branch information
lemmy committed Oct 31, 2023
1 parent 40a3783 commit 0afd920
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 28 deletions.
2 changes: 0 additions & 2 deletions tla/consensus/MCccfraft.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ CONSTANTS
NodeOne = n1
NodeTwo = n2
NodeThree = n3
NodeFour = n4
NodeFive = n5

SYMMETRY Symmetry
VIEW View
Expand Down
3 changes: 3 additions & 0 deletions tla/consensus/MCccfraft.tla
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---------- MODULE MCccfraft ----------
EXTENDS ccfraft, TLC

CONSTANTS
NodeOne, NodeTwo, NodeThree

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

Expand Down
2 changes: 0 additions & 2 deletions tla/consensus/MCccfraftWithReconfig.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ CONSTANTS
NodeOne = n1
NodeTwo = n2
NodeThree = n3
NodeFour = n4
NodeFive = n5

SYMMETRY Symmetry
VIEW View
Expand Down
3 changes: 3 additions & 0 deletions tla/consensus/SIMccfraft.tla
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---------- MODULE SIMccfraft ----------
EXTENDS ccfraft, TLC, Integers

CONSTANTS
NodeOne, NodeTwo, NodeThree, NodeFour, NodeFive

Servers_mc == {NodeOne, NodeTwo, NodeThree, NodeFour, NodeFive}

----
Expand Down
1 change: 0 additions & 1 deletion tla/consensus/Traceccfraft.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ CHECK_DEADLOCK

CONSTANTS
Servers <- TraceServers
AllServers <- TraceServers

\* Redefine the AppendEntries batch size to model empty and batches with arbitrary size.
AppendEntriesBatchsize <- TraceAppendEntriesBatchsize
Expand Down
3 changes: 3 additions & 0 deletions tla/consensus/Traceccfraft.tla
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ JsonServers ==

ASSUME JsonServers \in Nat \ {0}

CONSTANTS
NodeOne, NodeTwo, NodeThree, NodeFour, NodeFive

TraceServers ==
Range(SubSeq(<<NodeOne, NodeTwo, NodeThree, NodeFour, NodeFive>>, 1, JsonServers))
ASSUME TraceServers \subseteq Servers
Expand Down
24 changes: 1 addition & 23 deletions tla/consensus/ccfraft.tla
Original file line number Diff line number Diff line change
Expand Up @@ -81,25 +81,9 @@ CONSTANTS
TypeSignature,
TypeReconfiguration

CONSTANTS
NodeOne,
NodeTwo,
NodeThree,
NodeFour,
NodeFive

AllServers == {
NodeOne,
NodeTwo,
NodeThree,
NodeFour,
NodeFive
}

\* Set of nodes for this model
CONSTANTS Servers
ASSUME Servers /= {}
ASSUME Servers \subseteq AllServers
ASSUME Servers /= {} /\ IsFiniteSet(Servers)

Nil ==
(*************************************************************************)
Expand Down Expand Up @@ -1401,12 +1385,6 @@ DebugInvLeaderCannotStepDown ==
/\ currentTerm[m.source] = m.term
=> state[m.source] = Leader

\* This invariant shows that it should be possible for Node 4 or 5 to become leader
\* Note that symmetry for the set of servers should be disabled to check this debug invariant
DebugInvReconfigLeader ==
/\ state[NodeFour] /= Leader
/\ state[NodeFive] /= Leader

\* This invariant shows that a txn can be committed after a reconfiguration
DebugInvSuccessfulCommitAfterReconfig ==
\lnot (
Expand Down

0 comments on commit 0afd920

Please sign in to comment.