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

feat: disable fuzz fixtures in Solidity #661

Merged
merged 6 commits into from
Sep 13, 2024

Conversation

agostbiro
Copy link
Member

Foundry supports specifying fuzz inputs in Solidity. They call this feature “fixtures”. This seems to follow from the “do everything in Solidity” philosophy and would probably make more sense to get as an input in EDR. The values could be then specified in a config in Hardhat or generated dynamically with JS.

For this reason, we don't want to let users specify fuzz inputs with Solidity, but fixtures are integral to the fuzz executor implementation, so while it’s possible to rip it out, it’d be a big effort to put it back later on. And we will want to add support for fuzz fixtures later on, just not via Solidity code.

So I added a solidity_fuzz_fixtures config option which is always false for the JS runner and it turns off loading fixtures from Solidity, but the Rust integration test runner can turn it on to keep the tests covering this feature.

This way users won’t be able to depend on Foundry-style fuzz fixtures by accident, but we can add a fuzz fixtures config option to the JS runner interface in the future with little effort.

@agostbiro agostbiro added the no changeset needed This PR doesn't require a changeset label Sep 11, 2024
@agostbiro agostbiro added this to the Solidity tests, phase 2 milestone Sep 11, 2024
@agostbiro agostbiro requested a review from a team September 11, 2024 19:06
@agostbiro agostbiro self-assigned this Sep 11, 2024
Copy link

changeset-bot bot commented Sep 11, 2024

⚠️ No Changeset found

Latest commit: 8ce3970

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@agostbiro agostbiro temporarily deployed to github-action-benchmark September 11, 2024 19:06 — with GitHub Actions Inactive
@agostbiro agostbiro temporarily deployed to github-action-benchmark September 11, 2024 19:06 — with GitHub Actions Inactive
// No-op if the feature is disabled
if !self.solidity_fuzz_fixtures {
fixture_funcs.for_each(|func| {
log::warn!("Possible fuzz fixture usage detected: '{}', but solidity fuzz fixtures are disabled.", &func.name);
Copy link
Member Author

@agostbiro agostbiro Sep 11, 2024

Choose a reason for hiding this comment

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

This is a noop unless a consumer is configured which isn't currently when ran from JS


uint256[] public fixtureAmount = [
// This is a random value
7191815684697958081204101901807852913954269296144377099693178655035380638910
Copy link
Member

Choose a reason for hiding this comment

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

image

@agostbiro agostbiro changed the base branch from test/env-var-js-integration to feat/solidity-tests September 13, 2024 08:52
@agostbiro agostbiro changed the base branch from feat/solidity-tests to test/env-var-js-integration September 13, 2024 09:24
Base automatically changed from test/env-var-js-integration to feat/solidity-tests September 13, 2024 10:26
@agostbiro agostbiro temporarily deployed to github-action-benchmark September 13, 2024 10:31 — with GitHub Actions Inactive
@agostbiro agostbiro temporarily deployed to github-action-benchmark September 13, 2024 10:31 — with GitHub Actions Inactive
@agostbiro agostbiro merged commit b164398 into feat/solidity-tests Sep 13, 2024
18 checks passed
@agostbiro agostbiro deleted the feat/disable-fuzz-fixtures branch September 13, 2024 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no changeset needed This PR doesn't require a changeset
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants