You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* first draft remediation of CIP-0042
* oops, left the old Type field in
* spelled NA instead of standard N/A
* add @michaelpj as sole implementor
Co-authored-by: Matthias Benkort <[email protected]>
* added reference to document + promote Data format
Co-authored-by: Matthias Benkort <[email protected]>
---------
Co-authored-by: Matthias Benkort <[email protected]>
This document describes the addition of a new Plutus builtin for serialising `BuiltinData` to `BuiltinByteString`.
21
21
22
-
## Motivation
22
+
## Motivation: why is this CIP necessary?
23
23
24
24
As part of developing on-chain script validators for [the Hydra Head protocol](https://eprint.iacr.org/2020/299), we stumble across a peculiar need for on-chain scripts: we need to verify and compare digests obtained from hashing elements of the script's surrounding transaction.
25
25
@@ -97,7 +97,7 @@ We propose to re-use this instance to define a cost model linear in the size of
97
97
98
98
Benchmarking and costing `serialiseData` was done in [this PR](https://github.com/input-output-hk/plutus/pull/4480) according to this strategy. As the benchmark is not very uniform, because some cases of `Data` "structures" differ in CPU time taken to process, the linear model is used as an **upper bound** and thus conservatively overestimating actual costs.
99
99
100
-
## Rationale
100
+
## Rationale: how does this CIP achieve its goals?
101
101
102
102
* Easy to implement as it reuses existing code of the Plutus codebase;
103
103
* Such built-in is generic enough to also cover a wider set of use-cases, while nicely fitting ours;
@@ -110,26 +110,31 @@ Benchmarking and costing `serialiseData` was done in [this PR](https://github.co
110
110
111
111
Results can be reproduced with the [plutus-cbor benchmark][].
112
112
113
-
## Path To Active
114
-
115
-
-[x] Using the existing _sizing metric_ for `Data`, we need to determine a costing function (using existing tooling / benchmarks? TBD)
116
-
-[x] The Plutus team updates plutus to add the built-in to PlutusV1 and PlutusV2 and uses a suitable cost function
117
-
-[ ] The binary format of `Data` is documented and embraced as an interface within `plutus`.
118
-
-[ ] Release it as a backward-compatible change within the next hard-fork
119
-
120
-
## Alternatives
113
+
### Alternatives
121
114
122
115
* We have identified that the cost mainly stems from concatenating bytestrings; so possibly, an alternative to this proposal could be a better way to concatenate (or to cost) bytestrings (Builders in Plutus?)
123
116
124
117
* If costing for `BuiltinData` is unsatisfactory, maybe we want have only well-known input types, e.g. `TxIn`, `TxOut`, `Value` and so on.. `WellKnown t => t -> BuiltinByteString`
125
118
126
-
## Backward Compatibility
119
+
###Backward Compatibility
127
120
128
121
* Additional built-in: so can be added to PlutusV1 and PlutusV2 without breaking any existing script validators. A hard-fork is however required as it would makes more blocks validate.
129
122
123
+
## Path To Active
124
+
125
+
### Acceptance Criteria
126
+
127
+
-[x] Release it as a backward-compatible change within the Vasil protocol upgrade
128
+
129
+
### Implementation Plan
130
+
131
+
-[x] Using the existing _sizing metric_ for `Data`, determine a costing function (using existing tooling / benchmarks? TBD)
132
+
-[x] The Plutus team updates plutus to add the built-in to PlutusV1 and PlutusV2 and uses a suitable cost function
133
+
-[x] The binary format of `Data` is documented and embraced as an interface within `plutus`. (see [cardano-ledger's CDDL specification](https://github.com/IntersectMBO/cardano-ledger/blob/faa40b812511bfb6592cdfbdd85fe560cbcaed43/eras/babbage/impl/cddl-files/babbage.cddl#L306-L311))
134
+
130
135
## Copyright
131
136
132
-
This CIP is licensed under Apache-2.0
137
+
This CIP is licensed under [Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0).
0 commit comments