cardano-multiplatform-lib
cardano-multiplatform-lib copied to clipboard
Fix compatibility with Pallas TxOut
The Pallas code for generating a TxOut can be found here: https://github.com/txpipe/pallas/blob/187245a62f071d92de26d55f01df881fa993a97b/pallas-primitives/src/byron/model.rs#L210
This is an example of a TxOut cbor generated by Pallas
8282d818584283581ccde9e14edd1bef88f693d98ac1a8362e322cde8dbfa0585e8cfad0baa101581e581c40ac845ff7ff8674f52c136eba28aafa85563db9755292bf3cae9c12001a5e68a4c51b00000098360f4780
However, parsing this with CML using
TransactionOutput::from_bytes(
hex::decode(hash).unwrap()
).unwrap();
gives DeserializeError { location: Some("TransactionOutput.address")
If you look at cbor.me
This is what Pallas gives

This is what CML gives

I think that actually our output is wrong because we should be using the raw_with_crc32 for Byron addresses 🤔
I don't know why this parsing error only happens as part of parsing a TransactionOutput while parsing the address itself works fine
Looks like the conclusion of this is that the Shelley TxOut type isn't compatible with the Byron TxOut type so this is expected since CML doesn't support most Byron-era structs until we one day run the codegen on byron.cddl
This should be fixed by #244 as we have full byron support now.