Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Tag
-
data
Script
era
- = TimelockScript ( Timelock ( Crypto era))
- | PlutusScript Language ShortByteString
- txscriptfee :: Prices -> ExUnits -> Coin
- isPlutusScript :: Script era -> Bool
- pointWiseExUnits :: ( Natural -> Natural -> Bool ) -> ExUnits -> ExUnits -> Bool
- data CostModel
- mkCostModel :: Language -> Map Text Integer -> Either CostModelApplyError CostModel
- getCostModelLanguage :: CostModel -> Language
- getCostModelParams :: CostModel -> Map Text Integer
- getEvaluationContext :: CostModel -> EvaluationContext
-
newtype
ExUnits
where
- WrapExUnits { }
- pattern ExUnits :: Natural -> Natural -> ExUnits
- data ExUnits' a
-
data
Prices
=
Prices
{
- prMem :: ! NonNegativeInterval
- prSteps :: ! NonNegativeInterval
- hashCostModel :: forall e. Era e => Proxy e -> CostModel -> SafeHash ( Crypto e) CostModel
- assertWellFormedCostModelParams :: MonadError CostModelApplyError m => CostModelParams -> m ()
- decodeCostModelMap :: Decoder s ( Map Language CostModel )
- decodeCostModel :: Language -> Decoder s CostModel
- newtype CostModels = CostModels { }
- data CostModelApplyError
Documentation
Marker indicating the part of a transaction for which this script is acting as a validator.
Spend |
Validates spending a script-locked UTxO |
Mint |
Validates minting new tokens |
Cert |
Validates certificate transactions |
Rewrd |
Validates withdrawl from a reward account |
Instances
Bounded Tag Source # | |
Enum Tag Source # | |
Eq Tag Source # | |
Ord Tag Source # | |
Show Tag Source # | |
Generic Tag Source # | |
NFData Tag Source # | |
Defined in Cardano.Ledger.Alonzo.Scripts |
|
ToCBOR Tag Source # | |
FromCBOR Tag Source # | |
NoThunks Tag Source # | |
type Rep Tag Source # | |
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
)))
|
Scripts in the Alonzo Era, Either a Timelock script or a Plutus script.
Instances
txscriptfee :: Prices -> ExUnits -> Coin Source #
Compute the cost of a script based upon prices and the number of execution units.
isPlutusScript :: Script era -> Bool Source #
Cost Model
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
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.
This newtype wrapper of ExUnits' is used to hide an implementation detail inside the ExUnits pattern.
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
We would have preferred to use a type alias for
|
Instances
Eq ExUnits Source # | |
Show ExUnits Source # | |
Generic ExUnits Source # | |
Semigroup ExUnits Source # | |
Monoid ExUnits Source # | |
NFData ExUnits Source # | |
Defined in Cardano.Ledger.Alonzo.Scripts |
|
ToJSON ExUnits Source # | |
FromJSON ExUnits Source # | |
ToCBOR ExUnits Source # | |
FromCBOR ExUnits Source # | |
NoThunks ExUnits Source # | |
type Rep ExUnits Source # | |
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
))))
|
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
Prices per execution unit
Prices | |
|
Instances
Eq Prices Source # | |
Ord Prices Source # | |
Show Prices Source # | |
Generic Prices Source # | |
NFData Prices Source # | |
Defined in Cardano.Ledger.Alonzo.Scripts |
|
ToJSON Prices Source # | |
FromJSON Prices Source # | |
ToCBOR Prices Source # | |
FromCBOR Prices Source # | |
NoThunks Prices Source # | |
type Rep Prices Source # | |
Defined in Cardano.Ledger.Alonzo.Scripts
type
Rep
Prices
=
D1
('
MetaData
"Prices" "Cardano.Ledger.Alonzo.Scripts" "cardano-ledger-alonzo-0.1.0.0-xW3meaGVQP43dxJ76zbGD" '
False
) (
C1
('
MetaCons
"Prices" '
PrefixI
'
True
) (
S1
('
MetaSel
('
Just
"prMem") '
NoSourceUnpackedness
'
SourceStrict
'
DecidedStrict
) (
Rec0
NonNegativeInterval
)
:*:
S1
('
MetaSel
('
Just
"prSteps") '
NoSourceUnpackedness
'
SourceStrict
'
DecidedStrict
) (
Rec0
NonNegativeInterval
)))
|
assertWellFormedCostModelParams :: MonadError CostModelApplyError m => CostModelParams -> m () Source #
Comparably expensive to
mkEvaluationContext
, so it should only be used sparingly.
newtype CostModels Source #
Instances
data CostModelApplyError Source #
The type of errors that
applyParams
can throw.
CMUnknownParamError Text |
a costmodel parameter with the give name does not exist in the costmodel to be applied upon |
CMInternalReadError |
internal error when we are transforming the applyParams' input to json (should not happen) |
CMInternalWriteError String |
internal error when we are transforming the applied params from json with given jsonstring error (should not happen) |
Instances
Show CostModelApplyError | |
|
|
Exception CostModelApplyError | |
Pretty CostModelApplyError | |
Defined in PlutusCore.Evaluation.Machine.CostModelInterface pretty :: CostModelApplyError -> Doc ann Source # prettyList :: [ CostModelApplyError ] -> Doc ann Source # |