Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem when several fueled UTxOs #570

Closed
pgrange opened this issue Oct 19, 2022 · 2 comments
Closed

Problem when several fueled UTxOs #570

pgrange opened this issue Oct 19, 2022 · 2 comments
Labels
bug 🐛 Something isn't working

Comments

@pgrange
Copy link
Contributor

pgrange commented Oct 19, 2022

In an experiment, my node was unable to initiate a head with a not enough funds error.
However I did have a fueled UTxO with enough found.
Maybe the problem came from the fact that I had a second fueled UTxO without enough funds.

I'm wondering if that might come from the selection of the fueled UTxO choosing the too small one.

Context & versions

Using the latest version from October 19th.

Having the following UTxO available in my wallet:

                           TxHash                                 TxIx        Amount
--------------------------------------------------------------------------------------
043b9fcb61006b42967714135607b632a9f0d50efbf710822365d214b237a504     0        89832651 lovelace + TxOutDatumNone
043b9fcb61006b42967714135607b632a9f0d50efbf710822365d214b237a504     1        10000000 lovelace + TxOutDatumHash ScriptDataInBabbageEra "a654fb60d21c1fed48db2c320aa6df9737ec0204c0ba53b9b94a09fb40e757f3"
13400285bb2db7179ac470f525fe341b0b2f91f579da265a350fa1db6829bf7f     0        10000000 lovelace + TxOutDatumNone
e9c45dd07cdafd96a399b52c9c73f5d9886bbd283b09b7eae054092e5b926b58     1        3654400 lovelace + TxOutDatumHash ScriptDataInBabbageEra "a654fb60d21c1fed48db2c320aa6df9737ec0204c0ba53b9b94a09fb40e757f3"

Steps to reproduce

  1. Setup a small fueled UTxO (around 3654400 Lovelace)
  2. Setup a big enough fueled UTxO (around 10000000 lovelace)
  3. run hydra tui and press I to try open a head

Actual behavior

The initialization fails. You should observe an error regarding not enough funds.

Expected behavior

The initialization succeeds

@pgrange pgrange added the bug 🐛 Something isn't working label Oct 19, 2022
@ghost
Copy link

ghost commented May 10, 2023

Should we do something about this? It seems that when we retrieve the fuel UTxO we sort by value and take the smallest one:

findFuelUTxO :: Map TxIn TxOut -> Maybe (TxIn, TxOut)
findFuelUTxO utxo =
  let utxosWithDatum = Map.toList $ Map.filter hasMarkerDatum utxo
      sortingCriteria (_, Babbage.BabbageTxOut _ v _ _) = fst' (gettriples' v)
      sortedByValue = sortOn sortingCriteria utxosWithDatum
   in case sortedByValue of
        [] -> Nothing
        as -> Just (List.last as)

A "simple" fix would be to put a lower-bound on the selection, an reasonable approximation of fees?

@ch1bo
Copy link
Collaborator

ch1bo commented Jun 21, 2023

This be addressed by #924

@ch1bo ch1bo closed this as completed Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants