Skip to content

Commit d819e74

Browse files
committed
Removed era parameter from GovActionId
1 parent d811995 commit d819e74

File tree

17 files changed

+190
-138
lines changed

17 files changed

+190
-138
lines changed

eras/conway/impl/src/Cardano/Ledger/Conway/Governance.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ cgsFuturePParamsL :: Lens' (ConwayGovState era) (FuturePParams era)
287287
cgsFuturePParamsL =
288288
lens cgsFuturePParams (\cgs futurePParams -> cgs {cgsFuturePParams = futurePParams})
289289

290-
govStatePrevGovActionIds :: ConwayEraGov era => GovState era -> GovRelation StrictMaybe era
290+
govStatePrevGovActionIds :: ConwayEraGov era => GovState era -> GovRelation StrictMaybe
291291
govStatePrevGovActionIds = view $ proposalsGovStateL . pRootsL . to toPrevGovActionIds
292292

293293
conwayGovStateDRepDistrG ::

eras/conway/impl/src/Cardano/Ledger/Conway/Governance/Internal.hs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ data EnactState era = EnactState
141141
, ensPrevPParams :: !(PParams era)
142142
, ensTreasury :: !Coin
143143
, ensWithdrawals :: !(Map (Credential 'Staking) Coin)
144-
, ensPrevGovActionIds :: !(GovRelation StrictMaybe era)
144+
, ensPrevGovActionIds :: !(GovRelation StrictMaybe)
145145
-- ^ Last enacted GovAction Ids
146146
}
147147
deriving (Generic)
@@ -167,23 +167,23 @@ ensTreasuryL = lens ensTreasury $ \es x -> es {ensTreasury = x}
167167
ensWithdrawalsL :: Lens' (EnactState era) (Map (Credential 'Staking) Coin)
168168
ensWithdrawalsL = lens ensWithdrawals $ \es x -> es {ensWithdrawals = x}
169169

170-
ensPrevGovActionIdsL :: Lens' (EnactState era) (GovRelation StrictMaybe era)
170+
ensPrevGovActionIdsL :: Lens' (EnactState era) (GovRelation StrictMaybe)
171171
ensPrevGovActionIdsL = lens ensPrevGovActionIds (\es x -> es {ensPrevGovActionIds = x})
172172

173173
ensPrevPParamUpdateL ::
174-
Lens' (EnactState era) (StrictMaybe (GovPurposeId 'PParamUpdatePurpose era))
174+
Lens' (EnactState era) (StrictMaybe (GovPurposeId 'PParamUpdatePurpose))
175175
ensPrevPParamUpdateL = ensPrevGovActionIdsL . grPParamUpdateL
176176

177177
ensPrevHardForkL ::
178-
Lens' (EnactState era) (StrictMaybe (GovPurposeId 'HardForkPurpose era))
178+
Lens' (EnactState era) (StrictMaybe (GovPurposeId 'HardForkPurpose))
179179
ensPrevHardForkL = ensPrevGovActionIdsL . grHardForkL
180180

181181
ensPrevCommitteeL ::
182-
Lens' (EnactState era) (StrictMaybe (GovPurposeId 'CommitteePurpose era))
182+
Lens' (EnactState era) (StrictMaybe (GovPurposeId 'CommitteePurpose))
183183
ensPrevCommitteeL = ensPrevGovActionIdsL . grCommitteeL
184184

185185
ensPrevConstitutionL ::
186-
Lens' (EnactState era) (StrictMaybe (GovPurposeId 'ConstitutionPurpose era))
186+
Lens' (EnactState era) (StrictMaybe (GovPurposeId 'ConstitutionPurpose))
187187
ensPrevConstitutionL = ensPrevGovActionIdsL . grConstitutionL
188188

189189
instance EraPParams era => ToJSON (EnactState era) where

eras/conway/impl/src/Cardano/Ledger/Conway/Governance/Procedures.hs

Lines changed: 51 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -629,63 +629,63 @@ isGovActionWithPurpose govAction =
629629
NewConstitution {} -> toGovActionPurpose @p == ConstitutionPurpose
630630
InfoAction -> False
631631

632-
newtype GovPurposeId (p :: GovActionPurpose) era = GovPurposeId
632+
newtype GovPurposeId (p :: GovActionPurpose) = GovPurposeId
633633
{ unGovPurposeId :: GovActionId
634634
}
635635
deriving (Eq, Ord, Generic)
636636

637-
type role GovPurposeId nominal nominal
637+
type role GovPurposeId nominal
638638

639639
deriving newtype instance
640-
(Era era, Typeable p) => EncCBOR (GovPurposeId (p :: GovActionPurpose) era)
640+
Typeable p => EncCBOR (GovPurposeId (p :: GovActionPurpose))
641641

642642
deriving newtype instance
643-
(Era era, Typeable p) => DecCBOR (GovPurposeId (p :: GovActionPurpose) era)
643+
Typeable p => DecCBOR (GovPurposeId (p :: GovActionPurpose))
644644

645-
deriving newtype instance Era era => NoThunks (GovPurposeId (p :: GovActionPurpose) era)
645+
deriving newtype instance NoThunks (GovPurposeId (p :: GovActionPurpose))
646646

647-
deriving newtype instance Era era => NFData (GovPurposeId (p :: GovActionPurpose) era)
647+
deriving newtype instance NFData (GovPurposeId (p :: GovActionPurpose))
648648

649-
deriving newtype instance Era era => ToJSONKey (GovPurposeId (p :: GovActionPurpose) era)
649+
deriving newtype instance ToJSONKey (GovPurposeId (p :: GovActionPurpose))
650650

651-
deriving newtype instance Era era => ToJSON (GovPurposeId (p :: GovActionPurpose) era)
651+
deriving newtype instance ToJSON (GovPurposeId (p :: GovActionPurpose))
652652

653-
deriving newtype instance Era era => Show (GovPurposeId (p :: GovActionPurpose) era)
653+
deriving newtype instance Show (GovPurposeId (p :: GovActionPurpose))
654654

