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

Cardano.Ledger.Alonzo.Plutus.Evaluate

Synopsis

Documentation

evalPlutusScripts ∷ [PlutusWithContext c] → ScriptResult c Source #

Evaluate a list of Plutus scripts. All scripts in the list must evaluate to True.

data CollectError era Source #

When collecting inputs for two phase scripts, 3 things can go wrong.

Instances

Instances details
(Era era, ToJSON (PlutusPurpose AsItem era), ToJSON (ContextError era)) ⇒ ToJSON (CollectError era) Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.Plutus.Evaluate

Generic (CollectError era) Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.Plutus.Evaluate

Associated Types

type Rep (CollectError era) ∷ TypeType Source #

Methods

fromCollectError era → Rep (CollectError era) x Source #

toRep (CollectError era) x → CollectError era Source #

(AlonzoEraScript era, Show (ContextError era)) ⇒ Show (CollectError era) Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.Plutus.Evaluate

(AlonzoEraScript era, DecCBOR (ContextError era)) ⇒ DecCBOR (CollectError era) Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.Plutus.Evaluate

(AlonzoEraScript era, EncCBOR (ContextError era)) ⇒ EncCBOR (CollectError era) Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.Plutus.Evaluate

Methods

encCBORCollectError era → Encoding Source #

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

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

(AlonzoEraScript era, NFData (ContextError era)) ⇒ NFData (CollectError era) Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.Plutus.Evaluate

Methods

rnfCollectError era → () Source #

(AlonzoEraScript era, Eq (ContextError era)) ⇒ Eq (CollectError era) Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.Plutus.Evaluate

Methods

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

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

(AlonzoEraScript era, NoThunks (ContextError era)) ⇒ NoThunks (CollectError era) Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.Plutus.Evaluate

type Rep (CollectError era) Source # 
Instance details

Defined in Cardano.Ledger.Alonzo.Plutus.Evaluate

type Rep (CollectError era) = D1 ('MetaData "CollectError" "Cardano.Ledger.Alonzo.Plutus.Evaluate" "cardano-ledger-alonzo-1.11.0.0-inplace" 'False) ((C1 ('MetaCons "NoRedeemer" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (PlutusPurpose AsItem era))) :+: C1 ('MetaCons "NoWitness" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (ScriptHash (EraCrypto era))))) :+: (C1 ('MetaCons "NoCostModel" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Language)) :+: C1 ('MetaCons "BadTranslation" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (ContextError era)))))

lookupPlutusScriptAlonzoEraScript era ⇒ Map (ScriptHash (EraCrypto era)) (Script era) → ScriptHash (EraCrypto era) → Maybe (PlutusScript era) Source #

Deprecated: In favor of new version with arguments flipped: lookupPlutusScript

Given a script hash and a Map of available scripts, find the PlutusScript. Returns Nothing when script is missing or it is not a PlutusScript

Execution units estimation

data TransactionScriptFailure era Source #

Script failures that can be returned by evalTxExUnitsWithLogs.

Constructors

RedeemerPointsToUnknownScriptHash !(PlutusPurpose AsIx era)

A redeemer was supplied which points to a script hash which we cannot connect to a Plutus script.

MissingScript

Missing redeemer.

Fields

MissingDatum !(DataHash (EraCrypto era))

Missing datum.

ValidationFailure

Plutus evaluation error, for any version

Fields

UnknownTxIn !(TxIn (EraCrypto era))

A redeemer points to a transaction input which is not present in the current UTxO.

InvalidTxIn !(TxIn (EraCrypto era))

A redeemer points to a transaction input which is not plutus locked.

IncompatibleBudget !ExBudget

The execution budget that was calculated by the Plutus evaluator is out of bounds.

NoCostModelInLedgerState !Language

There was no cost model for a given version of Plutus in the ledger state

ContextError !(ContextError era)

Error that can happen during plutus context translation

evalTxExUnits Source #

Arguments

∷ ∀ era. (AlonzoEraTx era, EraUTxO era, EraPlutusContext era, ScriptsNeeded era ~ AlonzoScriptsNeeded era) 
PParams era 
Tx era

The transaction.

UTxO era

The current UTxO set (or the relevant portion for the transaction).

EpochInfo (Either Text)

The epoch info, used to translate slots to POSIX time for plutus.

SystemStart

The start time of the given block chain.

RedeemerReport era

We return a map from redeemer pointers to either a failure or a sufficient execution budget.

Evaluate the execution budgets needed for all the redeemers in a given transaction. If a redeemer is invalid, a failure is returned instead.

The execution budgets in the supplied transaction are completely ignored. The results of evalTxExUnitsWithLogs are intended to replace them.

evalTxExUnitsWithLogs Source #

Arguments

∷ ∀ era. (AlonzoEraTx era, EraUTxO era, EraPlutusContext era, ScriptsNeeded era ~ AlonzoScriptsNeeded era) 
PParams era 
Tx era

The transaction.

UTxO era

The current UTxO set (or the relevant portion for the transaction).

EpochInfo (Either Text)

The epoch info, used to translate slots to POSIX time for plutus.

SystemStart

The start time of the given block chain.

RedeemerReportWithLogs era

We return a map from redeemer pointers to either a failure or a sufficient execution budget with logs of the script. Otherwise, we return a TranslationError manifesting from failed attempts to construct a valid execution context for the given transaction.

Unlike evalTxExUnits, this function also returns evaluation logs, useful for debugging.

Evaluate the execution budgets needed for all the redeemers in a given transaction.

The execution budgets in the supplied transaction are completely ignored. The results of evalTxExUnitsWithLogs are intended to replace them.