IntersectMBO / IntersectMBO/plutus

TxOut datum datatype constructor order change

Open
#4,816 7 comments 0 reactions 0 assignees View on GitHub
Low priority security status: triaged
Dominant language
Haskell
Stars
1.6k
Forks
508
Avg merge
3d 10h
Merged PRs (30d)
22

Description

### Summary

Moving from V1 where [txOutDatumHash](https://github.com/input-output-hk/plutus/blob/master/plutus-ledger-api/src/PlutusLedgerApi/V1/Tx.hs#L167) is a `Maybe DatumHash`
which according to the [IsData instance](https://github.com/input-output-hk/plutus/blob/master/plutus-tx/src/PlutusTx/IsData/Instances.hs#L17) this effectively becomes `OutputDatumHash DatumHash | NoOutputDatum` on-chain

In V2, this is changed to [OutputDatum instead](https://github.com/input-output-hk/plutus/blob/master/plutus-ledger-api/src/PlutusLedgerApi/V2/Tx.hs#L142) that serializes like `NoOutputDatum | OutputDatumHash DatumHash | OutputDatum Datum`

The crux of the problem being that the order of the two fields was changed around. Is this an intended change, and if so are the possible bugs born out of this cascading through the ecosystem worth it?

### Steps to reproduce the behavior

Follow the links, changes are self-evident

### Actual Result

-

### Expected Result

The V1 encoding should have been extended by adding a new constructor and preserving their order from V1

### Describe the approach you would take to fix this

Switch the order of `NoOutputDatum` and `OutputDatumHash` constructors around in the V2 implementation

### System info

Any

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.