IntersectMBO / IntersectMBO/plutus
Fix `costIsAcceptable`
Open
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
Assessment
This issue has not been assessed yet.