MeshJS / mesh

An open-source library to advance Web3 development on Cardano
https://meshjs.dev
Apache License 2.0
200 stars 55 forks source link

`ExUnitsTooBigUTxO` when redeeming more than one UTxO #238

Closed dchambers closed 3 weeks ago

dchambers commented 2 months ago

I need to be able to redeem multiple UTxOs within a single transaction, and I'm attempting to use multiple invocations of redeemValue to do that. From this issue it sounds like the available budget would need to be shared across the set of redeemed UTxOs. The redeemValue function always sets the budget to DEFAULT_REDEEMER_BUDGET, however, with no obvious way to override this.

Here's the crux of the error message I get:

{
  "contents": {
    "contents": {
      "contents": {
        "era": "ShelleyBasedEraBabbage",
        "error": [
          {
            "contents": {
              "contents": "AlonzoInBabbageUtxoPredFailure (ExUnitsTooBigUTxO (WrapExUnits {unWrapExUnits = ExUnits' {exUnitsMem' = 14000000, exUnitsSteps' = 10000000000}}) (WrapExUnits {unWrapExUnits = ExUnits' {exUnitsMem' = 28000000, exUnitsSteps' = 12000000000}}))",
              "tag": "UtxoFailure"
            },
            "tag": "UtxowFailure"
          }
        ],
        "kind": "ShelleyTxValidationError"
      },
      "tag": "TxValidationErrorInCardanoMode"
    },
    "tag": "TxCmdTxSubmitValidationError"
  },
  "tag": "TxSubmitFail"
}

Am I maybe doing something wrong, or is there some alternate API for cases where multiple UTxOs need to be redeemed in a single transaction please?

HinsonSIDAN commented 3 weeks ago

You can now pass in a IEvaluator instance in Transaction to automatically update redeemer. That should fix this issue:

const tx = new Transaction({ initiator: wallet, evaluator: provider }) // provider is a provider instance which has implemented IEvaluator