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

Gas report for fuzz test and internal transactions: confusing output #7313

Closed
2 tasks done
aelmanaa opened this issue Mar 5, 2024 · 0 comments · Fixed by #7324
Closed
2 tasks done

Gas report for fuzz test and internal transactions: confusing output #7313

aelmanaa opened this issue Mar 5, 2024 · 0 comments · Fixed by #7324
Labels
T-bug Type: bug

Comments

@aelmanaa
Copy link

aelmanaa commented Mar 5, 2024

Component

Forge

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (3df3e0c 2024-03-04T00:19:46.775990000Z)

What command(s) is the bug in?

forge test --gas-report -vvvv --isolate

Operating System

macOS (Apple Silicon)

Describe the bug

Hi,

I'd like to estimate the gas used using --gas-report -vvvv --isolate but I have noticed confusing output.

  1. I've created a repo that you can clone to reproduce the same tests.
  2. Run the test using: forge test --gas-report -vvvv --isolate

Issues:

  • The fuzz test shows a different result [PASS] testFuzz_SetNumber(uint256) (runs: 256, μ: 75638, ~: 57224) than the gas report result setNumber| 103747 | 103747 | 103747 | 103747 | 1 . For instance, the gas report shows an average of 103747 while the fuzz test shows 75638.

  • Why the fuzz test shows 1 # calls in the gas report table while there were 256 runs?

  • The gas show in the trace for Counter's setNumber doesn't tell if it's the average, median or maximum. It would have been handy to get all of them. [77244] Counter::setNumber(35111896637628685440013362 [3.511e25])

Additional question:

  • Is it possible to include internal transactions in the gas report? In this example, My test calls ContractA's increment/setNumber functions, which call Counter's increment/setNumber functions. The gas report shows only the gas for ContractA functions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-bug Type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant