Skip to content

Commit 3dea699

Browse files
committed
Update SimulatorModel.md
1 parent 15731aa commit 3dea699

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

simulation/docs/SimulatorModel.md

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ Each EB (see `LeiosProtocol.Common.EndorseBlock`) consists of the following fiel
9696

9797
More details for some fields.
9898

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.
100101
- If the Leios variant is set to `short`, this EB includes no EB IDs.
101102
- 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.
102103
- 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.
129130
- A VB from iteration `i` includes the IDs of all EBs that satisfy the following.
130131
- The EB must have already been adopted.
131132
- 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.
134137
- 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`.
135138
(TODO the `zipWith` is suspicious; whether it would misbehave in various scenarios depends on many implementation details.)
136139
- 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?
192195
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.
193196
Once that finishes, the Relay logic will decide whether it needs to fetch the body.
194197

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.
196199
- 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.
197200
- 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.
198201

@@ -233,7 +236,9 @@ Because those threads use STM to read both the state of pending tasks as well as
233236

234237
The existence of those threads enable very simple logic for the adoption tasks.
235238

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.
237242
- 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`.
238243
- The node adopts a validated VB by starting to diffuse it and adding it to `votesForEBVar`.
239244
- 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
245250
## Pruning threads
246251

247252
- *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`.
251254
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`.
252259
- *EBs 1*.
253260
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.
254261
See `relayEBState`, `votesForEBVar`, and `ibsNeededForEBVar`.
255-
- *VBs* and *IBs 2*.
262+
- *VBs*.
256263
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`.
259265
- *EBs 2*.
260266
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.
261267
(TODO these blocks should have stopped diffusing a long time ago, assuming `maxEndorseBlockAgeSlots >> sliceLength`)
@@ -281,7 +287,7 @@ TODO include `taskQueue`
281287

282288
TODO `relayIBState` abuse
283289

284-
TODO `ibDeliveryTimesVar`
290+
TODO `iBsForEBsAndVotesVar`
285291

286292
## Adopted EBs state
287293

0 commit comments

Comments
 (0)