Skip to content

Commit 87b61b1

Browse files
authored
Enable Chang+1 builtins at Chang+1 and add them to V3.ParamName (#6449)
1 parent 9ca7a24 commit 87b61b1

File tree

6 files changed

+57
-30
lines changed

6 files changed

+57
-30
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,14 @@ builtinsIntroducedIn = Map.fromList [
120120
Bls12_381_millerLoop, Bls12_381_mulMlResult, Bls12_381_finalVerify,
121121
Keccak_256, Blake2b_224, IntegerToByteString, ByteStringToInteger
122122
]),
123-
((PlutusV3, futurePV), Set.fromList [
123+
((PlutusV3, changPlus1PV), Set.fromList [
124124
AndByteString, OrByteString, XorByteString, ComplementByteString,
125125
ReadBit, WriteBits, ReplicateByte,
126126
ShiftByteString, RotateByteString, CountSetBits, FindFirstSetBit,
127-
Ripemd_160, ExpModInteger
127+
Ripemd_160
128+
]),
129+
((PlutusV3, futurePV), Set.fromList [
130+
ExpModInteger
128131
])
129132
]
130133

plutus-ledger-api/src/PlutusLedgerApi/V3/ParamName.hs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,54 @@ data ParamName =
266266
| ByteStringToInteger'cpu'arguments'c2
267267
| ByteStringToInteger'memory'arguments'intercept
268268
| ByteStringToInteger'memory'arguments'slope
269+
-- Chang+1
270+
| AndByteString'cpu'arguments'intercept
271+
| AndByteString'cpu'arguments'slope1
272+
| AndByteString'cpu'arguments'slope2
273+
| AndByteString'memory'arguments'intercept
274+
| AndByteString'memory'arguments'slope
275+
| OrByteString'cpu'arguments'intercept
276+
| OrByteString'cpu'arguments'slope1
277+
| OrByteString'cpu'arguments'slope2
278+
| OrByteString'memory'arguments'intercept
279+
| OrByteString'memory'arguments'slope
280+
| XorByteString'cpu'arguments'intercept
281+
| XorByteString'cpu'arguments'slope1
282+
| XorByteString'cpu'arguments'slope2
283+
| XorByteString'memory'arguments'intercept
284+
| XorByteString'memory'arguments'slope
285+
| ComplementByteString'cpu'arguments'intercept
286+
| ComplementByteString'cpu'arguments'slope
287+
| ComplementByteString'memory'arguments'intercept
288+
| ComplementByteString'memory'arguments'slope
289+
| ReadBit'cpu'arguments
290+
| ReadBit'memory'arguments
291+
| WriteBits'cpu'arguments'intercept
292+
| WriteBits'cpu'arguments'slope
293+
| WriteBits'memory'arguments'intercept
294+
| WriteBits'memory'arguments'slope
295+
| ReplicateByte'cpu'arguments'intercept
296+
| ReplicateByte'cpu'arguments'slope
297+
| ReplicateByte'memory'arguments'intercept
298+
| ReplicateByte'memory'arguments'slope
299+
| ShiftByteString'cpu'arguments'intercept
300+
| ShiftByteString'cpu'arguments'slope
301+
| ShiftByteString'memory'arguments'intercept
302+
| ShiftByteString'memory'arguments'slope
303+
| RotateByteString'cpu'arguments'intercept
304+
| RotateByteString'cpu'arguments'slope
305+
| RotateByteString'memory'arguments'intercept
306+
| RotateByteString'memory'arguments'slope
307+
| CountSetBits'cpu'arguments'intercept
308+
| CountSetBits'cpu'arguments'slope
309+
| CountSetBits'memory'arguments
310+
| FindFirstSetBit'cpu'arguments'intercept
311+
| FindFirstSetBit'cpu'arguments'slope
312+
| FindFirstSetBit'memory'arguments
313+
| Ripemd_160'cpu'arguments'intercept
314+
| Ripemd_160'cpu'arguments'slope
315+
| Ripemd_160'memory'arguments
316+
269317
-- not enabled yet:
270318
-- ExpModInteger'cpu'arguments
271319
-- ExpModInteger'memory'arguments

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ tests =
2828
[ testCase "length" $ do
2929
166 @=? length v1_ParamNames
3030
185 @=? length v2_ParamNames
31-
251 @=? length v3_ParamNames
31+
297 @=? length v3_ParamNames
3232
, testCase "tripping paramname" $ do
3333
for_ v1_ParamNames $ \ p ->
3434
assertBool "tripping v1 cm params failed" $ Just p == readParamName (showParamName p)

plutus-ledger-api/test/Spec/Data/CostModelParams.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ tests =
2626
[ testCase "length" $ do
2727
166 @=? length v1_ParamNames
2828
185 @=? length v2_ParamNames
29-
251 @=? length v3_ParamNames
29+
297 @=? length v3_ParamNames
3030
, testCase "tripping paramname" $ do
3131
for_ v1_ParamNames $ \ p ->
3232
assertBool "tripping v1 cm params failed" $ Just p == readParamName (showParamName p)

plutus-ledger-api/testlib/PlutusLedgerApi/Test/V3/Data/EvaluationContext.hs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -93,17 +93,5 @@ clearBuiltinCostModel' :: (m ~ MBuiltinCostModel) => m -> m
9393
clearBuiltinCostModel' r = r
9494
{ -- , paramIntegerToByteString = mempty -- Required for V2
9595
-- , paramByteStringToInteger = mempty -- Required for V2
96-
paramAndByteString = mempty
97-
, paramOrByteString = mempty
98-
, paramXorByteString = mempty
99-
, paramComplementByteString = mempty
100-
, paramReadBit = mempty
101-
, paramWriteBits = mempty
102-
, paramReplicateByte = mempty
103-
, paramShiftByteString = mempty
104-
, paramRotateByteString = mempty
105-
, paramCountSetBits = mempty
106-
, paramFindFirstSetBit = mempty
107-
, paramRipemd_160 = mempty
108-
, paramExpModInteger = mempty
96+
paramExpModInteger = mempty
10997
}

plutus-ledger-api/testlib/PlutusLedgerApi/Test/V3/EvaluationContext.hs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -94,17 +94,5 @@ clearBuiltinCostModel' :: (m ~ MBuiltinCostModel) => m -> m
9494
clearBuiltinCostModel' r = r
9595
{ -- , paramIntegerToByteString = mempty -- Required for V2
9696
-- , paramByteStringToInteger = mempty -- Required for V2
97-
paramAndByteString = mempty
98-
, paramOrByteString = mempty
99-
, paramXorByteString = mempty
100-
, paramComplementByteString = mempty
101-
, paramReadBit = mempty
102-
, paramWriteBits = mempty
103-
, paramReplicateByte = mempty
104-
, paramShiftByteString = mempty
105-
, paramRotateByteString = mempty
106-
, paramCountSetBits = mempty
107-
, paramFindFirstSetBit = mempty
108-
, paramRipemd_160 = mempty
109-
, paramExpModInteger = mempty
97+
paramExpModInteger = mempty
11098
}

0 commit comments

Comments
 (0)