IntersectMBO / IntersectMBO/plutus

Fix `costIsAcceptable`

Open
#7,194 0 comments 0 reactions 0 assignees View on GitHub
bug Internal optimization status: triaged
Dominant language
Haskell
Stars
1.6k
Forks
508
Avg merge
3d 10h
Merged PRs (30d)
22

Description

`costIsAcceptable` in both PIR and UPLC thinks that any `Constr` node containing a single element is fine as long as the cost of the latter is acceptable:

```haskell
costIsAcceptable :: Term name uni fun a -> Bool
costIsAcceptable = \case
<...>
Constr _ _ es ->
case es of
[] -> True
[e] -> costIsAcceptable e
_ -> False
```

Which makes sense on the surface until you realize that you can a 100-level-deep `Constr` node each containing a single element at each level -- and the cost of that isn't acceptable, because all those levels are gonna get evaluated at runtime. This needs to be fixed.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.