You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: simulation/docs/SimulatorModel.md
+18-12Lines changed: 18 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -96,7 +96,8 @@ Each EB (see `LeiosProtocol.Common.EndorseBlock`) consists of the following fiel
96
96
97
97
More details for some fields.
98
98
99
-
- An EB from iteration `i` includes the IDs of all IBs that were already adopted, are also from iteration `i`, and arrived before the end of `i`'s Deliver2 stage.
99
+
- If `leios-late-ib-inclusion` is disabled, an EB from iteration `i` includes the IDs of all IBs that were already adopted, are also from iteration `i`, and arrived before the end of `i`'s Deliver2 stage.
100
+
- If `leios-late-ib-inclusion` is enabled, an EB from iteration `i` includes the IDs of all IBs that were already adopted, are from an iteration `j` in the closed interval `[max 0 (i-2), i]`, and arrived before the end of `j`'s contemporary Deliver2 stage.
100
101
- If the Leios variant is set to `short`, this EB includes no EB IDs.
101
102
- If the Leios variant is set to `full`, an EB from iteration `i` includes the ID of the best eligible EB from each iteration with any eligible EBs.
102
103
- An eligible EB has already been adopted, has already been certified, and is from an iteration in the closed interval `[i - min i (2 + pipelinesToReferenceFromEB), i-3]`.
@@ -129,8 +130,10 @@ More details for some fields.
129
130
- A VB from iteration `i` includes the IDs of all EBs that satisfy the following.
130
131
- The EB must have already been adopted.
131
132
- The EB must also be from iteration `i`.
132
-
- The EB must only include IBs that have already been adopted, are from iteration `i`, and arrived before the end of `i`'s Endorse stage.
133
-
- The EB must include all IBs that have already been adopted, are from iteration `i`, and arrived before the end of `i`'s Deliver1 stage.
133
+
- If `leios-late-ib-inclusion` is disabled, the EB must only include IBs that have already been adopted, are from iteration `i`, and arrived before the end of `i`'s Endorse stage.
134
+
- If `leios-late-ib-inclusion` is disabled, the EB must include all IBs that have already been adopted, are from iteration `i`, and arrived before the end of `i`'s Deliver1 stage.
135
+
- If `leios-late-ib-inclusion` is enabled, the EB must only include IBs that have already been adopted, are from an iteration `j` in the closed interval `[max 0 (i-2), i]`, and arrived before the end of `j`'s Endorse stage.
136
+
- If `leios-late-ib-inclusion` is enabled, the EB must include all IBs that have already been adopted, are from an iteration `j` in the closed interval `[max 0 (i-2), i]`, and arrived before the end of `j`'s Deliver1 stage.
134
137
- If the Leios variant is set to `full`, then let X be the EB's included EBs in iteration order; let Y be the EBs this node would have considered eligible if it were to retroactively create an EB for iteration `i` right now with the only extra restriction being ignore EBs that arrived within Δ_hdr of the end of iteration `i`; then `and (zipWith elem X Y)` must be `True`.
135
138
(TODO the `zipWith` is suspicious; whether it would misbehave in various scenarios depends on many implementation details.)
136
139
- The byte size is computed as `voteBundleSizeBytesConstant + voteBundleSizeBytesPerEb * #EBs` (which implies the weighted-vote perspective).
@@ -192,7 +195,7 @@ TODO discuss the other Relay parameters, backpressure, pipelining, etc?
192
195
When an IB header arrives, its validation task is enqueued on the model CPU---for VBs and EBs it's just an ID, not a header, so there's no validation.
193
196
Once that finishes, the Relay logic will decide whether it needs to fetch the body.
194
197
195
-
- An IB body is not fetched if it's older than the slot to which the buffer as has already been pruned or if it's already in the buffer.
198
+
- An IB body is not fetched if it exists earlier than it should, it's being offered later than it should be, or if it's already in the buffer.
196
199
- An EB is not fetched if it's older than the slot to which the buffer has already been pruned, it's too old to be included by an RB (see `maxEndorseBlockAgeSlots`), or if it's already in the buffer.
197
200
- A VB is not fetched if it's older than the slot to which the buffer has already been pruned or if it's already in the buffer.
198
201
@@ -233,7 +236,9 @@ Because those threads use STM to read both the state of pending tasks as well as
233
236
234
237
The existence of those threads enable very simple logic for the adoption tasks.
235
238
236
-
- The node adopts a validated IB by starting to diffuse it, adding its `UTCTime` arrival to `ibDeliveryTimesVar`, and removing the IB from the todo lists in `ibsNeededForEBVar`.
239
+
- The node adopts a validated IB by starting to diffuse it, removing the IB from the todo lists in `ibsNeededForEBVar`, and recording its ID and which stage it arrived during.
240
+
See `iBsForEBsAndVotesVar`.
241
+
If it arrived during the IB's iteration's Propose stage (aka "early") or after the IB's iteration's Endorse stage (aka "tardy"), then the IB is discarded.
237
242
- The node adopts a validated EB by starting to diffuse it, adding it to `relayEBState`, and adding a corresponding todo list of the not-already-available IBs to `ibsNeededForEBVar`.
238
243
- The node adopts a validated VB by starting to diffuse it and adding it to `votesForEBVar`.
239
244
- The node adopts a validated RB by starting to diffuse it and including it whenever calculating its selection; see `preferredChain`.
@@ -245,17 +250,18 @@ The Relay component invokes the given callback when some object arrives, and tha
245
250
## Pruning threads
246
251
247
252
-*IBs 1*.
248
-
At the end of the Vote(Send) stage for iteration `i`, the node stops diffusing all IBs from `i`.
249
-
(TODO this should happen at the end of the Endorse stage, but this buffer is being abused as the adoption buffer as well.)
250
-
It also forgets any of those IBs it had adopted, with the exception of their arrival time, which is used when generating VBs.
253
+
At the end of the Endorse stage for iteration `i`, the node stops diffusing all IBs from `i`.
251
254
See `relayIBState`.
255
+
-*IBs 2*.
256
+
If `leios-late-ib-inclusion` is disabled, then at the end of the Vote(Send) stage for iteration `i`, the node forgets the arrival times of all IBs from `i`.
257
+
If `leios-late-ib-inclusion` is enabled, the node instead does that two stages later.
258
+
See `iBsForEBsAndVotesVar`.
252
259
-*EBs 1*.
253
260
At the end of the Vote(Recv) stage for iteration `i`, the node stops diffusing and completely forgets all EBs from `i` that are not already certified.
254
261
See `relayEBState`, `votesForEBVar`, and `ibsNeededForEBVar`.
255
-
-*VBs* and *IBs 2*.
262
+
-*VBs*.
256
263
At the end of the Vote(Recv) stage for iteration `i`, the node stops diffusing and completely forgets all VBs from `i`, except that certified EBs from `i` remember the ID and multiplicity of the VBs that first met quorum.
257
-
It also forgets the arrival time of IBs from `i`.
258
-
See `relayVoteState` and `ibDeliveryTimesVar`.
264
+
See `relayVoteState`.
259
265
-*EBs 2*.
260
266
If the Leios variant is set to `short`, then `maxEndorseBlockAgeSlots` after the end of the Endorse stage for iteration `i`, the node stops diffusing and forgets all EBs from `i` that were certified but are not included by an RB on the selected chain.
261
267
(TODO these blocks should have stopped diffusing a long time ago, assuming `maxEndorseBlockAgeSlots >> sliceLength`)
0 commit comments