Skip to content
Merged
Show file tree
Hide file tree
Changes from 17 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
3 changes: 2 additions & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ Please provide a clear and concise description of the vulnerability, including:
If you have developed any code or utilities that can help demonstrate the suspected
vulnerability, please mention them in your email but ***DO NOT*** attempt to include them as
attachments as this may cause your Email to be blocked by spam filters.
See the security file in the [Cardano engineering handbook](https://github.com/input-output-hk/cardano-engineering-handbook/blob/main/SECURITY.md).
See the security file in the [Cardano engineering handbook](https://github.com/input-output-hk/cardano-engineering-handbook/blob/main/SECURITY.md).

2 changes: 1 addition & 1 deletion plutus-ledger-api/src/PlutusLedgerApi/V1/Contexts.hs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ module PlutusLedgerApi.V1.Contexts

import PlutusTx
import PlutusTx.Foldable qualified as F
import PlutusTx.List
import PlutusTx.List hiding (mapMaybe)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why to hide only this one?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name collision with mapMaybe from PlutusTx.Prelude.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to import explicitly only the used symbols. Alternatively, Import PlutusTx.List qualified as List

import PlutusTx.Prelude

import GHC.Generics (Generic)
Expand Down
2 changes: 1 addition & 1 deletion plutus-ledger-api/src/PlutusLedgerApi/V2/Contexts.hs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ import PlutusTx.Blueprint.Definition.Derive (definitionRef)
import PlutusTx.Blueprint.TH (makeIsDataSchemaIndexed)
import PlutusTx.Foldable qualified as F
import PlutusTx.Lift (makeLift)
import PlutusTx.List
import PlutusTx.List hiding (mapMaybe)
import Prettyprinter (Pretty (..), nest, vsep, (<+>))

-- | An input of a pending transaction.
Expand Down
5 changes: 5 additions & 0 deletions plutus-tx-plugin/test/BuiltinList/Budget/9.6/(++).eval.golden
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not asking to change this, but you're really brave introducing that symbolic name haha.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cpu: 9002784
mem: 33712
size: 42

(con (list integer) [1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10])
25 changes: 25 additions & 0 deletions plutus-tx-plugin/test/BuiltinList/Budget/9.6/(++).pir.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
\(xs : list integer) ->
(let
b = list integer
in
\(f : integer -> b -> b) (acc : b) ->
letrec
!go : list integer -> b
= \(xs : list integer) ->
chooseList
{integer}
{all dead. b}
xs
(/\dead -> acc)
(/\dead ->
let
!x : integer = headList {integer} xs
!xs : list integer = tailList {integer} xs
in
f x (go xs))
{b}
in
go)
(mkCons {integer})
xs
xs
14 changes: 14 additions & 0 deletions plutus-tx-plugin/test/BuiltinList/Budget/9.6/(++).uplc.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
(program
1.1.0
(\xs ->
(\s -> s s)
(\s xs ->
force
(force (force chooseList)
xs
(delay xs)
(delay
(force mkCons
(force headList xs)
((\x -> s s x) (force tailList xs))))))
xs))
5 changes: 5 additions & 0 deletions plutus-tx-plugin/test/BuiltinList/Budget/9.6/(<|).eval.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cpu: 216462
mem: 1032
size: 9

(con (list integer) [42,1,2,3,4,5,6,7,8,9,10])
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
\(xs : list integer) -> mkCons {integer} 42 xs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(program 1.1.0 (\xs -> force mkCons 42 xs))
5 changes: 5 additions & 0 deletions plutus-tx-plugin/test/BuiltinList/Budget/9.6/and.eval.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cpu: 2091812
mem: 8694
size: 53

(constr 1)
27 changes: 27 additions & 0 deletions plutus-tx-plugin/test/BuiltinList/Budget/9.6/and.pir.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
let
data Bool | Bool_match where
True : Bool
False : Bool
in
letrec
!go : list bool -> Bool
= \(xs : list bool) ->
chooseList
{bool}
{all dead. Bool}
xs
(/\dead -> True)
(/\dead ->
let
!x : bool = headList {bool} xs
!xs : list bool = tailList {bool} xs
in
Bool_match
(ifThenElse {Bool} x True False)
{all dead. Bool}
(/\dead -> go xs)
(/\dead -> False)
{all dead. dead})
{Bool}
in
\(xs : list bool) -> go xs
19 changes: 19 additions & 0 deletions plutus-tx-plugin/test/BuiltinList/Budget/9.6/and.uplc.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
(program
1.1.0
((\go xs -> go xs)
((\s -> s s)
(\s xs ->
force
(force (force chooseList)
xs
(delay (constr 0 []))
(delay
((\x ->
(\xs ->
force
(force ifThenElse
x
(delay (s s xs))
(delay (constr 1 []))))
(force tailList xs))
(force headList xs))))))))
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cpu: 9002784
mem: 33712
size: 42

(con (list integer) [1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10])
25 changes: 25 additions & 0 deletions plutus-tx-plugin/test/BuiltinList/Budget/9.6/append.pir.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
\(xs : list integer) ->
(let
b = list integer
in
\(f : integer -> b -> b) (acc : b) ->
letrec
!go : list integer -> b
= \(xs : list integer) ->
chooseList
{integer}
{all dead. b}
xs
(/\dead -> acc)
(/\dead ->
let
!x : integer = headList {integer} xs
!xs : list integer = tailList {integer} xs
in
f x (go xs))
{b}
in
go)
(mkCons {integer})
xs
xs
14 changes: 14 additions & 0 deletions plutus-tx-plugin/test/BuiltinList/Budget/9.6/append.uplc.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
(program
1.1.0
(\xs ->
(\s -> s s)
(\s xs ->
force
(force (force chooseList)
xs
(delay xs)
(delay
(force mkCons
(force headList xs)
((\x -> s s x) (force tailList xs))))))
xs))
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cpu: 7467372
mem: 32100
size: 75

(con (list integer) [1,2,3,4])
42 changes: 42 additions & 0 deletions plutus-tx-plugin/test/BuiltinList/Budget/9.6/concat.pir.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
let
!caseList' : all a r. r -> (a -> list a -> r) -> list a -> r
= /\a r ->
\(z : r) (f : a -> list a -> r) (xs : list a) ->
chooseList
{a}
{all dead. r}
xs
(/\dead -> z)
(/\dead -> f (headList {a} xs) (tailList {a} xs))
{r}
in
\(xss : list (list integer)) ->
(letrec
!go : list (list integer) -> list integer
= caseList'
{list integer}
{list integer}
[]
(\(x : list integer) (xs : list (list integer)) ->
let
!r : list integer = go xs
in
(let
b = list integer
in
\(f : integer -> b -> b) (acc : b) ->
letrec
!go : list integer -> b
= caseList'
{integer}
{b}
acc
(\(x : integer) (xs : list integer) -> f x (go xs))
in
go)
(mkCons {integer})
r
x)
in
go)
xss
22 changes: 22 additions & 0 deletions plutus-tx-plugin/test/BuiltinList/Budget/9.6/concat.uplc.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
(program
1.1.0
(\xss ->
(\caseList' ->
(\s -> s s)
(\s ->
caseList'
[]
(\x xs ->
(\acc ->
(\s -> s s)
(\s ->
caseList' acc (\x xs -> force mkCons x (s s xs))))
(s s xs)
x)))
(\z f xs ->
force
(force (force chooseList)
xs
(delay z)
(delay (f (force headList xs) (force tailList xs)))))
xss))
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cpu: 56224464
mem: 237912
size: 120

(con (list integer) [1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10])
62 changes: 62 additions & 0 deletions plutus-tx-plugin/test/BuiltinList/Budget/9.6/concatMap.pir.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
let
!caseList' : all a r. r -> (a -> list a -> r) -> list a -> r
= /\a r ->
\(z : r) (f : a -> list a -> r) (xs : list a) ->
chooseList
{a}
{all dead. r}
xs
(/\dead -> z)
(/\dead -> f (headList {a} xs) (tailList {a} xs))
{r}
data Bool | Bool_match where
True : Bool
False : Bool
in
\(xss : list integer) ->
(letrec
!go : list integer -> list integer
= caseList'
{integer}
{list integer}
[]
(\(x : integer) ->
letrec
!go : integer -> list integer
= \(n : integer) ->
Bool_match
(ifThenElse
{Bool}
(lessThanEqualsInteger n 0)
True
False)
{all dead. list integer}
(/\dead -> [])
(/\dead ->
mkCons {integer} x (go (subtractInteger n 1)))
{all dead. dead}
in
\(xs : list integer) ->
let
!ys : list integer = go xs
!l : list integer = go 2
in
(let
b = list integer
in
\(f : integer -> b -> b) (acc : b) ->
letrec
!go : list integer -> b
= caseList'
{integer}
{b}
acc
(\(x : integer) (xs : list integer) -> f x (go xs))
in
go)
(mkCons {integer})
ys
l)
in
go)
xss
38 changes: 38 additions & 0 deletions plutus-tx-plugin/test/BuiltinList/Budget/9.6/concatMap.uplc.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
(program
1.1.0
(\xss ->
(\caseList' ->
(\s -> s s)
(\s ->
caseList'
[]
(\x ->
(\go xs ->
(\ys ->
(\l ->
(\s -> s s)
(\s ->
caseList'
ys
(\x xs -> force mkCons x (s s xs)))
l)
(go 2))
(s s xs))
((\s -> s s)
(\s n ->
force
(force ifThenElse
(lessThanEqualsInteger n 0)
(delay [])
(delay
(force mkCons
x
((\x -> s s x)
(subtractInteger n 1))))))))))
(\z f xs ->
force
(force (force chooseList)
xs
(delay z)
(delay (f (force headList xs) (force tailList xs)))))
xss))
5 changes: 5 additions & 0 deletions plutus-tx-plugin/test/BuiltinList/Budget/9.6/cons.eval.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cpu: 216462
mem: 1032
size: 9

(con (list integer) [0,1,2,3,4,5,6,7,8,9,10])
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
\(xs : list integer) -> mkCons {integer} 0 xs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(program 1.1.0 (\xs -> force mkCons 0 xs))
Loading