IntersectMBO / plutus

The Plutus language implementation and tools

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`builtinsAvailableIn` doesn't account for backports

effectfully opened this issue · comments

We claim that it's possible to extend ParamName data types with new costing parameters without issuing a new language version, however builtinsAvailableIn doesn't account for that. It's defined as

builtinsAvailableIn :: PlutusLedgerLanguage -> MajorProtocolVersion -> Set.Set DefaultFun
builtinsAvailableIn thisLv thisPv = fold $ Map.elems $
    Map.takeWhileAntitone builtinAvailableIn builtinsIntroducedIn
    where
      builtinAvailableIn :: (PlutusLedgerLanguage, MajorProtocolVersion) -> Bool
      builtinAvailableIn (introducedInLv,introducedInPv) =
          -- both should be satisfied
          introducedInLv <= thisLv && introducedInPv <= thisPv

which may look fine on the surface, but note how it's takeWhileAntitone and not filter or something: we can have a situation when introducedInPv <= thisPv fails, because a builtin was introduced in a late protocol version, but there's still room for a few more language versions that introduce builtins in early protocol versions. This needs fixing.