|
115 | 115 | -- |
116 | 116 | -- > j ╔════════╗ |
117 | 117 | -- > ╭────────── ║ Dynamo ║ ◀─────────╮ |
118 | | --- > │ ╭──╚════════╝ │f |
| 118 | +-- > │ ╭─ ╚════════╝ │f |
119 | 119 | -- > ▼ │ ▲ │ |
120 | 120 | -- > ┌────────────┐ │ │ k ┌──────────┐ |
121 | 121 | -- > │ Disengaged │ ◀─│─────────│────────── │ Objector │ |
|
124 | 124 | -- > l│ g│ │e b │ │ │ |
125 | 125 | -- > │ │ │ ╭─────╯ i│ │c |
126 | 126 | -- > ╭╌╌╌▼╌╌╌▼╌╌╌╌╌╌╌╌╌╌╌╌╌│╌╌╌╌╌╌╌╌╌╌│╌▼╌╌╌╮ |
127 | | --- > ┆ ╔═══════╗ a ┌──────┐ d ┌─────┐ | |
128 | | --- > ┆ ║ Happy ║ ───▶ │ LFI* │ ───▶ │ FI* │ | |
129 | | --- > ┆ ╚═══════╝ ◀─╮ └──────┘ └─────┘ | |
130 | | --- > ┆ Jumper ╰─────┴────────────╯h | |
| 127 | +-- > ┆ ╔═══════╗ a ┌──────┐ d ┌─────┐ ┆ |
| 128 | +-- > ┆ ║ Happy ║ ───▶ │ LFI* │ ───▶ │ FI* │ ┆ |
| 129 | +-- > ┆ ╚═══════╝ ◀─╮ └──────┘ └─────┘ ┆ |
| 130 | +-- > ┆ Jumper ╰─────┴────────────╯h ┆ |
131 | 131 | -- > ╰╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╯ |
132 | 132 | -- |
133 | 133 | -- *: LookingForIntersection and FoundIntersection, abbreviated for this |
134 | 134 | -- drawing only; this abbreviation will not be used elsewhere. |
135 | 135 | -- |
| 136 | +-- In the following walk-through, we will point to transitions in the drawing |
| 137 | +-- between parentheses, like so: (a) (b+c) (e|f). We will use `+` to express |
| 138 | +-- that both transitions happen simultaneously (for different peers) and `|` to |
| 139 | +-- express a choice. |
| 140 | +-- |
136 | 141 | -- A new peer starts as the dynamo if there is no other peer or as a Happy |
137 | 142 | -- jumper otherwise. The dynamo periodically requests jumps from happy |
138 | | --- jumpers who, in the ideal case, accept them. |
| 143 | +-- jumpers who, in the ideal case, accept them and remain happy jumpers. |
139 | 144 | -- |
140 | 145 | -- In the event that a jumper rejects a jump, it goes from Happy to LFI* (a). |
141 | 146 | -- From there starts a back-and-forth of intersection search messages until |
142 | 147 | -- the exact point of disagreement with the dynamo is found. |
143 | 148 | -- |
144 | 149 | -- Once the exact point of disagreement is found, and if there is no objector |
145 | 150 | -- yet, the jumper becomes the objector (b). If there is an objector, then we |
146 | | --- compare the intersections of the objector and the jumper. If the jumper's |
147 | | --- intersection is strictly older, then the jumper replaces the objector (b+c). |
| 151 | +-- compare the intersection of the objector with the dynamo and the intersection |
| 152 | +-- of the jumper with the dynamo. If the jumper's intersection is strictly |
| 153 | +-- older, then the jumper replaces the objector, who is marked as FI* (b+c). |
148 | 154 | -- Otherwise, the jumper is marked as FI* (d). |
149 | 155 | -- |
150 | 156 | -- If the dynamo disconnects or is disengaged, one peer is elected as the new |
151 | | --- dynamo (e|f) and all other peers revert to being happy jumpers (g+h). |
| 157 | +-- dynamo (e|f) and all the other peers revert to being happy jumpers (g+h). |
152 | 158 | -- |
153 | 159 | -- If the objector disconnects or is disengaged, and there are FI* jumpers, then |
154 | 160 | -- the one with the oldest intersection with the dynamo gets elected (i). |
| 161 | +-- Otherwise, we are left with no dynamo. |
155 | 162 | -- |
156 | 163 | -- If the dynamo rolls back to a point older than the last jump it requested, it |
157 | | --- is disengaged (j) and a new dynamo is elected (e|f). |
| 164 | +-- is disengaged (j), a new dynamo is elected (e|f), and all the other peers |
| 165 | +-- revert to being happy jumpers (g+h). |
158 | 166 | -- |
159 | 167 | -- If the objector agrees with the dynamo, it is disengaged (k). If there are |
160 | 168 | -- FI* jumpers, then one of them gets elected as the new objector (i). |
| 169 | +-- Otherwise, we are left with no dynamo. |
161 | 170 | -- |
162 | | --- If dynamo or objector claim to have no more headers, they are disengaged |
163 | | --- (j|k). |
| 171 | +-- If the dynamo or the objector claim to have no more headers, they are |
| 172 | +-- disengaged (j|k), triggering the same chain of effect as described in the two |
| 173 | +-- previous points. |
164 | 174 | -- |
165 | 175 | -- The BlockFetch logic can ask to change the dynamo if it is not serving blocks |
166 | 176 | -- fast enough. If there are other non-disengaged peers, the dynamo (and the |
167 | | --- objector if there is one) is demoted to a jumper (l+g) and a new dynamo is |
168 | | --- elected. |
| 177 | +-- objector if there is one, and all the other peers) is demoted to a happy |
| 178 | +-- jumper (l+g+h) and a new dynamo is elected (e). |
169 | 179 | -- |
170 | 180 | module Ouroboros.Consensus.MiniProtocol.ChainSync.Client.Jumping ( |
171 | 181 | Context |
|
0 commit comments