Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
This module contains the code for handling the various kinds of version that we care about:
- Protocol versions
- Plutus ledger languages
- Plutus Core language versions
Synopsis
- module PlutusLedgerApi.Common.ProtocolVersions
- data PlutusLedgerLanguage
- data Version = Version {}
- ledgerLanguageIntroducedIn ∷ PlutusLedgerLanguage → MajorProtocolVersion
- ledgerLanguagesAvailableIn ∷ MajorProtocolVersion → Set PlutusLedgerLanguage
- plcVersionsIntroducedIn ∷ Map (PlutusLedgerLanguage, MajorProtocolVersion) (Set Version)
- plcVersionsAvailableIn ∷ PlutusLedgerLanguage → MajorProtocolVersion → Set Version
- builtinsIntroducedIn ∷ Map (PlutusLedgerLanguage, MajorProtocolVersion) (Set DefaultFun)
- builtinsAvailableIn ∷ PlutusLedgerLanguage → MajorProtocolVersion → Set DefaultFun
Cardano Protocol versions
Plutus ledger languages
data PlutusLedgerLanguage Source #
The Plutus ledger language. These are entirely different script languages from the ledger's perspective, which on our side are interpreted in very similar ways.
It is a simple enumerated datatype (there is no major and minor components as in protocol version) and the ordering of constructors is essential for deriving Enum,Ord,Bounded.
IMPORTANT: this is different from the Plutus Core language version, Version
Instances
Plutus Core language versions
The version of Plutus Core used by this program.
The intention is to convey different levels of backwards compatibility for existing scripts: - Major version changes are backwards-incompatible - Minor version changes are backwards-compatible - Patch version changes should be entirely invisible (and we will likely not use this level)
The version used should be changed only when the language itself changes. For example, adding a new kind of term to the language would require a minor version bump; removing a kind of term would require a major version bump.
Similarly, changing the semantics of the language will require a version bump, typically a major one. This is the main reason why the version is actually tracked in the AST: we can have two language versions with identical ASTs but different semantics, so we need to track the version explicitly.
Compatibility is about compatibility for specific scripts, not about e.g. tools which consume scripts. Adding a new kind of term does not change how existing scripts behave, but does change what tools would need to do to process scripts.
Instances
Generic Version | |
Show Version | |
NFData Version | |
Defined in PlutusCore.Version | |
Eq Version | |
Ord Version | |
Defined in PlutusCore.Version | |
Hashable Version | |
Pretty Version | |
type Rep Version | |
Defined in PlutusCore.Version type Rep Version = D1 ('MetaData "Version" "PlutusCore.Version" "plutus-core-1.36.0.0-inplace" 'False) (C1 ('MetaCons "Version" 'PrefixI 'True) (S1 ('MetaSel ('Just "_versionMajor") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Natural) :*: (S1 ('MetaSel ('Just "_versionMinor") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Natural) :*: S1 ('MetaSel ('Just "_versionPatch") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Natural)))) |
Version-testing functions
ledgerLanguageIntroducedIn ∷ PlutusLedgerLanguage → MajorProtocolVersion Source #
Query the protocol version that a specific Plutus ledger language was first introduced in.
ledgerLanguagesAvailableIn ∷ MajorProtocolVersion → Set PlutusLedgerLanguage Source #
Which Plutus language versions are available in the given MajorProtocolVersion
?
See Note [New builtins/language versions and protocol versions]
plcVersionsIntroducedIn ∷ Map (PlutusLedgerLanguage, MajorProtocolVersion) (Set Version) Source #
A map indicating which Plutus Core versions were introduced in which
MajorProtocolVersion
and PlutusLedgerLanguage
. Each version should appear at most once.
This must be updated when new versions are added. See Note [New builtins/language versions and protocol versions]
plcVersionsAvailableIn ∷ PlutusLedgerLanguage → MajorProtocolVersion → Set Version Source #
Which Plutus Core language versions are available in the given PlutusLedgerLanguage
and MajorProtocolVersion
?
See Note [New builtins/language versions and protocol versions]
builtinsIntroducedIn ∷ Map (PlutusLedgerLanguage, MajorProtocolVersion) (Set DefaultFun) Source #
A map indicating which builtin functions were introduced in which MajorProtocolVersion
.
This must be updated when new builtins are added. See Note [New builtins/language versions and protocol versions]
builtinsAvailableIn ∷ PlutusLedgerLanguage → MajorProtocolVersion → Set DefaultFun Source #
Which builtin functions are available in the given given PlutusLedgerLanguage
and MajorProtocolVersion
?
See Note [New builtins/language versions and protocol versions]