Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Unions of PlutusData and BuiltinData #367

Open
nielstron opened this issue Apr 7, 2024 · 1 comment
Open

Allow Unions of PlutusData and BuiltinData #367

nielstron opened this issue Apr 7, 2024 · 1 comment
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

Comments

@nielstron
Copy link
Contributor

nielstron commented Apr 7, 2024

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 and x: 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 and bool so these should not be allowed in Unions (or at least not together with int / bytes as they are not distinguishable on the plutusdata level)

Bug bounty: 1000 ADA

@nielstron nielstron added enhancement New feature or request bug bounty This issue is prized out as part of the Bug Bounty Program bb: medium Medium issue according to bug bounty categorization labels Apr 7, 2024
@SCMusson
Copy link
Contributor

SCMusson commented Aug 5, 2024

Claiming this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

2 participants