Skip to content

Commit

Permalink
Made divisions that are supposed to fail on zero, fail again
Browse files Browse the repository at this point in the history
  • Loading branch information
Soupstraw committed Jan 27, 2025
1 parent 28a4903 commit aa5b616
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions eras/shelley/impl/src/Cardano/Ledger/Shelley/Rewards.hs
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,9 @@ rewardOnePoolMember
pool = poolPs rewardInfo
sigma = poolRelativeStake rewardInfo
poolR = poolPot rewardInfo
stakeShare = StakeShare $ c %? unCoin totalStake
stakeShare =
StakeShare $
c %. (unCoin totalStake `nonZeroOr` error "total stake is zero!")
r = memberRew poolR pool stakeShare sigma

-- | Calculate single stake pool specific values for the reward computation.
Expand Down Expand Up @@ -332,7 +334,9 @@ mkPoolRewardInfo
-- intermediate values needed for the individual reward calculations.
Just blocksN ->
let Coin pledge = ppPledge pool
pledgeRelative = pledge %? unCoin totalStake
pledgeRelative =
pledge
%. (unCoin totalStake `nonZeroOr` error "totalStake is zero!")
sigmaA = pstakeTot %? unCoin activeStake
Coin maxP =
if pledge <= ostake
Expand Down

0 comments on commit aa5b616

Please sign in to comment.