Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CborObject.GetTransaction: requiredSigners are not deserialized correctly #111

Open
maxee opened this issue Nov 9, 2022 · 0 comments
Open

Comments

@maxee
Copy link

maxee commented Nov 9, 2022

When creating a transaction via the Cardano Serialization Lib which contains one or more additional required signers, these are not correctly parsed when deserializing the CBOR via CardanoSharp.Wallet.

However, when the same transaction is build via the Cardano Serialization Lib without the additional required signers, everything works as expected.

Example (not working as expected, with required signers)

Having the following CBOR constructed by the CSL containing required signers set via CSL's method add_required_signer:

84a700818258207043c6744f9c699e2e5f43df08ffc3dbb259a89383a4023d133cc3b8bc5b5bae0101838258390005acdfa65952ac8a7b0cf168d4912535b117f5998967ee742644dcc405bc59d947656b4167d84497085d372b58f74b2057c8c542a11c22be1a001e848082583900c010c94c93bbe65283293a9946719b9277b325a0ab07e787b78572bac151e09314abc3031eae0f450ac4f3bbac851b9947ab4651433d47a81a003d0900825839001bcb60012703fcb4d6c97f1a177163e1797133b859a2b4feed0635657bcba45a50d5547e72cbad7a330c051a14b410a08dca551ed40e998d821a0048d9a3a1581c373b7956817434b15b87717075359307b1f1f6911ee03c4cb2004eb3a1581c6f636361656361746943686965664d6f62696c6974794f726368657301021a0003719d031a00bc177f0758206d600030ef909d098d217e07f0f34efee88a9b67740ad747a2833ec06cb091ae09a1581c373b7956817434b15b87717075359307b1f1f6911ee03c4cb2004eb3a1581c6f636361656361746943686965664d6f62696c6974794f7263686573010e82581c25ab8e56be62c4bf8a22db139f2c6a90793d21c17b99b9aaebf5f5f2581c20763045c339d6f996e02a0a81ca5f41aa3898e964fd3206caf12f75a101818201818200581c20763045c339d6f996e02a0a81ca5f41aa3898e964fd3206caf12f75f5f6

When this CBOR is deserialized by this library into an instance of Transaction and then serialized back to CBOR, the resulting CBOR is not identical to the one created by the CSL:

Code to deserialize/serialize:

var cborToSign = "84a7008182...2f75f5f6";
var cbor = CBORObject.DecodeFromBytes(Convert.FromHexString(cborToSign), new CBOREncodeOptions("keepkeyorder=true"));

var transaction = cbor.GetTransaction();

var cborOut = Convert.ToHexString(transaction.GetCBOR().EncodeToBytes()).ToLowerInvariant();

The CBOR constructed by this library after deserialization/serialization is different than the original CSL cbor most likely lacking the required signers being deserialized.

84a600818258207043c6744f9c699e2e5f43df08ffc3dbb259a89383a4023d133cc3b8bc5b5bae0101838258390005acdfa65952ac8a7b0cf168d4912535b117f5998967ee742644dcc405bc59d947656b4167d84497085d372b58f74b2057c8c542a11c22be1a001e848082583900c010c94c93bbe65283293a9946719b9277b325a0ab07e787b78572bac151e09314abc3031eae0f450ac4f3bbac851b9947ab4651433d47a81a003d0900825839001bcb60012703fcb4d6c97f1a177163e1797133b859a2b4feed0635657bcba45a50d5547e72cbad7a330c051a14b410a08dca551ed40e998d821a0048d9a3a1581c373b7956817434b15b87717075359307b1f1f6911ee03c4cb2004eb3a1581c6f636361656361746943686965664d6f62696c6974794f726368657301021a0003719d031a00bc177f0758206d600030ef909d098d217e07f0f34efee88a9b67740ad747a2833ec06cb091ae09a1581c373b7956817434b15b87717075359307b1f1f6911ee03c4cb2004eb3a1581c6f636361656361746943686965664d6f62696c6974794f726368657301a101818201818200581c20763045c339d6f996e02a0a81ca5f41aa3898e964fd3206caf12f75f5f6

Example (working as expected, no required signers)

When the CBOR constructed by the CSL does not contain additional required signers, everything works as expected.

Original CSL CBOR:

84a600818258207043c6744f9c699e2e5f43df08ffc3dbb259a89383a4023d133cc3b8bc5b5bae0101838258390005acdfa65952ac8a7b0cf168d4912535b117f5998967ee742644dcc405bc59d947656b4167d84497085d372b58f74b2057c8c542a11c22be1a001e848082583900c010c94c93bbe65283293a9946719b9277b325a0ab07e787b78572bac151e09314abc3031eae0f450ac4f3bbac851b9947ab4651433d47a81a003d0900825839001bcb60012703fcb4d6c97f1a177163e1797133b859a2b4feed0635657bcba45a50d5547e72cbad7a330c051a14b410a08dca551ed40e998d821a0048ea23a1581c373b7956817434b15b87717075359307b1f1f6911ee03c4cb2004eb3a1581c6f6d6e697350726f647563745365637572697479526570726573656e01021a0003611d031a00bc1a200758200a175108e98a082f86696662c3cbf4ea588edf60a09831ccc0be04279de4886d09a1581c373b7956817434b15b87717075359307b1f1f6911ee03c4cb2004eb3a1581c6f6d6e697350726f647563745365637572697479526570726573656e01a101818201818200581c20763045c339d6f996e02a0a81ca5f41aa3898e964fd3206caf12f75f5f6

Deserialized => Serialized CBOR via this library (identical to the original one):

84a600818258207043c6744f9c699e2e5f43df08ffc3dbb259a89383a4023d133cc3b8bc5b5bae0101838258390005acdfa65952ac8a7b0cf168d4912535b117f5998967ee742644dcc405bc59d947656b4167d84497085d372b58f74b2057c8c542a11c22be1a001e848082583900c010c94c93bbe65283293a9946719b9277b325a0ab07e787b78572bac151e09314abc3031eae0f450ac4f3bbac851b9947ab4651433d47a81a003d0900825839001bcb60012703fcb4d6c97f1a177163e1797133b859a2b4feed0635657bcba45a50d5547e72cbad7a330c051a14b410a08dca551ed40e998d821a0048ea23a1581c373b7956817434b15b87717075359307b1f1f6911ee03c4cb2004eb3a1581c6f6d6e697350726f647563745365637572697479526570726573656e01021a0003611d031a00bc1a200758200a175108e98a082f86696662c3cbf4ea588edf60a09831ccc0be04279de4886d09a1581c373b7956817434b15b87717075359307b1f1f6911ee03c4cb2004eb3a1581c6f6d6e697350726f647563745365637572697479526570726573656e01a101818201818200581c20763045c339d6f996e02a0a81ca5f41aa3898e964fd3206caf12f75f5f6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant