-
Notifications
You must be signed in to change notification settings - Fork 479
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
Add specialized builtins for handling Value? #6585
Comments
adding something named Value as a builtin type would be mildly annoying at least cause naming conflicts with Cek Value. I think ByteStringMap is the way for this, bringing a standard library concept down to UPLC does not seem like a good idea. |
Personally I think this name clash is insignificant, particularly given that it's
The issue here is that
Perhaps. @colll78 you have a different view, don't you? |
This does not make sense to me. Why do you consider Value as BuiltinData to be a “standard library concept”? Maybe you have misunderstood. My proposal is to add builtin functions for working with UPLC is not a general-purpose programming language. It is a language specifically designed to write validation logic to set constraints for the creation and transfer of Value and Data across the Cardano blockchain. Given that half of the entire purpose of this language is to add constraints to the creation and transfer of Value, why should Value be a “standard library concept”? The whole value proposition behind domain specific languages (ie UPLC) is that the design is informed by and tailored to, the problem space. As such, it should be better suited to the task in that domain than a general-purpose language. To me it seems like this has not been taken into consideration much historically in the design of Plutus. How is there not first-class language support for Values in a domain specific language designed primarily to manage the transfer of Value??? |
Also BuiltinByteStringMap is not sufficient for many production use-cases, because you will have to first coerce the relevant data in the script context from BuiltinData to |
IMHO It makes sense to a dedicated |
With regards to the naming/"standard library concept" issue:
|
This is a nice initiation, and I think @colll78 articulated it quite nicely. There are so many utility functions I end up writing for almost all non-trivial contracts (the one I can think of right away, is a function for validating authenticity of a UTxO, i.e. it carries a specific NFT). While I understand adding features to a language should be done conservatively, this kind of repetition is bloating the chain. |
I still just think more functions for working with PlutusData is more appropriate. The concept of Value (Multiasset thingy) doesn't exist in the VM, it's just PlutusData. But I don't feel too strongly, I just think focusing on more performant primitives is more worth it than embedding high level constructs into the machine. The notion that Plutus VM is general purpose is silly. I was certainly not advocating for some vague notion of general purpose. That said, the machine imo must stay decoupled from ledger implementation details. Value being one of them. This doesn't mean we shouldn't add a builtin for this but it also doesn't need to make mention of Value in the builtin name. I also really like the idea of higher order builtins. Sounds like a good long term play. |
I agree. I am suggesting exactly that, functions for dealing The true necessary invariants afaik are:
I think many Value operations can be covered by the builtins functions provided for
Yep agreed. This is decoupled from the ledger Value types. If the structure of Value in the ledger changes, and |
@colll78 reports
I'm not sure what the best way of doing this is though. Do we add
Value
as a built-in type plus some conversions toByteStringMap
orData
? CanValue
change in future? In that case hardcoding the details of a specific implementation in the type signature (i.e. returning aByteStringMap
) of a conversion builtin is perhaps not wise, while returningData
is maybe fine.Or do we just alias
Value = Data
in builtins?Or maybe we can get decent performance without specialized builtins once we have
ByteStringMap
and some general builtins over it? I can only think of one way of doing that though, but it's not pretty: #6587.The text was updated successfully, but these errors were encountered: