cardano-ledger-alonzo-1.12.0.0: Cardano ledger introducing Plutus Core
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cardano.Ledger.Alonzo.Tx

Description

This module exports implementations of many of the functions outlined in the Alonzo specification. The link to source of the specification https://github.com/intersectmbo/cardano-ledger/tree/master/eras/alonzo/formal-spec The most recent version of the document can be found here: https://github.com/intersectmbo/cardano-ledger/releases/latest/download/alonzo-ledger.pdf The functions can be found in Figures in that document, and sections of this code refer to those figures.

Synopsis

Documentation

data CostModel Source #

A language dependent cost model for the Plutus evaluator. Note that the EvaluationContext is entirely dependent on the cost model parameters (ie the Map Text Integer) and that this type uses the smart constructor mkCostModel to hide the evaluation context.

Instances

Instances details
ToJSON CostModel 
Instance details

Defined in Cardano.Ledger.Plutus.CostModels

Generic CostModel 
Instance details

Defined in Cardano.Ledger.Plutus.CostModels

Associated Types

type Rep CostModelTypeType Source #

Show CostModel 
Instance details

Defined in Cardano.Ledger.Plutus.CostModels

NFData CostModel 
Instance details

Defined in Cardano.Ledger.Plutus.CostModels

Methods

rnfCostModel → () Source #

Eq CostModel

Note that this Eq instance ignores the evaluation context, which is entirely dependent on the cost model parameters and is guarded by the smart constructor mkCostModel.

Instance details

Defined in Cardano.Ledger.Plutus.CostModels

Ord CostModel

Note that this Ord instance ignores the evaluation context, which is entirely dependent on the cost model parameters and is guarded by the smart constructor mkCostModel.

Instance details

Defined in Cardano.Ledger.Plutus.CostModels

NoThunks CostModel 
Instance details

Defined in Cardano.Ledger.Plutus.CostModels

type Rep CostModel 
Instance details

Defined in Cardano.Ledger.Plutus.CostModels

type Rep CostModel = D1 ('MetaData "CostModel" "Cardano.Ledger.Plutus.CostModels" "cardano-ledger-core-1.16.0.0-inplace" 'False) (C1 ('MetaCons "CostModel" 'PrefixI 'True) (S1 ('MetaSel ('Just "cmLanguage") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Language) :*: (S1 ('MetaSel ('Just "cmValues") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [Int64]) :*: S1 ('MetaSel ('Just "cmEvalCtx") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 EvaluationContext))))

data Data era Source #

Instances

Instances details
Memoized Data 
Instance details

Defined in Cardano.Ledger.Plutus.Data

Associated Types

type RawType Data = (r ∷ TypeType) Source #

Methods

getMemoBytesData era → MemoBytes (RawType Data) era

wrapMemoBytesMemoBytes (RawType Data) era → Data era

Generic (Data era) 
Instance details

Defined in Cardano.Ledger.Plutus.Data

Associated Types

type Rep (Data era) ∷ TypeType Source #

Methods

fromData era → Rep (Data era) x Source #

toRep (Data era) x → Data era Source #

HashAlgorithm (HASH (EraCrypto era)) ⇒ Show (Data era) 
Instance details

Defined in Cardano.Ledger.Plutus.Data

Methods

showsPrecIntData era → ShowS Source #

showData era → String Source #

showList ∷ [Data era] → ShowS Source #

Typeable era ⇒ ToCBOR (Data era) 
Instance details

Defined in Cardano.Ledger.Plutus.Data

Methods

toCBORData era → Encoding Source #

encodedSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy (Data era) → Size Source #

encodedListSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy [Data era] → Size Source #

Era era ⇒ DecCBOR (Annotator (Data era)) 
Instance details

Defined in Cardano.Ledger.Plutus.Data

Methods

decCBORDecoder s (Annotator (Data era)) Source #

dropCBORProxy (Annotator (Data era)) → Decoder s () Source #

labelProxy (Annotator (Data era)) → Text Source #

Typeable era ⇒ EncCBOR (Data era)

Encodes memoized bytes created upon construction.

Instance details

Defined in Cardano.Ledger.Plutus.Data

Methods

encCBORData era → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (Data era) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [Data era] → Size Source #

SafeToHash (Data era) 
Instance details

Defined in Cardano.Ledger.Plutus.Data

NFData (Data era) 
Instance details

Defined in Cardano.Ledger.Plutus.Data

Methods

rnfData era → () Source #

Eq (Data era) 
Instance details

Defined in Cardano.Ledger.Plutus.Data

Methods

(==)Data era → Data era → Bool Source #

(/=)Data era → Data era → Bool Source #

Typeable era ⇒ NoThunks (Data era) 
Instance details

Defined in Cardano.Ledger.Plutus.Data

EraCrypto era ~ c ⇒ HashAnnotated (Data era) EraIndependentData c 
Instance details

Defined in Cardano.Ledger.Plutus.Data

type RawType Data 
Instance details

Defined in Cardano.Ledger.Plutus.Data

type Rep (Data era) 
Instance details

Defined in Cardano.Ledger.Plutus.Data

type Rep (Data era) = D1 ('MetaData "Data" "Cardano.Ledger.Plutus.Data" "cardano-ledger-core-1.16.0.0-inplace" 'True) (C1 ('MetaCons "DataConstr" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (MemoBytes PlutusData era))))

newtype IsValid Source #

Tag indicating whether non-native scripts in this transaction are expected to validate. This is added by the block creator when constructing the block.

Constructors

IsValid Bool 

Instances

Instances details
ToJSON IsValid Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

Generic IsValid Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

Associated Types

type Rep IsValidTypeType Source #

Methods

fromIsValidRep IsValid x Source #

toRep IsValid x → IsValid Source #

Show IsValid Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

ToCBOR IsValid Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

Methods

toCBORIsValidEncoding Source #

encodedSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy IsValidSize Source #

encodedListSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy [IsValid] → Size Source #

DecCBOR IsValid Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

EncCBOR IsValid Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

Methods

encCBORIsValidEncoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy IsValidSize Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [IsValid] → Size Source #

NFData IsValid Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

Methods

rnfIsValid → () Source #

Eq IsValid Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

Methods

(==)IsValidIsValidBool Source #

(/=)IsValidIsValidBool Source #

NoThunks IsValid Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

type Rep IsValid Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

type Rep IsValid = D1 ('MetaData "IsValid" "Cardano.Ledger.Alonzo.Tx" "cardano-ledger-alonzo-1.12.0.0-inplace" 'True) (C1 ('MetaCons "IsValid" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)))

hashDataEra era ⇒ Data era → DataHash (EraCrypto era) Source #

data ScriptIntegrity era Source #

A ScriptIntegrityHash is the hash of three things. The first two come from the witnesses and the last comes from the Protocol Parameters.

Constructors

ScriptIntegrity !(Redeemers era) !(TxDats era) !(Set LangDepView) 

Instances

Instances details
Generic (ScriptIntegrity era) Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

Associated Types

type Rep (ScriptIntegrity era) ∷ TypeType Source #

AlonzoEraScript era ⇒ Show (ScriptIntegrity era) Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

Era era ⇒ SafeToHash (ScriptIntegrity era) Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

AlonzoEraScript era ⇒ Eq (ScriptIntegrity era) Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

AlonzoEraScript era ⇒ NoThunks (ScriptIntegrity era) Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

(Era era, c ~ EraCrypto era) ⇒ HashAnnotated (ScriptIntegrity era) EraIndependentScriptIntegrity c Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

type Rep (ScriptIntegrity era) Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

type Rep (ScriptIntegrity era) = D1 ('MetaData "ScriptIntegrity" "Cardano.Ledger.Alonzo.Tx" "cardano-ledger-alonzo-1.12.0.0-inplace" 'False) (C1 ('MetaCons "ScriptIntegrity" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Redeemers era)) :*: (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (TxDats era)) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Set LangDepView)))))

data AlonzoTx era Source #

Constructors

AlonzoTx 

Fields

Instances

Instances details
Generic (AlonzoTx era) Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

Associated Types

type Rep (AlonzoTx era) ∷ TypeType Source #

Methods

fromAlonzoTx era → Rep (AlonzoTx era) x Source #

toRep (AlonzoTx era) x → AlonzoTx era Source #

(Era era, Show (TxBody era), Show (TxAuxData era), Show (Script era), Show (TxWits era)) ⇒ Show (AlonzoTx era) Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

Methods

showsPrecIntAlonzoTx era → ShowS Source #

showAlonzoTx era → String Source #

showList ∷ [AlonzoTx era] → ShowS Source #

(Era era, EncCBOR (TxBody era), EncCBOR (TxAuxData era), EncCBOR (TxWits era)) ⇒ ToCBOR (AlonzoTx era) Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

Methods

toCBORAlonzoTx era → Encoding Source #

encodedSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy (AlonzoTx era) → Size Source #

encodedListSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy [AlonzoTx era] → Size Source #

(Typeable era, DecCBOR (Annotator (TxBody era)), DecCBOR (Annotator (TxWits era)), DecCBOR (Annotator (TxAuxData era))) ⇒ DecCBOR (Annotator (AlonzoTx era)) Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

(Era era, EncCBOR (TxBody era), EncCBOR (TxAuxData era), EncCBOR (TxWits era)) ⇒ EncCBOR (AlonzoTx era) Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

Methods

encCBORAlonzoTx era → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (AlonzoTx era) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [AlonzoTx era] → Size Source #

(Tx era ~ AlonzoTx era, AlonzoEraTx era) ⇒ EqRaw (AlonzoTx era) Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

Methods

eqRawAlonzoTx era → AlonzoTx era → Bool Source #

(Era era, NFData (TxWits era), NFData (TxAuxData era), NFData (TxBody era)) ⇒ NFData (AlonzoTx era) Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

Methods

rnfAlonzoTx era → () Source #

(Era era, Eq (TxBody era), Eq (TxWits era), Eq (TxAuxData era)) ⇒ Eq (AlonzoTx era) Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

Methods

(==)AlonzoTx era → AlonzoTx era → Bool Source #

(/=)AlonzoTx era → AlonzoTx era → Bool Source #

(Era era, NoThunks (TxWits era), NoThunks (TxAuxData era), NoThunks (TxBody era)) ⇒ NoThunks (AlonzoTx era) Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

type Rep (AlonzoTx era) Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

type Rep (AlonzoTx era) = D1 ('MetaData "AlonzoTx" "Cardano.Ledger.Alonzo.Tx" "cardano-ledger-alonzo-1.12.0.0-inplace" 'False) (C1 ('MetaCons "AlonzoTx" 'PrefixI 'True) ((S1 ('MetaSel ('Just "body") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (TxBody era)) :*: S1 ('MetaSel ('Just "wits") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (TxWits era))) :*: (S1 ('MetaSel ('Just "isValid") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 IsValid) :*: S1 ('MetaSel ('Just "auxiliaryData") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (StrictMaybe (TxAuxData era))))))

class (EraTx era, AlonzoEraTxBody era, AlonzoEraTxWits era, AlonzoEraScript era) ⇒ AlonzoEraTx era where Source #

Methods

isValidTxLLens' (Tx era) IsValid Source #

Instances

Instances details
Crypto c ⇒ AlonzoEraTx (AlonzoEra c) Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

mkBasicAlonzoTxMonoid (TxWits era) ⇒ TxBody era → AlonzoTx era Source #

bodyAlonzoTxLLens' (AlonzoTx era) (TxBody era) Source #

TxBody setter and getter for AlonzoTx.

witsAlonzoTxLLens' (AlonzoTx era) (TxWits era) Source #

TxWits setter and getter for AlonzoTx.

sizeAlonzoTxF ∷ ∀ era. EraTx era ⇒ SimpleGetter (AlonzoTx era) Integer Source #

txsize computes the length of the serialised bytes (for estimations)

wireSizeAlonzoTxF ∷ ∀ era. EraTx era ⇒ SimpleGetter (AlonzoTx era) Word32 Source #

txsize computes the length of the serialised bytes (actual size)

txdats'Era era ⇒ AlonzoTxWits era → TxDats era Source #

txscripts'Era era ⇒ AlonzoTxWits era → Map (ScriptHash (EraCrypto era)) (Script era) Source #

data AlonzoTxBody era where Source #

Bundled Patterns

pattern AlonzoTxBody ∷ (EraTxOut era, EraTxCert era) ⇒ Set (TxIn (EraCrypto era)) → Set (TxIn (EraCrypto era)) → StrictSeq (TxOut era) → StrictSeq (TxCert era) → Withdrawals (EraCrypto era) → CoinValidityIntervalStrictMaybe (Update era) → Set (KeyHash 'Witness (EraCrypto era)) → MultiAsset (EraCrypto era) → StrictMaybe (ScriptIntegrityHash (EraCrypto era)) → StrictMaybe (AuxiliaryDataHash (EraCrypto era)) → StrictMaybe NetworkAlonzoTxBody era 

Instances

Instances details
Memoized AlonzoTxBody Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.TxBody.Internal

Associated Types

type RawType AlonzoTxBody = (r ∷ TypeType) Source #

Generic (AlonzoTxBody era) Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.TxBody.Internal

Associated Types

type Rep (AlonzoTxBody era) ∷ TypeType Source #

Methods

fromAlonzoTxBody era → Rep (AlonzoTxBody era) x Source #

toRep (AlonzoTxBody era) x → AlonzoTxBody era Source #

(Era era, Show (TxOut era), Show (TxCert era), Show (PParamsUpdate era)) ⇒ Show (AlonzoTxBody era) Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.TxBody.Internal

Typeable era ⇒ ToCBOR (AlonzoTxBody era) Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.TxBody.Internal

Methods

toCBORAlonzoTxBody era → Encoding Source #

encodedSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy (AlonzoTxBody era) → Size Source #

encodedListSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy [AlonzoTxBody era] → Size Source #

(Era era, DecCBOR (TxOut era), DecCBOR (TxCert era), DecCBOR (PParamsUpdate era)) ⇒ DecCBOR (Annotator (AlonzoTxBody era)) Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.TxBody.Internal

Era era ⇒ EncCBOR (AlonzoTxBody era) Source #

Encodes memoized bytes created upon construction.

Instance details

Defined in Cardano.Ledger.Alonzo.TxBody.Internal

Methods

encCBORAlonzoTxBody era → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (AlonzoTxBody era) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [AlonzoTxBody era] → Size Source #

(Era era, Eq (PParamsUpdate era), Eq (TxOut era), Eq (TxCert era)) ⇒ EqRaw (AlonzoTxBody era) Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.TxBody.Internal

Methods

eqRawAlonzoTxBody era → AlonzoTxBody era → Bool Source #

SafeToHash (AlonzoTxBody era) Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.TxBody.Internal

(Era era, NFData (TxOut era), NFData (TxCert era), NFData (PParamsUpdate era)) ⇒ NFData (AlonzoTxBody era) Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.TxBody.Internal

Methods

rnfAlonzoTxBody era → () Source #

(Era era, Eq (TxOut era), Eq (TxCert era), Eq (PParamsUpdate era)) ⇒ Eq (AlonzoTxBody era) Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.TxBody.Internal

Methods

(==)AlonzoTxBody era → AlonzoTxBody era → Bool Source #

(/=)AlonzoTxBody era → AlonzoTxBody era → Bool Source #

(Era era, NoThunks (TxOut era), NoThunks (TxCert era), NoThunks (PParamsUpdate era)) ⇒ NoThunks (AlonzoTxBody era) Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.TxBody.Internal

c ~ EraCrypto era ⇒ HashAnnotated (AlonzoTxBody era) EraIndependentTxBody c Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.TxBody.Internal

type RawType AlonzoTxBody Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.TxBody.Internal

type Rep (AlonzoTxBody era) Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.TxBody.Internal

type Rep (AlonzoTxBody era) = D1 ('MetaData "AlonzoTxBody" "Cardano.Ledger.Alonzo.TxBody.Internal" "cardano-ledger-alonzo-1.12.0.0-inplace" 'True) (C1 ('MetaCons "TxBodyConstr" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (MemoBytes AlonzoTxBodyRaw era))))

totExUnits ∷ (EraTx era, AlonzoEraTxWits era) ⇒ Tx era → ExUnits Source #

alonzoMinFeeTx ∷ (EraTx era, AlonzoEraTxWits era, AlonzoEraPParams era) ⇒ PParams era → Tx era → Coin Source #

txoutsEraTxBody era ⇒ TxBody era → UTxO era Source #

Compute the transaction outputs of a transaction.

alonzoSegwitTxAlonzoEraTx era ⇒ Annotator (TxBody era) → Annotator (TxWits era) → IsValidMaybe (Annotator (TxAuxData era)) → Annotator (Tx era) Source #

Construct an annotated Alonzo style transaction.

toCBORForSizeComputation ∷ (EncCBOR (TxBody era), EncCBOR (TxWits era), EncCBOR (TxAuxData era)) ⇒ AlonzoTx era → Encoding Source #

This ensures that the size of transactions from Mary is unchanged. The individual components all store their bytes; the only work we do in this function is concatenating

toCBORForMempoolSubmission ∷ (EncCBOR (TxBody era), EncCBOR (TxWits era), EncCBOR (TxAuxData era)) ⇒ AlonzoTx era → Encoding Source #

Encode to CBOR for the purposes of transmission from node to node, or from wallet to node.

Note that this serialisation is neither the serialisation used on-chain (where Txs are deconstructed using segwit), nor the serialisation used for computing the transaction size (which omits the IsValid field for compatibility with Mary - see toCBORForSizeComputation).

alonzoEqTxRawAlonzoEraTx era ⇒ Tx era → Tx era → Bool Source #

Orphan instances