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

Insufficient Funds Warning After Collateral Query #73

Open
Cerkoryn opened this issue Jan 5, 2024 · 2 comments
Open

Insufficient Funds Warning After Collateral Query #73

Cerkoryn opened this issue Jan 5, 2024 · 2 comments

Comments

@Cerkoryn
Copy link

Cerkoryn commented Jan 5, 2024

Describe the bug
SOR seems to be unable to query the correct amount of ADA at the given collateral UTxO and gives an Insufficient Funds warning and a seemingly static number of 2000000 lovelace even though the UTxOs I tried had either 5000000 or 9000000 lovelace. I'm not sure why this issue seems to occur for some people but not others.

To Reproduce

  1. Create a wallet using cardano-cli, the Genius Yield signing key generator , or Eternl.
  2. Fund the wallet with at least 5 ADA on one UTxO.
  3. Set the PAYMENT_SIGNING_KEY_CBOR_HEX, COLLATERAL_UTXO_REF, MAESTRO_API_KEY, and CARDANO_NETWORK accordingly.
  4. Run the SOR using the Docker setup per instructions.
  5. SOR logs show Insufficient Funds warning and a seemingly incorrect lovelace value.
  6. Left SOR running for over a week but no matches/trades were made and the error still persists.

Expected behavior
SOR should detect the correct collateral UTxO with the correct amount of ADA and use it to make SOR matches.

Screenshots
image
image

Station (please complete the following information):

  • OS: Debian inside Docker. Docker is running via TrueNAS Scale (Debian-based Linux distro)
  • Version: smart-order-router:latest, TrueNAS-SCALE-23.10.0.1

Additional context
I tried to troubleshoot this a number of different ways but I can't diagnose what the actual problem is, mostly due to my limited Haskell ability. I can see that the error message is getting triggered here but I'm unsure how to trace it back to a root cause.

@sourabhxyz
Copy link
Member

Thanks for being elaborate in your issue @Cerkoryn !

From the screenshot shared, it is clear that your SOR has found a match, namely the one with commodity 25f0.... But note that, this match need not be optimal! I.e., there is some improvements we need to do in our matching algorithm (as I guess it doesn't yet handle for fees that need to be given to GY DEX) so that the match it gives does not lead to loss of ada.

UTxO which you explicitly specify as collateral is reserved, i.e., we do not spend it in our tx build process, thus ada in it is not available as wallet's balance. If you want to get rid of this warning, then as of now, you can put up another UTxO in your wallet with sufficient size, like 10 ada. Also, you may want to check out this PR's branch until it is merged, #66, so as to not lose ada under transaction fees.

@Cerkoryn
Copy link
Author

Cerkoryn commented Jan 8, 2024

Thank you @sourabhxyz. However as you can see from the second screenshot, I have several UTxOs in that wallet at the same address with balances ranging from 5 ADA to 28 ADA, but I still get the warning and the bot has not yet made a trade.

I'll keep an eye on the PR but I'm not particularly worried about losing a small amount of ADA due to Tx fees right now as I'm more focused on making sure my SOR instance is functioning properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants