Description
Internal/External
External
Area
Plutus Related to Plutus Scripts (Alonzo).
Summary
makeTransactionBody
duplicates scripts. This is obviously undesirable due to size and execution unit limits. I have written a version which does not duplicate scripts, but this is not ideal - it has to do a lot of unsafe and gnarly things with Generics to get around the fact that the true constructors for TxBody are not exported (which they should be, please!). Because the constructors aren't exposed, I can't just deduplicate after the fact.
Steps to reproduce
Steps to reproduce the behavior:
I don't have a minimal repro right now. What I would suggest is to create a TxBodyContent with some scripts of a chosen size (say 2000 bytes), spending multiple different inputs from the same script. Call makeTransactionBody
, then serialiseToCBOR
, then inspect in the CBOR Playground. You should see multiple appearances of the script with the size you chose.
Expected behavior
makeTransactionBody
should not duplicate scripts.
System info (please complete the following information):
- OS Name: NixOS
- OS Version: 21.11
- Node version: cardano-node 1.33.0 - linux-x86_64 - ghc-8.10\ngit rev d7427a8
- CLI version: cardano-cli 1.33.0 - linux-x86_64 - ghc-8.10\ngit rev d7427a8
Screenshots and attachments
Here is the cbor of a transaction with duplicates: https://gist.github.com/chessai/12f9795ab322cc633b1b403995473c55
Note that the scripts are 0'd out. You can load this into the CBOR Playground and you should see that there are two instances of a script with size 2121.
Additional context
I would suggest exporting the constructors of TxBody
from an unsafe module, and keeping the (complete) pattern synonym as the default export.