Skip to content

Commit

Permalink
Add RefScriptSizeTooBig predicate failure to ConwayBbodyPredFailure
Browse files Browse the repository at this point in the history
  • Loading branch information
teodanciu committed Jun 27, 2024
1 parent 4189450 commit 3fd77f4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions eras/conway/impl/src/Cardano/Ledger/Conway/Rules/Bbody.hs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ data ConwayBbodyPredFailure era
!ExUnits
-- | Maximum allowed by protocal parameters
!ExUnits
| RefScriptsSizeTooBig
-- | Computed sum of reference script size
Int
-- | Maximum allowed total reference script size
Int
deriving (Generic)

deriving instance
Expand All @@ -130,6 +135,7 @@ instance
InvalidBodyHashBBODY x y -> Sum (InvalidBodyHashBBODY @era) 1 !> To x !> To y
LedgersFailure x -> Sum (LedgersFailure @era) 2 !> To x
TooManyExUnits x y -> Sum TooManyExUnits 3 !> To x !> To y
RefScriptsSizeTooBig x y -> Sum RefScriptsSizeTooBig 4 !> To x !> To y

instance
( Era era
Expand All @@ -142,6 +148,7 @@ instance
1 -> SumD InvalidBodyHashBBODY <! From <! From
2 -> SumD LedgersFailure <! From
3 -> SumD TooManyExUnits <! From <! From
4 -> SumD RefScriptsSizeTooBig <! From <! From
n -> Invalid n

type instance EraRuleFailure "BBODY" (ConwayEra c) = ConwayBbodyPredFailure (ConwayEra c)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1656,6 +1656,12 @@ instance Reflect era => PrettyA (ShelleyBbodyPredFailure era) where

-- ================
ppConwayBbodyPredFail :: forall era. Reflect era => ConwayBbodyPredFailure era -> PDoc
ppConwayBbodyPredFail (ConwayRules.RefScriptsSizeTooBig s1 s2) =
ppRecord
"RefScriptsSizeTooBig"
[ ("Computed sum of reference script size", ppInt s1)
, ("Maximum allowed total reference script size", ppInt s2)
]
ppConwayBbodyPredFail (ConwayRules.TooManyExUnits e1 e2) =
ppRecord
"TooManyExUnits"
Expand Down

0 comments on commit 3fd77f4

Please sign in to comment.