Skip to content

Commit 3be0eef

Browse files
committed
fix error in Sailfish
1 parent bffcef5 commit 3be0eef

File tree

6 files changed

+22
-14
lines changed

6 files changed

+22
-14
lines changed

specifications/dag-consensus/Sailfish.tla

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ INSTANCE BlockDag \* Import definitions related to DAGs of blocks
3030
es = {}; \* the edges of the DAG
3131
define {
3232
dag == <<vs, es>>
33-
NoLeaderVoteQuorum(r, deliveredVertices, add) ==
34-
LET NoLeaderVote == {v \in deliveredVertices : LeaderVertex(r-1) \notin Children(dag, v)}
33+
NoLeaderVoteQuorum(r, vertices, add) ==
34+
LET NoLeaderVote == {v \in vertices : LeaderVertex(r-1) \notin Children(dag, v)}
3535
IN IsQuorum({Node(v) : v \in NoLeaderVote} \cup add)
3636
}
3737
process (correctNode \in N \ F)
@@ -63,7 +63,7 @@ l0: while (TRUE) {
6363
\* have evidence it cannot commit:
6464
if (Leader(r) = self)
6565
await \/ LeaderVertex(r-1) \in deliveredVertices
66-
\/ NoLeaderVoteQuorum(r, deliveredVertices, {self});
66+
\/ NoLeaderVoteQuorum(r, {v \in vs : Round(v) = r}, {self});
6767
\* create a new vertex:
6868
with (newV = <<self, r>>) {
6969
vs := vs \cup {newV};
@@ -104,14 +104,14 @@ l0: while (TRUE) {
104104
}
105105
}
106106
}*)
107-
\* BEGIN TRANSLATION (chksum(pcal) = "444b3304" /\ chksum(tla) = "3580c6e5")
107+
\* BEGIN TRANSLATION (chksum(pcal) = "c16dfa43" /\ chksum(tla) = "9cdbd4f5")
108108
\* Label l0 of process correctNode at line 42 col 9 changed to l0_
109109
VARIABLES vs, es
110110

111111
(* define statement *)
112112
dag == <<vs, es>>
113-
NoLeaderVoteQuorum(r, deliveredVertices, add) ==
114-
LET NoLeaderVote == {v \in deliveredVertices : LeaderVertex(r-1) \notin Children(dag, v)}
113+
NoLeaderVoteQuorum(r, vertices, add) ==
114+
LET NoLeaderVote == {v \in vertices : LeaderVertex(r-1) \notin Children(dag, v)}
115115
IN IsQuorum({Node(v) : v \in NoLeaderVote} \cup add)
116116

117117
VARIABLES round, log
@@ -142,7 +142,7 @@ correctNode(self) == IF round[self] = 0
142142
\/ NoLeaderVoteQuorum(r-1, deliveredVertices, {})
143143
/\ IF Leader(r) = self
144144
THEN /\ \/ LeaderVertex(r-1) \in deliveredVertices
145-
\/ NoLeaderVoteQuorum(r, deliveredVertices, {self})
145+
\/ NoLeaderVoteQuorum(r, {v \in vs : Round(v) = r}, {self})
146146
ELSE /\ TRUE
147147
/\ LET newV == <<self, r>> IN
148148
/\ vs' = (vs \cup {newV})

specifications/dag-consensus/TLCSailfish1.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
SPECIFICATION Spec
1+
SPECIFICATION TerminatingSpec
22

33
CONSTANTS
44
n1 = n1

specifications/dag-consensus/TLCSailfish1.tla

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ CONSTANTS
1717

1818
N == {n1,n2,n3}
1919
F == {n1}
20-
R == 1..4
20+
R == 1..5
2121
IsQuorum(Q) == Q \in {{n1,n3},{n2,n3},{n1,n2,n3}}
2222
IsBlocking(B) == B \in {{n3},{n1,n3},{n2,n3},{n1,n2,n3}}
2323
LeaderSchedule == <<n1,n2,n3>>
2424
Leader(r) == LeaderSchedule[((r-1) % Cardinality(N))+1]
25-
GST == 2
25+
GST == 3
2626

2727
INSTANCE Sailfish
2828

@@ -31,6 +31,10 @@ INSTANCE Sailfish
3131
(**************************************************************************************)
3232
StateConstraint == \A n \in N \ F : round[n] \in 0..Max(R)
3333

34+
Done == \A n \in N \ F : round[n] = Max(R)
35+
Terminate == Done /\ UNCHANGED <<vs, es, round, log>>
36+
TerminatingSpec == Init /\ [][Next \/ Terminate]_<<vs, es, round, log>>
37+
3438
(**************************************************************************************)
3539
(* Finally, we give some properties we expect to be violated (useful to get the *)
3640
(* model-checker to print interesting executions). *)

specifications/dag-consensus/TLCSailfish2.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
SPECIFICATION Spec
1+
SPECIFICATION TerminatingSpec
22

33
CONSTANTS
44
n1 = n1

specifications/dag-consensus/TLCSailfish2.tla

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,8 @@ INSTANCE Sailfish
2626

2727
StateConstraint == \A n \in N \ F : round[n] \in 0..Max(R)
2828

29+
Done == \A n \in N \ F : round[n] = Max(R)
30+
Terminate == Done /\ UNCHANGED <<vs, es, round, log>>
31+
TerminatingSpec == Init /\ [][Next \/ Terminate]_<<vs, es, round, log>>
32+
2933
===========================================================================

specifications/dag-consensus/manifest.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@
4141
"runtime": "00:00:10",
4242
"mode": "exhaustive search",
4343
"result": "success",
44-
"distinctStates": 5158,
45-
"totalStates": 13180,
46-
"stateDepth": 13
44+
"distinctStates": 109604,
45+
"totalStates": 314144,
46+
"stateDepth": 16
4747
}
4848
]
4949
},

0 commit comments

Comments
 (0)