Skip to content

Commit

Permalink
Add new bootstrap-related inhabitants to ConwayGovPredFailure
Browse files Browse the repository at this point in the history
  • Loading branch information
teodanciu committed Apr 29, 2024
1 parent 66e2e02 commit 2e1d1ac
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions eras/conway/impl/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## 1.14.0 0

* Add`DisallowedProposalDuringBootstrap` and `DisallowedVotesDuringBootstrap` to `ConwayGovPredFailure`
* Make `DRepDistr` calculation include rewards when no UTxO stake is delegated. #4273
* Rename `computeDrepPulser` to `computeDRepPulser`.
* Implement `NoThunks` instance for:
Expand Down
9 changes: 9 additions & 0 deletions eras/conway/impl/src/Cardano/Ledger/Conway/Rules/Gov.hs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ data ConwayGovPredFailure era
(StrictMaybe (ScriptHash (EraCrypto era)))
-- | The policy script hash of the current constitution
(StrictMaybe (ScriptHash (EraCrypto era)))
| DisallowedProposalDuringBootstrap (ProposalProcedure era)
| DisallowedVotesDuringBootstrap
(NonEmpty (Voter (EraCrypto era), GovActionId (EraCrypto era)))
deriving (Eq, Show, Generic)

type instance EraRuleFailure "GOV" (ConwayEra c) = ConwayGovPredFailure (ConwayEra c)
Expand All @@ -189,6 +192,8 @@ instance EraPParams era => DecCBOR (ConwayGovPredFailure era) where
9 -> SumD VotingOnExpiredGovAction <! From
10 -> SumD ProposalCantFollow <! From <! From <! From
11 -> SumD InvalidPolicyHash <! From <! From
12 -> SumD DisallowedProposalDuringBootstrap <! From
13 -> SumD DisallowedVotesDuringBootstrap <! From
k -> Invalid k

instance EraPParams era => EncCBOR (ConwayGovPredFailure era) where
Expand Down Expand Up @@ -221,6 +226,10 @@ instance EraPParams era => EncCBOR (ConwayGovPredFailure era) where
Sum InvalidPolicyHash 11
!> To got
!> To expected
DisallowedProposalDuringBootstrap proposal ->
Sum DisallowedProposalDuringBootstrap 12 !> To proposal
DisallowedVotesDuringBootstrap votes ->
Sum DisallowedVotesDuringBootstrap 13 !> To votes

instance EraPParams era => ToCBOR (ConwayGovPredFailure era) where
toCBOR = toEraCBOR @era
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1489,7 +1489,7 @@ instance Reflect era => PrettyA (ConwayCertsPredFailure era) where
ppConwayGovPredFailure :: ConwayGovPredFailure era -> PDoc
ppConwayGovPredFailure x = case x of
GovActionsDoNotExist c -> ppSexp "GovActionsDoNotExist" [prettyA c]
MalformedProposal ga -> ppSexp " MalformedProposal" [pcGovAction ga] -- (GovAction era)
MalformedProposal ga -> ppSexp "MalformedProposal" [pcGovAction ga]
ProposalProcedureNetworkIdMismatch racnt nw ->
ppSexp "ProposalProcedureNetworkIdMismatch" [pcRewardAccount racnt, pcNetwork nw]
TreasuryWithdrawalsNetworkIdMismatch sr nw ->
Expand All @@ -1498,14 +1498,17 @@ ppConwayGovPredFailure x = case x of
DisallowedVoters m -> ppSexp "DisallowedVoters" [prettyA m]
ConflictingCommitteeUpdate s ->
ppSexp "ConflictingCommitteeUpdate" [ppSet pcCredential s]
ExpirationEpochTooSmall m -> ppSexp " ExpirationEpochTooSmall" [ppMap pcCredential ppEpochNo m]
ExpirationEpochTooSmall m -> ppSexp "ExpirationEpochTooSmall" [ppMap pcCredential ppEpochNo m]
InvalidPrevGovActionId p -> ppSexp "InvalidPrevGovActionId" [pcProposalProcedure p]
VotingOnExpiredGovAction m ->
ppSexp "VotingOnExpiredGovAction" [prettyA m]
ProposalCantFollow s1 p1 p2 ->
ppSexp "ProposalCantFollow" [ppStrictMaybe pcGovPurposeId s1, ppProtVer p1, ppProtVer p2]
InvalidPolicyHash a b ->
ppSexp "InvalidPolicyHash" [ppStrictMaybe prettyA a, ppStrictMaybe prettyA b]
DisallowedProposalDuringBootstrap p ->
ppSexp "DisallowedProposalDuringBootstrap" [pcProposalProcedure p]
DisallowedVotesDuringBootstrap m -> ppSexp "DisallowedVotesDuringBootstrap" [prettyA m]

instance PrettyA (ConwayGovPredFailure era) where
prettyA = ppConwayGovPredFailure
Expand Down

0 comments on commit 2e1d1ac

Please sign in to comment.