-
Notifications
You must be signed in to change notification settings - Fork 323
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
CIP-0076? | Hash-Checked Data #363
Conversation
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.
This was a considered alternative to CIP-42, but was rejected because it confuses the meaning of txInfoData
. It currently reflects the corresponding field in the transaction, this would pollute it with ad-hoc data.
CIP-AnyDataIsDatum/README.md
Outdated
|
||
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. |
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.
the ScriptContext
is not a mapping. I think you mean the txInfoData
field of TxInfo
.
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.
Yes, this sentence refers to the one field in ScriptContext. Although at the time of writing I was unsure whether or not to include the other way of doing this via including a new field txInfoAdditionalData
to contain these which, to the other thread, would make it backwards compatible.
Relevant: IntersectMBO/cardano-ledger#2649 |
I think this proposal is rather about removing the current restriction in the ledger rules that prevent one from adding extraneous unreferenced data to the transaction, than it is about changing anything in Plutus per-se (though, one will likely impact the other I agree). |
Hmm, you could make the same argument for data that had to be signed with different signing algorithms for other chains |
As discussed in today's editors meeting, @kevinhammond to reach to relevant people at IOG from the ledger team to assess the feasibility and consequences of adjusting the ledger rules in that direction. |
|
||
### 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`. |
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.
Are you suggesting we only support Blake2b 256? (ie the hash function currently used for Data). Above it says "hashing function of our choice", but here it looks like you are suggesting just keeping with the status quo.
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 believe that we should have more discussion around how it would be possible to have an arbitrary hashing algorithm used here -- but I'd be happy to have an MVP here of just the blake256 as for the purpose of what this aims to achieve it is entirely sufficient.
I don't see any explanation in this CIP regarding how this extra data is supplied. A new field in the transaction body? Or is the idea just to relax the restrictions on the auxiliary data (and keep to Blake2b 256)? |
My two lovelace, just as a random human (ie, just me speaking without any authority, etc): I empathize with the desire to relax the constraints mentioned in IntersectMBO/cardano-ledger#2649. This would let folks be able to utilize the node for random Blake2b 256 hashes inside of Plutus. Of course, this is more work for nodes that no one is really going to be paid for (except in some very indirect way of creating user-value). I also empathize with @michaelpj in wanting to keep some coherency to the meaning of As for the "feasibility and consequences" of the design (assuming all my assumptions above are valid regarding what exactly is being proposed), it's a matter of tweaking a rule in the next ledger era and deciding that we are okay with changing the meaning of |
I don't agree with this. The purpose of this CIP is to work around a problem in Plutus. I don't think there's any reason to do it apart from that. My objections are:
|
Co-authored-by: Matthias Benkort <[email protected]>
@zygomeb I'm closing this as |
The aim of this CIP is to extend the use of node as a source of truth and as a result bring cost-savings to on-chain computation.
Related work: CIP 42
(draft proposal in branch)