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

The subgraph URL looks no longer available #300

Open
marcello-pv01 opened this issue Sep 4, 2024 · 2 comments
Open

The subgraph URL looks no longer available #300

marcello-pv01 opened this issue Sep 4, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@marcello-pv01
Copy link

Version Information

$ python -m curvesim --version
curvesim 0.5.0, CPython 3.11.2 on Darwin

What's your issue about?

Please include information like:

Full output

---------------------------------------------------------------------------
ClientResponseError                       Traceback (most recent call last)
File [~/Library/Caches/pypoetry/virtualenvs/curvesimdemo-T_UBs_fm-py3.11/lib/python3.11/site-packages/curvesim/network/http.py:47](http://localhost:8888/lab/tree/~/Library/Caches/pypoetry/virtualenvs/curvesimdemo-T_UBs_fm-py3.11/lib/python3.11/site-packages/curvesim/network/http.py#line=46), in HTTP.post(url, json)
     46 async with aiohttp.request("POST", **kwargs) as resp:
---> 47     resp.raise_for_status()
     48     json_data = await resp.json()

File [~/Library/Caches/pypoetry/virtualenvs/curvesimdemo-T_UBs_fm-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py:1093](http://localhost:8888/lab/tree/~/Library/Caches/pypoetry/virtualenvs/curvesimdemo-T_UBs_fm-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py#line=1092), in ClientResponse.raise_for_status(self)
   1092 self.release()
-> 1093 raise ClientResponseError(
   1094     self.request_info,
   1095     self.history,
   1096     status=self.status,
   1097     message=self.reason,
   1098     headers=self.headers,
   1099 )

ClientResponseError: 410, message='Gone', url='https://api.thegraph.com/subgraphs/name/convex-community/volume-matic'

During handling of the above exception, another exception occurred:

HttpClientError                           Traceback (most recent call last)
File ~/Library/Caches/pypoetry/virtualenvs/curvesimdemo-T_UBs_fm-py3.11/lib/python3.11/site-packages/tenacity/asyncio/__init__.py:114, in AsyncRetrying.__call__(self, fn, *args, **kwargs)
    113 try:
--> 114     result = await fn(*args, **kwargs)
    115 except BaseException:  # noqa: B902

File [~/Library/Caches/pypoetry/virtualenvs/curvesimdemo-T_UBs_fm-py3.11/lib/python3.11/site-packages/curvesim/network/http.py:54](http://localhost:8888/lab/tree/~/Library/Caches/pypoetry/virtualenvs/curvesimdemo-T_UBs_fm-py3.11/lib/python3.11/site-packages/curvesim/network/http.py#line=53), in HTTP.post(url, json)
     53     # pylint: disable-next=raise-missing-from
---> 54     raise HttpClientError(status, message, url)
     56 return json_data

HttpClientError: (410, 'Gone')

The above exception was the direct cause of the following exception:

RetryError                                Traceback (most recent call last)
Cell In[6], line 1
----> 1 curvesim.pool.get("0x8f043ddc578da04c26763a572cefe50263e710cc", "matic")

File [~/Library/Caches/pypoetry/virtualenvs/curvesimdemo-T_UBs_fm-py3.11/lib/python3.11/site-packages/curvesim/pool/__init__.py:183](http://localhost:8888/lab/tree/~/Library/Caches/pypoetry/virtualenvs/curvesimdemo-T_UBs_fm-py3.11/lib/python3.11/site-packages/curvesim/pool/__init__.py#line=182), in get_pool(pool_metadata, chain, normalize, end_ts, env)
    180     raise CurvesimValueError("`end_ts` has no effect unless pool address is used.")
    182 if isinstance(pool_metadata, str):
--> 183     pool_metadata = get_metadata(pool_metadata, chain=chain, env=env, end_ts=end_ts)
    184 elif isinstance(pool_metadata, dict):
    185     pool_metadata = PoolMetaData(pool_metadata)

File [~/Library/Caches/pypoetry/virtualenvs/curvesimdemo-T_UBs_fm-py3.11/lib/python3.11/site-packages/curvesim/pool_data/queries/metadata.py:91](http://localhost:8888/lab/tree/~/Library/Caches/pypoetry/virtualenvs/curvesimdemo-T_UBs_fm-py3.11/lib/python3.11/site-packages/curvesim/pool_data/queries/metadata.py#line=90), in get_metadata(address, chain, env, end_ts)
     88 chain = Chain(chain)
     89 env = Env(env)
---> 91 metadata_dict = from_address(address, chain, env=env, end_ts=end_ts)
     92 metadata = PoolMetaData(metadata_dict)
     94 return metadata

File [~/Library/Caches/pypoetry/virtualenvs/curvesimdemo-T_UBs_fm-py3.11/lib/python3.11/site-packages/curvesim/pool_data/queries/metadata.py:32](http://localhost:8888/lab/tree/~/Library/Caches/pypoetry/virtualenvs/curvesimdemo-T_UBs_fm-py3.11/lib/python3.11/site-packages/curvesim/pool_data/queries/metadata.py#line=31), in from_address(address, chain, env, end_ts)
     14 """
     15 Returns
     16 
   (...)
     29 :func:`curvesim.network.subgraph.pool_snapshot`.
     30 """
     31 loop = get_event_loop()
---> 32 data = pool_snapshot_sync(address, chain, env=env, end_ts=end_ts, event_loop=loop)
     34 # Get underlying token addresses
     35 if data["pool_type"] == "LENDING":

File [~/Library/Caches/pypoetry/virtualenvs/curvesimdemo-T_UBs_fm-py3.11/lib/python3.11/site-packages/curvesim/network/utils.py:51](http://localhost:8888/lab/tree/~/Library/Caches/pypoetry/virtualenvs/curvesimdemo-T_UBs_fm-py3.11/lib/python3.11/site-packages/curvesim/network/utils.py#line=50), in sync.<locals>.inner(event_loop, *args, **kwargs)
     49         _setup_extra_event_loop()
     50     future = asyncio.run_coroutine_threadsafe(coro, _loop)
---> 51     res = future.result()
     53 else:
     54     res = loop.run_until_complete(coro)

File [~/.pyenv/versions/3.11.2/lib/python3.11/concurrent/futures/_base.py:456](http://localhost:8888/lab/tree/~/.pyenv/versions/3.11.2/lib/python3.11/concurrent/futures/_base.py#line=455), in Future.result(self, timeout)
    454     raise CancelledError()
    455 elif self._state == FINISHED:
--> 456     return self.__get_result()
    457 else:
    458     raise TimeoutError()

File [~/.pyenv/versions/3.11.2/lib/python3.11/concurrent/futures/_base.py:401](http://localhost:8888/lab/tree/~/.pyenv/versions/3.11.2/lib/python3.11/concurrent/futures/_base.py#line=400), in Future.__get_result(self)
    399 if self._exception:
    400     try:
--> 401         raise self._exception
    402     finally:
    403         # Break a reference cycle with the exception in self._exception
    404         self = None

File [~/Library/Caches/pypoetry/virtualenvs/curvesimdemo-T_UBs_fm-py3.11/lib/python3.11/site-packages/curvesim/network/subgraph.py:254](http://localhost:8888/lab/tree/~/Library/Caches/pypoetry/virtualenvs/curvesimdemo-T_UBs_fm-py3.11/lib/python3.11/site-packages/curvesim/network/subgraph.py#line=253), in pool_snapshot(address, chain, env, end_ts)
    236 async def pool_snapshot(address, chain, env="prod", end_ts=None):
    237     """
    238     Async function to pull pool state and metadata from daily snapshots.
    239 
   (...)
    252 
    253     """
--> 254     r = await _pool_snapshot(address, chain, env, end_ts)
    255     logger.debug("Pool snapshot: %s", r)
    257     # Flatten

File [~/Library/Caches/pypoetry/virtualenvs/curvesimdemo-T_UBs_fm-py3.11/lib/python3.11/site-packages/curvesim/network/subgraph.py:224](http://localhost:8888/lab/tree/~/Library/Caches/pypoetry/virtualenvs/curvesimdemo-T_UBs_fm-py3.11/lib/python3.11/site-packages/curvesim/network/subgraph.py#line=223), in _pool_snapshot(address, chain, env, end_ts)
    168 # pylint: disable=consider-using-f-string
    169 q = """
    170     {
    171       dailyPoolSnapshots(
   (...)
    221     end_ts,
    222 )
--> 224 r = await convex(chain, q, env)
    225 try:
    226     r = r["dailyPoolSnapshots"][0]

File [~/Library/Caches/pypoetry/virtualenvs/curvesimdemo-T_UBs_fm-py3.11/lib/python3.11/site-packages/curvesim/network/subgraph.py:92](http://localhost:8888/lab/tree/~/Library/Caches/pypoetry/virtualenvs/curvesimdemo-T_UBs_fm-py3.11/lib/python3.11/site-packages/curvesim/network/subgraph.py#line=91), in convex(chain, q, env)
     68 """
     69 Async function to query convex community subgraphs
     70 
   (...)
     89 
     90 """
     91 url = _get_subgraph_url(chain, env)
---> 92 r = await query(url, q)
     93 if "data" not in r:
     94     raise SubgraphResultError(
     95         f"No data returned from Convex: chain: {chain}, query: {q}"
     96     )

File [~/Library/Caches/pypoetry/virtualenvs/curvesimdemo-T_UBs_fm-py3.11/lib/python3.11/site-packages/curvesim/network/subgraph.py:40](http://localhost:8888/lab/tree/~/Library/Caches/pypoetry/virtualenvs/curvesimdemo-T_UBs_fm-py3.11/lib/python3.11/site-packages/curvesim/network/subgraph.py#line=39), in query(url, q)
     23 async def query(url, q):
     24     """
     25     Core async function to query subgraphs.
     26 
   (...)
     38 
     39     """
---> 40     r = await HTTP.post(url, json={"query": q})
     41     return r

File [~/Library/Caches/pypoetry/virtualenvs/curvesimdemo-T_UBs_fm-py3.11/lib/python3.11/site-packages/tenacity/asyncio/__init__.py:189](http://localhost:8888/lab/tree/~/Library/Caches/pypoetry/virtualenvs/curvesimdemo-T_UBs_fm-py3.11/lib/python3.11/site-packages/tenacity/asyncio/__init__.py#line=188), in AsyncRetrying.wraps.<locals>.async_wrapped(*args, **kwargs)
    187 copy = self.copy()
    188 async_wrapped.statistics = copy.statistics  # type: ignore[attr-defined]
--> 189 return await copy(fn, *args, **kwargs)

File [~/Library/Caches/pypoetry/virtualenvs/curvesimdemo-T_UBs_fm-py3.11/lib/python3.11/site-packages/tenacity/asyncio/__init__.py:111](http://localhost:8888/lab/tree/~/Library/Caches/pypoetry/virtualenvs/curvesimdemo-T_UBs_fm-py3.11/lib/python3.11/site-packages/tenacity/asyncio/__init__.py#line=110), in AsyncRetrying.__call__(self, fn, *args, **kwargs)
    109 retry_state = RetryCallState(retry_object=self, fn=fn, args=args, kwargs=kwargs)
    110 while True:
--> 111     do = await self.iter(retry_state=retry_state)
    112     if isinstance(do, DoAttempt):
    113         try:

File [~/Library/Caches/pypoetry/virtualenvs/curvesimdemo-T_UBs_fm-py3.11/lib/python3.11/site-packages/tenacity/asyncio/__init__.py:153](http://localhost:8888/lab/tree/~/Library/Caches/pypoetry/virtualenvs/curvesimdemo-T_UBs_fm-py3.11/lib/python3.11/site-packages/tenacity/asyncio/__init__.py#line=152), in AsyncRetrying.iter(self, retry_state)
    151 result = None
    152 for action in self.iter_state.actions:
--> 153     result = await action(retry_state)
    154 return result

File [~/Library/Caches/pypoetry/virtualenvs/curvesimdemo-T_UBs_fm-py3.11/lib/python3.11/site-packages/tenacity/_utils.py:99](http://localhost:8888/lab/tree/~/Library/Caches/pypoetry/virtualenvs/curvesimdemo-T_UBs_fm-py3.11/lib/python3.11/site-packages/tenacity/_utils.py#line=98), in wrap_to_async_func.<locals>.inner(*args, **kwargs)
     98 async def inner(*args: typing.Any, **kwargs: typing.Any) -> typing.Any:
---> 99     return call(*args, **kwargs)

File [~/Library/Caches/pypoetry/virtualenvs/curvesimdemo-T_UBs_fm-py3.11/lib/python3.11/site-packages/tenacity/__init__.py:419](http://localhost:8888/lab/tree/~/Library/Caches/pypoetry/virtualenvs/curvesimdemo-T_UBs_fm-py3.11/lib/python3.11/site-packages/tenacity/__init__.py#line=418), in BaseRetrying._post_stop_check_actions.<locals>.exc_check(rs)
    417 if self.reraise:
    418     raise retry_exc.reraise()
--> 419 raise retry_exc from fut.exception()

RetryError: RetryError[<Future at 0x12871b3d0 state=finished raised HttpClientError>]

Command I run

import curvesim
curvesim.pool.get("0x8f043ddc578da04c26763a572cefe50263e710cc", "matic")

More info

Once identified that the link to the subgraph is broken, I also tried with the equivalent for mainnet, as I thought it would have been more likely to be up to date, but I've got the same error:

This endpoint has been removed. If you are the owner of this subgraph you can upgrade it by going here: https://thegraph.com/hosted-service. If you have any questions, reach out to [email protected]. Learn more about why this happening here: https://thegraph.com/docs/en/sunrise/#upgrading-subgraphs-to-the-graph-network

How can it be fixed?

I believe it should be used a corrected URL to the relevant subgraph.

@allt0ld
Copy link
Collaborator

allt0ld commented Sep 24, 2024

Sorry for the inconvenience. The subgraph has been deprecated, and we will soon fix the issue by switching to Curve's curve-prices backend API: https://prices.curve.fi/feeds-docs

@allt0ld allt0ld added the bug Something isn't working label Sep 24, 2024
@marcello-pv01
Copy link
Author

Fair enough, thanks for the explanation 🙏

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