From a2661d2cb71aaf221beeca64a5eda3ebefe33fdd Mon Sep 17 00:00:00 2001 From: Philipp Gackstatter Date: Fri, 16 Feb 2024 08:44:44 +0800 Subject: [PATCH] Account for Genesis Slot in Epoch index calc --- tips/TIP-0046/tip-0046.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tips/TIP-0046/tip-0046.md b/tips/TIP-0046/tip-0046.md index cb4a8a033..34f3d381b 100644 --- a/tips/TIP-0046/tip-0046.md +++ b/tips/TIP-0046/tip-0046.md @@ -80,8 +80,11 @@ timestamp `Unix Timestamp` (in seconds) is calculated as follows: Each epoch has a corresponding epoch index, which is a `uint32`. To calculate the epoch index of a slot index, that is, the index of the epoch to which the slot belongs, the protocol parameter `Slots Per Epoch Exponent` is used. The epoch -index of a slot index `Slot Index` is `Slot Index >> Slots Per Epoch Exponent`, where `>>` is the _zero-fill -right-shift_ or _logical shift_ operation. +index of a slot index `Slot Index` is calculated as follows: + +- If `Slot Index <= Genesis Slot` then the epoch index is `0`. +- Otherwise the epoch index is `(Slot Index - Genesis Slot) >> Slots Per Epoch Exponent)`, where `>>` is the _zero-fill + right-shift_ or _logical shift_ operation. ## Slot Commitment