Python-Cardano / pycardano

A lightweight Cardano library in Python
https://pycardano.readthedocs.io
MIT License
215 stars 67 forks source link

PyCardano creates an imbalanced transaction in complex transactions #347

Open nielstron opened 6 months ago

nielstron commented 6 months ago

Describe the bug Running the fill_request script of STEAK protocol results in an imbalanced transaction. The transaction only fails upon submitting to the network.

To Reproduce

Logs

pycardano.exception.TransactionFailedException: Failed to submit transaction. Error code: 400. Error message: {"contents":{"contents":{"contents":{"era":"ShelleyBasedEraBabbage","error":[{"contents":{"contents":"AlonzoInBabbageUtxoPredFailure (ValueNotConservedUTxO (MaryValue (Coin 10264839234) (MultiAsset (fromList [(PolicyID {policyID = ScriptHash \"126a82c32b90b321eec79a79eaacd07abcc902d18cfcf62652708e6d\"},fromList [(\"0014df107374616b65636f696e\",64777740999000)]),(PolicyID {policyID = ScriptHash \"3d717587db9bd16648e1250145bab02e5c0a7e49b66c29d8c6c22c08\"},fromList [(\"0014df107374616b65636f696e\",15555540399000)]),(PolicyID {policyID = ScriptHash \"6bf11a7eb4f3671348b4618ca650211dccca49ffae613b429de8a24e\"},fromList [(\"3cdb6c30d6ed8ac9ba26795b36c9d2c224fbb44ea529babe5f8ea48ee2825722\",1)]),(PolicyID {policyID = ScriptHash \"ba76ca8c77699f673e41e42dda0f2e8004daf7ce365635f15a8dd782\"},fromList [(\"0014df107374616b65636f696e\",15555555400000)]),(PolicyID {policyID = ScriptHash \"d3b98b391903a105310d96e46163a478d277f69050d3be646acba8f1\"},fromList [(\"638b4508475c63cb22c5fd46231c4a37dc1392cc3247b3a37f08661a47c6c6e4\",42000000),(\"e7a7829dd58eaaecf0ba36d3340f28f851d08dad4e7e35ae6a6bcde684ffb06a\",1999992999000)]),(PolicyID {policyID = ScriptHash \"dfc450815c964e21bc9dd8e4ed1029c3407408c9fa95c48e1484f368\"},fromList [(\"3cdb6c30d6ed8ac9ba26795b36c9d2c224fbb44ea529babe5f8ea48ee2825722\",1)])]))) (MaryValue (Coin 10264865094) (MultiAsset (fromList [(PolicyID {policyID = ScriptHash \"126a82c32b90b321eec79a79eaacd07abcc902d18cfcf62652708e6d\"},fromList [(\"0014df107374616b65636f696e\",64777740999000)]),(PolicyID {policyID = ScriptHash \"3d717587db9bd16648e1250145bab02e5c0a7e49b66c29d8c6c22c08\"},fromList [(\"0014df107374616b65636f696e\",15555540399000)]),(PolicyID {policyID = ScriptHash \"6bf11a7eb4f3671348b4618ca650211dccca49ffae613b429de8a24e\"},fromList [(\"3cdb6c30d6ed8ac9ba26795b36c9d2c224fbb44ea529babe5f8ea48ee2825722\",1)]),(PolicyID {policyID = ScriptHash \"ba76ca8c77699f673e41e42dda0f2e8004daf7ce365635f15a8dd782\"},fromList [(\"0014df107374616b65636f696e\",15555555400000)]),(PolicyID {policyID = ScriptHash \"d3b98b391903a105310d96e46163a478d277f69050d3be646acba8f1\"},fromList [(\"638b4508475c63cb22c5fd46231c4a37dc1392cc3247b3a37f08661a47c6c6e4\",42000000),(\"e7a7829dd58eaaecf0ba36d3340f28f851d08dad4e7e35ae6a6bcde684ffb06a\",1999992999000)]),(PolicyID {policyID = ScriptHash \"dfc450815c964e21bc9dd8e4ed1029c3407408c9fa95c48e1484f368\"},fromList [(\"3cdb6c30d6ed8ac9ba26795b36c9d2c224fbb44ea529babe5f8ea48ee2825722\",1)])]))))","tag":"UtxoFailure"},"tag":"UtxowFailure"}],"kind":"ShelleyTxValidationError"},"tag":"TxValidationErrorInCardanoMode"},"tag":"TxCmdTxSubmitValidationError"},"tag":"TxSubmitFail"}

Expected behavior The transaction should be balanced

Environment and software version (please complete the following information):

Additional context Minimum breaking example to be isolated

cffls commented 5 months ago

Looks like I need to setup a wallet and submit some transactions onchain to be able to reproduce it. Alternatively, is it possible to use this newly added feature to capture the state of txbuilder for debugging?