gateway icon indicating copy to clipboard operation
gateway copied to clipboard

Uniswap Liquidity Error "unkown error: Couldnot get position with id **"

Open emusol opened this issue 2 years ago • 15 comments

While Running a script that monitor liquidity positions, the script is running successfully, and at random times it produce an error as seen on this screenshot, it can take 18 hours till the bug appears, or several minutes, I tried to use different nodes to see if this could be something unrelated to hummingbot, but it keeps on appearing: image

Steps To Reproduce activate a liquidity strategy and let it run for a while, Im testing on Arbitrum one

emusol avatar Nov 01 '23 09:11 emusol

hi @emusol Could you please attach the log file and the script that you're running

nikspz avatar Nov 01 '23 12:11 nikspz

hi @nikspz , I encountered the same problem。I used the 'startup.sh' to run gateway. image

qinyang369 avatar Nov 09 '23 06:11 qinyang369

hi @nikspz , I encountered the same problem。I used the 'startup.sh' to run gateway. image

Hey I tried to debug it with my node provider, and got this: "These 7 invalid requests all triggered the 502 errors. This is caused by the long response time (around 30 seconds) of the eth_call method sent from your side. Right now there are no other 502 errors with your node." and hummingbot dont handle it right now, but a few weeks or a month back it worked without problem, my script just retried to fetch the position, still trying to work on a script I can share here, but hard error to reproduce, need to run a script for a few hours till it appears

emusol avatar Nov 09 '23 11:11 emusol

hey did anyone was able to solve this one?

emusol avatar Dec 06 '23 06:12 emusol

hi @emusol for the HBF team currently uniswapLP strategy is not a priority, maybe someone from the community was able to solve it

nikspz avatar Dec 06 '23 09:12 nikspz

hi @nikspz would love to fund this as a bounty, do you know how I can do it?

emusol avatar Dec 06 '23 10:12 emusol

@emusol Yes, you could fund the bounty, you could try to post it here https://discord.com/channels/530578568154054663/1103258262385741844 for devs to estimate bounty amount

Also you could check this: https://hummingbot.org/bounties/sponsors/

nikspz avatar Dec 11 '23 09:12 nikspz

@emusol Probably we need to debug here: https://github.com/hummingbot/gateway/blob/4afa163bb0a8d18a838209cdca10878cb0a25bf7/src/connectors/uniswap/uniswap.lp.ts#L57-L60

You got the error because the connector saw there are reject from the request promises that it made from the above code, the check is here: https://github.com/hummingbot/gateway/blob/4afa163bb0a8d18a838209cdca10878cb0a25bf7/src/connectors/uniswap/uniswap.lp.ts#L65-L66

So the connector found reject and thrown error, but the problem is that we are not sure which request failed, contract.positions(tokenId) or this.collectFees(this.ethereum.provider, tokenId)

For debugging and fixing this, I think I can help you for 50k of HBOT :)

mlguys avatar Dec 11 '23 16:12 mlguys

Add new scope for this issue:

when adding a position HB dont recognize it(its a new issue, before it recognized it and just failed to get the position at one point and crashed, now its like that from the start) image

mlguys avatar Dec 14 '23 08:12 mlguys

This bounty has been funded and work has been performed but the current status is unclear. Let me propose a clarification of the acceptance criteria to ensure that we can close it out.

Per @emusol, the issue appears to be when running scripts on the uniswaplp connector, errors fetching the position occur that prevent the connector from being used reliably. The user funded a bounty that Hummingbot Foundation is currently holding in escrow. Afterwards, the bounty was assigned to @mlguys, who has provided a potential fix to the issue.

However, it's not clear what the acceptance criteria for this bounty should be. Here is the acceptance criteria I propose:

  • Successfully running amm_v3_lp strategy on uniswaplp for over 48 hours without any position fetching errors

@mlguys @emusol Do you agree? If not, please propose revised acceptance criteria

fengtality avatar Jan 10 '24 17:01 fengtality

hi @emusol Could you please check and provide updates on acceptance criteria?

nikspz avatar Jan 22 '24 06:01 nikspz

Hey @fengtality @nikspz, I have worked with @emusol and we agreed that we will set acceptance criteria as follow:

  • We will run his script and make sure there is no position fetching errors in 48 hours.

mlguys avatar Jan 22 '24 14:01 mlguys

Hey! the issue is now resolved, we can close this issue and release all funds

Thanks @mlguys for the hard work, was pleasure working on it with you

lmpbq avatar Feb 13 '24 09:02 lmpbq

Hey @nikspz, I will add tests to meet coverage requirement and some more updates to finalize the solution, probably finish by the end of this weekend.

mlguys avatar Feb 14 '24 15:02 mlguys

@mlguys Could you please finalize this bounty with adding tests here? https://github.com/hummingbot/hummingbot/pull/6731 https://github.com/hummingbot/gateway/pull/257

nikspz avatar Mar 21 '24 05:03 nikspz

Mark this bounty as paid

nikspz avatar Aug 29 '24 14:08 nikspz