{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
{-# OPTIONS_GHC -Wno-orphans #-}
module Cardano.Ledger.Alonzo (
AlonzoEra,
AlonzoTxOut,
MaryValue,
pattern AlonzoTxBody,
AlonzoScript,
AlonzoTxAuxData,
Tx (..),
ApplyTxError (..),
) where
import Cardano.Ledger.Alonzo.BlockBody ()
import Cardano.Ledger.Alonzo.Era
import Cardano.Ledger.Alonzo.PParams ()
import Cardano.Ledger.Alonzo.Plutus.TxInfo ()
import Cardano.Ledger.Alonzo.Rules ()
import Cardano.Ledger.Alonzo.Scripts (AlonzoScript (..))
import Cardano.Ledger.Alonzo.State ()
import Cardano.Ledger.Alonzo.Transition ()
import Cardano.Ledger.Alonzo.Translation ()
import Cardano.Ledger.Alonzo.Tx (Tx (..))
import Cardano.Ledger.Alonzo.TxAuxData (AlonzoTxAuxData)
import Cardano.Ledger.Alonzo.TxBody (AlonzoTxOut, TxBody (AlonzoTxBody))
import Cardano.Ledger.Alonzo.TxWits ()
import Cardano.Ledger.Alonzo.UTxO ()
import Cardano.Ledger.Binary (DecCBOR, EncCBOR)
import Cardano.Ledger.Mary.Value (MaryValue)
import Cardano.Ledger.Plutus.Data ()
import Cardano.Ledger.Shelley.API
import Cardano.Ledger.Shelley.Rules (ShelleyLedgerPredFailure)
import Data.Bifunctor (Bifunctor (first))
import Data.List.NonEmpty (NonEmpty)
instance ApplyTx AlonzoEra where
newtype ApplyTxError AlonzoEra = AlonzoApplyTxError (NonEmpty (ShelleyLedgerPredFailure AlonzoEra))
deriving (ApplyTxError AlonzoEra -> ApplyTxError AlonzoEra -> Bool
(ApplyTxError AlonzoEra -> ApplyTxError AlonzoEra -> Bool)
-> (ApplyTxError AlonzoEra -> ApplyTxError AlonzoEra -> Bool)
-> Eq (ApplyTxError AlonzoEra)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ApplyTxError AlonzoEra -> ApplyTxError AlonzoEra -> Bool
== :: ApplyTxError AlonzoEra -> ApplyTxError AlonzoEra -> Bool
$c/= :: ApplyTxError AlonzoEra -> ApplyTxError AlonzoEra -> Bool
/= :: ApplyTxError AlonzoEra -> ApplyTxError AlonzoEra -> Bool
Eq, Int -> ApplyTxError AlonzoEra -> ShowS
[ApplyTxError AlonzoEra] -> ShowS
ApplyTxError AlonzoEra -> String
(Int -> ApplyTxError AlonzoEra -> ShowS)
-> (ApplyTxError AlonzoEra -> String)
-> ([ApplyTxError AlonzoEra] -> ShowS)
-> Show (ApplyTxError AlonzoEra)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ApplyTxError AlonzoEra -> ShowS
showsPrec :: Int -> ApplyTxError AlonzoEra -> ShowS
$cshow :: ApplyTxError AlonzoEra -> String
show :: ApplyTxError AlonzoEra -> String
$cshowList :: [ApplyTxError AlonzoEra] -> ShowS
showList :: [ApplyTxError AlonzoEra] -> ShowS
Show)
deriving newtype (ApplyTxError AlonzoEra -> Encoding
(ApplyTxError AlonzoEra -> Encoding)
-> EncCBOR (ApplyTxError AlonzoEra)
forall a. (a -> Encoding) -> EncCBOR a
$cencCBOR :: ApplyTxError AlonzoEra -> Encoding
encCBOR :: ApplyTxError AlonzoEra -> Encoding
EncCBOR, Typeable (ApplyTxError AlonzoEra)
Typeable (ApplyTxError AlonzoEra) =>
(forall s. Decoder s (ApplyTxError AlonzoEra))
-> (forall s. Proxy (ApplyTxError AlonzoEra) -> Decoder s ())
-> (Proxy (ApplyTxError AlonzoEra) -> Text)
-> DecCBOR (ApplyTxError AlonzoEra)
Proxy (ApplyTxError AlonzoEra) -> Text
forall s. Decoder s (ApplyTxError AlonzoEra)
forall a.
Typeable a =>
(forall s. Decoder s a)
-> (forall s. Proxy a -> Decoder s ())
-> (Proxy a -> Text)
-> DecCBOR a
forall s. Proxy (ApplyTxError AlonzoEra) -> Decoder s ()
$cdecCBOR :: forall s. Decoder s (ApplyTxError AlonzoEra)
decCBOR :: forall s. Decoder s (ApplyTxError AlonzoEra)
$cdropCBOR :: forall s. Proxy (ApplyTxError AlonzoEra) -> Decoder s ()
dropCBOR :: forall s. Proxy (ApplyTxError AlonzoEra) -> Decoder s ()
$clabel :: Proxy (ApplyTxError AlonzoEra) -> Text
label :: Proxy (ApplyTxError AlonzoEra) -> Text
DecCBOR)
applyTxValidation :: ValidationPolicy
-> Globals
-> MempoolEnv AlonzoEra
-> MempoolState AlonzoEra
-> Tx TopTx AlonzoEra
-> Either
(ApplyTxError AlonzoEra)
(MempoolState AlonzoEra, Validated (Tx TopTx AlonzoEra))
applyTxValidation ValidationPolicy
validationPolicy Globals
globals MempoolEnv AlonzoEra
env MempoolState AlonzoEra
state Tx TopTx AlonzoEra
tx =
(NonEmpty (ShelleyLedgerPredFailure AlonzoEra)
-> ApplyTxError AlonzoEra)
-> Either
(NonEmpty (ShelleyLedgerPredFailure AlonzoEra))
(MempoolState AlonzoEra, Validated (Tx TopTx AlonzoEra))
-> Either
(ApplyTxError AlonzoEra)
(MempoolState AlonzoEra, Validated (Tx TopTx AlonzoEra))
forall a b c. (a -> b) -> Either a c -> Either b c
forall (p :: * -> * -> *) a b c.
Bifunctor p =>
(a -> b) -> p a c -> p b c
first NonEmpty (ShelleyLedgerPredFailure AlonzoEra)
-> ApplyTxError AlonzoEra
AlonzoApplyTxError (Either
(NonEmpty (ShelleyLedgerPredFailure AlonzoEra))
(MempoolState AlonzoEra, Validated (Tx TopTx AlonzoEra))
-> Either
(ApplyTxError AlonzoEra)
(MempoolState AlonzoEra, Validated (Tx TopTx AlonzoEra)))
-> Either
(NonEmpty (ShelleyLedgerPredFailure AlonzoEra))
(MempoolState AlonzoEra, Validated (Tx TopTx AlonzoEra))
-> Either
(ApplyTxError AlonzoEra)
(MempoolState AlonzoEra, Validated (Tx TopTx AlonzoEra))
forall a b. (a -> b) -> a -> b
$
forall (rule :: Symbol) era.
(STS (EraRule rule era), BaseM (EraRule rule era) ~ ShelleyBase,
Environment (EraRule rule era) ~ LedgerEnv era,
State (EraRule rule era) ~ MempoolState era,
Signal (EraRule rule era) ~ Tx TopTx era) =>
ValidationPolicy
-> Globals
-> LedgerEnv era
-> MempoolState era
-> Tx TopTx era
-> Either
(NonEmpty (PredicateFailure (EraRule rule era)))
(MempoolState era, Validated (Tx TopTx era))
ruleApplyTxValidation @"LEDGER" ValidationPolicy
validationPolicy Globals
globals MempoolEnv AlonzoEra
env MempoolState AlonzoEra
state Tx TopTx AlonzoEra
tx
instance ApplyBlock AlonzoEra