From b435c9d0ee67e6eada16d76e7ac58e3586740b38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joosep=20J=C3=A4=C3=A4ger?= Date: Mon, 27 Jan 2025 10:59:56 +0000 Subject: [PATCH] Update eras/shelley/impl/src/Cardano/Ledger/Shelley/PoolRank.hs Co-authored-by: Alexey Kuleshevich --- eras/shelley/impl/src/Cardano/Ledger/Shelley/PoolRank.hs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/eras/shelley/impl/src/Cardano/Ledger/Shelley/PoolRank.hs b/eras/shelley/impl/src/Cardano/Ledger/Shelley/PoolRank.hs index 037d4cd0dbc..3ae7fc24a60 100644 --- a/eras/shelley/impl/src/Cardano/Ledger/Shelley/PoolRank.hs +++ b/eras/shelley/impl/src/Cardano/Ledger/Shelley/PoolRank.hs @@ -35,6 +35,7 @@ import Cardano.Ledger.BaseTypes ( NonZero (..), UnitInterval, activeSlotVal, + knownNonZero, knownNonZeroBounded, nonZeroOr, toIntegerNonZero, @@ -279,7 +280,7 @@ desirability :: PerformanceEstimate -> Coin -> Double -desirability (a0, nOpt) r pool (PerformanceEstimate p) totalStake = +desirability a0 nOpt r pool (PerformanceEstimate p) totalStake = if fTilde <= cost then 0 else (fTilde - cost) * (1 - margin) @@ -336,7 +337,8 @@ getTopRankedPoolsInternal rPot totalStake pp pdata = rankings = [ ( hk , desirability - (pp ^. ppA0L, (pp ^. ppNOptL) `nonZeroOr` knownNonZeroBounded @1) + (pp ^. ppA0L) + ((pp ^. ppNOptL) `nonZeroOr` knownNonZeroBounded @1) rPot pool ap @@ -362,7 +364,7 @@ nonMyopicStake :: Set (KeyHash 'StakePool) -> StakeShare nonMyopicStake pp (StakeShare s) (StakeShare sigma) (StakeShare t) kh topPools = - let z0 = 1 %. toIntegerNonZero ((pp ^. ppNOptL) `nonZeroOr` knownNonZeroBounded @1) + let z0 = 1 %. (toInteger (pp ^. ppNOptL) `nonZeroOr` knownNonZero @1) in if kh `Set.member` topPools then StakeShare (max (sigma + t) z0) else StakeShare (s + t)