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

Cardano.Ledger.Alonzo.Scripts

Contents

Synopsis

Documentation

data Tag Source #

Marker indicating the part of a transaction for which this script is acting as a validator.

Constructors

Spend

Validates spending a script-locked UTxO

Mint

Validates minting new tokens

Cert

Validates certificate transactions

Rewrd

Validates withdrawl from a reward account

Instances

Instances details
Bounded Tag Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

Enum Tag Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

Eq Tag Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

Ord Tag Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

Show Tag Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

Generic Tag Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

Associated Types

type Rep Tag :: Type -> Type Source #

NFData Tag Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

Methods

rnf :: Tag -> () Source #

ToCBOR Tag Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

FromCBOR Tag Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

NoThunks Tag Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

type Rep Tag Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

type Rep Tag = D1 (' MetaData "Tag" "Cardano.Ledger.Alonzo.Scripts" "cardano-ledger-alonzo-0.1.0.0-xW3meaGVQP43dxJ76zbGD" ' False ) (( C1 (' MetaCons "Spend" ' PrefixI ' False ) ( U1 :: Type -> Type ) :+: C1 (' MetaCons "Mint" ' PrefixI ' False ) ( U1 :: Type -> Type )) :+: ( C1 (' MetaCons "Cert" ' PrefixI ' False ) ( U1 :: Type -> Type ) :+: C1 (' MetaCons "Rewrd" ' PrefixI ' False ) ( U1 :: Type -> Type )))

data Script era Source #

Scripts in the Alonzo Era, Either a Timelock script or a Plutus script.

Instances

Instances details
HasField "referenceScript" ( TxOut era) ( StrictMaybe ( Script era)) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxBody

Eq ( Script era) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

Ord ( Script era) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

( ValidateScript era, Script era ~ Script era) => Show ( Script era) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

Generic ( Script era) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

Associated Types

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

NFData ( Script era) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

Methods

rnf :: Script era -> () Source #

( Typeable ( Crypto era), Typeable era) => ToCBOR ( Script era) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

( Crypto ( Crypto era), Typeable ( Crypto era), Typeable era) => FromCBOR ( Annotator ( Script era)) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

SafeToHash ( Script era) Source #

Both constructors know their original bytes

Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

NoThunks ( Script era) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

type Rep ( Script era) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

txscriptfee :: Prices -> ExUnits -> Coin Source #

Compute the cost of a script based upon prices and the number of execution units.

pointWiseExUnits :: ( Natural -> Natural -> Bool ) -> ExUnits -> ExUnits -> Bool Source #

It is deliberate that there is no Ord instance for ExUnits . Use this function to compare if one ExUnit is pointwise compareable to another.

Cost Model

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

mkCostModel :: Language -> Map Text Integer -> Either CostModelApplyError CostModel Source #

Convert cost model parameters to a cost model, making use of the conversion function mkEvaluationContext from the Plutus API.

newtype ExUnits Source #

This newtype wrapper of ExUnits' is used to hide an implementation detail inside the ExUnits pattern.

Bundled Patterns

pattern ExUnits :: Natural -> Natural -> ExUnits

Arbitrary execution unit in which we measure the cost of scripts in terms of space in memory and execution time.

This pattern hides the fact that ExUnits' is parametric in the underlying type. The ledger itself uses ExUnits Natural' exclusively.

We would have preferred to use a type alias for ExUnits Natural', but this is not possible: https://gitlab.haskell.org/ghc/ghc/-/issues/19507 .

Instances

Instances details
Eq ExUnits Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

Show ExUnits Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

Generic ExUnits Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

Semigroup ExUnits Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

Monoid ExUnits Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

NFData ExUnits Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

ToJSON ExUnits Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Genesis

FromJSON ExUnits Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Genesis

ToCBOR ExUnits Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

FromCBOR ExUnits Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

NoThunks ExUnits Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

type Rep ExUnits Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

type Rep ExUnits = D1 (' MetaData "ExUnits" "Cardano.Ledger.Alonzo.Scripts" "cardano-ledger-alonzo-0.1.0.0-xW3meaGVQP43dxJ76zbGD" ' True ) ( C1 (' MetaCons "WrapExUnits" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "unWrapExUnits") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ( ExUnits' Natural ))))

data ExUnits' a Source #

Arbitrary execution unit in which we measure the cost of scripts in terms of space in memory and execution time.

The ledger itself uses ExUnits Natural' exclusively, but the flexibility here alows the consensus layer to translate the execution units into something equivalent to 'ExUnits (Inf Natural)'. This is needed in order to provide a BoundedMeasure instance, which itself is needed for the alonzo instance of TxLimits (in consensus).

Instances

Instances details
Functor ExUnits' Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

Eq a => Eq ( ExUnits' a) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

Show a => Show ( ExUnits' a) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

Generic ( ExUnits' a) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

Associated Types

type Rep ( ExUnits' a) :: Type -> Type Source #

Measure a => Semigroup ( ExUnits' a) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

Measure a => Monoid ( ExUnits' a) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

NFData a => NFData ( ExUnits' a) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

ToJSON a => ToJSON ( ExUnits' a) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Genesis

FromJSON a => FromJSON ( ExUnits' a) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Genesis

Measure a => Measure ( ExUnits' a) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

BoundedMeasure a => BoundedMeasure ( ExUnits' a) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

NoThunks a => NoThunks ( ExUnits' a) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

type Rep ( ExUnits' a) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

type Rep ( ExUnits' a) = D1 (' MetaData "ExUnits'" "Cardano.Ledger.Alonzo.Scripts" "cardano-ledger-alonzo-0.1.0.0-xW3meaGVQP43dxJ76zbGD" ' False ) ( C1 (' MetaCons "ExUnits'" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "exUnitsMem'") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 a) :*: S1 (' MetaSel (' Just "exUnitsSteps'") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 a)))

data Prices Source #

Prices per execution unit

Instances

Instances details
Eq Prices Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

Ord Prices Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

Show Prices Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

Generic Prices Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

NFData Prices Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

ToJSON Prices Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Genesis

FromJSON Prices Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Genesis

ToCBOR Prices Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

FromCBOR Prices Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

NoThunks Prices Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

type Rep Prices Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

newtype CostModels Source #

Instances

Instances details
Eq CostModels Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

Ord CostModels Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

Show CostModels Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

Generic CostModels Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

NFData CostModels Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

ToJSON CostModels Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Genesis

FromJSON CostModels Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Genesis

ToCBOR CostModels Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

FromCBOR CostModels Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

NoThunks CostModels Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

type Rep CostModels Source #
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

type Rep CostModels = D1 (' MetaData "CostModels" "Cardano.Ledger.Alonzo.Scripts" "cardano-ledger-alonzo-0.1.0.0-xW3meaGVQP43dxJ76zbGD" ' True ) ( C1 (' MetaCons "CostModels" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "unCostModels") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ( Map Language CostModel ))))