Closed ilap closed 2 months ago
Good catch, thanks for the thorough report @ilap; will fix ASAP.
Hey @KtorZ,
Sorry, but it was my mistake. As I have just started to debug it and the error message the unexpected type map at position 78: expected array
is the last (Alonzo's) of the three decodes when it cannot decode the tx for any era.
The issue that the in my tx the validity is set to -1
which should be an unsigned integer and the error cascades down to the alonzo decoding which expect an array.
So all good and sorry for any inconvenience caused by this.
let multi_era_tx = MultiEraTx::decode_for_era(Era::Conway, tx_bytes)
.or_else(|_| MultiEraTx::decode_for_era(Era::Babbage, tx_bytes))
.or_else(|_| MultiEraTx::decode_for_era(Era::Alonzo, tx_bytes))?;
What Git revision are you using?
I'm using the latest commit as of the time of this issue: be31a7ce38a16bc3f3dad14b43535c58d4ef3f98
What operating system are you using, and which version?
Describe what the problem is?
The current implementation of the
uplc
crate in the Aiken project seems to me use the PreBabbage era transaction decoding method for the outputs, which expects an array for aTransactionOutput
.However, in the Post-Alonzo (Conway) era, a transaction output is either a map (preferred) or an array. This discrepancy is causing a decoding error when attempting to decode transaction outputs from the Post-Alonzo era using (an array/list of) map.
When trying to decode a Conway era CBOR transaction, the following error occurs:
The example of a Conway era CBOR encoded transaction that triggers this error:
It appears that the code segment responsible for decoding UTXOs is still expecting an array format. Specifically, this part of tx.rs: https://github.com/aiken-lang/aiken/blob/5879dcfd4c3e467559adc9a7d36e8942a2d8e5f7/crates/uplc/src/tx.rs#L115
What should be the expected behavior?
The TransactionOutput::decode_fragment method should be updated to handle both array and map structures, depending on the era of the transaction being decoded. This will ensure that transactions from both the PreBabbage and Post-Alonzo eras can be decoded correctly.