Skip to content

Commit

Permalink
Merge pull request #3705 from input-output-hk/jj/remove-protver
Browse files Browse the repository at this point in the history
Removed ProtVer from EnactState
  • Loading branch information
lehins authored Sep 5, 2023
2 parents 6bad64a + fea8678 commit 5fbcf6e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
11 changes: 3 additions & 8 deletions eras/conway/impl/src/Cardano/Ledger/Conway/Governance.hs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,6 @@ data EnactState era = EnactState
-- ^ Constitutional Committee
, ensConstitution :: !(Constitution era)
-- ^ Constitution
, ensProtVer :: !ProtVer
, ensPParams :: !(PParams era)
, ensPrevPParams :: !(PParams era)
, ensTreasury :: !Coin
Expand All @@ -331,8 +330,8 @@ ensCommitteeL = lens ensCommittee (\x y -> x {ensCommittee = y})
ensConstitutionL :: Lens' (EnactState era) (Constitution era)
ensConstitutionL = lens ensConstitution (\x y -> x {ensConstitution = y})

ensProtVerL :: Lens' (EnactState era) ProtVer
ensProtVerL = lens ensProtVer (\x y -> x {ensProtVer = y})
ensProtVerL :: EraPParams era => Lens' (EnactState era) ProtVer
ensProtVerL = ensCurPParamsL . ppProtocolVersionL

ensCurPParamsL :: Lens' (EnactState era) (PParams era)
ensCurPParamsL = lens ensPParams (\es x -> es {ensPParams = x})
Expand Down Expand Up @@ -378,11 +377,10 @@ instance EraPParams era => ToJSON (EnactState era) where
toEncoding = pairs . mconcat . toEnactStatePairs

toEnactStatePairs :: (KeyValue a, EraPParams era) => EnactState era -> [a]
toEnactStatePairs cg@(EnactState _ _ _ _ _ _ _ _) =
toEnactStatePairs cg@(EnactState _ _ _ _ _ _ _) =
let EnactState {..} = cg
in [ "committee" .= ensCommittee
, "constitution" .= ensConstitution
, "protVer" .= ensProtVer
, "pparams" .= ensPParams
, "prevPParams" .= ensPParams
, "treasury" .= ensTreasury
Expand All @@ -399,7 +397,6 @@ instance EraPParams era => Default (EnactState era) where
EnactState
def
def
(ProtVer (eraProtVerLow @era) 0)
def
def
(Coin 0)
Expand All @@ -417,15 +414,13 @@ instance EraPParams era => DecCBOR (EnactState era) where
<! From
<! From
<! From
<! From

instance EraPParams era => EncCBOR (EnactState era) where
encCBOR EnactState {..} =
encode $
Rec EnactState
!> To ensCommittee
!> To ensConstitution
!> To ensProtVer
!> To ensPParams
!> To ensPrevPParams
!> To ensTreasury
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ instance
<*> arbitrary
<*> arbitrary
<*> arbitrary
<*> arbitrary

uniqueIdGovActions ::
( Era era
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,14 +413,13 @@ instance PrettyA (Constitution era) where
]

instance PrettyA (PParams era) => PrettyA (EnactState era) where
prettyA ens@(EnactState _ _ _ _ _ _ _ _) =
prettyA ens@(EnactState _ _ _ _ _ _ _) =
let EnactState {..} = ens
in ppRecord
"EnactState"
[ ("Constitutional Committee", prettyA ensCommittee)
, ("PParams", prettyA ensPParams)
, ("PrevPParams", prettyA ensPrevPParams)
, ("ProtVer", prettyA ensProtVer)
, ("Constitution", prettyA ensConstitution)
, ("Treasury", prettyA ensTreasury)
, ("Withdrawals", prettyA ensWithdrawals)
Expand Down

0 comments on commit 5fbcf6e

Please sign in to comment.