Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
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
- data CostModel
- getLanguageView ∷ AlonzoEraPParams era ⇒ PParams era → Language → LangDepView
- data Data era
- type DataHash = SafeHash EraIndependentData
- newtype IsValid = IsValid Bool
- hashData ∷ Data era → DataHash
- nonNativeLanguages ∷ [Language]
- hashScriptIntegrity ∷ ∀ era. AlonzoEraScript era ⇒ Set LangDepView → Redeemers era → TxDats era → StrictMaybe ScriptIntegrityHash
- data EraIndependentScriptIntegrity
- data ScriptIntegrity era = ScriptIntegrity !(Redeemers era) !(TxDats era) !(Set LangDepView)
- type ScriptIntegrityHash = SafeHash EraIndependentScriptIntegrity
- data AlonzoTx era = AlonzoTx {
- body ∷ !(TxBody era)
- wits ∷ !(TxWits era)
- isValid ∷ !IsValid
- auxiliaryData ∷ !(StrictMaybe (TxAuxData era))
- class (EraTx era, AlonzoEraTxBody era, AlonzoEraTxWits era, AlonzoEraScript era) ⇒ AlonzoEraTx era where
- isValidTxL ∷ Lens' (Tx era) IsValid
- mkBasicAlonzoTx ∷ Monoid (TxWits era) ⇒ TxBody era → AlonzoTx era
- bodyAlonzoTxL ∷ Lens' (AlonzoTx era) (TxBody era)
- witsAlonzoTxL ∷ Lens' (AlonzoTx era) (TxWits era)
- auxDataAlonzoTxL ∷ Lens' (AlonzoTx era) (StrictMaybe (TxAuxData era))
- sizeAlonzoTxF ∷ ∀ era. EraTx era ⇒ SimpleGetter (AlonzoTx era) Integer
- wireSizeAlonzoTxF ∷ ∀ era. EraTx era ⇒ SimpleGetter (AlonzoTx era) Word32
- isValidAlonzoTxL ∷ Lens' (AlonzoTx era) IsValid
- txdats' ∷ Era era ⇒ AlonzoTxWits era → TxDats era
- txscripts' ∷ Era era ⇒ AlonzoTxWits era → Map ScriptHash (Script era)
- txrdmrs ∷ AlonzoEraScript era ⇒ AlonzoTxWits era → Redeemers era
- data AlonzoTxBody era where
- pattern AlonzoTxBody ∷ (EraTxOut era, EraTxCert era) ⇒ Set TxIn → Set TxIn → StrictSeq (TxOut era) → StrictSeq (TxCert era) → Withdrawals → Coin → ValidityInterval → StrictMaybe (Update era) → Set (KeyHash 'Witness) → MultiAsset → StrictMaybe ScriptIntegrityHash → StrictMaybe TxAuxDataHash → StrictMaybe Network → AlonzoTxBody era
- totExUnits ∷ (EraTx era, AlonzoEraTxWits era) ⇒ Tx era → ExUnits
- alonzoMinFeeTx ∷ (EraTx era, AlonzoEraTxWits era, AlonzoEraPParams era) ⇒ PParams era → Tx era → Coin
- txouts ∷ EraTxBody era ⇒ TxBody era → UTxO era
- alonzoSegwitTx ∷ AlonzoEraTx era ⇒ Annotator (TxBody era) → Annotator (TxWits era) → IsValid → Maybe (Annotator (TxAuxData era)) → Annotator (Tx era)
- toCBORForSizeComputation ∷ (EncCBOR (TxBody era), EncCBOR (TxWits era), EncCBOR (TxAuxData era)) ⇒ AlonzoTx era → Encoding
- toCBORForMempoolSubmission ∷ (EncCBOR (TxBody era), EncCBOR (TxWits era), EncCBOR (TxAuxData era)) ⇒ AlonzoTx era → Encoding
- alonzoEqTxRaw ∷ AlonzoEraTx era ⇒ Tx era → Tx era → Bool
Documentation
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
ToJSON CostModel | |
Generic CostModel | |
Show CostModel | |
NFData CostModel | |
Defined in Cardano.Ledger.Plutus.CostModels | |
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 |
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 |
Defined in Cardano.Ledger.Plutus.CostModels | |
NoThunks CostModel | |
type Rep CostModel | |
Defined in Cardano.Ledger.Plutus.CostModels type Rep CostModel = D1 ('MetaData "CostModel" "Cardano.Ledger.Plutus.CostModels" "cardano-ledger-core-1.17.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)))) |
getLanguageView ∷ AlonzoEraPParams era ⇒ PParams era → Language → LangDepView Source #
Instances
type DataHash = SafeHash EraIndependentData 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.
Instances
ToJSON IsValid Source # | |
Generic IsValid Source # | |
Show IsValid Source # | |
ToCBOR IsValid Source # | |
DecCBOR IsValid Source # | |
EncCBOR IsValid Source # | |
NFData IsValid Source # | |
Defined in Cardano.Ledger.Alonzo.Tx | |
Eq IsValid Source # | |
NoThunks IsValid Source # | |
type Rep IsValid Source # | |
Defined in Cardano.Ledger.Alonzo.Tx |
hashScriptIntegrity ∷ ∀ era. AlonzoEraScript era ⇒ Set LangDepView → Redeemers era → TxDats era → StrictMaybe ScriptIntegrityHash Source #
data EraIndependentScriptIntegrity Source #
Instances
Era era ⇒ HashAnnotated (ScriptIntegrity era) EraIndependentScriptIntegrity Source # | |
Defined in Cardano.Ledger.Alonzo.Tx |
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.
ScriptIntegrity !(Redeemers era) !(TxDats era) !(Set LangDepView) |
Instances
AlonzoTx | |
|
Instances
class (EraTx era, AlonzoEraTxBody era, AlonzoEraTxWits era, AlonzoEraScript era) ⇒ AlonzoEraTx era where Source #
Instances
AlonzoEraTx AlonzoEra Source # | |
Defined in Cardano.Ledger.Alonzo.Tx |
auxDataAlonzoTxL ∷ Lens' (AlonzoTx era) (StrictMaybe (TxAuxData era)) Source #
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)
txscripts' ∷ Era era ⇒ AlonzoTxWits era → Map ScriptHash (Script era) Source #
txrdmrs ∷ AlonzoEraScript era ⇒ AlonzoTxWits era → Redeemers era Source #
data AlonzoTxBody era where Source #
pattern AlonzoTxBody ∷ (EraTxOut era, EraTxCert era) ⇒ Set TxIn → Set TxIn → StrictSeq (TxOut era) → StrictSeq (TxCert era) → Withdrawals → Coin → ValidityInterval → StrictMaybe (Update era) → Set (KeyHash 'Witness) → MultiAsset → StrictMaybe ScriptIntegrityHash → StrictMaybe TxAuxDataHash → StrictMaybe Network → AlonzoTxBody era |
Instances
totExUnits ∷ (EraTx era, AlonzoEraTxWits era) ⇒ Tx era → ExUnits Source #
alonzoMinFeeTx ∷ (EraTx era, AlonzoEraTxWits era, AlonzoEraPParams era) ⇒ PParams era → Tx era → Coin Source #
txouts ∷ EraTxBody era ⇒ TxBody era → UTxO era Source #
Compute the transaction outputs of a transaction.
alonzoSegwitTx ∷ AlonzoEraTx era ⇒ Annotator (TxBody era) → Annotator (TxWits era) → IsValid → Maybe (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
).
alonzoEqTxRaw ∷ AlonzoEraTx era ⇒ Tx era → Tx era → Bool Source #
Orphan instances
EraTx AlonzoEra Source # | |
mkBasicTx ∷ TxBody AlonzoEra → Tx AlonzoEra Source # bodyTxL ∷ Lens' (Tx AlonzoEra) (TxBody AlonzoEra) Source # witsTxL ∷ Lens' (Tx AlonzoEra) (TxWits AlonzoEra) Source # auxDataTxL ∷ Lens' (Tx AlonzoEra) (StrictMaybe (TxAuxData AlonzoEra)) Source # sizeTxF ∷ SimpleGetter (Tx AlonzoEra) Integer Source # wireSizeTxF ∷ SimpleGetter (Tx AlonzoEra) Word32 Source # validateNativeScript ∷ Tx AlonzoEra → NativeScript AlonzoEra → Bool Source # getMinFeeTx ∷ PParams AlonzoEra → Tx AlonzoEra → Int → Coin Source # upgradeTx ∷ Tx (PreviousEra AlonzoEra) → Either (TxUpgradeError AlonzoEra) (Tx AlonzoEra) Source # |