Skip to content

Commit

Permalink
Add reDRepState to RatifyEnv and pass it from Epoch rule
Browse files Browse the repository at this point in the history
Implement DRep ratification with an 'always passing' threshold
  • Loading branch information
teodanciu committed Aug 15, 2023
1 parent 12161e7 commit b0d2a22
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion eras/conway/impl/src/Cardano/Ledger/Conway/Rules/Epoch.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ where

import Cardano.Ledger.Address (RewardAcnt (getRwdCred))
import Cardano.Ledger.BaseTypes (ShelleyBase)
import Cardano.Ledger.CertState (certDStateL, dsUnifiedL)
import Cardano.Ledger.CertState (certDStateL, dsUnifiedL, vsDRepsL)
import Cardano.Ledger.Coin (Coin)
import Cardano.Ledger.Compactible (Compactible (..))
import Cardano.Ledger.Conway.Core
Expand Down Expand Up @@ -253,6 +253,7 @@ epochTransition = do
, reStakePoolDistr = stakePoolDistr
, reDRepDistr = drepDistr
, reCurrentEpoch = eNo
, reDRepState = vstate ^. vsDRepsL
}
govStateToSeq = Seq.fromList . Map.toList
ratSig = RatifySignal . govStateToSeq . unGovActionsState $ cgGovActionsState govSt
Expand Down
2 changes: 2 additions & 0 deletions eras/conway/impl/src/Cardano/Ledger/Conway/Rules/Ratify.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module Cardano.Ledger.Conway.Rules.Ratify (
) where

import Cardano.Ledger.BaseTypes (ShelleyBase)
import Cardano.Ledger.CertState (DRepState (..))
import Cardano.Ledger.Coin (Coin (..), CompactForm (..))
import Cardano.Ledger.Conway.Era (ConwayENACT, ConwayRATIFY)
import Cardano.Ledger.Conway.Governance (
Expand Down Expand Up @@ -59,6 +60,7 @@ data RatifyEnv era = RatifyEnv
{ reStakeDistr :: !(Map (Credential 'Staking (EraCrypto era)) Coin)
, reStakePoolDistr :: !(PoolDistr (EraCrypto era))
, reDRepDistr :: !(Map (DRep (EraCrypto era)) (CompactForm Coin))
, reDRepState :: !(Map (Credential 'DRepRole (EraCrypto era)) (DRepState (EraCrypto era)))
, reCurrentEpoch :: !EpochNo
}
deriving (Show)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ instance
<*> arbitrary
<*> arbitrary
<*> arbitrary
<*> arbitrary

instance Crypto (EraCrypto era) => Arbitrary (Constitution era) where
arbitrary = Constitution <$> arbitrary <*> arbitrary
Expand Down

0 comments on commit b0d2a22

Please sign in to comment.