Open mkoura opened 2 weeks ago
@CarlosLopezDeLara and I tried the oldest release version of cardano-cli
we easily have access to, it's 8.21 from April 2024, and indeed the error message was better:
Command failed: transaction build-raw Error: Transaction validaton error: Negative quantity (-1) in transaction output: TxOutInAnyEra ConwayEra (TxOut (AddressInEra (ShelleyAddressInEra ShelleyBasedEraConway) (ShelleyAddress Testnet (KeyHashObj (KeyHash "12602a07263315f2f20179fe2baee5b4a8dc4c5a56511d37d033f12e")) StakeRefNull)) (TxOutValueShelleyBased ShelleyBasedEraConway (MaryValue (Coin (-1)) (MultiAsset (fromList [])))) TxOutDatumNone ReferenceScriptNone)
At this time, we were using cardano-api
8.42.0.0.
Alright, here's how it was working in 8.21:
build-raw
was calling API's createAndValidateTransactionBody
createAndValidateTransactionBody
was calling makeShelleyTransactionBody
, that calls validateTxBodyContent
validateTxBodyContent
is doing the positive verification by calling validateTxOuts
.Now, the situation is as follows:
build-raw
calls API's createTransactionBody
.createTransactionBody
doesn't do validation of transaction outputs.And actually @palas caught the issue: https://github.com/IntersectMBO/cardano-cli/pull/853#discussion_r1746086547 :upside_down_face:
So this shows that this issue started appearing in cardano-cli
9.4.0.0
Description
When building a tx with negative value in txout, we used to have a user friendly error message like "Negative quantity..." returned by
cardano-cli
. Now (in cli budled with node 9.2.0) we get a ledger exception likeSteps to Reproduce