plutus-ledger-api
Safe HaskellNone
LanguageHaskell2010

PlutusLedgerApi.Common.Versions

Description

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

Cardano Protocol versions

newtype MajorProtocolVersion Source #

This represents the major component of the Cardano protocol version. The ledger can only supply the major component of the protocol version, not the minor component, and Plutus should only need to care about the major component anyway. This relies on careful understanding between us and the ledger as to what this means.

Instances

Instances details
Enum MajorProtocolVersion Source # 
Instance details

Defined in PlutusLedgerApi.Common.ProtocolVersions

Generic MajorProtocolVersion Source # 
Instance details

Defined in PlutusLedgerApi.Common.ProtocolVersions

Associated Types

type Rep MajorProtocolVersion 
Instance details

Defined in PlutusLedgerApi.Common.ProtocolVersions

type Rep MajorProtocolVersion = D1 ('MetaData "MajorProtocolVersion" "PlutusLedgerApi.Common.ProtocolVersions" "plutus-ledger-api-1.60.0.0-G1HmqwHNllaA7AnJNjAfhP" 'True) (C1 ('MetaCons "MajorProtocolVersion" 'PrefixI 'True) (S1 ('MetaSel ('Just "getMajorProtocolVersion") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)))
Show MajorProtocolVersion Source # 
Instance details

Defined in PlutusLedgerApi.Common.ProtocolVersions

Eq MajorProtocolVersion Source # 
Instance details

Defined in PlutusLedgerApi.Common.ProtocolVersions

Ord MajorProtocolVersion Source # 
Instance details

Defined in PlutusLedgerApi.Common.ProtocolVersions

Pretty MajorProtocolVersion Source # 
Instance details

Defined in PlutusLedgerApi.Common.ProtocolVersions

Methods

pretty :: MajorProtocolVersion -> Doc ann

prettyList :: [MajorProtocolVersion] -> Doc ann

Serialise MajorProtocolVersion Source # 
Instance details

Defined in PlutusLedgerApi.Common.ProtocolVersions

type Rep MajorProtocolVersion Source # 
Instance details

Defined in PlutusLedgerApi.Common.ProtocolVersions

type Rep MajorProtocolVersion = D1 ('MetaData "MajorProtocolVersion" "PlutusLedgerApi.Common.ProtocolVersions" "plutus-ledger-api-1.60.0.0-G1HmqwHNllaA7AnJNjAfhP" 'True) (C1 ('MetaCons "MajorProtocolVersion" 'PrefixI 'True) (S1 ('MetaSel ('Just "getMajorProtocolVersion") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)))

shelleyPV :: MajorProtocolVersion Source #

Shelley era was introduced in protocol version 2.0

allegraPV :: MajorProtocolVersion Source #

Allegra era was introduced in protocol version 3.0

maryPV :: MajorProtocolVersion Source #

Mary era was introduced in protocol version 4.0

alonzoPV :: MajorProtocolVersion Source #

Alonzo era was introduced in protocol version 5.0

vasilPV :: MajorProtocolVersion Source #

The Vasil HF introduced the Babbage era and Plutus V2

valentinePV :: MajorProtocolVersion Source #

Valentine was an intra-era HF where builtin functions VerifyEcdsaSecp256k1Signature and VerifySchnorrSecp256k1Signature were enabled.

changPV :: MajorProtocolVersion Source #

The Chang HF introduced the Conway era and Plutus V3

plominPV :: MajorProtocolVersion Source #

The Plomin HF was an intra-era HF where some new builtin functions were introduced in Plutus V2 and V3.

vanRossemPV :: MajorProtocolVersion Source #

The van Rossem HF will be an intra-era HF.

knownPVs :: [MajorProtocolVersion] Source #

The set of protocol versions that are "known", i.e. that have been released and have actual differences associated with them. This is currently only used for testing, so efficiency is not parmount and a list is fine.

futurePV :: MajorProtocolVersion Source #

This is a placeholder for when we don't yet know what protocol version will be used for something. It's a very high protocol version that should never appear in reality.

We should not assign names to future protocol versions until it's confirmed that they are correct, otherwise we could accidentally associate something with the wrong protocol version.

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

Constructors

PlutusV1

introduced in Alonzo HF

PlutusV2

introduced in Vasil HF

PlutusV3

introduced in Chang HF

Instances

Instances details
Bounded PlutusLedgerLanguage Source # 
Instance details

Defined in PlutusLedgerApi.Common.Versions

Enum PlutusLedgerLanguage Source # 
Instance details

Defined in PlutusLedgerApi.Common.Versions

Generic PlutusLedgerLanguage Source # 
Instance details

Defined in PlutusLedgerApi.Common.Versions

Associated Types

type Rep PlutusLedgerLanguage 
Instance details

Defined in PlutusLedgerApi.Common.Versions

type Rep PlutusLedgerLanguage = D1 ('MetaData "PlutusLedgerLanguage" "PlutusLedgerApi.Common.Versions" "plutus-ledger-api-1.60.0.0-G1HmqwHNllaA7AnJNjAfhP" 'False) (C1 ('MetaCons "PlutusV1" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "PlutusV2" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PlutusV3" 'PrefixI 'False) (U1 :: Type -> Type)))
Show PlutusLedgerLanguage Source # 
Instance details

Defined in PlutusLedgerApi.Common.Versions

NFData PlutusLedgerLanguage Source # 
Instance details

Defined in PlutusLedgerApi.Common.Versions

Eq PlutusLedgerLanguage Source # 
Instance details

Defined in PlutusLedgerApi.Common.Versions

Ord PlutusLedgerLanguage Source # 
Instance details

Defined in PlutusLedgerApi.Common.Versions

NoThunks PlutusLedgerLanguage Source # 
Instance details

Defined in PlutusLedgerApi.Common.Versions

Methods

noThunks :: Context -> PlutusLedgerLanguage -> IO (Maybe ThunkInfo)

wNoThunks :: Context -> PlutusLedgerLanguage -> IO (Maybe ThunkInfo)

showTypeOf :: Proxy PlutusLedgerLanguage -> String

Pretty PlutusLedgerLanguage Source # 
Instance details

Defined in PlutusLedgerApi.Common.Versions

Methods

pretty :: PlutusLedgerLanguage -> Doc ann

prettyList :: [PlutusLedgerLanguage] -> Doc ann

Serialise PlutusLedgerLanguage Source # 
Instance details

Defined in PlutusLedgerApi.Common.Versions

type Rep PlutusLedgerLanguage Source # 
Instance details

Defined in PlutusLedgerApi.Common.Versions

type Rep PlutusLedgerLanguage = D1 ('MetaData "PlutusLedgerLanguage" "PlutusLedgerApi.Common.Versions" "plutus-ledger-api-1.60.0.0-G1HmqwHNllaA7AnJNjAfhP" 'False) (C1 ('MetaCons "PlutusV1" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "PlutusV2" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PlutusV3" 'PrefixI 'False) (U1 :: Type -> Type)))

Plutus Core language versions

data Version #

Instances

Instances details
Generic Version 
Instance details

Defined in PlutusCore.Version

Associated Types

type Rep Version 
Instance details

Defined in PlutusCore.Version

type Rep Version = D1 ('MetaData "Version" "PlutusCore.Version" "plutus-core-1.60.0.0-LXFqBsoUlXsJIEqLytHte7" '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))))
Show Version 
Instance details

Defined in PlutusCore.Version

NFData Version 
Instance details

Defined in PlutusCore.Version

Methods

rnf :: Version -> () Source #

Eq Version 
Instance details

Defined in PlutusCore.Version

Ord Version 
Instance details

Defined in PlutusCore.Version

Hashable Version 
Instance details

Defined in PlutusCore.Version

Methods

hashWithSalt :: Int -> Version -> Int

hash :: Version -> Int

Pretty Version 
Instance details

Defined in PlutusCore.Version

Methods

pretty :: Version -> Doc ann

prettyList :: [Version] -> Doc ann

type Rep Version 
Instance details

Defined in PlutusCore.Version

type Rep Version = D1 ('MetaData "Version" "PlutusCore.Version" "plutus-core-1.60.0.0-LXFqBsoUlXsJIEqLytHte7" '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]. This function (and others in this module) assumes that once a LL is available it remains available in all later PVs and that if m <= n, PlutusVm is introduced no later than PlutusVn.

plcVersionsIntroducedIn :: PlutusLedgerLanguage -> Map 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?

builtinsIntroducedIn :: PlutusLedgerLanguage -> Map MajorProtocolVersion (Set DefaultFun) Source #

Given a ledger language, return a map indicating which builtin functions were introduced in which MajorProtocolVersion. This must be updated when new builtins are added. It is not necessary to add entries for protocol versions where no new builtins are added. See Note [New builtins/language versions and protocol versions]

builtinsAvailableIn :: PlutusLedgerLanguage -> MajorProtocolVersion -> Set DefaultFun Source #

Return a set containing the builtins which are available in a given LL in a given PV. All builtins are available in all LLs from vanRossemPV onwards.

batch1 :: [DefaultFun] Source #

batch2 :: [DefaultFun] Source #

batch3 :: [DefaultFun] Source #

batch4a :: [DefaultFun] Source #

batch4b :: [DefaultFun] Source #

batch5 :: [DefaultFun] Source #

batch6 :: [DefaultFun] Source #