Wrong Tx ID obtained via from_cbor
mpizenberg opened this issue · 11 comments
I’m loading a Transaction from its cbor shape and displaying the Tx ID, but there is an inconsistency with the actual Tx ID.
For example, when decoding the following Tx https://preview.cardanoscan.io/transaction/f0e910cc0b48c54d562d99cc5ec5a54e25a449664457e2d157a8425b0565d723
which has the following cbor hex
84aa00d9010281825820ac3c0a10ebe5c049dedba8b14c991bff1ebceb941a568c9ff94808a399d9f726010181825839001d737b7461f723d962b5c47092d3ad6d15d6cd2956fe29ad42a6cf6670b46e985fa50328fcb3d80594b6c5c54974a08d2c766a47570bfa36821a002be4e9a1581cc627af9fd4828832860a74af935a3903a1f60892fa55ca0d41993dfea14001021a00030efa031a04bd9890081a04bd6d9809a1581cc627af9fd4828832860a74af935a3903a1f60892fa55ca0d41993dfea140010b58203276ea13ff47fb5352d47c21329d17583751344bcac1e3752cfe3ee66be64e980dd9010282825820ac3c0a10ebe5c049dedba8b14c991bff1ebceb941a568c9ff94808a399d9f72601825820ddd5ac9dd39f7558ea3234ef285a35f5e3955ae28694a03e96943fb1dee0aca10010825839001d737b7461f723d962b5c47092d3ad6d15d6cd2956fe29ad42a6cf6670b46e985fa50328fcb3d80594b6c5c54974a08d2c766a47570bfa36821a0016867ba1581c2fe3c3364b443194b10954771c95819b8d6ed464033c21f03f8facb5a144695553441860111a00370c3fa300d9010281825820699fcb42601d00a1735f7fd03c7e68adace25339a8444bcb384756b71fdd4a7e584028e44bd0777bfc9c459f3b0d70addda68d4e62d2578714c763e9d2bd42fcf11e94c115401666f0de28a9e015eac26f9df0095216c8f14795b88b23d8db57f70207d90102815901895901860101003229800aba2aba1aba0aab9faab9eaab9dab9a488888896600264653001300800198041804800cc0200092225980099b8748000c01cdd500144c8c966002601c0031325980099b880014800229462b30013370e002900144c8cc004004dd6180798061baa0052259800800c528456600266ebcc040c034dd51808000809c528c4cc008008c04400500b201c8a5040248048dd69806800c5900b1919800800992cc004cdc3a400460146ea8006297adef6c6089bab300e300b37540028048c8cc004004dd59807180798079807980798059baa0042259800800c5300103d87a8000899192cc004cdc8803000c56600266e3c018006266e95200033010300e0024bd7045300103d87a80004031133004004301200340306eb8c030004c03c00500d112cc004006297ae089980698059807000998010011807800a018375c601660106ea800a2c8030601000260066ea802229344d9590011300127d8799f5820ac3c0a10ebe5c049dedba8b14c991bff1ebceb941a568c9ff94808a399d9f72601ff000105a1820100828082199e051a00d67925f5f6
Then pycardano tx = Transaction.from_cbor(...) followed by tx.id gives me aa4cb8b1bac1029aad36d858a7a87d2cafde7b45ae24b722ded5da1d5950540c instead of f0e910cc0b48c54d562d99cc5ec5a54e25a449664457e2d157a8425b0565d723
I’m using pycardano 0.13.2 on Macos.
Could you try if installing pure python version of cbor2 helps? https://github.com/Python-Cardano/pycardano?tab=readme-ov-file#install-cbor2-pure-python-implementation-optional
I’ll try. But I’ve just overblown my time budget trying pycardano and blaze, and will most likely not be able to come back to this for 2 or 3 weeks.
Ok something is weird. I might have mixed up my Txs sorry. Though I tried again right now on another Tx I just submitted, and I’m sure it’s wrong now.
This Tx on preview: https://preview.cardanoscan.io/transaction/e5de3d17d3569d9423c34683908e7d242d838933112272f6f4527058714d0f10
Has the following cbor:
84aa00d9010281825820fd593f871c22bbd3e22a556f1c07f639a0c2d57dc0fb5af55c326f0b660682d4010181825839001d737b7461f723d962b5c47092d3ad6d15d6cd2956fe29ad42a6cf6670b46e985fa50328fcb3d80594b6c5c54974a08d2c766a47570bfa36821a00152466a1581ca406fd39d1006b0f6472c6adda5dffc0a19735c27a59d6d3b1653fd6a14001021a00030efa031a04bdff23081a04bdd42b09a1581ca406fd39d1006b0f6472c6adda5dffc0a19735c27a59d6d3b1653fd6a140010b58203276ea13ff47fb5352d47c21329d17583751344bcac1e3752cfe3ee66be64e980dd9010282825820ddd5ac9dd39f7558ea3234ef285a35f5e3955ae28694a03e96943fb1dee0aca1008258202e0cb866bb80ba078501acb083502c0d01c0509250df681a7593352230a8795a0110825839001d737b7461f723d962b5c47092d3ad6d15d6cd2956fe29ad42a6cf6670b46e985fa50328fcb3d80594b6c5c54974a08d2c766a47570bfa36821a00ef8a98a1581c2fe3c3364b443194b10954771c95819b8d6ed464033c21f03f8facb5a144695553441860111a00370c3fa300d9010281825820699fcb42601d00a1735f7fd03c7e68adace25339a8444bcb384756b71fdd4a7e5840e1b55b3e1f078e17a2f9b1455c29a0996af7536fdef03479fe6143aa42a51c4d1039609ffa6594de8ce14a4dfd4e56111c826d4d07860f06f210a63b16989f0107d90102815901895901860101003229800aba2aba1aba0aab9faab9eaab9dab9a488888896600264653001300800198041804800cc0200092225980099b8748000c01cdd500144c8c966002601c0031325980099b880014800229462b30013370e002900144c8cc004004dd6180798061baa0052259800800c528456600266ebcc040c034dd51808000809c528c4cc008008c04400500b201c8a5040248048dd69806800c5900b1919800800992cc004cdc3a400460146ea8006297adef6c6089bab300e300b37540028048c8cc004004dd59807180798079807980798059baa0042259800800c5300103d87a8000899192cc004cdc8803000c56600266e3c018006266e95200033010300e0024bd7045300103d87a80004031133004004301200340306eb8c030004c03c00500d112cc004006297ae089980698059807000998010011807800a018375c601660106ea800a2c8030601000260066ea802229344d9590011300127d8799f5820fd593f871c22bbd3e22a556f1c07f639a0c2d57dc0fb5af55c326f0b660682d401ff000105a1820100828082199e051a00d67925f5f6
And I’m getting the wrong Tx ID with from_cbor: ba390dfceb03be3875ea4a08a2f60dc98d243280194ef44141583cdd461d70df

