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

forge: keep fuzz snapshots behind a flag #1086

Merged
merged 2 commits into from
Mar 28, 2022
Merged

forge: keep fuzz snapshots behind a flag #1086

merged 2 commits into from
Mar 28, 2022

Conversation

transmissions11
Copy link
Contributor

Closes #1081

@transmissions11 transmissions11 changed the title fix: move cargo forge & cast bins to foundry bin ✨ Keep fuzz snapshots behind a flag Mar 28, 2022
@transmissions11 transmissions11 changed the title ✨ Keep fuzz snapshots behind a flag forge: keep fuzz snapshots behind a flag Mar 28, 2022
@transmissions11
Copy link
Contributor Author

we might want a corresponding config option for --include-fuzz-test-gas... but could use a little help figuring out how to do that while still keeping compatibility with the flag 😅

@transmissions11
Copy link
Contributor Author

transmissions11 commented Mar 28, 2022

also if anyone has ideas for a better/shorter flag name than --include-fuzz-test-gas pls chime in!

Comment on lines +128 to +133
#[clap(long, env = "FORGE_GAS_REPORT")]
gas_report: bool,

/// Include the mean and median gas use of fuzz tests in the output.
#[clap(long, env = "FORGE_INCLUDE_FUZZ_TEST_GAS")]
pub include_fuzz_test_gas: bool,
Copy link
Member

Choose a reason for hiding this comment

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

will move this to config values as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

how'd I go about doing that while still respecting the CLI arg?

Copy link
Member

Choose a reason for hiding this comment

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

env always take precedent over config vals, but with bools it's a bit tricky, because if set to true in the config then you can't set it to false via cli easily...

So not sure whether to move this to config at all, perhaps the env var is sufficient?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i think folks like @mds1 would def prefer a config option

Copy link
Member

Choose a reason for hiding this comment

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

sg, this will require some minor refactoring because this is actually the first config val directly included in the TestArgs struct, so I'll rewrite the macro that does all the config magic,
moving this to a followup

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sg!

Comment on lines +128 to +133
#[clap(long, env = "FORGE_GAS_REPORT")]
gas_report: bool,

/// Include the mean and median gas use of fuzz tests in the output.
#[clap(long, env = "FORGE_INCLUDE_FUZZ_TEST_GAS")]
pub include_fuzz_test_gas: bool,
Copy link
Member

Choose a reason for hiding this comment

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

this would make median and mean opt-in instead of opt-out.
should we rather flip it?

Copy link
Contributor Author

@transmissions11 transmissions11 Mar 28, 2022

Choose a reason for hiding this comment

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

I think anyone actually optimizing realizes these values are uselessly inconsistent and should be out-in as a result but as long as I can opt-out via config I'm willing to concede hehe

Copy link
Member

Choose a reason for hiding this comment

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

sg, can you please run cargo +nightly fmt to fix the fmt errors? then this is good to merge

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done 🙌

@mattsse mattsse merged commit b995eea into foundry-rs:master Mar 28, 2022
@onbjerg onbjerg added the T-feature Type: feature label Mar 28, 2022
mattsse pushed a commit to mattsse/foundry that referenced this pull request Mar 28, 2022
* ✨ Keep fuzz snapshots behind a flag

* ♻️ cargo +nightly fmt
transmissions11 added a commit to transmissions11/foundry that referenced this pull request Mar 30, 2022
mattsse pushed a commit that referenced this pull request Mar 30, 2022
mattsse pushed a commit that referenced this pull request Mar 30, 2022
* revert #1086

* ✨ Hide fuzz tests unless flag

* ⚡️ forge snapshot: don't run fuzz tests by default

* ♻️ Combine args into a tuple

* ♻️ Simplify write_to_snapshot_file

* ♻️ Unused import

* ♻️ fmt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-feature Type: feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Put fuzz test snapshots behind a flag
3 participants