IntersectMBO / IntersectMBO/plutus

Builtins are versioned in Plutus but not in Haskell

Open
#5,968 0 comments 0 reactions 1 assignee Claimed by @effectfully View on GitHub
bug Builtins Internal status: triaged tech debt
Dominant language
Haskell
Stars
1.6k
Forks
508
Avg merge
3d 10h
Merged PRs (30d)
22

Description

`PlutusTx.Builtins.Internal` has

```haskell
consByteString :: BuiltinInteger -> BuiltinByteString -> BuiltinByteString
consByteString n (BuiltinByteString b) = BuiltinByteString $ BS.cons (fromIntegral n) b
```

but that's the old definition of `consByteString`, the new one doesn't use `fromIntegral` and instead fails if `n` doesn't fit into `Word8`. This means that some builtins behave differently on whether we evaluate them in Plutus or Haskell.

From what I was able to gather, people mostly evaluate Plutus as Haskell just for the purposes of testing, but if the behavior is inconsistent, then such tests can be extremely misleading. We should either make builtins versioned in Haskell as well or remove that functionality entirely and require people to always evaluate Plutus code using a Plutus evaluator.

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.