11{-# LANGUAGE DataKinds #-}
2+ {-# LANGUAGE DerivingStrategies #-}
23{-# LANGUAGE FlexibleContexts #-}
34{-# LANGUAGE FlexibleInstances #-}
5+ {-# LANGUAGE GeneralizedNewtypeDeriving #-}
46{-# LANGUAGE PatternSynonyms #-}
57{-# LANGUAGE ScopedTypeVariables #-}
68{-# LANGUAGE TypeApplications #-}
9+ {-# LANGUAGE TypeFamilies #-}
710{-# LANGUAGE UndecidableInstances #-}
811{-# OPTIONS_GHC -Wno-orphans #-}
912
@@ -15,6 +18,7 @@ module Cardano.Ledger.Alonzo (
1518 AlonzoScript ,
1619 AlonzoTxAuxData ,
1720 Tx (.. ),
21+ ApplyTxError (.. ),
1822) where
1923
2024import Cardano.Ledger.Alonzo.BlockBody ()
@@ -31,13 +35,22 @@ import Cardano.Ledger.Alonzo.TxAuxData (AlonzoTxAuxData)
3135import Cardano.Ledger.Alonzo.TxBody (AlonzoTxOut , TxBody (AlonzoTxBody ))
3236import Cardano.Ledger.Alonzo.TxWits ()
3337import Cardano.Ledger.Alonzo.UTxO ()
38+ import Cardano.Ledger.Binary (DecCBOR , EncCBOR )
3439import Cardano.Ledger.Mary.Value (MaryValue )
3540import Cardano.Ledger.Plutus.Data ()
3641import Cardano.Ledger.Shelley.API
42+ import Cardano.Ledger.Shelley.Rules (ShelleyLedgerPredFailure )
43+ import Data.Bifunctor (Bifunctor (first ))
44+ import Data.List.NonEmpty (NonEmpty )
3745
3846-- =====================================================
3947
4048instance ApplyTx AlonzoEra where
41- applyTxValidation = ruleApplyTxValidation @ " LEDGER"
49+ newtype ApplyTxError AlonzoEra = AlonzoApplyTxError (NonEmpty (ShelleyLedgerPredFailure AlonzoEra ))
50+ deriving (Eq , Show )
51+ deriving newtype (EncCBOR , DecCBOR )
52+ applyTxValidation validationPolicy globals env state tx =
53+ first AlonzoApplyTxError $
54+ ruleApplyTxValidation @ " LEDGER" validationPolicy globals env state tx
4255
4356instance ApplyBlock AlonzoEra
0 commit comments