655655
-- | Abstract data type for representing relationship of governance action with the same purpose
656-
data GovRelation (f :: Type -> Type) era = GovRelation
657-
{ grPParamUpdate :: !(f (GovPurposeId 'PParamUpdatePurpose era))
658-
, grHardFork :: !(f (GovPurposeId 'HardForkPurpose era))
659-
, grCommittee :: !(f (GovPurposeId 'CommitteePurpose era))
660-
, grConstitution :: !(f (GovPurposeId 'ConstitutionPurpose era))
656+
data GovRelation (f :: Type -> Type) = GovRelation
657+
{ grPParamUpdate :: !(f (GovPurposeId 'PParamUpdatePurpose))
658+
, grHardFork :: !(f (GovPurposeId 'HardForkPurpose))
659+
, grCommittee :: !(f (GovPurposeId 'CommitteePurpose))
660+
, grConstitution :: !(f (GovPurposeId 'ConstitutionPurpose))
661661
}
662662
deriving (Generic)
663663

664664
deriving instance
665-
(forall p. Eq (f (GovPurposeId (p :: GovActionPurpose) era))) =>
666-
Eq (GovRelation f era)
665+
(forall p. Eq (f (GovPurposeId (p :: GovActionPurpose)))) =>
666+
Eq (GovRelation f)
667667

668668
deriving instance
669-
(forall p. Show (f (GovPurposeId (p :: GovActionPurpose) era))) =>
670-
Show (GovRelation f era)
669+
(forall p. Show (f (GovPurposeId (p :: GovActionPurpose)))) =>
670+
Show (GovRelation f)
671671

672672
instance
673-
(forall p. NoThunks (f (GovPurposeId (p :: GovActionPurpose) era))) =>
674-
NoThunks (GovRelation f era)
673+
(forall p. NoThunks (f (GovPurposeId (p :: GovActionPurpose)))) =>
674+
NoThunks (GovRelation f)
675675

676676
instance
677-
(forall p. Default (f (GovPurposeId (p :: GovActionPurpose) era))) =>
678-
Default (GovRelation f era)
677+
(forall p. Default (f (GovPurposeId (p :: GovActionPurpose)))) =>
678+
Default (GovRelation f)
679679

680680
instance
681-
(forall p. NFData (f (GovPurposeId (p :: GovActionPurpose) era))) =>
682-
NFData (GovRelation f era)
681+
(forall p. NFData (f (GovPurposeId (p :: GovActionPurpose)))) =>
682+
NFData (GovRelation f)
683683
where
684684
rnf (GovRelation a b c d) = a `deepseq` b `deepseq` c `deepseq` rnf d
685685

686686
instance
687-
(forall p. Semigroup (f (GovPurposeId (p :: GovActionPurpose) era))) =>
688-
Semigroup (GovRelation f era)
687+
(forall p. Semigroup (f (GovPurposeId (p :: GovActionPurpose)))) =>
688+
Semigroup (GovRelation f)
689689
where
690690
(<>) p1 p2 =
691691
GovRelation
@@ -696,8 +696,8 @@ instance
696696
}
697697

698698
instance
699-
(forall p. Monoid (f (GovPurposeId (p :: GovActionPurpose) era))) =>
700-
Monoid (GovRelation f era)
699+
(forall p. Monoid (f (GovPurposeId (p :: GovActionPurpose)))) =>
700+
Monoid (GovRelation f)
701701
where
702702
mempty =
703703
GovRelation
@@ -708,11 +708,10 @@ instance
708708
}
709709

710710
instance
711-
( Era era
712-
, Typeable f
713-
, (forall p. Typeable p => DecCBOR (f (GovPurposeId (p :: GovActionPurpose) era)))
711+
( Typeable f
712+
, (forall p. Typeable p => DecCBOR (f (GovPurposeId (p :: GovActionPurpose))))
714713
) =>
715-
DecCBOR (GovRelation f era)
714+
DecCBOR (GovRelation f)
716715
where
717716
decCBOR =
718717
decodeRecordNamed
@@ -721,11 +720,10 @@ instance
721720
(GovRelation <$> decCBOR <*> decCBOR <*> decCBOR <*> decCBOR)
722721

723722
instance
724-
( Era era
725-
, Typeable f
726-
, (forall p. Typeable p => EncCBOR (f (GovPurposeId (p :: GovActionPurpose) era)))
723+
( Typeable f
724+
, (forall p. Typeable p => EncCBOR (f (GovPurposeId (p :: GovActionPurpose))))
727725
) =>
728-
EncCBOR (GovRelation f era)
726+
EncCBOR (GovRelation f)
729727
where
730728
encCBOR govPurpose@(GovRelation _ _ _ _) =
731729
let GovRelation {..} = govPurpose
@@ -737,9 +735,9 @@ instance
737735

738736
toPrevGovActionIdsPairs ::
739737
( KeyValue e a
740-
, (forall p. ToJSON (f (GovPurposeId (p :: GovActionPurpose) era)))
738+
, (forall p. ToJSON (f (GovPurposeId (p :: GovActionPurpose))))
741739
) =>
742-
GovRelation f era ->
740+
GovRelation f ->
743741
[a]
744742
toPrevGovActionIdsPairs govPurpose@(GovRelation _ _ _ _) =
745743
let GovRelation {..} = govPurpose
@@ -750,25 +748,25 @@ toPrevGovActionIdsPairs govPurpose@(GovRelation _ _ _ _) =
750748
]
751749

752750
instance
753-
(Era era, (forall p. ToJSON (f (GovPurposeId (p :: GovActionPurpose) era)))) =>
754-
ToJSON (GovRelation f era)
751+
(forall p. ToJSON (f (GovPurposeId (p :: GovActionPurpose)))) =>
752+
ToJSON (GovRelation f)
755753
where
756754
toJSON = object . toPrevGovActionIdsPairs
757755
toEncoding = pairs . mconcat . toPrevGovActionIdsPairs
758756

759-
grPParamUpdateL :: Lens' (GovRelation f era) (f (GovPurposeId 'PParamUpdatePurpose era))
757+
grPParamUpdateL :: Lens' (GovRelation f) (f (GovPurposeId 'PParamUpdatePurpose))
760758
grPParamUpdateL = lens grPParamUpdate $ \x y -> x {grPParamUpdate = y}
761759

762-
grHardForkL :: Lens' (GovRelation f era) (f (GovPurposeId 'HardForkPurpose era))
760+
grHardForkL :: Lens' (GovRelation f) (f (GovPurposeId 'HardForkPurpose))
763761
grHardForkL = lens grHardFork $ \x y -> x {grHardFork = y}
764762

765-
grCommitteeL :: Lens' (GovRelation f era) (f (GovPurposeId 'CommitteePurpose era))
763+
grCommitteeL :: Lens' (GovRelation f) (f (GovPurposeId 'CommitteePurpose))
766764
grCommitteeL = lens grCommittee $ \x y -> x {grCommittee = y}
767765

768-
grConstitutionL :: Lens' (GovRelation f era) (f (GovPurposeId 'ConstitutionPurpose era))
766+
grConstitutionL :: Lens' (GovRelation f) (f (GovPurposeId 'ConstitutionPurpose))
769767
grConstitutionL = lens grConstitution $ \x y -> x {grConstitution = y}
770768

771-
hoistGovRelation :: (forall a. f a -> g a) -> GovRelation f era -> GovRelation g era
769+
hoistGovRelation :: (forall a. f a -> g a) -> GovRelation f -> GovRelation g
772770
hoistGovRelation f gr =
773771
GovRelation
774772
{ grPParamUpdate = f (grPParamUpdate gr)
@@ -784,9 +782,9 @@ withGovActionParent ::
784782
a ->
785783
-- | Function that will be applied to a lens and a parent
786784
( forall p.
787-
(forall f. Lens' (GovRelation f era) (f (GovPurposeId p era))) ->
788-
StrictMaybe (GovPurposeId p era) -> -- GovAction Parent
789-
GovPurposeId p era ->
785+
(forall f. Lens' (GovRelation f) (f (GovPurposeId p))) ->
786+
StrictMaybe (GovPurposeId p) -> -- GovAction Parent
787+
GovPurposeId p ->
790788
a
791789
) ->
792790
a
@@ -806,15 +804,15 @@ data GovAction era
806804
= ParameterChange
807805
-- | Previous governance action id of `ParameterChange` type, which corresponds to
808806
-- `PParamUpdatePurpose`.
809-
!(StrictMaybe (GovPurposeId 'PParamUpdatePurpose era))
807+
!(StrictMaybe (GovPurposeId 'PParamUpdatePurpose))
810808
-- | Proposed changes to PParams
811809
!(PParamsUpdate era)
812810
-- | Policy hash protection
813811
!(StrictMaybe ScriptHash)
814812
| HardForkInitiation
815813
-- | Previous governance action id of `HardForkInitiation` type, which corresponds
816814
-- to `HardForkPurpose`
817-
!(StrictMaybe (GovPurposeId 'HardForkPurpose era))
815+
!(StrictMaybe (GovPurposeId 'HardForkPurpose))
818816
-- | Proposed new protocol version
819817
!ProtVer
820818
| TreasuryWithdrawals
@@ -825,11 +823,11 @@ data GovAction era
825823
| NoConfidence
826824
-- | Previous governance action id of `NoConfidence` or `UpdateCommittee` type, which
827825
-- corresponds to `CommitteePurpose`
828-
!(StrictMaybe (GovPurposeId 'CommitteePurpose era))
826+
!(StrictMaybe (GovPurposeId 'CommitteePurpose))
829827
| UpdateCommittee
830828
-- | Previous governance action id of `UpdateCommittee` or `NoConfidence` type, which
831829
-- corresponds to `CommitteePurpose`
832-
!(StrictMaybe (GovPurposeId 'CommitteePurpose era))
830+
!(StrictMaybe (GovPurposeId 'CommitteePurpose))
833831
-- | Constitutional Committe members to be removed
834832
!(Set (Credential 'ColdCommitteeRole))
835833
-- | Constitutional committee members to be added
@@ -839,7 +837,7 @@ data GovAction era
839837
| NewConstitution
840838
-- | Previous governance action id of `NewConstitution` type, which corresponds to
841839
-- `ConstitutionPurpose`
842-
!(StrictMaybe (GovPurposeId 'ConstitutionPurpose era))
840+
!(StrictMaybe (GovPurposeId 'ConstitutionPurpose))
843841
!(Constitution era)
844842
| InfoAction
845843
deriving (Generic, Ord)

0 commit comments

Comments
 (0)