Skip to content

Conversation

DaniPopes
Copy link
Member

Coverage was calling a low level function of forge test args, which does not setup stuff like config.fuzz.gas_report_samples, EvmArgs, etc., as well as missing options in the test runner builder etc.

This means that forge coverage falls out of sync gradually with forge test. One of the options which was thus missed, gas_report_samples, controls how many traces are saved from fuzz and invariant tests, which with the recent addition of tracing for backtraces means we are storing a lot of traces unnecessarily, massively increasing memory usage.

Coverage was calling a low level function of forge test args, which
does not setup stuff like config.fuzz.gas_report_samples, EvmArgs, etc.,
as well as missing options in the test runner builder etc.

This means that `forge coverage` falls out of sync gradually with
`forge test`. One of the options which was thus missed,
`gas_report_samples`, controls how many traces are saved from fuzz
and invariant tests, which with the recent addition of tracing for
backtraces means we are storing a lot of traces unnecessarily,
massively increasing memory usage.
onbjerg
onbjerg previously approved these changes Sep 24, 2025
@onbjerg onbjerg enabled auto-merge (squash) September 24, 2025 19:08
@grandizzy grandizzy added the T-perf Type: performance label Sep 24, 2025
@grandizzy grandizzy added this to the v1.4.0 milestone Sep 24, 2025
.dynamic_test_linking(config.dynamic_test_linking)
.quiet(shell::is_json() || self.junit)
.files(self.get_sources_to_compile(&config, &filter)?);
let output = compiler.compile(&project)?;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't sync the compilation, which is currently also mismatched due to get_sources_to_compile and dynamic_test_linking

Copy link
Collaborator

@grandizzy grandizzy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome!

@onbjerg onbjerg merged commit ca57995 into master Sep 24, 2025
16 checks passed
@onbjerg onbjerg deleted the dani/coverage-sync-test branch September 24, 2025 19:34
@github-project-automation github-project-automation bot moved this to Done in Foundry Sep 24, 2025
@grandizzy grandizzy moved this from Done to Completed in Foundry Sep 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-perf Type: performance
Projects
Status: Completed
Development

Successfully merging this pull request may close these issues.

4 participants