Skip to content

Commit ba7639a

Browse files
committed
docs: slots and intervals
1 parent ab880e7 commit ba7639a

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

docs/slots_and_intervals.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Slots and Intervals
2+
3+
A Lean Chain slot has a duration of 4 seconds and is divided in 5 intervals:
4+
5+
1. Block proposal
6+
2. Vote propagation
7+
3. Vote aggregation
8+
4. Safe target computation
9+
5. Head update
10+
11+
```text
12+
ONE SLOT (4000 ms)
13+
┌────────────┬────────────┬────────────┬────────────┬────────────┐
14+
│ Interval 0 │ Interval 1 │ Interval 2 │ Interval 3 │ Interval 4 │
15+
│ t+0 ms │ t+800 ms │ t+1600 ms │ t+2400 ms │ t+3200 ms │
16+
├────────────┼────────────┼────────────┼────────────┼────────────┤
17+
│ block │ vote │ vote │ safe target│ head │
18+
│ proposal │propagation │aggregation │computation │ update │
19+
└────────────┴────────────┴────────────┴────────────┴────────────┘
20+
```
21+
22+
Block proposal is the first interval of a slot. During this interval, a block proposer, selected in a round-robin fashion, proposes a new block and gossips it to the network. Right before building the block, the proposer merges their "new attestations buffer" into their fork-choice view. They then include attestations that the proposer has recently seen into their block. Other validators verify the block and its contents, and merge the votes it includes into their fork-choice view. After importing a block, all validators recompute their [head](./lmd_ghost.md), and update the latest [finalized and justified checkpoints](./3sf_mini.md) according to the block's post-state.
23+
24+
Vote propagation is the second interval of a slot. During this interval, validators gossip their votes for the block they consider to be the head of the chain, and append to it a `(source, target)` [finality vote](./3sf_mini.md). These votes are in aggregation subnets and are imported by aggregators. Aggregators verify the votes in their subnet and store them for later aggregation.
25+
26+
Vote aggregation is the third interval of a slot. During this interval, aggregators aggregate the votes they have received and gossip the resulting aggregated attestations to the network. These aggregated attestations are imported by all validators, who verify and store them in a "new attestations buffer".
27+
28+
Safe target computation is the fourth interval of a slot. During this interval, validators compute the [safe target](./lmd_ghost.md#safe-target-selection) they'll use when deciding which finality vote to cast on the next slot. The safe target is computed based on the votes received in the current slot.
29+
30+
Head update is the fifth and final interval of a slot. During this interval, validators merge the aggregated attestations they have in their "new attestations buffer" into their fork-choice view, and recompute their head.
31+
32+
> **In ethlambda:** the intervals are the `SlotInterval` variants in
33+
> `crates/blockchain/src/lib.rs`, and their length comes from
34+
> `MILLISECONDS_PER_INTERVAL` and `INTERVALS_PER_SLOT` in
35+
> `crates/common/types/src/constants.rs`. Block proposal is merged into the
36+
> previous slot's head-update interval: the proposer advances its store to the
37+
> next slot, builds the block there, and holds publication until the slot
38+
> boundary. That buys the build one extra interval of headroom and leaves no
39+
> actor work at the block-proposal tick itself.

0 commit comments

Comments
 (0)