Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 31 additions & 19 deletions plutus-ledger-api/src/PlutusLedgerApi/Common/Versions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,34 @@ batch6 =
, LengthOfArray, ListToArray, IndexArray
]

{-| Given a ledger language, return a map indicating which builtin functions were
plutusV1builtins :: Map.Map MajorProtocolVersion (Set.Set DefaultFun)
plutusV1builtins =
Map.fromList
[ (alonzoPV, Set.fromList batch1)
, (pv11PV, Set.fromList (batch2 ++ batch3 ++ batch4 ++ batch5 ++ batch6))
]
{-# OPAQUE plutusV1builtins #-}

plutusV2builtins :: Map.Map MajorProtocolVersion (Set.Set DefaultFun)
plutusV2builtins =
Map.fromList
[ (vasilPV, Set.fromList (batch1 ++ batch2))
, (valentinePV, Set.fromList batch3)
, (plominPV, Set.fromList batch4b)
, (pv11PV , Set.fromList (batch4a ++ batch5 ++ batch6))
]
{-# OPAQUE plutusV2builtins #-}

plutusV3builtins :: Map.Map MajorProtocolVersion (Set.Set DefaultFun)
plutusV3builtins =
Map.fromList
[ (changPV, Set.fromList (batch1 ++ batch2 ++ batch3 ++ batch4))
, (plominPV, Set.fromList batch5)
, (pv11PV, Set.fromList batch6)
]
{-# OPAQUE plutusV3builtins #-}

{-| 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
Expand All @@ -230,24 +257,9 @@ batch6 =
builtinsIntroducedIn :: PlutusLedgerLanguage -> Map.Map MajorProtocolVersion (Set.Set DefaultFun)
builtinsIntroducedIn =
\case
PlutusV1 ->
Map.fromList
[ (alonzoPV, Set.fromList batch1)
, (pv11PV, Set.fromList (batch2 ++ batch3 ++ batch4 ++ batch5 ++ batch6))
]
PlutusV2 ->
Map.fromList
[ (vasilPV, Set.fromList (batch1 ++ batch2))
, (valentinePV, Set.fromList batch3)
, (plominPV, Set.fromList batch4b)
, (pv11PV , Set.fromList (batch4a ++ batch5 ++ batch6))
]
PlutusV3 ->
Map.fromList
[ (changPV, Set.fromList (batch1 ++ batch2 ++ batch3 ++ batch4))
, (plominPV, Set.fromList batch5)
, (pv11PV, Set.fromList batch6)
]
PlutusV1 -> plutusV1builtins
PlutusV2 -> plutusV2builtins
PlutusV3 -> plutusV3builtins

{- | 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 `pv11PV` onwards. -}
Expand Down