-
Notifications
You must be signed in to change notification settings - Fork 57
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
Price data should be fetched async and configured for reporter #60
Comments
@SimonHausdorf Could you share your config (without the key value) just to double-check that it's ok? |
I created a small example: https://github.com/SimonHausdorf/GasFeeTest I changed the cmc key in the config. My current output looks like this
Edit: I checked out the tests in the original repository and have the same issue. Edit2: CMC is only used to get the current ETH price? If yes, maybe we can switch to something free: https://api.coinpaprika.com/ so users don't have to maintain / configure a cmc key Edit3: https://github.com/cgewecke/eth-gas-reporter/blob/bbf521f137407f106aeec44c730541dda6734ce3/index.js#L53 should be await?
I think there is too much hope here :P |
Ah! Thanks for the reproduction and analysis. Yes, you're hitting a latency problem because your tests execute so quickly. My computer's a little slow (or my internet connection is faster?) and was able to run your example repeatedly without missing the data. In hardhat-gas-reporter we can fetch that data async so we should. In Truffle / eth-gas-reporter it's not really possible because the mocha 3rd party reporter api only supports synchronous calls. |
Yes, coinmarketcap used to have open endpoints as well ... would definitely prefer if this feature was zero config. But I'm hesitant to change data providers because it's almost inevitable that they'll add an api key eventually to prevent DDOS. |
I guess my current location slows it down.
coinpaprika exists since a long time too, and their promise is: Anyways, thanks for the work :) |
Will keep open and consider coinpaprika, thank you. Renaming. |
I think this issue needs to be renamed? IIUC, the race condition was already fixed and released, and so this is open for the purposes of considering switching to another price feed service like coinpaprika, which sounds like a fantastic idea to me. BTW, https://www.coingecko.com/en/api says: so that's another possibility. |
This is fixed in the latest version. All price data is fetched async at the end of the test run. https://github.com/cgewecke/hardhat-gas-reporter/releases/tag/v2.0.0 |
I added my own CMC API key. Sometimes the column
usd (avg)
does not contain any value and sometimes it does.Does anyone have the same issue? It is enough to just run the test like 5 times in a row to get the price at some point.
The text was updated successfully, but these errors were encountered: