Open SerenityFund opened 1 year ago
@corerouter Osmosis QA here
Thank you very much for the validation. Please find my feedbacks below.
Osmosis Dex is the first DeFi subgraphs for Cosmos blockchain according to my knowledge. The support for Cosmos by The Graph is just rolled out and so far I did not find any important projects using the infrastructure. Just some demo subgraphs from the graph node development team can be found. It causes great challenges for the subgraph development.
At the beginning , there is not even stable coin on osmosis. So as suggested by @this-username-is-taken I retrieve daily price data from coingecko and use them as baseline price. Once the USDC was introduced into osmosis, I then deduce other coin's price when they swap with each other. In this way, I can get a relatively accurate price data for tokens in osmosis dex.
However, in osmosis, someone can deposit one coin, for example ATOM, into a liquidity pool such as ATOM/WETH, as liquidity. It is called "Join Swap Extern Amount In" transaction. The problem is in the log for the transaction, it just show how much ATOM is deposited into the pool in the beginning but did not show how ATOM and WETH are swapped, and their respective amount added into the pool as liquidity, as shown in the sample log at https://bigdipper.live/osmosis/transactions/20845D9BA3C17158C660D7EE9BD97755055B49D8C01ABB54E4FAC77BF86384FE Meanwhile, there are not eth_call supported for cosmos subgraph to retrieve the inputTokenBalance change from the block chain.
As a result, I can only compute the resulting inputTokenBalance change by myself. It looks the previous computation causes the TVL and volume problems for some pools. I just came out another solution and initial test shows it has better result.
For Daily Transaction Count, the google sheet shows status is ok, so I assume the result is fine.
For total pool count, the problem will be fixed.
For the problem of Subgraph data is not updated. currently the host service only support data for osmosis chain up to 7.9M blocks, as shown in the status pages for all osmosis subgraph.
According to some Pool and Events sections can not be retrieved at https://subgraphs.messari.io/, I can successfully query such data at https://thegraph.com/hosted-service/subgraph/corerouter/osmosisdex, as shown below. So I think it is because there are some missmatch between the subgraph and validation portal's query graphQL. We may need to involve the validation portal's developers into the loop in order to fix the problem.
The current fix right now is tested in some pools. Once the result is ok, I will deploy the new version to sync the whole osmosis dex transactions. However, as the subgraph will index all the osmosis chain from block 0, it may takes weeks to fully sync. The whole develop-test-develop process is very slow due to the slow syncing speed for osmosis chain by the host service.
Meanwhile, given the limited functionality of cosmos subgraph and infrastructure support of The Graph host service for cosmos block chain, I am afraid the non-EVM osmosis dex subgraph, based on new delivered The Graph support for cosmos block chain, may be very difficult, even impossible, to reach the same level data accuracy comparable with EVM subgraph.
Thank you very much for your work again.
@corerouter Thanks for the comprehensive write-up looks like to me the majority of the issues are around TVL, but there should be a fix in place for that? When you deploy the new deployment with the fixes do you mind doing uploading the link here?
Thanks for the comprehensive write-up looks like to me the majority of the issues are around TVL, but there should be a fix in place for that? When you deploy the new deployment with the fixes do you mind doing uploading the link here?
@bye43 No problem. It may takes weeks as the osmosis subgraph on host service is very slow right now. Thank you very much for your understanding.
@corerouter Is the deployment link above the same one for the updated version. If not, do you mind sharing just so we can track the syncing % to re-QA ASAP? Thanks!
@corerouter Is the deployment link above the same one for the updated version. If not, do you mind sharing just so we can track the syncing % to re-QA ASAP? Thanks!
Yes. It is the same one. I just checked it and found the latest fix has finished syncing. The TVL data in the latest version improve a lot in terms of accuracy but still somehow off. (The subgraph shows total TVL about 591M while the dapp shows TVL at about 163M. I will be able to dig deeper into it early next week to see whether I can still make some progress on this issue. Thanks!
@corerouter Any update on the TVL issue here?
@corerouter Any update on the TVL issue here?
It looks like the method used in EVM subgraph to add up inputTokenAmount and then totalValueLocked does not accurately matches with data shown at osmosis stats pages at https://info.osmosis.zone/
I tried to solve it by querying the current pool's token amount directly with querying interface provided by osmosis chain from time to time in the subgraph, which is similar with EVM chain's contract call. Whether or not the feature is supported by cosmos subgraph remains an unknown issue. This question was asked in cosmos channel of The Graph discord several weeks ago, but so far it does not receive any positive confirmation from the team.
Meanwhile, I am also making some changes on the input token amount and total value locked tracking and then test it. Once there is any positive result, I will update in this issue. Thanks!
@corerouter Just checking on this again, if you need anything on our side let us know!
A test fix was deployed and is syncing at https://thegraph.com/hosted-service/subgraph/corerouter/osmosis?version=pending now.
The problem now is related with USD denominated TVL and volume data. The USD value for osmos and cosmos token in this subgraph comes from coingecko and then other coins' price derive from them as there are not USDC and USDT stable coin before, which creates a lot of mess here. I would suggest to have a price lib for osmosis as same as for other chain such as Ethereum and Arbitrum. Then this subgraph will get token price by calling the price lib. It can isolate problem better and will also make it easier to deduce USD denominated TVL and volume data.
@corerouter Thanks for the update! @steegecs @harsh9200 any thoughts on supporting a price library for cosmos?
cc: @dmelotik for visibility
@harsh9200 is probably better suited to answer this, I am not sure that Cosmos can be integrated into the pricing library with existing methods.
@bye43 I will get back to you on this after doing some research on osmosis.
Review Info
Metric to Review
TVL
TVL data shows a massive 5-day average discrepancy of more than 11k% with the official website data and Defi Llama data.
Daily Volume USD
The daily volume data is showing a high 5-day average discrepancy of -28.5% with the official website data and Defi Llama data.
Revenue
Daily Transaction Count
Daily transaction count data is not mathematically in line with the sum of deposit, withdraw, and swap daily counts in the past five days.
Total Pool Count
The official website data only shows pools up to 926 instead of 1088.
Pool Overview - TVL
Editorials
There are some errors that we've noticed and are not necessarily data errors.
Subgraph data is not updated
Pool and Events section
Please refer to the attached worksheet for more details.