plutus icon indicating copy to clipboard operation
plutus copied to clipboard

Simple and efficient way of accessing the datum and redeemer

Open effectfully opened this issue 1 year ago • 0 comments

In #6247 @Unisay showed us how to access the datum and redeemer efficiently, but not simply. We could consider adding a dedicated data type for doing this lazy decoding (data JustGiveMeDatumAndRedeemer = <...>), so that unsafeFromBuiltinData does the right thing for it, however we actually probably don't need to, because once @ana-pantilie's work on backing ScriptContext by Data is done we'll probably be able to use the fields of ScriptContext directly (implemented as pattern synonyms, I assume)? Accessing both the datum and redeemer via fields is going to be less efficient than using a dedicated type though, because we'd have to skip the tx info twice for each of them for example, so maybe having a dedicated type is worth it in the end.

This issue is for figuring what interface we should provide for accessing the datum and redeemer, as well as implementing that interface.

effectfully avatar Jun 28 '24 05:06 effectfully