cardano-ledger-alonzo-0.1.0.0: Cardano ledger introducing Plutus Core
Safe Haskell None
Language Haskell2010

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/input-output-hk/cardano-ledger/tree/master/eras/alonzo/formal-spec The most recent version of the document can be found here: https://hydra.iohk.io/job/Cardano/cardano-ledger/specs.alonzo-ledger/latest/download-by-type/doc-pdf/alonzo-changes 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
Eq CostModel Source #

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.Alonzo.Scripts

Ord CostModel Source #

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.Alonzo.Scripts

Show CostModel Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

Generic CostModel Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

NFData CostModel Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

ToJSON CostModel Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Genesis

ToCBOR CostModel Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

SafeToHash CostModel Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

NoThunks CostModel Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

HashWithCrypto CostModel CostModel Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

type Rep CostModel Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

data Data era Source #

Instances

Instances details
c ~ Crypto era => HasField "txdatahash" ( ValidatedTx era) ( Map ( DataHash c) ( Data era)) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

Eq ( Data era) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Data

Ord ( Data era) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Data

Show ( Data era) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Data

Generic ( Data era) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Data

Associated Types

type Rep ( Data era) :: Type -> Type Source #

NFData ( Data era) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Data

Methods

rnf :: Data era -> () Source #

Typeable era => ToCBOR ( Data era) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Data

Typeable era => FromCBOR ( Annotator ( Data era)) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Data

SafeToHash ( Data era) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Data

NoThunks ( Data era) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Data

Crypto era ~ c => HashAnnotated ( Data era) EraIndependentData c Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Data

type Rep ( Data era) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Data

