From 65a3cc54f00a1f8bdc8db8ed96040df45c96e08e Mon Sep 17 00:00:00 2001 From: Philipp Gackstatter Date: Wed, 29 Nov 2023 15:57:22 +0100 Subject: [PATCH] Add Genesis Slot to timestamp-slot conversion --- tips/TIP-0046/tip-0046.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tips/TIP-0046/tip-0046.md b/tips/TIP-0046/tip-0046.md index ed153e7a6..f563e8b18 100644 --- a/tips/TIP-0046/tip-0046.md +++ b/tips/TIP-0046/tip-0046.md @@ -67,14 +67,14 @@ slots and each slot is `Slot Duration In Seconds` seconds in length. ### Slot Index Each slot has a corresponding slot index, which is a `uint32`. To calculate the slot index of a timestamp, the protocol -parameters `Genesis Unix Timestamp` and `Slot Duration In Seconds` are used. The slot index of a Unix timestamp -`Unix Timestamp` (in seconds) is calculated as follows: +parameters `Genesis Slot`, `Genesis Unix Timestamp` and `Slot Duration In Seconds` are used. The slot index of a Unix +timestamp `Unix Timestamp` (in seconds) is calculated as follows: - Compute `Elapsed Time` as `Unix Timestamp - Genesis Unix Timestamp`. -- If `Elapsed Time < 0`, the slot index is `0`. -- Otherwise the slot index is `Elapsed Time/Slot Duration In Seconds + 1`. - - Note: The `+ 1` is required because slots are counted starting from `1` with `0` being reserved for times before the - genesis, which has to be addressable as its own slot. +- If `Elapsed Time < 0`, the slot index is `Genesis Slot`. +- Otherwise the slot index is `Genesis Slot + Elapsed Time/Slot Duration In Seconds + 1`. + - Note: The `+ 1` is required because slots are counted starting from `1`. `0` is reserved for times before the + genesis (if `Genesis Slot = 0`), which has to be addressable as its own slot. ### Epoch Index