As mentioned before, you can fix this by simply installing the pure python version of cbor2 in your environment with this script: https://github.com/Python-Cardano/pycardano/blob/main/ensure_pure_cbor2.sh

Oh sorry I was confused by the previous message, I thought you said it worked on the default one. Because I just retried with my default install and it worked (thus my puzzle message with another error, this time for real). Would you mind checking with the real error?
The default one (c implementation) will fail randomly. I tried both examples provided above and they all worked with python implementation.
Is there an easy way to specify the --no-binary install in a pyproject.toml? I’m using uv on my setup so that’s the easiest way for me to try.
I did search for solutions of specifying non binary in pyproject.toml, but couldn't find much unfortunately...
I’ve updated my lock file by re-installing cbor2 with this after uv sync:
CBOR2_BUILD_C_EXTENSION=0 uv pip install --no-binary cbor2 --force-reinstall cbor2For others reading this and also using uv. Don’t forget the env var set to 0. Because once it’s built (and cached by uv) there is no going back, except by clearing the cache.
I can confirm that the Tx IDs are also correct for me with the pure-python version. So I’ll let you decide if you want to keep this issue open as a reminder until the c version is fixed or close this issue.
Nice, thanks for confirming! I will close this issue for now. Will create an enhancement issue for supporting c version.
