Skip to content

Commit 3c7fe53

Browse files
authored
fix: replace SLOTS_PER_EPOCH with JUSTIFICATION_LOOKBACK_SLOTS (leanEthereum#23)
* fix: replace SLOTS_PER_EPOCH with SLOTS_JUSTIFICATION_LOOKBACK * fix: rename * fix: fmt
1 parent 0ac7352 commit 3c7fe53

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

src/lean_spec/subspecs/chain/config.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
SECONDS_PER_SLOT: Final = SLOT_DURATION_MS // 1000
1919
"""The fixed duration of a single slot in seconds."""
2020

21-
SLOTS_PER_EPOCH: Final = 96
22-
"""The number of slots in an epoch."""
21+
JUSTIFICATION_LOOKBACK_SLOTS: Final = 3
22+
"""The number of slots to lookback for justification."""
2323

2424
PROPOSER_REORG_CUTOFF_BPS: Final = 2500
2525
"""
@@ -81,7 +81,7 @@ class _ChainConfig(BaseModel):
8181
# Time Parameters
8282
slot_duration_ms: Uint64
8383
second_per_slot: Uint64
84-
slots_per_epoch: Uint64
84+
justification_lookback_slots: Uint64
8585
proposer_reorg_cutoff_bps: BasisPoint
8686
vote_due_bps: BasisPoint
8787
fast_confirm_due_bps: BasisPoint
@@ -96,7 +96,7 @@ class _ChainConfig(BaseModel):
9696
DEVNET_CONFIG: Final = _ChainConfig(
9797
slot_duration_ms=SLOT_DURATION_MS,
9898
second_per_slot=SECONDS_PER_SLOT,
99-
slots_per_epoch=SLOTS_PER_EPOCH,
99+
justification_lookback_slots=JUSTIFICATION_LOOKBACK_SLOTS,
100100
proposer_reorg_cutoff_bps=PROPOSER_REORG_CUTOFF_BPS,
101101
vote_due_bps=VOTE_DUE_BPS,
102102
fast_confirm_due_bps=FAST_CONFIRM_DUE_BPS,

src/lean_spec/subspecs/networking/gossipsub.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,12 @@ class GossipsubParameters(StrictBaseModel):
3939
"""The number of history windows to gossip about."""
4040

4141
seen_ttl_secs: int = (
42-
DEVNET_CONFIG.second_per_slot * DEVNET_CONFIG.slots_per_epoch * 2
42+
DEVNET_CONFIG.second_per_slot
43+
* DEVNET_CONFIG.justification_lookback_slots
44+
* 2
4345
)
4446
"""
4547
The expiry time in seconds for the cache of seen message IDs.
4648
47-
This is calculated as SECONDS_PER_SLOT * SLOTS_PER_EPOCH * 2.
49+
This is calculated as SECONDS_PER_SLOT * JUSTIFICATION_LOOKBACK_SLOTS * 2.
4850
"""

0 commit comments

Comments
 (0)