Skip to content

Commit

Permalink
638-Allow next leadership-schedule at 4k/f
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewWestberg committed Sep 15, 2024
1 parent eb2108c commit 7aa8b65
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cardano-api/internal/Cardano/Api/LedgerState.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1791,12 +1791,12 @@ nextEpochEligibleLeadershipSlots sbe sGen serCurrEpochState ptclState poolid (Vr
first LeaderErrSlotRangeCalculationFailure $
Slot.epochInfoRange eInfo (currentEpoch `Slot.addEpochInterval` Slot.EpochInterval 1)

-- First we check if we are within 3k/f slots of the end of the current epoch.
-- First we check if we are within 4k/f slots of the end of the current epoch.
-- Why? Because the stake distribution is stable at this point.
-- k is the security parameter
-- f is the active slot coefficient
let stabilityWindowR :: Rational
stabilityWindowR = fromIntegral (3 * sgSecurityParam sGen) / Ledger.unboundRational (sgActiveSlotsCoeff sGen)
stabilityWindowR = fromIntegral (4 * sgSecurityParam sGen) / Ledger.unboundRational (sgActiveSlotsCoeff sGen)
stabilityWindowSlots :: SlotNo
stabilityWindowSlots = fromIntegral @Word64 $ floor $ fromRational @Double stabilityWindowR
stableStakeDistribSlot = currentEpochLastSlot - stabilityWindowSlots
Expand Down

0 comments on commit 7aa8b65

Please sign in to comment.