Skip to content

Commit 62c6d6c

Browse files
bezirgSeungheonOh
andauthored
Make the Tx.&& and Tx.|| short-circuit also in Haskell (#7432)
update golden Co-authored-by: Nikolaos Bezirgiannis <[email protected]> Co-authored-by: SeungheonOh <[email protected]>
1 parent 13e5d10 commit 62c6d6c

23 files changed

+810
-604
lines changed
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
CPU: 1_628_853_751_874
2-
Memory: 4_738_061_878
3-
AST Size: 3_325
4-
Flat Size: 5_265
1+
CPU: 1_628_853_655_874
2+
Memory: 4_738_061_278
3+
AST Size: 3_319
4+
Flat Size: 5_260
55

66
(con bool False)

plutus-benchmark/bitwise/test/9.6/Ed25519.golden.pir

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2217,31 +2217,27 @@
22172217
(appendByteString
22182218
x
22192219
(appendByteString x (appendByteString x x))))))))
2220-
!ds :
2221-
Tuple2 integer integer
2222-
= scalarMult
2223-
(Tuple2
2224-
{integer}
2225-
{integer}
2226-
(modInteger
2227-
bx
2228-
57896044618658097711785492504343953926634992332820282019728792003956564819949)
2229-
(modInteger
2230-
by
2231-
57896044618658097711785492504343953926634992332820282019728792003956564819949))
2232-
s
2233-
!ds : Tuple2 integer integer = edwards nt (scalarMult nt h)
22342220
in
22352221
Tuple2_match
22362222
{integer}
22372223
{integer}
2238-
ds
2224+
(scalarMult
2225+
(Tuple2
2226+
{integer}
2227+
{integer}
2228+
(modInteger
2229+
bx
2230+
57896044618658097711785492504343953926634992332820282019728792003956564819949)
2231+
(modInteger
2232+
by
2233+
57896044618658097711785492504343953926634992332820282019728792003956564819949))
2234+
s)
22392235
{bool}
22402236
(\(x : integer) (y : integer) ->
22412237
Tuple2_match
22422238
{integer}
22432239
{integer}
2244-
ds
2240+
(edwards nt (scalarMult nt h))
22452241
{bool}
22462242
(\(x : integer) (y : integer) ->
22472243
case

plutus-benchmark/bitwise/test/9.6/Ed25519.golden.uplc

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -25,29 +25,7 @@
2525
(\nt ->
2626
(\nt ->
2727
(\h ->
28-
(\ds ->
29-
(\ds ->
30-
case
31-
ds
32-
[ (\x
33-
y ->
34-
case
35-
ds
36-
[ (\x
37-
y ->
38-
case
39-
(equalsInteger
40-
x
41-
x)
42-
[ False
43-
, (equalsInteger
44-
y
45-
y) ]) ]) ])
46-
(edwards
47-
nt
48-
(scalarMult
49-
nt
50-
h)))
28+
case
5129
(scalarMult
5230
(constr 0
5331
[ (modInteger
@@ -56,7 +34,25 @@
5634
, (modInteger
5735
by
5836
57896044618658097711785492504343953926634992332820282019728792003956564819949) ])
59-
s))
37+
s)
38+
[ (\x
39+
y ->
40+
case
41+
(edwards
42+
nt
43+
(scalarMult
44+
nt
45+
h))
46+
[ (\x
47+
y ->
48+
case
49+
(equalsInteger
50+
x
51+
x)
52+
[ False
53+
, (equalsInteger
54+
y
55+
y) ]) ]) ])
6056
((\eta ->
6157
byteStringToInteger
6258
False
@@ -963,7 +959,7 @@
963959
(case
964960
ds
965961
[ (\w
966-
rest ->
962+
cont ->
967963
w) ]))
968964
(case
969965
ds
@@ -978,7 +974,7 @@
978974
(case
979975
ds
980976
[ (\w
981-
cont ->
977+
rest ->
982978
w) ])) ])
983979
(next
984980
ipv)) ])
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
CPU: 110_908_889
2-
Memory: 621_150
3-
AST Size: 7_443
4-
Flat Size: 8_699
1+
CPU: 111_100_889
2+
Memory: 622_350
3+
AST Size: 7_408
4+
Flat Size: 8_666
55

66
(con unit ())

plutus-benchmark/cardano-loans/test/9.6/main.golden.pir

Lines changed: 8 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -93,23 +93,7 @@
9393
(stakingCred' : Maybe StakingCredential) ->
9494
case
9595
(all dead. bool)
96-
(Credential_match
97-
cred
98-
{bool}
99-
(\(l : bytestring) ->
100-
Credential_match
101-
cred'
102-
{bool}
103-
(\(r : bytestring) ->
104-
equalsByteString l r)
105-
(\(ipv : bytestring) -> False))
106-
(\(a : bytestring) ->
107-
Credential_match
108-
cred'
109-
{bool}
110-
(\(ipv : bytestring) -> False)
111-
(\(a' : bytestring) ->
112-
equalsByteString a a')))
96+
(`$fEqCredential_$c==` cred cred')
11397
[ (/\dead -> False)
11498
, (/\dead ->
11599
Maybe_match
@@ -257,24 +241,7 @@
257241
Maybe StakingCredential) ->
258242
case
259243
(all dead. bool)
260-
(Credential_match
261-
cred
262-
{bool}
263-
(\(l : bytestring) ->
264-
Credential_match
265-
cred'
266-
{bool}
267-
(\(r : bytestring) ->
268-
equalsByteString l r)
269-
(\(ipv : bytestring) ->
270-
False))
271-
(\(a : bytestring) ->
272-
Credential_match
273-
cred'
274-
{bool}
275-
(\(ipv : bytestring) -> False)
276-
(\(a' : bytestring) ->
277-
equalsByteString a a')))
244+
(`$fEqCredential_$c==` cred cred')
278245
[ (/\dead -> False)
279246
, (/\dead ->
280247
Maybe_match
@@ -5595,6 +5562,8 @@
55955562
{all dead. dead}
55965563
in
55975564
let
5565+
!equalsInteger : integer -> integer -> bool
5566+
= \(x : integer) (y : integer) -> equalsInteger x y
55985567
~`$fAdditiveMonoidValue` :
55995568
(\k v -> List (Tuple2 k v))
56005569
bytestring
@@ -12022,7 +11991,7 @@
1202211991
(all dead. bool)
1202311992
(traceIfFalse
1202411993
"Datum is not an AskDatum"
12025-
(equalsInteger 0 (encodeDatum loanDatum)))
11994+
(equalsInteger (encodeDatum loanDatum) 0))
1202611995
[ (/\dead -> False)
1202711996
, (/\dead ->
1202811997
case
@@ -12058,19 +12027,19 @@
1205812027
(all dead. bool)
1205912028
(traceIfFalse
1206012029
"Datum is not an OfferDatum"
12061-
(equalsInteger 1 (encodeDatum loanDatum)))
12030+
(equalsInteger (encodeDatum loanDatum) 1))
1206212031
[ (/\dead -> False)
1206312032
, (/\dead ->
1206412033
case
1206512034
(all dead. bool)
1206612035
(equalsInteger
12067-
1
1206812036
(uncurry
1206912037
{bytestring}
1207012038
{bytestring}
1207112039
{integer}
1207212040
(valueOf inputValue)
12073-
(offerBeacon loanDatum)))
12041+
(offerBeacon loanDatum))
12042+
1)
1207412043
[ (/\dead ->
1207512044
traceIfFalse
1207612045
"Staking credential did not approve"

0 commit comments

Comments
 (0)