You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With support for --isolate when running tests and scripts, it would be helpful to expose a function lastGasUsed() in VM.sol that returns the gasUsed of the immediate last top-level transaction.
Better still, a function gasUsed() returns (uint256[] memory) that returns an array of gasUsed of all top level calls made in that isolated vm execution
Additional context
This would be particularly helpful given that currently, when a function is called multiple times, the only way to see the gas used for individual calls is to look at the expanded trace, a gasUsed helper function, would make it possible for a dev to access and use this info how they deem fit.
No response
The text was updated successfully, but these errors were encountered:
would make it possible for a dev to access and use this info how they deem fit.
Can you expand on the use case? Instead of a cheatcode specific to --isolate mode, a more generic solution may be to use forge test --gas-report, and perhaps update it to also output the raw data as JSON or something if needed
Component
Forge
Describe the feature you would like
With support for
--isolate
when running tests and scripts, it would be helpful to expose a functionlastGasUsed()
in VM.sol that returns the gasUsed of the immediate last top-level transaction.Better still, a function
gasUsed() returns (uint256[] memory)
that returns an array of gasUsed of all top level calls made in that isolated vm executionAdditional context
This would be particularly helpful given that currently, when a function is called multiple times, the only way to see the gas used for individual calls is to look at the expanded trace, a
gasUsed
helper function, would make it possible for a dev to access and use this info how they deem fit.No response
The text was updated successfully, but these errors were encountered: