diff --git a/shelley/chain-and-ledger/executable-spec/src/Shelley/Spec/Ledger/API/Wallet.hs b/shelley/chain-and-ledger/executable-spec/src/Shelley/Spec/Ledger/API/Wallet.hs index 8cb5beec63a..b1ef874d691 100644 --- a/shelley/chain-and-ledger/executable-spec/src/Shelley/Spec/Ledger/API/Wallet.hs +++ b/shelley/chain-and-ledger/executable-spec/src/Shelley/Spec/Ledger/API/Wallet.hs @@ -78,8 +78,9 @@ getNonMyopicMemberRewards globals ss creds = (\cred -> (cred, Map.mapWithKey (mkNMMRewards $ memShare cred) poolData)) (Set.toList creds) where - total = fromIntegral $ maxLovelaceSupply globals - toShare (Coin x) = StakeShare (x % total) + maxSupply = Coin . fromIntegral $ maxLovelaceSupply globals + Coin totalStake = circulation es maxSupply + toShare (Coin x) = StakeShare (x % totalStake) memShare (Right cred) = toShare $ Map.findWithDefault (Coin 0) cred (EB.unStake stake) memShare (Left coin) = toShare coin es = nesEs ss @@ -97,7 +98,7 @@ getNonMyopicMemberRewards globals ss creds = (\k p -> (percentile' (histLookup k), p, toShare . fold . EB.unStake $ EB.poolStake k delegs stake)) poolParams histLookup k = fromMaybe mempty (Map.lookup k ls) - topPools = getTopRankedPools rPot (Coin total) pp poolParams (fmap percentile' ls) + topPools = getTopRankedPools rPot (Coin totalStake) pp poolParams (fmap percentile' ls) mkNMMRewards ms k (ap, poolp, sigma) = if checkPledge poolp then nonMyopicMemberRew pp poolp rPot s ms nmps ap diff --git a/shelley/chain-and-ledger/executable-spec/src/Shelley/Spec/Ledger/Rewards.hs b/shelley/chain-and-ledger/executable-spec/src/Shelley/Spec/Ledger/Rewards.hs index 98d7489d261..3fecc333670 100644 --- a/shelley/chain-and-ledger/executable-spec/src/Shelley/Spec/Ledger/Rewards.hs +++ b/shelley/chain-and-ledger/executable-spec/src/Shelley/Spec/Ledger/Rewards.hs @@ -274,10 +274,10 @@ getTopRankedPools :: Map (KeyHash 'StakePool era) (PoolParams era) -> Map (KeyHash 'StakePool era) PerformanceEstimate -> Set (KeyHash 'StakePool era) +getTopRankedPools rPot totalStake pp poolParams aps = Set.fromList $ fmap fst $ take (fromIntegral $ _nOpt pp) (sortBy (flip compare `on` snd) rankings) -getTopRankedPools rPot totalStake pp poolParams aps = where pdata = Map.toList $ Map.intersectionWith (,) poolParams aps rankings =