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

Proxy error: Exception on /swap_path/eth/.../latest #64

Closed
rappie opened this issue May 15, 2023 · 7 comments · Fixed by #110
Closed

Proxy error: Exception on /swap_path/eth/.../latest #64

rappie opened this issue May 15, 2023 · 7 comments · Fixed by #110

Comments

@rappie
Copy link

rappie commented May 15, 2023

Let me know if you need more info

Traceback (most recent call last):
  File "/home/rappie/.pyenv/versions/ityfuzz/lib/python3.10/site-packages/flask/app.py", line 2529, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/rappie/.pyenv/versions/ityfuzz/lib/python3.10/site-packages/flask/app.py", line 1825, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/rappie/.pyenv/versions/ityfuzz/lib/python3.10/site-packages/flask/app.py", line 1823, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/rappie/.pyenv/versions/ityfuzz/lib/python3.10/site-packages/flask/app.py", line 1799, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "/home/rappie/Desktop/ityfuzz.git/proxy/main.py", line 621, in swap_path
    return flask.jsonify(find_path_subgraph(network, token_address.lower(), block))
  File "/home/rappie/Desktop/ityfuzz.git/proxy/main.py", line 371, in find_path_subgraph
    hops = get_all_hops(token, network, block, known=set())
  File "/home/rappie/Desktop/ityfuzz.git/proxy/main.py", line 322, in get_all_hops
    hops[token] = get_pair(token, network, block)
  File "/home/rappie/.pyenv/versions/ityfuzz/lib/python3.10/site-packages/decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
  File "/home/rappie/.pyenv/versions/ityfuzz/lib/python3.10/site-packages/retry/api.py", line 73, in retry_decorator
    return __retry_internal(partial(f, *args, **kwargs), exceptions, tries, delay, max_delay, backoff, jitter,
  File "/home/rappie/.pyenv/versions/ityfuzz/lib/python3.10/site-packages/retry/api.py", line 33, in __retry_internal
    return f()
  File "/home/rappie/Desktop/ityfuzz.git/proxy/main.py", line 266, in get_pair
    res = res["data"]
KeyError: 'data'
@rappie
Copy link
Author

rappie commented May 18, 2023

Any idea with this one? Is this something I could hotfix locally?

@ByteSecurity
Copy link
Contributor

Could you send me the URL requested on the traceback above? I would like to try reproducing it.

My guess is that either:

  1. TheGraph has stopped serving your IP.
  2. This trading pair is not indexed on TheGraph.

@rappie
Copy link
Author

rappie commented Jun 15, 2023

url https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v2
error {'errors': [{'message': 'Failed to decode `block.number` value: `subgraph QmWTrJJ9W8h3JE19FhCzzPYsJ2tgXZCdUqnbyuo64ToTBN has only indexed up to block number 17308397 and data for block number 17485440 is therefore not yet available`'}]}

It seems to be because thegraph is not indexing fast enough. Is nobody else encountering this?

I've been using a bigger delay as a workaround:

    if network == "eth":
        # delay = 50
        delay = 200000
    elif network == "bsc":
        delay = 700000
    else:
        delay = 50

    block_int = int(block, 16) if block != "latest" else int(get_latest_block(network), 16) - delay

@ByteSecurity
Copy link
Contributor

has only indexed up to block number 17308397 and data for block number 17485440 is therefore not yet available
I have also encountered this issue. It is likely that TheGraph's index is not up to date. If it is not necessary to use the latest block, I choose to use the block number returned by TheGraph.

@rappie
Copy link
Author

rappie commented Jun 15, 2023

/swap_path/eth/0x64aa3364f17a4d01c6f1751fd97c2bd3d7e7f1d5/latest

@ByteSecurity
Copy link
Contributor

/swap_path/eth/0x64aa3364f17a4d01c6f1751fd97c2bd3d7e7f1d5/latest

I know where the problem is now. It's because TheGraph's block synchronization time is three years ago, which makes it impossible to get data with the latest blocks.

https://thegraph.com/hosted-service/subgraph/uniswap/uniswap-v2

@ByteSecurity
Copy link
Contributor

Added a fallback to use the old block method for requesting, as well as error handling.

@shouc shouc closed this as completed in #110 Jul 8, 2023
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

Successfully merging a pull request may close this issue.

2 participants