type Rep ( Data era) = D1 (' MetaData "Data" "Cardano.Ledger.Alonzo.Data" "cardano-ledger-alonzo-0.1.0.0-xW3meaGVQP43dxJ76zbGD" ' True ) ( C1 (' MetaCons "DataConstr" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ( MemoBytes Data ))))

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
Eq IsValid Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

Show IsValid Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

Generic IsValid Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

NFData IsValid Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

ToCBOR IsValid Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

FromCBOR IsValid Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

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-0.1.0.0-xW3meaGVQP43dxJ76zbGD" ' True ) ( C1 (' MetaCons "IsValid" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Bool )))

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.

Instances

Instances details
Eq ( ScriptIntegrity era) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

Show ( ScriptIntegrity era) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

Generic ( ScriptIntegrity era) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

Associated Types

type Rep ( ScriptIntegrity era) :: Type -> Type Source #

Era era => SafeToHash ( ScriptIntegrity era) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

Typeable era => NoThunks ( ScriptIntegrity era) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

( Era era, c ~ Crypto 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

data ValidatedTx era Source #

Instances

Instances details
( Typeable era, ToCBOR ( TxBody era), ToCBOR ( AuxiliaryData era)) => HasField "txsize" ( ValidatedTx era) Integer Source #

txsize computes the length of the serialised bytes

Instance details

Defined in Cardano.Ledger.Alonzo.Tx

c ~ Crypto era => HasField "addrWits" ( ValidatedTx era) ( Set ( WitVKey ' Witness c)) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

c ~ Crypto era => HasField "bootWits" ( ValidatedTx era) ( Set ( BootstrapWitness c)) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

(c ~ Crypto era, script ~ Script era) => HasField "scriptWits" ( ValidatedTx era) ( Map ( ScriptHash c) script) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

c ~ Crypto era => HasField "txdatahash" ( ValidatedTx era) ( Map ( DataHash c) ( Data era)) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

( Era era, Eq ( AuxiliaryData era), Eq ( Script era), Eq ( TxBody era), Eq ( Value era), Eq ( PParamsDelta era), Compactible ( Value era)) => Eq ( ValidatedTx era) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

( Era era, Compactible ( Value era), Show ( AuxiliaryData era), Show ( Script era), Show ( TxBody era), Show ( Value era), Show ( PParamsDelta era)) => Show ( ValidatedTx era) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

Generic ( ValidatedTx era) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

Associated Types

type Rep ( ValidatedTx era) :: Type -> Type Source #

( Era era, Script era ~ Script era, crypto ~ Crypto era, NFData ( AuxiliaryData era), NFData ( Script era), NFData ( TxBody era), NFData ( Value era), NFData ( PParamsDelta era), NFData ( TxDats era), NFData ( Redeemers era), NFData ( VerKeyDSIGN ( DSIGN crypto)), NFData ( SigDSIGN ( DSIGN crypto))) => NFData ( ValidatedTx era) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

( Typeable era, ToCBOR ( TxBody era), ToCBOR ( AuxiliaryData era)) => ToCBOR ( ValidatedTx era) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

( Era era, FromCBOR ( Annotator ( TxBody era)), FromCBOR ( Annotator ( AuxiliaryData era)), FromCBOR ( Annotator ( Witnesses era)), ValidateScript era, Script era ~ Script era) => FromCBOR ( Annotator ( ValidatedTx era)) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

( Era era, NoThunks ( AuxiliaryData era), NoThunks ( Script era), NoThunks ( TxBody era), NoThunks ( Value era), NoThunks ( PParamsDelta era)) => NoThunks ( ValidatedTx era) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

type Rep ( ValidatedTx era) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

data TxBody era where Source #

Instances

Instances details
HasField "txfee" ( TxBody era) Coin Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxBody

HasField "vldt" ( TxBody era) ValidityInterval Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxBody

c ~ Crypto era => HasField "adHash" ( TxBody era) ( StrictMaybe ( AuxiliaryDataHash c)) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxBody

Crypto era ~ crypto => HasField "certs" ( TxBody era) ( StrictSeq ( DCert crypto)) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxBody

Crypto era ~ c => HasField "collateral" ( TxBody era) ( Set ( TxIn c)) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxBody

Crypto era ~ c => HasField "inputs" ( TxBody era) ( Set ( TxIn c)) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxBody

Crypto era ~ c => HasField "mint" ( TxBody era) ( Value c) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxBody

Crypto era ~ c => HasField "minted" ( TxBody era) ( Set ( ScriptHash c)) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxBody

HasField "outputs" ( TxBody era) ( StrictSeq ( TxOut era)) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxBody

Crypto era ~ crypto => HasField "referenceInputs" ( TxBody era) ( Set ( TxIn crypto)) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxBody

Crypto era ~ c => HasField "reqSignerHashes" ( TxBody era) ( Set ( KeyHash ' Witness c)) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxBody

c ~ Crypto era => HasField "scriptIntegrityHash" ( TxBody era) ( StrictMaybe ( ScriptIntegrityHash c)) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxBody

HasField "txnetworkid" ( TxBody era) ( StrictMaybe Network ) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxBody

HasField "update" ( TxBody era) ( StrictMaybe ( Update era)) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxBody

Crypto era ~ crypto => HasField "wdrls" ( TxBody era) ( Wdrl crypto) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxBody

Crypto ( Crypto era) => Eq ( TxBody era) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxBody

( Era era, Compactible ( Value era), Show ( Value era), Show ( PParamsDelta era)) => Show ( TxBody era) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxBody

( Crypto ( Crypto era), Typeable era, NFData ( Value era), NFData ( PParamsDelta era)) => NFData ( TxBody era) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxBody

Methods

rnf :: TxBody era -> () Source #

Typeable era => ToCBOR ( TxBody era) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxBody

( Era era, Typeable ( Script era), Typeable ( AuxiliaryData era), Compactible ( Value era), Show ( Value era), DecodeNonNegative ( Value era), FromCBOR ( Annotator ( Script era)), SerialisableData ( PParamsDelta era)) => FromCBOR ( Annotator ( TxBody era)) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxBody

SafeToHash ( TxBody era) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxBody

( Typeable era, NoThunks ( Value era), NoThunks ( PParamsDelta era)) => NoThunks ( TxBody era) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxBody

c ~ Crypto era => HashAnnotated ( TxBody era) EraIndependentTxBody c Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxBody

data ScriptPurpose crypto Source #

Instances

Instances details
Eq ( ScriptPurpose crypto) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

Show ( ScriptPurpose crypto) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

Generic ( ScriptPurpose crypto) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

Associated Types

type Rep ( ScriptPurpose crypto) :: Type -> Type Source #

Crypto crypto => NFData ( ScriptPurpose crypto) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

Methods

rnf :: ScriptPurpose crypto -> () Source #

( Typeable c, Crypto c) => ToCBOR ( ScriptPurpose c) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

( Typeable c, Crypto c) => FromCBOR ( ScriptPurpose c) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

NoThunks ( ScriptPurpose crypto) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

type Rep ( ScriptPurpose crypto) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Tx

isTwoPhaseScriptAddressFromMap :: forall era. ValidateScript era => Map ( ScriptHash ( Crypto era)) ( Script era) -> Addr ( Crypto era) -> Bool Source #

Compute if an Addr has the hash of a TwoPhaseScript, we can tell what kind of Script from the Hash, by looking it up in the Map

txouts :: Era era => TxBody era -> UTxO era Source #

Compute the transaction outputs of a transaction.

indexedRdmrs :: forall era tx. ( Era era, HasField "inputs" ( TxBody era) ( Set ( TxIn ( Crypto era))), HasField "wdrls" ( TxBody era) ( Wdrl ( Crypto era)), HasField "certs" ( TxBody era) ( StrictSeq ( DCert ( Crypto era))), HasField "wits" tx ( TxWitness era), HasField "body" tx ( TxBody era)) => tx -> ScriptPurpose ( Crypto era) -> Maybe ( Data era, ExUnits ) Source #

Find the Data and ExUnits assigned to a script.

toCBORForSizeComputation :: ( Typeable era, ToCBOR ( TxBody era), ToCBOR ( AuxiliaryData era)) => ValidatedTx 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 :: ( Typeable era, ToCBOR ( TxBody era), ToCBOR ( AuxiliaryData era)) => ValidatedTx 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 ).