cardano-client-lib icon indicating copy to clipboard operation
cardano-client-lib copied to clipboard

Some UTXO payload's fail to deserialise

Open tdedgx opened this issue 3 years ago • 3 comments

Hi, In both 0.2.0 & 0.3.0-beta2, for certain utxo payloads seeing this:

java.lang.ClassCastException: class co.nstant.in.cbor.model.Array cannot be cast to class co.nstant.in.cbor.model.ByteString (co.nstant.in.cbor.model.Array and co.nstant.in.cbor.model.ByteString are in unnamed module of loader 'app')
  	at com.bloxbean.cardano.client.transaction.spec.TransactionOutput.deserializeAlonzo(TransactionOutput.java:272)
  	at com.bloxbean.cardano.client.transaction.spec.TransactionOutput.deserialize(TransactionOutput.java:196)

Details:

  • Error occurs when doing this: TransactionOutput txOutput = TransactionOutput.deserialize(CborSerializationUtil.deserialize( <hex encoded bytes[] payload> ));
  • encoded payloads in examples attached were retrieved using Carp
  • FYI, utxos in the examples were all inputs of the linked tx (shouldn't make a difference I don't think)

Example failing utxo's in the attached file java-client-lib-example-tx-2.txt

tdedgx avatar Sep 13 '22 06:09 tdedgx

Thanks. I will check.

jfyi, if you just want to deserialize already executed txn, you may also want to check serializers in yaci-core project. But it doesn't support serialization.

https://github.com/bloxbean/yaci-core/blob/1d588014d78e1a809a821e71a0ece6cd50ce8797/src/main/java/com/bloxbean/cardano/yaci/core/model/serializers/TransactionOutputSerializer.java#L26

satran004 avatar Sep 13 '22 06:09 satran004

@stake1edge It seems the utxos for all three transactions are from Byron era. But in case of tx-2 & tx-3, those utxos are used in Shelley era transaction.

Cardano Client doesn't support Byron era transaction format. Only Shelley and post shelley eras are supported.

I tried the same with cardano-serialization-lib rust impl, same error.

For your reference, format of shelley era txouput

[h'016A55A69E79495C10485A18D3E163BA3D914960E1F5A9B53A481CAFC36CAB9059A9BC1D93645F50D0B8D6DD8464171B68FF5E70C6044D7872', 23768601738]

Byron Era txoutput

[[24(h'83581CC21DB1F9531843CB7B88D28FA957AE8F6FF0F077E10AC751B99E2B30A101581E581C26152059D617412C1097B53F65B751CEF33B2D9BBA289807ABAFE64100'), 1647883302], 23768908743]

You may need to manually parse the Byron era utxo in your app.

Fyi, yaci-core library will support Byron era parsing in future release. (Currently it only supports Shelley and later).

satran004 avatar Sep 14 '22 04:09 satran004

ah ok I see. Good to know, tks for the info

tdedgx avatar Sep 14 '22 05:09 tdedgx

@stake1edge, closing this issue as the lib only supports Shelley and post shelley era transactions.

satran004 avatar Nov 02 '22 12:11 satran004