-
Notifications
You must be signed in to change notification settings - Fork 479
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PlutusLedgerApi] [Refactoring] Polish imports and exports
- Loading branch information
1 parent
c013014
commit c2fb15d
Showing
5 changed files
with
425 additions
and
374 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,138 @@ | ||
-- editorconfig-checker-disable-file | ||
|
||
-- | The types and functions that are common among all ledger Plutus versions. | ||
module PlutusLedgerApi.Common | ||
( -- * Script (de)serialization | ||
SerialisedScript | ||
, ScriptForEvaluation | ||
, serialisedScript | ||
, deserialisedScript | ||
, serialiseCompiledCode | ||
, serialiseUPLC | ||
, deserialiseScript | ||
, uncheckedDeserialiseUPLC | ||
, ScriptDecodeError (..) | ||
, ScriptNamedDeBruijn (..) | ||
|
||
-- * Script evaluation | ||
, evaluateScriptCounting | ||
, evaluateScriptRestricting | ||
, evaluateTerm | ||
, VerboseMode (..) | ||
, LogOutput | ||
, EvaluationError (..) | ||
-- reexport Data & ExBudget for convenience to upstream users | ||
, PlutusCore.Data (..) | ||
, PlutusCore.ExBudget (..) | ||
|
||
-- * 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. | ||
-} | ||
, MajorProtocolVersion (..) | ||
, PlutusLedgerLanguage (..) | ||
, Version (..) | ||
, builtinsIntroducedIn | ||
, builtinsAvailableIn | ||
, ledgerLanguageIntroducedIn | ||
, ledgerLanguagesAvailableIn | ||
|
||
-- * 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] | ||
-} | ||
, CostModelParams | ||
, toCostModelParams | ||
, assertWellFormedCostModelParams | ||
, IsParamName (showParamName, readParamName) | ||
, GenericParamName | ||
, CostModelApplyError (..) | ||
, CostModelApplyWarn (..) | ||
|
||
-- ** Evaluation context | ||
, EvaluationContext (..) | ||
, mkDynEvaluationContext | ||
, 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. | ||
, mkTermToEvaluate | ||
) where | ||
|
||
import PlutusCore.Data as PlutusCore (Data (..)) | ||
import PlutusCore.Evaluation.Machine.CostModelInterface (CostModelParams) | ||
import PlutusCore.Evaluation.Machine.ExBudget as PlutusCore (ExBudget (..)) | ||
import PlutusLedgerApi.Common.Eval | ||
import PlutusLedgerApi.Common.ParamName | ||
import PlutusLedgerApi.Common.SerialisedScript | ||
import PlutusLedgerApi.Common.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 (..), | ||
|
||
-- * 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 | ||
Prelude.BuiltinByteString, | ||
Prelude.toBuiltin, | ||
Prelude.fromBuiltin, | ||
Prelude.toOpaque, | ||
Prelude.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 (EvaluationContext (..), EvaluationError (..), | ||
LogOutput, VerboseMode (..), | ||
assertWellFormedCostModelParams, | ||
evaluateScriptCounting, | ||
evaluateScriptRestricting, evaluateTerm, | ||
mkDynEvaluationContext, mkTermToEvaluate, | ||
toMachineParameters) | ||
import PlutusLedgerApi.Common.ParamName qualified as ParamName (CostModelApplyError (..), | ||
CostModelApplyWarn (..), | ||
GenericParamName, IsParamName (..), | ||
toCostModelParams) | ||
import PlutusLedgerApi.Common.SerialisedScript qualified as SerialisedScript (ScriptDecodeError (..), | ||
ScriptForEvaluation, | ||
ScriptNamedDeBruijn (..), | ||
SerialisedScript, | ||
deserialiseScript, | ||
deserialisedScript, | ||
serialiseCompiledCode, | ||
serialiseUPLC, | ||
serialisedScript, | ||
uncheckedDeserialiseUPLC) | ||
import PlutusLedgerApi.Common.Versions qualified as Versions (MajorProtocolVersion (..), | ||
PlutusLedgerLanguage (..), | ||
Version (..), builtinsAvailableIn, | ||
builtinsIntroducedIn, | ||
ledgerLanguageIntroducedIn, | ||
ledgerLanguagesAvailableIn) | ||
|
||
import PlutusTx.Builtins.Internal qualified as Builtins (BuiltinData (..), builtinDataToData, | ||
dataToBuiltinData) | ||
import PlutusTx.IsData.Class qualified as IsData (FromData (..), ToData (..), UnsafeFromData (..), | ||
fromData, toData, unsafeFromData) | ||
import PlutusTx.Prelude qualified as Prelude (BuiltinByteString, fromBuiltin, fromOpaque, toBuiltin, | ||
toOpaque) | ||
|
||
import PlutusCore.Data qualified as PLC (Data (..)) | ||
import PlutusCore.Evaluation.Machine.CostModelInterface qualified as PLC (CostModelParams) | ||
import PlutusCore.Evaluation.Machine.ExBudget qualified as PLC (ExBudget (..)) | ||
import PlutusCore.Evaluation.Machine.ExMemory qualified as PLC (ExCPU (..), ExMemory (..)) | ||
|
||
import Control.Monad.Except (MonadError) | ||
import Data.SatInt qualified as SatInt (SatInt (unSatInt), fromSatInt) |
Oops, something went wrong.