-
Notifications
You must be signed in to change notification settings - Fork 4
/
MC_safety.tla
76 lines (57 loc) · 1.42 KB
/
MC_safety.tla
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
---- MODULE MC_safety ----
EXTENDS Mempool_global, TLC
NN == 3
char(n) ==
CASE n = 1 -> "a"
[] n = 2 -> "b"
[] n = 3 -> "c"
[] n = 4 -> "d"
[] n = 5 -> "e"
int_of_char(c) ==
CASE c = "a" -> 1
[] c = "b" -> 2
[] c = "c" -> 3
[] c = "d" -> 4
[] c = "e" -> 5
Ns == Map_set(1..NN, char)
exclude(n) == {n, char((int_of_char(n) % Cardinality(Ns)) + 1)}
----
Init_peers[ n \in Ns ] == Ns \ {n}
\* NN = 2
\* Init_connections[ n \in Ns ] == Ns \ {n}
\* NN = 3
\* a --- b --- c
Init_connections[ n \in Ns ] == IF n /= "b" THEN {"b"} ELSE {"a", "c"}
\* NN = 5
\* Init_connections[ n \in Ns ] ==
\* CASE n = "a" -> {"b", "c"}
\* [] n = "b" -> {"a", "c"}
\* [] n = "c" -> {"a", "b", "d"}
\* [] n = "d" -> {"c", "e"}
\* [] n = "e" -> {"d"}
Init_predecessor[ n \in Ns ] == block(0, <<>>)
Max_hops == 3
Min_connections == 1
Max_connections == 4
Min_endorsements == 2
Max_hash == 25
View == [
shell |-> [
peers |-> peers,
connections |-> connections,
messages |-> messages
],
pv |-> [
predecessor |-> predecessor,
branch_delayed |-> branch_delayed,
branch_refused |-> branch_refused,
refused |-> refused,
pending |-> pending,
advertisement |-> advertisement
],
mp |-> [
known_valid |-> known_valid,
mp_pending |-> mp_pending
]
]
==========================