-
Notifications
You must be signed in to change notification settings - Fork 78
/
Copy pathrelay-states.tex
134 lines (101 loc) · 4.12 KB
/
relay-states.tex
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[margin=1in]{geometry}
\usepackage{tikz}
\usepackage[colorlinks=true]{hyperref}
\usepackage{varwidth}
\usetikzlibrary{positioning}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{shapes.symbols}
\usetikzlibrary{calc}
\tikzset{
every node/.style={above},
start state/.style={draw,circle,text width=0},
state/.style={draw,circle,align=flush center,text width=2cm},
decision/.style={draw,rectangle,align=flush center},
thread/.style={draw,signal,signal to=east,fill=white},
% Nested states and decisions use doubled borders to indicate
% that you have to reference a different diagram.
nested state/.style={draw,circle,double,align=flush center},
nested decision/.style={draw,rectangle,double,align=flush center},
% Chain states and decisions use dashed borders to indicate
% that you have to interact with the chain.
chain state/.style={draw,circle,dashed,align=flush center,text width=2cm},
chain decision/.style={draw,rectangle,dashed,align=flush center},
chain transition/.style={draw,dashed},
% Nested chain decisions combine nested and chain styles to
% indicate a reference to a different diagram for a state that
% depends on chain interaction.
nested chain decision/.style={draw,rectangle,double,dashed,align=flush center},
% Set default arrow style to stealth.
>=Stealth
}
\begin{document}
Below are state diagrams elaborating on the various pieces of a Keep node. Note
that Keep nodes actually run multiple processes in parallel, for participation
in the random beacon threshold relay as well as for participating in the Keep
network. The startup diagram indicates this and links to the subprocess state
diagrams.
First, however, a legend:
\vspace{0.5cm}
\begin{center}
\tikz{
\node[thread] (thread) {A thread};
\node[nested state] (nested state) [below=1cm of thread] {A nested state};
\node[state] [left=1cm of nested state](state) {A regular state};
\node[chain state] (chain state) [right=1cm of nested state] {A state dependent on the chain};
\node[nested decision] (nested decision) [below=1cm of nested state] {A nested decision};
\node[decision] (decision) [left=1cm of nested decision] {A decision};
\node[chain decision,text width=2cm] (chain decision) [right=1cm of nested decision] {A decision dependent on the chain};
\draw [<-] (-4.5,0.25) -- node [centered,text width=2cm,align=center] {state\\transition} (-2.5,0.25);
\draw [->,dashed] (2,0.25) -- node [centered,text width=4cm,align=center] {chain-dependent\\state transition} (5.25,0.25)
}
\end{center}
\vspace{0.5cm}
Nested states and decisions should link to the nested diagrams that indicate
what is going on within these states or decisions.
\vspace{0.5cm}
\begin{center}
\input{img-src/startup-diagram.tikz}
\vspace{0.5cm}
Keep node startup process: processes run in parallel
\end{center}
\clearpage
\begin{figure}
\centering
\input{img-src/relay-group-initialization.tikz}
\caption{\label{fig:relay-group-initialization}Relay Group Initialization}
\end{figure}
\begin{figure}
\centering
\input{img-src/relay-group-assignment.tikz}
\caption{\label{fig:relay-group-assignment}Relay Group Assignment}
\vspace{0.5cm}
% Mildly abusing the itemize env...
\begin{itemize}
\item[*] Note that eligibility checking is done by combining the latest relay
entry with the latest participant registry in a way specified outside
this document.
\end{itemize}
\end{figure}
\begin{figure}
\centering
\input{img-src/relay-group-setup.tikz}
\caption{\label{fig:relay-group-setup}Relay Group Setup}
\end{figure}
\begin{figure}
\centering
\input{img-src/relay-entry-request-processing.tikz}
\caption{\label{fig:relay-entry-request-processing}Relay Entry Request Processing}
\end{figure}
\begin{figure}
\centering
\input{img-src/libp2p-join.tikz}
\caption{\label{fig:libp2p-join}{\tt libp2p} Join Process}
\end{figure}
\begin{figure}
\centering
\input{img-src/relay-entry-verification.tikz}
\caption{\label{fig:relay-entry-verification}Relay Entry Verification}
\end{figure}
\end{document}