tweag / cooked-validators

MIT License
39 stars 11 forks source link

Inline datums #203

Closed carlhammann closed 1 year ago

carlhammann commented 1 year ago

This PR proposes a design for inline datums:

This last point is also what I do not like about this design: In order to write a transaction that consumes an UTxO with a datum hash (which I assume will still be the "normal case") you'll have to keep track of the datum on that UTxO yourself, cooked won't help you. But is it safe to assume that we knew this datum when we created the UTxO in the first place? In that case, It would be simple to change the type Either Pl.DatumHash a of transaction output datums to something like

data TxSkelOutDatum a = TxSkelOutDatum a | TxSkelOutDatumHash a

This would have the intended meaning that we always know the full datum while we create the transaction output, but sometimes we only include its hash on the transaction, but remember the complete datum in the MockChainState.

You can see the interface in action in the tests for inline datums.

mmontin commented 1 year ago

Here are some feedback / questions about this PR :

carlhammann commented 1 year ago

This PR has now served its purpose as a draft for inline datums. With PR #206, this feature is now implemented much more elegantly, and merged into ch/spendableout-types, which will soon be merged into ch/hedge-v2.