question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. Itย collects links to all the places you might be looking at while hunting down a tough bug.

And, if youโ€™re still stuck at the end, weโ€™re happy to hop on a call to see how we can help out.

Price data missing from report

See original GitHub issue

I just finished integrating hardhat-gas-reporter into a new Advanced Sample Project that can be generated by the project initialization feature of the hardhat command-line interface. See https://github.com/nomiclabs/hardhat/pull/1632

However, I could not get the price data to show in the output. Re-posting from a comment on that PR:

  • Running with eth gas reporter doesnโ€™t show anything in the USD column. Why does this happen? Maybe some missing config? Can we maybe remove it / use ETH?

I spent an hour trying to figure this out. I couldnโ€™t get it to work.

I tried removing the currency from the config, and that made it default to EUR, but it still didnโ€™t have any price data. I also tried changing the config to currency: "ETH", but that didnโ€™t result in any meaningful data either. I also tried getting a CoinMarketCap API key and plugging it into the config, but that didnโ€™t help either.

I even went in and debugged eth-gas-station, adding a console.log() statements to just before the call to coinmarketcap and just after. The one just before showed that the URL it was hitting was just fine (I pulled the url via curl and the data looks fine/legit to me (no error conditions or anything, and expected object fields seem fine)), but the console.log() statement just after the CMC call never gets executed, and I gave up on trying to figure out why.

For easy reference:

And hereโ€™s a paste of the output Iโ€™m seeing:

ยท----------------------------|----------------------------|-------------|-----------------------------ยท
|    Solc version: 0.8.4     ยท  Optimizer enabled: false  ยท  Runs: 200  ยท  Block limit: 30000000 gas  โ”‚
ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท
|  Methods                                                                                            โ”‚
ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท
|  Contract  ยท  Method       ยท  Min         ยท  Max        ยท  Avg        ยท  # calls      ยท  usd (avg)  โ”‚
ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท
|  Greeter   ยท  setGreeting  ยท           -  ยท          -  ยท      35426  ยท            2  ยท          -  โ”‚
ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท
|  Deployments               ยท                                          ยท  % of limit   ยท             โ”‚
ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท
|  Greeter                   ยท           -  ยท          -  ยท     497002  ยท        1.7 %  ยท          -  โ”‚
ยท----------------------------|--------------|-------------|-------------|---------------|-------------ยท

Reproducing would be easy if you checked out and built the hardhat monorepo and then in an empty folder did yarn init --yes && yarn add --file:/path/to/monorepo/packages/hardhat-core && yarn hardhat and selected โ€œadvanced projectโ€ and then did REPORT_GAS=true yarn hardhat test. And it would be even easier than that if you were to wait until this functionality is officially released.

Please let me know if this is my error or if Iโ€™m having the wrong expectations.

Thank you!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:24 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
cgeweckecommented, Dec 6, 2021

@kazazor I think youโ€™ll need to get your own free-tier coinmarketcap api key, here and set the option in your config:

gasReporter: {
    currency: "USD",
    coinmarketcap: "abcde-....",
    gasPrice: 90,
  },

The limit on the shared key is not per plugin user but rather for all users of the plugin. Itโ€™s rate limited almost instantly now that the package is widely used โ€ฆ you have to have your own credentials for price reporting to work unfortunately.

Just lmk if doing that doesnโ€™t work and I will re-open this issue and investigate.

1reaction
cgeweckecommented, Aug 31, 2021

@feuGeneA

I think you could get price data by introducing a small delay in your โ€œinternalโ€ hh test here.

But ultimately the problem is a race-condition in eth-gas-reporter and the sync-ness of mochaโ€™s third-party reporter api. This race-condition shouldnโ€™t affect most people though - their test suites typically run longer than the latency of the CMC request.

To fix I will need to fetch the price in TASK_TEST_RUN_MOCHA_TESTS here (where async is supported) and create a configuration option at eth-gas-reporter for this data.

Sorry about thisโ€ฆIโ€™m sure it was annoying to debug ๐Ÿ˜…

Read more comments on GitHub >

github_iconTop Results From Across the Web

5 Reasons Data is Missing From Your Reports - Tag Inspector
If you notice data missing in reporting, and the tag is referencing the data layer, check to see that the required value is...
Read more >
What to Do When Data Are Missing in Group Randomized ...
In their impact report, researchers should report missing data rates by variable, explain the reasons for missing data (to the extent known), and...
Read more >
StockHistory and Missing Price Data - Microsoft Community
Hi There, I am using the stock history function, which is great, to build a 5yr graph showing the trends of stock (mainly...
Read more >
Missing data : Pricing - SAP Community
Hi all, During the sales order creating ( VA01 ) when I click on the save button in Incompletion Log the message appear...
Read more >
Missing Data | Types, Explanation, & Imputation - Scribbr
When data are missing completely at random (MCAR), the probability of any particular value being missing from your dataset is unrelated to ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found