Skip to content

Change the type of psDeposits to CompactForm Coin #5031

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eras/allegra/impl/src/Cardano/Ledger/Allegra/PParams.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ instance EraPParams AllegraEra where
hkdMaxTxSizeL = lens sppMaxTxSize $ \pp x -> pp {sppMaxTxSize = x}
hkdMaxBHSizeL = lens sppMaxBHSize $ \pp x -> pp {sppMaxBHSize = x}
hkdKeyDepositL = lens sppKeyDeposit $ \pp x -> pp {sppKeyDeposit = x}
hkdPoolDepositL = lens sppPoolDeposit $ \pp x -> pp {sppPoolDeposit = x}
hkdPoolDepositCompactL = lens sppPoolDeposit $ \pp x -> pp {sppPoolDeposit = x}
hkdEMaxL = lens sppEMax $ \pp x -> pp {sppEMax = x}
hkdNOptL = lens sppNOpt $ \pp x -> pp {sppNOpt = x}
hkdA0L = lens sppA0 $ \pp x -> pp {sppA0 = x}
Expand Down
4 changes: 2 additions & 2 deletions eras/alonzo/impl/golden/pparams-update.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"monetaryExpansion": 0.7810966919969065,
"poolPledgeInfluence": 8.319022570290014789e16,
"poolRetireMaxEpoch": 1843493333,
"stakePoolDeposit": 855059,
"stakePoolDeposit": 3827864344574364691,
"stakePoolTargetNum": 10900,
"treasuryCut": 0.234167131785253734
}
}
8 changes: 4 additions & 4 deletions eras/alonzo/impl/src/Cardano/Ledger/Alonzo/PParams.hs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ import Cardano.Ledger.Binary (
encodePreEncoded,
serialize',
)
import Cardano.Ledger.Coin (Coin (..))
import Cardano.Ledger.Coin (Coin (..), CompactForm (..))
import Cardano.Ledger.Core (EraPParams (..))
import Cardano.Ledger.HKD (HKDFunctor (..))
import Cardano.Ledger.Mary.Core
Expand Down Expand Up @@ -237,7 +237,7 @@ data AlonzoPParams f era = AlonzoPParams
-- ^ Maximal block header size
, appKeyDeposit :: !(HKD f Coin)
-- ^ The amount of a key registration deposit
, appPoolDeposit :: !(HKD f Coin)
, appPoolDeposit :: !(HKD f (CompactForm Coin))
-- ^ The amount of a pool registration deposit
, appEMax :: !(HKD f EpochInterval)
-- ^ Maximum number of epochs in the future a pool retirement is allowed to
Expand Down Expand Up @@ -319,7 +319,7 @@ instance EraPParams AlonzoEra where
hkdMaxTxSizeL = lens appMaxTxSize $ \pp x -> pp {appMaxTxSize = x}
hkdMaxBHSizeL = lens appMaxBHSize $ \pp x -> pp {appMaxBHSize = x}
hkdKeyDepositL = lens appKeyDeposit $ \pp x -> pp {appKeyDeposit = x}
hkdPoolDepositL = lens appPoolDeposit $ \pp x -> pp {appPoolDeposit = x}
hkdPoolDepositCompactL = lens appPoolDeposit $ \pp x -> pp {appPoolDeposit = x}
hkdEMaxL = lens appEMax $ \pp x -> pp {appEMax = x}
hkdNOptL = lens appNOpt $ \pp x -> pp {appNOpt = x}
hkdA0L = lens appA0 $ \pp x -> pp {appA0 = x}
Expand Down Expand Up @@ -465,7 +465,7 @@ emptyAlonzoPParams =
, appMaxTxSize = 2048
, appMaxBHSize = 0
, appKeyDeposit = Coin 0
, appPoolDeposit = Coin 0
, appPoolDeposit = CompactCoin 0
, appEMax = EpochInterval 0
, appNOpt = 100
, appA0 = minBound
Expand Down
4 changes: 2 additions & 2 deletions eras/babbage/impl/golden/pparams-update.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
"poolPledgeInfluence": 6.790200579626650307,
"poolRetireMaxEpoch": 1676560372,
"stakeAddressDeposit": 664860,
"stakePoolDeposit": 763288,
"stakePoolDeposit": 1.7453986152646146491e19,
"stakePoolTargetNum": 40749,
"treasuryCut": 0.34109,
"txFeeFixed": 321937
}
}
8 changes: 4 additions & 4 deletions eras/babbage/impl/src/Cardano/Ledger/Babbage/PParams.hs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ import Cardano.Ledger.Binary (
DecCBOR (..),
EncCBOR (..),
)
import Cardano.Ledger.Coin (Coin (..))
import Cardano.Ledger.Coin (Coin (..), CompactForm (..))
import Cardano.Ledger.Core (EraPParams (..))
import Cardano.Ledger.HKD (HKDFunctor (..))
import Cardano.Ledger.Orphans ()
Expand Down Expand Up @@ -113,7 +113,7 @@ data BabbagePParams f era = BabbagePParams
-- ^ Maximal block header size
, bppKeyDeposit :: !(HKD f Coin)
-- ^ The amount of a key registration deposit
, bppPoolDeposit :: !(HKD f Coin)
, bppPoolDeposit :: !(HKD f (CompactForm Coin))
-- ^ The amount of a pool registration deposit
, bppEMax :: !(HKD f EpochInterval)
-- ^ Maximum number of epochs in the future a pool retirement is allowed to
Expand Down Expand Up @@ -192,7 +192,7 @@ instance EraPParams BabbageEra where
hkdMaxTxSizeL = lens bppMaxTxSize $ \pp x -> pp {bppMaxTxSize = x}
hkdMaxBHSizeL = lens bppMaxBHSize $ \pp x -> pp {bppMaxBHSize = x}
hkdKeyDepositL = lens bppKeyDeposit $ \pp x -> pp {bppKeyDeposit = x}
hkdPoolDepositL = lens bppPoolDeposit $ \pp x -> pp {bppPoolDeposit = x}
hkdPoolDepositCompactL = lens bppPoolDeposit $ \pp x -> pp {bppPoolDeposit = x}
hkdEMaxL = lens bppEMax $ \pp x -> pp {bppEMax = x}
hkdNOptL = lens bppNOpt $ \pp x -> pp {bppNOpt = x}
hkdA0L = lens bppA0 $ \pp x -> pp {bppA0 = x}
Expand Down Expand Up @@ -274,7 +274,7 @@ emptyBabbagePParams =
, bppMaxTxSize = 2048
, bppMaxBHSize = 0
, bppKeyDeposit = Coin 0
, bppPoolDeposit = Coin 0
, bppPoolDeposit = CompactCoin 0
, bppEMax = EpochInterval 0
, bppNOpt = 100
, bppA0 = minBound
Expand Down
4 changes: 2 additions & 2 deletions eras/conway/impl/golden/pparams-update.json
Original file line number Diff line number Diff line change
Expand Up @@ -832,9 +832,9 @@
"ppSecurityGroup": 0.4
},
"stakeAddressDeposit": 479647,
"stakePoolDeposit": 569,
"stakePoolDeposit": 1.2522864161500168761e19,
"treasuryCut": 0.5,
"txFeeFixed": 203771,
"txFeePerByte": 379061,
"utxoCostPerByte": 664860
}
}
10 changes: 5 additions & 5 deletions eras/conway/impl/src/Cardano/Ledger/Conway/PParams.hs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ import Cardano.Ledger.Binary (
encodeListLen,
)
import Cardano.Ledger.Binary.Coders
import Cardano.Ledger.Coin (Coin (Coin))
import Cardano.Ledger.Coin (Coin (Coin), CompactForm (..))
import Cardano.Ledger.Conway.Era (ConwayEra, hardforkConwayBootstrapPhase)
import Cardano.Ledger.Core (EraPParams (..))
import Cardano.Ledger.HKD (
Expand Down Expand Up @@ -612,7 +612,7 @@ data ConwayPParams f era = ConwayPParams
-- ^ Maximal block header size
, cppKeyDeposit :: !(THKD ('PPGroups 'EconomicGroup 'NoStakePoolGroup) f Coin)
-- ^ The amount of a key registration deposit
, cppPoolDeposit :: !(THKD ('PPGroups 'EconomicGroup 'NoStakePoolGroup) f Coin)
, cppPoolDeposit :: !(THKD ('PPGroups 'EconomicGroup 'NoStakePoolGroup) f (CompactForm Coin))
-- ^ The amount of a pool registration deposit
, cppEMax :: !(THKD ('PPGroups 'TechnicalGroup 'NoStakePoolGroup) f EpochInterval)
-- ^ Maximum number of epochs in the future a pool retirement is allowed to
Expand Down Expand Up @@ -788,7 +788,7 @@ instance EraPParams ConwayEra where
hkdMaxTxSizeL = lens (unTHKD . cppMaxTxSize) $ \pp x -> pp {cppMaxTxSize = THKD x}
hkdMaxBHSizeL = lens (unTHKD . cppMaxBHSize) $ \pp x -> pp {cppMaxBHSize = THKD x}
hkdKeyDepositL = lens (unTHKD . cppKeyDeposit) $ \pp x -> pp {cppKeyDeposit = THKD x}
hkdPoolDepositL = lens (unTHKD . cppPoolDeposit) $ \pp x -> pp {cppPoolDeposit = THKD x}
hkdPoolDepositCompactL = lens (unTHKD . cppPoolDeposit) $ \pp x -> pp {cppPoolDeposit = THKD x}
hkdEMaxL = lens (unTHKD . cppEMax) $ \pp x -> pp {cppEMax = THKD x}
hkdNOptL = lens (unTHKD . cppNOpt) $ \pp x -> pp {cppNOpt = THKD x}
hkdA0L = lens (unTHKD . cppA0) $ \pp x -> pp {cppA0 = THKD x}
Expand Down Expand Up @@ -883,7 +883,7 @@ instance ConwayEraPParams ConwayEra where
, isValid (/= EpochInterval 0) ppuCommitteeMaxTermLengthL
, isValid (/= EpochInterval 0) ppuGovActionLifetimeL
, -- Coins
isValid (/= zero) ppuPoolDepositL
isValid (/= CompactCoin 0) ppuPoolDepositCompactL
, isValid (/= zero) ppuGovActionDepositL
, isValid (/= zero) ppuDRepDepositL
, hardforkConwayBootstrapPhase pv
Expand Down Expand Up @@ -929,7 +929,7 @@ emptyConwayPParams =
, cppMaxTxSize = THKD 2048
, cppMaxBHSize = THKD 0
, cppKeyDeposit = THKD (Coin 0)
, cppPoolDeposit = THKD (Coin 0)
, cppPoolDeposit = THKD (CompactCoin 0)
, cppEMax = THKD (EpochInterval 0)
, cppNOpt = THKD 100
, cppA0 = THKD minBound
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module Test.Cardano.Ledger.Conway.Imp.GovSpec (spec) where

import Cardano.Ledger.Address (RewardAccount (..))
import Cardano.Ledger.BaseTypes
import Cardano.Ledger.Coin (Coin (Coin))
import Cardano.Ledger.Coin (Coin (..))
import Cardano.Ledger.Conway (hardforkConwayDisallowUnelectedCommitteeFromVoting)
import Cardano.Ledger.Conway.Core
import Cardano.Ledger.Conway.Governance
Expand Down Expand Up @@ -223,7 +223,7 @@ pparamUpdateSpec =
testMalformedProposal
"ppuPoolDepositL cannot be 0"
ppuPoolDepositL
zero
$ Coin 0
testMalformedProposal
"ppuGovActionDepositL cannot be 0"
ppuGovActionDepositL
Expand Down
4 changes: 2 additions & 2 deletions eras/dijkstra/src/Cardano/Ledger/Dijkstra/PParams.hs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ instance EraPParams DijkstraEra where
hkdMaxTxSizeL = lens (unTHKD . cppMaxTxSize) $ \pp x -> pp {cppMaxTxSize = THKD x}
hkdMaxBHSizeL = lens (unTHKD . cppMaxBHSize) $ \pp x -> pp {cppMaxBHSize = THKD x}
hkdKeyDepositL = lens (unTHKD . cppKeyDeposit) $ \pp x -> pp {cppKeyDeposit = THKD x}
hkdPoolDepositL = lens (unTHKD . cppPoolDeposit) $ \pp x -> pp {cppPoolDeposit = THKD x}
hkdPoolDepositCompactL = lens (unTHKD . cppPoolDeposit) $ \pp x -> pp {cppPoolDeposit = THKD x}
hkdEMaxL = lens (unTHKD . cppEMax) $ \pp x -> pp {cppEMax = THKD x}
hkdNOptL = lens (unTHKD . cppNOpt) $ \pp x -> pp {cppNOpt = THKD x}
hkdA0L = lens (unTHKD . cppA0) $ \pp x -> pp {cppA0 = THKD x}
Expand Down Expand Up @@ -139,7 +139,7 @@ instance ConwayEraPParams DijkstraEra where
, isValid (/= EpochInterval 0) ppuCommitteeMaxTermLengthL
, isValid (/= EpochInterval 0) ppuGovActionLifetimeL
, -- Coins
isValid (/= zero) ppuPoolDepositL
isValid (/= mempty) ppuPoolDepositL
, isValid (/= zero) ppuGovActionDepositL
, isValid (/= zero) ppuDRepDepositL
, isValid ((/= zero) . unCoinPerByte) ppuCoinsPerUTxOByteL
Expand Down
2 changes: 1 addition & 1 deletion eras/mary/impl/src/Cardano/Ledger/Mary/PParams.hs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ instance EraPParams MaryEra where
hkdMaxTxSizeL = lens sppMaxTxSize $ \pp x -> pp {sppMaxTxSize = x}
hkdMaxBHSizeL = lens sppMaxBHSize $ \pp x -> pp {sppMaxBHSize = x}
hkdKeyDepositL = lens sppKeyDeposit $ \pp x -> pp {sppKeyDeposit = x}
hkdPoolDepositL = lens sppPoolDeposit $ \pp x -> pp {sppPoolDeposit = x}
hkdPoolDepositCompactL = lens sppPoolDeposit $ \pp x -> pp {sppPoolDeposit = x}
hkdEMaxL = lens sppEMax $ \pp x -> pp {sppEMax = x}
hkdNOptL = lens sppNOpt $ \pp x -> pp {sppNOpt = x}
hkdA0L = lens sppA0 $ \pp x -> pp {sppA0 = x}
Expand Down
4 changes: 2 additions & 2 deletions eras/shelley/impl/golden/pparams-update.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"poolPledgeInfluence": 3.8777413926852632e7,
"poolRetireMaxEpoch": 2414041002,
"stakeAddressDeposit": 180016,
"stakePoolDeposit": 205173,
"stakePoolDeposit": 1.1630186357330223477e19,
"stakePoolTargetNum": 52993,
"treasuryCut": 0.3,
"txFeeFixed": 601034,
"txFeePerByte": 921162
}
}
13 changes: 7 additions & 6 deletions eras/shelley/impl/src/Cardano/Ledger/Shelley/PParams.hs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ import Cardano.Ledger.Binary (
encodeListLen,
)
import Cardano.Ledger.Binary.Coders (Decode (From, RecD), decode, (<!))
import Cardano.Ledger.Coin (Coin (..))
import Cardano.Ledger.Coin (Coin (..), CompactForm (..))
import Cardano.Ledger.Compactible (Compactible (..))
import Cardano.Ledger.Core
import Cardano.Ledger.HKD (HKD)
import Cardano.Ledger.Hashes (GenDelegs)
Expand Down Expand Up @@ -103,7 +104,7 @@ data ShelleyPParams f era = ShelleyPParams
-- ^ Maximal block header size
, sppKeyDeposit :: !(HKD f Coin)
-- ^ The amount of a key registration deposit
, sppPoolDeposit :: !(HKD f Coin)
, sppPoolDeposit :: !(HKD f (CompactForm Coin))
-- ^ The amount of a pool registration deposit
, sppEMax :: !(HKD f EpochInterval)
-- ^ epoch bound on pool retirement
Expand Down Expand Up @@ -171,7 +172,7 @@ instance EraPParams ShelleyEra where
hkdMaxTxSizeL = lens sppMaxTxSize $ \pp x -> pp {sppMaxTxSize = x}
hkdMaxBHSizeL = lens sppMaxBHSize $ \pp x -> pp {sppMaxBHSize = x}
hkdKeyDepositL = lens sppKeyDeposit $ \pp x -> pp {sppKeyDeposit = x}
hkdPoolDepositL = lens sppPoolDeposit $ \pp x -> pp {sppPoolDeposit = x}
hkdPoolDepositCompactL = lens sppPoolDeposit $ \pp x -> pp {sppPoolDeposit = x}
hkdEMaxL = lens sppEMax $ \pp x -> pp {sppEMax = x}
hkdNOptL = lens sppNOpt $ \pp x -> pp {sppNOpt = x}
hkdA0L = lens sppA0 $ \pp x -> pp {sppA0 = x}
Expand All @@ -194,7 +195,7 @@ emptyShelleyPParams =
, sppMaxTxSize = 2048
, sppMaxBHSize = 0
, sppKeyDeposit = Coin 0
, sppPoolDeposit = Coin 0
, sppPoolDeposit = CompactCoin 0
, sppEMax = EpochInterval 0
, sppNOpt = 100
, sppA0 = minBound
Expand Down Expand Up @@ -380,8 +381,8 @@ ppPoolDeposit :: EraPParams era => PParam era
ppPoolDeposit =
PParam
{ ppName = "stakePoolDeposit"
, ppLens = ppPoolDepositL
, ppUpdate = Just $ PParamUpdate 6 ppuPoolDepositL
, ppLens = ppPoolDepositCompactL
, ppUpdate = Just $ PParamUpdate 6 ppuPoolDepositCompactL
}

ppEMax :: EraPParams era => PParam era
Expand Down
16 changes: 9 additions & 7 deletions eras/shelley/impl/src/Cardano/Ledger/Shelley/Rules/PoolReap.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module Cardano.Ledger.Shelley.Rules.PoolReap (

import Cardano.Ledger.Address (RewardAccount, raCredential)
import Cardano.Ledger.BaseTypes (ShelleyBase)
import Cardano.Ledger.Coin (Coin)
import Cardano.Ledger.Coin (Coin, CompactForm)
import Cardano.Ledger.Core
import Cardano.Ledger.Credential (Credential)
import Cardano.Ledger.PoolParams (ppRewardAccount)
Expand All @@ -35,7 +35,7 @@ import Cardano.Ledger.Shelley.LedgerState (
import Cardano.Ledger.Shelley.LedgerState.Types (potEqualsObligation)
import Cardano.Ledger.Slot (EpochNo (..))
import Cardano.Ledger.State
import Cardano.Ledger.UMap (UView (RewDepUView, SPoolUView), compactCoinOrError)
import Cardano.Ledger.UMap (UView (RewDepUView, SPoolUView), compactCoinOrError, fromCompact)
import qualified Cardano.Ledger.UMap as UM
import Cardano.Ledger.Val ((<+>), (<->))
import Control.DeepSeq (NFData)
Expand All @@ -49,6 +49,7 @@ import Control.State.Transition (
judgmentContext,
tellEvent,
)
import Data.Bifunctor (Bifunctor (..))
import Data.Default (Default, def)
import Data.Foldable (fold)
import qualified Data.Map.Strict as Map
Expand All @@ -74,9 +75,9 @@ instance NFData (ShelleyPoolreapPredFailure era)

data ShelleyPoolreapEvent era = RetiredPools
{ refundPools ::
Map.Map (Credential 'Staking) (Map.Map (KeyHash 'StakePool) Coin)
Map.Map (Credential 'Staking) (Map.Map (KeyHash 'StakePool) (CompactForm Coin))
, unclaimedPools ::
Map.Map (Credential 'Staking) (Map.Map (KeyHash 'StakePool) Coin)
Map.Map (Credential 'Staking) (Map.Map (KeyHash 'StakePool) (CompactForm Coin))
, epochNo :: EpochNo
}
deriving (Generic)
Expand Down Expand Up @@ -136,18 +137,19 @@ poolReapTransition = do
retired :: Set (KeyHash 'StakePool)
retired = eval (dom (psRetiring ps ▷ setSingleton e))
-- The Map of pools (retiring this epoch) to their deposits
retiringDeposits, remainingDeposits :: Map.Map (KeyHash 'StakePool) Coin
retiringDeposits, remainingDeposits :: Map.Map (KeyHash 'StakePool) (CompactForm Coin)
(retiringDeposits, remainingDeposits) =
Map.partitionWithKey (\k _ -> Set.member k retired) (psDeposits ps)
rewardAccounts :: Map.Map (KeyHash 'StakePool) RewardAccount
rewardAccounts = Map.map ppRewardAccount $ eval (retired ◁ psStakePoolParams ps)
rewardAccounts_ ::
Map.Map (KeyHash 'StakePool) (RewardAccount, Coin)
Map.Map (KeyHash 'StakePool) (RewardAccount, CompactForm Coin)
rewardAccounts_ = Map.intersectionWith (,) rewardAccounts retiringDeposits
rewardAccounts' :: Map.Map RewardAccount Coin
rewardAccounts' =
Map.fromListWith (<+>)
. Map.elems
. fmap (second fromCompact)
$ rewardAccounts_
refunds :: Map.Map (Credential 'Staking) Coin
mRefunds :: Map.Map (Credential 'Staking) Coin
Expand Down Expand Up @@ -187,7 +189,7 @@ poolReapTransition = do
& certPStateL . psStakePoolParamsL %~ (eval . (retired ⋪))
& certPStateL . psFutureStakePoolParamsL %~ (eval . (retired ⋪))
& certPStateL . psRetiringL %~ (eval . (retired ⋪))
& certPStateL . psDepositsL .~ remainingDeposits
& certPStateL . psDepositsCompactL .~ remainingDeposits
)

renderPoolReapViolation ::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ adaPreservationProps =
, map feesNonDecreasing noEpochBoundarySsts
]

infoRetire :: Map (KeyHash 'StakePool) Coin -> KeyHash 'StakePool -> String
infoRetire :: Show a => Map (KeyHash 'StakePool) a -> KeyHash 'StakePool -> String
infoRetire deposits keyhash = showKeyHash keyhash ++ extra
where
extra = case Map.lookup keyhash deposits of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import Cardano.Ledger.Shelley.LedgerState (
)
import Cardano.Ledger.Shelley.Rules.Reports (synopsisCoinMap)
import Cardano.Ledger.Shelley.State
import Cardano.Ledger.UMap (depositMap)
import Cardano.Ledger.UMap (depositMap, fromCompact)
import qualified Cardano.Ledger.UMap as UM
import Cardano.Ledger.Val ((<+>))
import qualified Data.Map.Strict as Map
Expand Down Expand Up @@ -87,14 +87,14 @@ depositInvariant SourceSignalTarget {source = chainSt} =
allDeposits = utxosDeposited utxost
sumCoin = Map.foldl' (<+>) (Coin 0)
keyDeposits = (UM.fromCompact . UM.sumDepositUView . UM.RewDepUView . dsUnified) dstate
poolDeposits = sumCoin (psDeposits pstate)
poolDeposits = sumCoin (fromCompact <$> psDeposits pstate)
in counterexample
( ansiDocToString . Pretty.vsep $
[ "Deposit invariant fails:"
, Pretty.indent 2 . Pretty.vsep . map Pretty.pretty $
[ "All deposits = " ++ show allDeposits
, "Key deposits = " ++ synopsisCoinMap (Just (depositMap (dsUnified dstate)))
, "Pool deposits = " ++ synopsisCoinMap (Just (psDeposits pstate))
, "Pool deposits = " ++ synopsisCoinMap (Just (fromCompact <$> psDeposits pstate))
]
]
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,10 @@ feesAndDeposits ppEx newFees stakes pools cs = cs {chainNes = nes'}
accum n x = if Map.member (ppId x) (psDeposits pstate) then (n :: Integer) else n + 1
newDeposits =
Map.fromList (map (\cred -> (cred, compactCoinOrError (ppEx ^. ppKeyDepositL))) stakes)
newPools = Map.fromList (map (\p -> (ppId p, ppEx ^. ppPoolDepositL)) pools)
newPools = Map.fromList (map (\p -> (ppId p, ppEx ^. ppPoolDepositCompactL)) pools)
dpstate' =
mkShelleyCertState
(pstate & psDepositsL %~ Map.unionWith (\old _new -> old) newPools)
(pstate & psDepositsCompactL %~ Map.unionWith (\old _new -> old) newPools)
(dstate & dsUnifiedL .~ UM.unionKeyDeposits (RewDepUView (dstate ^. dsUnifiedL)) newDeposits)
es' = es {esLState = ls'}
nes' = nes {nesEs = es'}
Expand Down Expand Up @@ -473,7 +473,7 @@ reapPool pool cs = cs {chainNes = nes'}
Just (UM.RDPair ccoin dep) ->
( UM.insert'
rewardAddr
(UM.RDPair (addCompactCoin ccoin (compactCoinOrError (pp ^. ppPoolDepositL))) dep)
(UM.RDPair (addCompactCoin ccoin (pp ^. ppPoolDepositCompactL)) dep)
(rewards ds)
, Coin 0
)
Expand Down
Loading
Loading