From 258751c68a41806441c1a0c0ec22d46cea73ff53 Mon Sep 17 00:00:00 2001 From: zygomeb Date: Tue, 25 Oct 2022 14:08:25 +0200 Subject: [PATCH 1/5] partial initial --- CIP-NoDatumIsDatum/README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 CIP-NoDatumIsDatum/README.md diff --git a/CIP-NoDatumIsDatum/README.md b/CIP-NoDatumIsDatum/README.md new file mode 100644 index 0000000000..db19524e33 --- /dev/null +++ b/CIP-NoDatumIsDatum/README.md @@ -0,0 +1,17 @@ +--- +CIP: ???? +Title: No Datum Is Unit +Author: Maksymilian 'zygomeb' Brodowicz +Status: Draft +Type: Standards Track +Created: 2022-08-23 +License: CC-BY-4.0 +--- + +## Simple Summary / Abstract + +The CIP changes interpretation of how the absence of a datum hash or inline datum is interpreted. The entire scope of what is does is make it so that such a UTXO is equivalent to a one that has `()` as the datum for the purpose of script evaluation. + +## Motivation / History + +Currently if a transaction is sent to a script without a datum it means that even if the script is `alwaysTrue` then that utxo is unable to be consumed. This enables the use case of spending scrips without datums \ No newline at end of file From eb55c93c4ade722077ca3f655b702ba1fce84628 Mon Sep 17 00:00:00 2001 From: zygomeb Date: Tue, 25 Oct 2022 15:10:13 +0200 Subject: [PATCH 2/5] initial version --- CIP-AnyDataIsDatum/README.md | 45 ++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 CIP-AnyDataIsDatum/README.md diff --git a/CIP-AnyDataIsDatum/README.md b/CIP-AnyDataIsDatum/README.md new file mode 100644 index 0000000000..f02dd5a923 --- /dev/null +++ b/CIP-AnyDataIsDatum/README.md @@ -0,0 +1,45 @@ +--- +CIP: ???? +Title: Hash-Checked Data +Author: Maksymilian 'zygomeb' Brodowicz +Status: Draft +Type: Standards +Created: 2022-10-25 +License: CC-BY-4.0 +--- + +## Simple Summary / Abstract + +Hashing data on-chain is quite expensive from a computational perspective. Currently, however, we are forced to use the `serializeData` primitive combined with a hashing function of our choice. It would be computationally beneficial to let the node hash the data before running the smart contracts, giving us only a guarantee that this mapping is correct, just as we do with Datums presently. + +Therefore we propose extending the ScriptContext from just a mapping between DatumHash and Datum to a more universal mapping between BuiltinByteString and BuiltinData. + +## Motivation / History + +We can repeat the same motivation as [CIP 42](https://cips.cardano.org/cips/cip42/), and more broadly emphasizing the want to leverage complex data structures on chain. + +When presented with either a datum inside a datum or in general, data behind a hash, we are forced to spend a lot of computational resources to first serialize and then hash and then check for equality. This comes up quite often when implementing counter-double-satisfation measures (payment to script double satisfied). + +## Specification + +### Extending the ScriptContext + +We change the field `txInfoData` to `[(BuiltinByteString, BuiltinData)]`. Nominally, this changes nothing as the `DatumHash` and `Datum` types are equivalent to these. Importantly however, we allow any pair to be pushed to this list, and the node will hash the `BuiltinData` to verify that it matches the `BuiltinByteString`. + +It is worth noting that we can keep the types as they are now. + +## Rationale + +Just as we use nodes to be the source of truth on hash equality for datums we should encourage the use of them for more data, if it can be known statically. + +## Backwards compatibility + +The change can be made to the node without a creating a new language version as it does not affect the past transactions. + +## Path to Active + +The appropriate changes need to be made to the node code. + +## Copyright + +This CIP is licensed under Apache-2.0 \ No newline at end of file From 5a03cc99c28f003a33411c8c579e00cd33945689 Mon Sep 17 00:00:00 2001 From: zygomeb Date: Tue, 25 Oct 2022 15:17:23 +0200 Subject: [PATCH 3/5] cleanup --- CIP-NoDatumIsDatum/README.md | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 CIP-NoDatumIsDatum/README.md diff --git a/CIP-NoDatumIsDatum/README.md b/CIP-NoDatumIsDatum/README.md deleted file mode 100644 index db19524e33..0000000000 --- a/CIP-NoDatumIsDatum/README.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -CIP: ???? -Title: No Datum Is Unit -Author: Maksymilian 'zygomeb' Brodowicz -Status: Draft -Type: Standards Track -Created: 2022-08-23 -License: CC-BY-4.0 ---- - -## Simple Summary / Abstract - -The CIP changes interpretation of how the absence of a datum hash or inline datum is interpreted. The entire scope of what is does is make it so that such a UTXO is equivalent to a one that has `()` as the datum for the purpose of script evaluation. - -## Motivation / History - -Currently if a transaction is sent to a script without a datum it means that even if the script is `alwaysTrue` then that utxo is unable to be consumed. This enables the use case of spending scrips without datums \ No newline at end of file From c0e20c057a48d318ed07c69cb56eab81afeb00ca Mon Sep 17 00:00:00 2001 From: zygomeb Date: Thu, 27 Oct 2022 00:21:47 +0200 Subject: [PATCH 4/5] incorporate feedback --- CIP-AnyDataIsDatum/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CIP-AnyDataIsDatum/README.md b/CIP-AnyDataIsDatum/README.md index f02dd5a923..ae683694de 100644 --- a/CIP-AnyDataIsDatum/README.md +++ b/CIP-AnyDataIsDatum/README.md @@ -12,7 +12,7 @@ License: CC-BY-4.0 Hashing data on-chain is quite expensive from a computational perspective. Currently, however, we are forced to use the `serializeData` primitive combined with a hashing function of our choice. It would be computationally beneficial to let the node hash the data before running the smart contracts, giving us only a guarantee that this mapping is correct, just as we do with Datums presently. -Therefore we propose extending the ScriptContext from just a mapping between DatumHash and Datum to a more universal mapping between BuiltinByteString and BuiltinData. +Therefore we propose extending the ScriptContext's txInfoData from just a mapping between DatumHash and Datum to a more universal mapping between BuiltinByteString and BuiltinData. ## Motivation / History @@ -34,7 +34,7 @@ Just as we use nodes to be the source of truth on hash equality for datums we sh ## Backwards compatibility -The change can be made to the node without a creating a new language version as it does not affect the past transactions. +The change needs a new language version to function safely ## Path to Active From 4d2e4b0b28ec2ae26402c8a18a1f3569f61c36a7 Mon Sep 17 00:00:00 2001 From: zygomeb <87449555+zygomeb@users.noreply.github.com> Date: Thu, 24 Nov 2022 23:16:32 +0100 Subject: [PATCH 5/5] incorporate suggested cip number Co-authored-by: Matthias Benkort <5680256+KtorZ@users.noreply.github.com> --- CIP-AnyDataIsDatum/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CIP-AnyDataIsDatum/README.md b/CIP-AnyDataIsDatum/README.md index ae683694de..28d3d0372a 100644 --- a/CIP-AnyDataIsDatum/README.md +++ b/CIP-AnyDataIsDatum/README.md @@ -1,5 +1,5 @@ --- -CIP: ???? +CIP: 76 Title: Hash-Checked Data Author: Maksymilian 'zygomeb' Brodowicz Status: Draft