-
Notifications
You must be signed in to change notification settings - Fork 486
/
Copy pathCommon.hs
113 lines (97 loc) · 3.56 KB
/
Common.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
-- editorconfig-checker-disable-file
-- | The types and functions that are common among all ledger Plutus versions.
module PlutusLedgerApi.Common (
-- * Script (de)serialization
SerialisedScript.SerialisedScript,
SerialisedScript.ScriptForEvaluation,
SerialisedScript.serialisedScript,
SerialisedScript.deserialisedScript,
SerialisedScript.serialiseCompiledCode,
SerialisedScript.serialiseUPLC,
SerialisedScript.deserialiseScript,
SerialisedScript.uncheckedDeserialiseUPLC,
SerialisedScript.ScriptDecodeError (..),
SerialisedScript.ScriptNamedDeBruijn (..),
SerialisedScript.hashScriptWithPrefix,
-- * Script evaluation
Eval.evaluateScriptCounting,
Eval.evaluateScriptRestricting,
Eval.evaluateTerm,
Eval.VerboseMode (..),
Eval.LogOutput,
Eval.EvaluationError (..),
-- * Network's versioning
{-| The network's behaviour (and plutus's by extension) can change via /hard forks/,
which directly correspond to major-number protocol version bumps.
-}
Versions.MajorProtocolVersion (..),
Versions.PlutusLedgerLanguage (..),
Versions.Version (..),
Versions.builtinsIntroducedIn,
Versions.builtinsAvailableIn,
Versions.ledgerLanguageIntroducedIn,
Versions.ledgerLanguagesAvailableIn,
-- * Costing-related types
PLC.ExBudget (..),
PLC.ExCPU (..),
PLC.ExMemory (..),
SatInt.SatInt (unSatInt),
SatInt.fromSatInt,
-- * Network's costing parameters
{-| A less drastic approach (that does not rely on a HF)
to affect the network's (and plutus's by extension) behaviour
is by tweaking the values of the cost model parameters.
The network does not associate names to cost model parameters;
Plutus attaches names to the network's cost model parameters (values)
either in a raw textual form or typed by a specific plutus version.
See Note [Cost model parameters]
-}
PLC.CostModelParams,
ParamName.toCostModelParams,
Eval.assertWellFormedCostModelParams,
ParamName.IsParamName (showParamName, readParamName),
ParamName.GenericParamName,
ParamName.CostModelApplyError (..),
ParamName.CostModelApplyWarn (..),
-- ** Evaluation context
Eval.EvaluationContext (..),
Eval.mkDynEvaluationContext,
Eval.toMachineParameters,
-- While not strictly used by the ledger, this is useful for people trying to
-- reconstruct the term evaluated by the ledger from the arguments, e.g.
-- for profiling purposes.
Eval.mkTermToEvaluate,
-- ** Supporting types used in the context types
-- *** Builtins
TxPrelude.BuiltinByteString,
TxPrelude.toBuiltin,
TxPrelude.fromBuiltin,
TxPrelude.toOpaque,
TxPrelude.fromOpaque,
-- * Data
PLC.Data (..),
Builtins.BuiltinData (..),
IsData.ToData (..),
IsData.FromData (..),
IsData.UnsafeFromData (..),
IsData.toData,
IsData.fromData,
IsData.unsafeFromData,
Builtins.dataToBuiltinData,
Builtins.builtinDataToData,
-- * Misc
MonadError,
) where
import PlutusLedgerApi.Common.Eval qualified as Eval
import PlutusLedgerApi.Common.ParamName qualified as ParamName
import PlutusLedgerApi.Common.SerialisedScript qualified as SerialisedScript
import PlutusLedgerApi.Common.Versions qualified as Versions
import PlutusTx.Builtins.Internal qualified as Builtins
import PlutusTx.IsData.Class qualified as IsData
import PlutusTx.Prelude qualified as TxPrelude
import PlutusCore.Data qualified as PLC
import PlutusCore.Evaluation.Machine.CostModelInterface qualified as PLC
import PlutusCore.Evaluation.Machine.ExBudget qualified as PLC
import PlutusCore.Evaluation.Machine.ExMemory qualified as PLC
import Control.Monad.Except (MonadError)
import Data.SatInt qualified as SatInt