-
Notifications
You must be signed in to change notification settings - Fork 375
CIP-0153 | Update and clarify Value primitives
#1088
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
Conversation
|
On a second thought I think it's better to just give This is good because it makes Note that this means |
@zliu41 Your example generalizes to |
|
In the ledger spec, if we are to translate the definitions there into the language we use here, value ordering is defined as: @colll78 @zliu41 is there anything wrong with the ledger spec's definition of value comparison? Unless we want a different semantics, I would proceed with this definition as it's canonical (unless for some reason we don't regard the ledger spec as canonical, which means we have bigger problems!). |
|
I alluded to this question in the main discussion, but from a dev's perspective, is Consider a dApp using tokens for authorization. For certain actions, these tokens need to be minted. These auth tokens may share the same policy id but not the same token name. So at runtime, the script builds up a IMHO either |
|
One thing please for reviewers and Plutus integrators on all node teams to consider posting about... this is tagged I think any of the reviewers @zliu41 tagged in #1088 (comment) would be able to support this qualification & of course all are always welcome to join the CIP meetings themselves (next = https://hackmd.io/@cip-editors/120). |
@ana-pantilie It is more expensive to implement. It will take
@colll78 what do you think about using |
Using == is not an option. Such a definition would completely kill the vast majority of use-cases for this builtin. If there is sufficient demand to perform partial subset equality on values then that should be added as a separate builtin. |
|
@colll78 I see. So there doesn't seem to be a sensible semantics on negative values for Also, we should enforce a 32-byte length limit on currency symbols and token names, for Any objections on either point? |
This may be an amateur question, but doesn't failing on negative make |
Value primitives
|
Why not add a separate -- | Returns a `BuiltinValue` containing only tokens with the specified policy id.
lookupTokens :: BuiltinValue -> BuiltinCurrencySymbol -> BuiltinValue |
I thought so too, but @colll78 mentioned that this need is uncommon. Also, given we are doing So a separate builtin makes more sense to me.
That could be useful but the proper path forward is to write a new CIP. |
I mean no disrespect, but this is heavily subjective. For CIP-89 based dApps, it is extremely important for securing the beacon tokens. I recognize it is a new paradigm that hasn't really taken hold yet, but we shouldn't base decisions solely off the current DeFi paradigm which most people agree is far from ideal.
@rphair Is this correct? IMHO adding |
Though I agree with you about the spirit of the change, I suspect that @zliu41 could be right... mainly since one doesn't extend the scope of a CIP by removing something: although one might be doing this by making additions to it. (You already know that Plutus is not my field so I'm not qualified to debate the relative significance of these changes.) CIP-0035 is pretty strict about adding elements without verifying what performance impact they would have: the kind of review that would be done for a new CIP (benchmarks, etc) but likely harder to evaluate for a CIP-based feature that people are already using. I couldn't imagine what such performance implications there might be, but maybe @kwxm could help with this... and also @effectfully to evaluate whether the semantic addition could be made as easily as you suggest. If there is consensus from these sources then maybe @zliu41 would agree that we could relax the usual strict suggestion of a new CIP. |
Out of curiosity, what semantics do such use cases require on negative amounts, Is it |
|
I consider myself a junior programmer so there could be better ways of doing it, but this is what I do:
I don't need that. If we had
Literally everything with |
|
Again, I am not opposed to adding a new builtin for this purpose at all. My point is that valueContains as defined by >= is a critical component of this CIP, and the lack of this builtin is a huge blocker for the programmable tokens CIP. So we cannot afford to modify valueContains to accommodate this specific use-case. We can introduce a new CIP with the lookupTokens builtin you propose, and this I would support and see value in. |
Agreed with 100% of the above. |
|
@zliu41 Are you okay with adding If I have to create a separate CIP, I will. But that seems excessive and just fragments documentation for this new |
Both can be done without builtins (for Plutus V1, V2 and V3). They will be much more useful for Plutus V4 onwards, so I agree we should have something along those lines. But I really suggest opening a new CIP because we need discussion and consensus on:
Also, we've committed to implementing CIP-0153 for the upcoming intra-era hard fork, so increasing the scope this close to the hard fork doesn't seem like a good idea. |
|
@rphair How should I join the CIP meeting? I don't see any link in https://hackmd.io/@cip-editors/120 |
|
@zliu41 @fallen-icarus we keep the CIP Discord invitation link here — https://github.com/cardano-foundation/CIPs/wiki#key-links--resources (in 1 place only so it doesn't attract so much spam membership) — along with all the information about the meetings. |
|
Apologies @zliu41 @fallen-icarus @colll78 that we couldn't help settle this question at the CIP meeting today due to the flash-mob review of Leios (#1078 (comment)). Also, progressing this to Therefore I'm keeping this in |
|
At this point it's pretty clear we cannot choose single reasonable non-failing semantics for negative integers w.r.t.
I mostly agree with Ziyang that it deserves its own CIP (although see below for a potential quick solution that doesn't require another CIP). The builtin is simple, sure, but maybe we want to generalize it so that it can handle not only a currency lookup but also a token lookup. At which point maybe what we actually want is to add Or maybe we should generalize the builtin in a different direction and add If we can agree that I wouldn't add And yeah, I get that So if a slightly less efficient but more general builtin can be added, then I think it's a good trade-off. Obviously, exceptions exist. But I'd say that the best place to argue about a builtin being an exception is a dedicated CIP. |
|
I updated the text based on the above consensus: (1) This PR is really mainly intended to settle the question on |
|
Okay, I'll draft another CIP to discuss the other builtins. I spoke to some other DeFi devs and they are asking for other functions too. Perhaps the title of this PR should be altered since the scope is way more specific than " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is ready to merge as an update now that the request to extend the scope has been settled with #1088 (comment) - no worries @fallen-icarus and personally I think your "tangent" was very appropriate considering the CIP-0153 implementation right around the corner as per #1088 (comment).
Since merging this would provide clarity about what's being implemented at that hard fork, I don't want this to get stuck in the queue so I'm personally approving & marking Last Check so we should have 2 weeks to note any objections to the change or any other other adjustments requested. Though this seemed doomed to another 2 weeks of Triage I think @effectfully's #1088 (comment) lack of objection to the CIP update (as submitted here) is confirmation enough for now.
Ryun1
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like discussions have reached conclusion
appreciate the update on this @zliu41 🙏
|
I believe I made a huge mistake not including |
|
@colll78 could this be covered by this new CIP PR under review? (cc @fallen-icarus) ... created from this discussion point: I would expect that evaluation of the new builtin would occur in an updated #1090 — or a further new CIP, if that were recommended (I'm not, but @zliu41 might) — rather than here. It would seem best to me to include this in #1090 if you & @fallen-icarus can agree upon that. Maybe @effectfully could also advise about questions of scope & help decide which. |
It could be covered under that CIP, but that CIP proposes the introduction of multiple other builtins in addition to |
|
@colll78 in Plutus V1 through V3 the builtin Value will be encoded as a Map in Data, so |
|
Let's continue the discussion in #1090 |
deleteCoin, since it can be expressed viainsertCoin.unionValuessince the benefits are unclear, especially since we can now process lists more efficiently in UPLC (via casing on lists). If the need for it arises in the future we can open a separate CIP for it.valueContains, making its behavior more sensible.valueDataandunValueDataworks - the behavior will be different in Plutus V1-V3, vs. V4 onwards.