Skip to content

Commit 856319c

Browse files
authored
Add v1.0.0 to PlutusV3 (#7385)
* Add v1.0.0 to PlutusV3, PlutusV2 available since vasilPV. Add tests for v1.0.0. * Fix typo, clean-up * Add changelog
1 parent b8363fc commit 856319c

File tree

3 files changed

+25
-13
lines changed

3 files changed

+25
-13
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
### Fixed
2+
3+
- Allows PlutusV3 scripts with the v1.0.0 Plutus Core language version.
4+

plutus-ledger-api/src/PlutusLedgerApi/Common/Versions.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,12 +274,12 @@ plcVersionsIntroducedIn =
274274
]
275275
PlutusV2 ->
276276
Map.fromList
277-
[ (alonzoPV, Set.fromList [ plcVersion100 ])
277+
[ (vasilPV, Set.fromList [ plcVersion100 ])
278278
, (pv11PV, Set.fromList [ plcVersion110 ])
279279
]
280280
PlutusV3 ->
281281
Map.fromList
282-
[(changPV, Set.fromList [ plcVersion110 ])
282+
[ (changPV, Set.fromList [ plcVersion100, plcVersion110 ])
283283
]
284284

285285
{-| Which Plutus Core language versions are available in the given 'PlutusLedgerLanguage'

plutus-ledger-api/test/Spec/Versions.hs

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ showPV (MajorProtocolVersion pv) =
5757
errorScript :: SerialisedScript
5858
errorScript = serialiseUPLC $ UPLC.Program () PLC.plcVersion100 $ UPLC.Error ()
5959

60+
v100script :: UPLC.Program UPLC.DeBruijn UPLC.DefaultUni UPLC.DefaultFun ()
61+
v100script = UPLC.Program () PLC.plcVersion100 $ UPLC.Constant () (PLC.Some (PLC.ValueOf PLC.DefaultUniUnit ()))
62+
6063
v110script :: UPLC.Program UPLC.DeBruijn UPLC.DefaultUni UPLC.DefaultFun ()
6164
v110script = UPLC.Program () PLC.plcVersion110 $ UPLC.Constr () 0 mempty
6265

@@ -119,23 +122,28 @@ testLedgerLanguages = testGroup "ledger languages"
119122
testLanguageVersions :: TestTree
120123
testLanguageVersions =
121124
testGroup "Plutus Core language versions" $
122-
let expectGood prog ll pv =
125+
let expectGood plcv prog ll pv =
123126
testCase ("Ok in " ++ showPV pv) $
124-
assertBool ("v110" ++ " not allowed in " ++ show ll ++" @" ++ showPV pv) $
127+
assertBool (plcv ++ " not allowed in " ++ show ll ++" @" ++ showPV pv) $
125128
isRight $ mkTestTerm ll pv prog
126-
expectBad prog ll pv =
129+
expectBad plcv prog ll pv =
127130
testCase ("Not in " ++ showPV pv) $
128-
assertBool ("v110" ++ " should not be allowed in " ++ show ll ++" @" ++ showPV pv) $
131+
assertBool (plcv ++ " should not be allowed in " ++ show ll ++" @" ++ showPV pv) $
129132
isLeft $ mkTestTerm ll pv prog
130-
testOkFrom ll firstGood prog =
133+
testOkFrom plcv ll firstGood prog =
131134
let expectedGood = [ firstGood .. newestPV ]
132135
in testGroup (show ll) $
133-
fmap (expectBad prog ll) (allPVs \\ expectedGood) ++
134-
fmap (expectGood prog ll) expectedGood
135-
in [ testGroup "v1.1.0 availability"
136-
[ testOkFrom PlutusV1 newestPV v110script
137-
, testOkFrom PlutusV2 newestPV v110script
138-
, testOkFrom PlutusV3 changPV v110script
136+
fmap (expectBad plcv prog ll) (allPVs \\ expectedGood) ++
137+
fmap (expectGood plcv prog ll) expectedGood
138+
in [ testGroup "v1.0.0 availability"
139+
[ testOkFrom "v100" PlutusV1 alonzoPV v100script
140+
, testOkFrom "v100" PlutusV2 vasilPV v100script
141+
, testOkFrom "v100" PlutusV3 changPV v100script
142+
]
143+
, testGroup "v1.1.0 availability"
144+
[ testOkFrom "v110" PlutusV1 newestPV v110script
145+
, testOkFrom "v110" PlutusV2 newestPV v110script
146+
, testOkFrom "v110" PlutusV3 changPV v110script
139147
]
140148
-- Check that case and constr are not allowed in 1.1.0 in any LL/PV combination
141149
, testCase "case is not available in v1.0.0 ever" $

0 commit comments

Comments
 (0)