Skip to content

[BUG] - Add error reporting of not enough value in makeTransactionBodyAutoBalance when there's not enough inputs #789

@carbolymer

Description

@carbolymer

Internal/External
Internal if an IOHK staff member.

Area
Other Any other topic (Delegation, Ranking, ...).

Summary
A clear and specific description of what the bug is.

Steps to reproduce
Steps to reproduce the behavior:

  1. Create a transaction with not enough inputs to cover the outputs
  2. use `makeTransactionBodyAutoboalance

Actual behaviour
The function throws an ErrorCall exception e.g.:

Illegal Value in TxOut: MaryValue (Coin (-163780)) (MultiAsset (fromList [(PolicyID {policyID = ScriptHash "71361c09ab5cdd2e6e61e5851234b36df7654d8613e7082591ee53ef"},fromList [("507279766974566164796d4b616b44656c61",1)])]))
CallStack (from HasCallStack):
  error, called at src/Cardano/Ledger/Babbage/TxOut.hs:401:25 in cardano-ledger-babbage-1.10.1.0-8b4b5cf77f41807309bd6c1be9db78c811baf86611ae1d3fa8029a2b5d16da8e:Cardano.Ledger.Babbage.TxOut
  mkTxOut, called at src/Cardano/Ledger/Babbage/TxOut.hs:372:44 in cardano-ledger-babbage-1.10.1.0-8b4b5cf77f41807309bd6c1be9db78c811baf86611ae1d3fa8029a2b5d16da8e:Cardano.Ledger.Babbage.TxOut
  BabbageTxOut, called at src/Cardano/Ledger/Conway/TxOut.hs:40:26 in cardano-ledger-conway-1.18.1.0-20d3810599f5ee8977f025aee975291e6b3c63a5484753de135c855dbd479b5b:Cardano.Ledger.Conway.TxOut
  mkBasicTxOut, called at src/Cardano/Api/Internal/Tx/Body.hs:3593:13 in cardano-api-10.10.0.0-2a0190cb7281d162fa1331508f3d9b8fc1ba9061e917e7d1ca17254005c03270:Cardano.Api.Internal.Tx.Body
  toShelleyTxOutAny, called at src/Cardano/Api/Internal/Tx/Body.hs:2855:41 in cardano-api-10.10.0.0-2a0190cb7281d162fa1331508f3d9b8fc1ba9061e917e7d1ca17254005c03270:Cardano.Api.Internal.Tx.Body
  convTxOuts, called at src/Cardano/Api/Internal/Tx/Body.hs:3042:31 in cardano-api-10.10.0.0-2a0190cb7281d162fa1331508f3d9b8fc1ba9061e917e7d1ca17254005c03270:Cardano.Api.Internal.Tx.Body
  mkCommonTxBody, called at src/Cardano/Api/Internal/Tx/Body.hs:2180:11 in cardano-api-10.10.0.0-2a0190cb7281d162fa1331508f3d9b8fc1ba9061e917e7d1ca17254005c03270:Cardano.Api.Internal.Tx.Body
  createTransactionBody, called at src/Cardano/Api/Internal/Fees.hs:1379:13 in cardano-api-10.10.0.0-2a0190cb7281d162fa1331508f3d9b8fc1ba9061e917e7d1ca17254005c03270:Cardano.Api.Internal.Fees
  makeTransactionBodyAutoBalance, called at src/Cardano/Api/Internal/Convenience/Construction.hs:77:7 in cardano-api-10.10.0.0-2a0190cb7281d162fa1331508f3d9b8fc1ba9061e917e7d1ca17254005c03270:Cardano.Api.Internal.Convenience.Construction

Expected behaviour
The function should return an error (Left) with an explanation what happened instead of an exception.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions