Allow Unions of PlutusData and BuiltinData #367
Labels
bb: medium
Medium issue according to bug bounty categorization
bug bounty
This issue is prized out as part of the Bug Bounty Program
enhancement
New feature or request
Is your feature request related to a problem? Please describe.
Currently, OpShin only allows Union between PlutusData objects with unique constructor IDs. In theory however, we could also allow Union with bytes, int, dict and list objects. This is currently only supported by wrapping the data in another PlutusData layer.
Describe the solution you'd like
In practice this would be treated by the compiler as Anything, and using ChooseData we can choose the appropriate datatype and downcast in
isinstance(x, int/bytes/...)
calls andx: int/bytes/... = x
. This could be tricky to get right however.Describe alternatives you've considered
Currently (as of #70 ) the status is to simply disallow such unions. There could be legitimate use cases that speak for it though.
Additional context
Note that there is no native plutusdata type for
str
andbool
so these should not be allowed in Unions (or at least not together withint
/bytes
as they are not distinguishable on the plutusdata level)The text was updated successfully, but these errors were encountered: