-
Notifications
You must be signed in to change notification settings - Fork 375
CIP-???? | Multi-arity UPLC lambda node #1043
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
base: master
Are you sure you want to change the base?
Changes from all commits
1494c1d
bc077bf
7714de8
cd92d47
398268e
0f8c9fc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,90 @@ | ||||||||||||||||||||||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||||||||||||||||||||||
| CIP: ??? | ||||||||||||||||||||||||||||||||||||||||||||
| Title: multi-arity uplc lambda node | ||||||||||||||||||||||||||||||||||||||||||||
| Category: Plutus | ||||||||||||||||||||||||||||||||||||||||||||
| Status: Proposed | ||||||||||||||||||||||||||||||||||||||||||||
| Authors: | ||||||||||||||||||||||||||||||||||||||||||||
| - Michele Nuzzi <[email protected]> | ||||||||||||||||||||||||||||||||||||||||||||
| Implementors: [] | ||||||||||||||||||||||||||||||||||||||||||||
| Discussions: | ||||||||||||||||||||||||||||||||||||||||||||
| - https://github.com/cardano-foundation/CIPs/pull/1043 | ||||||||||||||||||||||||||||||||||||||||||||
| Created: 2025-06-02 | ||||||||||||||||||||||||||||||||||||||||||||
| License: CC-BY-4.0 | ||||||||||||||||||||||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| <!-- Existing categories: | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| - Meta | For meta-CIPs which typically serves another category or group of categories. | ||||||||||||||||||||||||||||||||||||||||||||
| - Wallets | For standardisation across wallets (hardware, full-node or light). | ||||||||||||||||||||||||||||||||||||||||||||
| - Tokens | About tokens (fungible or non-fungible) and minting policies in general. | ||||||||||||||||||||||||||||||||||||||||||||
| - Metadata | For proposals around metadata (on-chain or off-chain). | ||||||||||||||||||||||||||||||||||||||||||||
| - Tools | A broad category for ecosystem tools not falling into any other category. | ||||||||||||||||||||||||||||||||||||||||||||
| - Plutus | Changes or additions to Plutus | ||||||||||||||||||||||||||||||||||||||||||||
| - Ledger | For proposals regarding the Cardano ledger (including Reward Sharing Schemes) | ||||||||||||||||||||||||||||||||||||||||||||
| - Catalyst | For proposals affecting Project Catalyst / the Jörmungandr project | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| --> | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+15
to
+27
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
(remove template scaffolding) |
||||||||||||||||||||||||||||||||||||||||||||
| ## Abstract | ||||||||||||||||||||||||||||||||||||||||||||
| <!-- A short (\~200 word) description of the proposed solution and the technical issue being addressed. --> | ||||||||||||||||||||||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
(remove template scaffolding) |
||||||||||||||||||||||||||||||||||||||||||||
| This CIP proposes a new node for an uplc tree. | ||||||||||||||||||||||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
If there's any context where lowercase makes sense, please let reviewers & editors know... e.g. if it's a symbol (in which case it would be |
||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| The node is intended to have the same effect of n consecutive lambda nodes for 1/n the cost. Improving contracts in all measurable metrics (size, cpu, memory) | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| ## Motivation: why is this CIP necessary? | ||||||||||||||||||||||||||||||||||||||||||||
| <!-- A clear explanation that introduces the reason for a proposal, its use cases and stakeholders. If the CIP changes an established design then it must outline design issues that motivate a rework. For complex proposals, authors must write a Cardano Problem Statement (CPS) as defined in CIP-9999 and link to it as the `Motivation`. --> | ||||||||||||||||||||||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
(remove template scaffolding) |
||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| Patterns like | ||||||||||||||||||||||||||||||||||||||||||||
| ```uplc | ||||||||||||||||||||||||||||||||||||||||||||
| (lam a (lam b (lam c <body>))) | ||||||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||||||
| are increasingly common in uplc contracts. | ||||||||||||||||||||||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
... et cetera, please, wherever this term is used... |
||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| These are not only used to represent functions with arity greater than 1, but also to destructure SoP enocded values, or to introduce multiple "letted" values in scope (witch in plutus v3 is done using a case/constr). | ||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. after reading a few facts:
I struggle to see how this answers the question "Why is this CIP necessary"? |
||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| ## Specification | ||||||||||||||||||||||||||||||||||||||||||||
| <!-- The technical specification should describe the proposed improvement in sufficient technical detail. In particular, it should provide enough information that an implementation can be performed solely on the basis of the design in the CIP. This is necessary to facilitate multiple, interoperable implementations. This must include how the CIP should be versioned, if not covered under an optional Versioning main heading. If a proposal defines structure of on-chain data it must include a CDDL schema in its specification.--> | ||||||||||||||||||||||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
(remove template scaffolding) |
||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| This CIP proposes the `func` node, which is encoded with arity n, intended to have the same effect as n consecutive lambda nodes. | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| The new node should have tag `10` (in binary: `1010`). | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| Once encountered, other 4 bits are expected indicating the arity of the function node. | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| Because we already have the `lam` node to indicate a function with arity 1, and `delay` can be interpreted as arity 0, the 4 arity bits can specify arity between 2 and 17 inclusive on both sides. | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| Encoding any arity greater than 17 will require at least 2 nodes, | ||||||||||||||||||||||||||||||||||||||||||||
| for example arity 18 can be encoded as `(func 17 a b c ... (lam r <body>))`, | ||||||||||||||||||||||||||||||||||||||||||||
| and arity 19 can be encoded as `(func 17 a b c ... (func 2 r s <body>))`. | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| ## Rationale: how does this CIP achieve its goals? | ||||||||||||||||||||||||||||||||||||||||||||
| <!-- The rationale fleshes out the specification by describing what motivated the design and what led to particular design decisions. It should describe alternate designs considered and related work. The rationale should provide evidence of consensus within the community and discuss significant objections or concerns raised during the discussion. | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| It must also explain how the proposal affects the backward compatibility of existing solutions when applicable. If the proposal responds to a CPS, the 'Rationale' section should explain how it addresses the CPS, and answer any questions that the CPS poses for potential solutions. | ||||||||||||||||||||||||||||||||||||||||||||
| --> | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+61
to
+65
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
(remove template scaffolding) |
||||||||||||||||||||||||||||||||||||||||||||
| The proposal does not impact backward compatibility by choice. The original lambda nodes are left in plutus both for backward compatibility and to save 4 bits on arity 1 functions. | ||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Knowing that CIP is backwads compatible is useful, |
||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| ## Path to Active | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| Included in Plutus V4. | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| ### Acceptance Criteria | ||||||||||||||||||||||||||||||||||||||||||||
| <!-- Describes what are the acceptance criteria whereby a proposal becomes 'Active' --> | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| Included in Plutus V4. | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+72
to
+75
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
(remove template scaffolding) @michele-nuzzi a little more effort here would be appreciated about how this change will be considered by the community & currently responsible architects:
|
||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| ### Implementation Plan | ||||||||||||||||||||||||||||||||||||||||||||
| <!-- A plan to meet those criteria or `N/A` if an implementation plan is not applicable. --> | ||||||||||||||||||||||||||||||||||||||||||||
| N/A | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| <!-- OPTIONAL SECTIONS: see CIP-0001 > Document > Structure table --> | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| ## Copyright | ||||||||||||||||||||||||||||||||||||||||||||
| <!-- The CIP must be explicitly licensed under acceptable copyright terms. Uncomment the license you wish to use (delete the other one) and ensure it matches the License field in the header. | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| If AI/LLMs were used in the creation of the copyright text, the author may choose to include a disclaimer to describe their application within the proposal. | ||||||||||||||||||||||||||||||||||||||||||||
| --> | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| This CIP is licensed under [CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/legalcode). | ||||||||||||||||||||||||||||||||||||||||||||
| <!-- This CIP is licensed under [Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0). --> | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+77
to
+90
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (remove template scaffolding AGAIN)
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||
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.
All CIP titles, like all titles, are capitalised. (Since these titles can also be considered phrases or sentences, it's not necessary to capitalise every word... some authors do & some don't.)