Skip to content

Commit 878a62f

Browse files
rphairKtorZ
andauthored
CIP-0042 | Adjust preamble and structure w.r.t CIP-0001 (cardano-foundation#698)
* 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]>
1 parent b169fa6 commit 878a62f

File tree

1 file changed

+26
-21
lines changed

1 file changed

+26
-21
lines changed

CIP-0042/README.md

+26-21
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
---
22
CIP: 42
3-
Title: New Plutus built-in serialiseData
4-
Authors: Matthias Benkort <[email protected]>, Sebastian Nagel <[email protected]>
5-
Discussions-To: https://github.com/cardano-foundation/CIPs/pull/218
6-
Comments-URI: https://github.com/cardano-foundation/CIPs/pull/218
7-
Category: Plutus
3+
Title: New Plutus Builtin serialiseData
84
Status: Active
9-
Type: Standards Track
5+
Category: Plutus
6+
Authors:
7+
- Matthias Benkort <[email protected]>
8+
- Sebastian Nagel <[email protected]>
9+
Implementors:
10+
- Michael Peyton Jones <[email protected]>
11+
Discussions:
12+
- https://github.com/cardano-foundation/CIPs/pull/218
1013
Created: 2022-02-09
1114
License: Apache-2.0
12-
Requires: CIP-35
1315

1416
---
1517

16-
# New Plutus built-in serialiseData
17-
1818
## Abstract
1919

2020
This document describes the addition of a new Plutus builtin for serialising `BuiltinData` to `BuiltinByteString`.
2121

22-
## Motivation
22+
## Motivation: why is this CIP necessary?
2323

2424
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.
2525

@@ -97,7 +97,7 @@ We propose to re-use this instance to define a cost model linear in the size of
9797

9898
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.
9999

100-
## Rationale
100+
## Rationale: how does this CIP achieve its goals?
101101

102102
* Easy to implement as it reuses existing code of the Plutus codebase;
103103
* 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
110110

111111
Results can be reproduced with the [plutus-cbor benchmark][].
112112

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
121114

122115
* 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?)
123116

124117
* 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`
125118

126-
## Backward Compatibility
119+
### Backward Compatibility
127120

128121
* 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.
129122

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+
130135
## Copyright
131136

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).
133138

134139
[CBOR]: https://www.rfc-editor.org/rfc/rfc8949
135140
[plutus-cbor]: https://github.com/input-output-hk/hydra-poc/tree/a4b843a040897e45120cb63b666d965759091651/plutus-cbor

0 commit comments

Comments
 (0)