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

init stateful fuzz harness #1018

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

init stateful fuzz harness #1018

wants to merge 1 commit into from

Conversation

bohendo
Copy link

@bohendo bohendo commented Sep 26, 2024

Description

Initialize a stateful fuzz harness at pkg/vault/test/foundry/fuzz/FuzzHarness.sol plus medusa & echidna config files, gitignore updates, and package.json scripts.

To run, we'll need to install either medusa or echidna. Note that we need to use a version of medusa that includes a recent bugfix. Installing the master branch from source will work, but a new release that includes this fix will be published soon. Echidna's performance may be degraded slightly due to slither failures (slither works with hardhat but echidna needs foundry).

Unfortunately, this PR re-introduces a copy of the legacy VaultMockDeployer foundry test util. Medusa's cheatcode support is not up to parity with foundry, so replacing this with the new VaultContractsDeployer util may require some adjustment.

When you're ready, run yarn run fuzz:medusa or yarn run fuzz:echidna from the vault package to kick off a fuzzing campaign.

By default, this will run optimization fuzz tests. Change the ASSERT_MODE constant in the FuzzHarness contract to true to switch to assertion mode.

Enjoy!

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Dependency changes
  • Code refactor / cleanup
  • Optimization: [ ] gas / [ ] bytecode
  • Documentation or wording changes
  • Other

Checklist:

  • The diff is legible and has no extraneous changes
  • Complex code has been commented, including external interfaces
  • Tests have 100% code coverage
  • The base branch is either main, or there's a description of how to merge

event Debug(string, uint256);

// If this flag is false, assertion tests will never fail! But optimizations will work.
// Changing to false will disable optimizations but allow the assertion tests to run
Copy link
Author

Choose a reason for hiding this comment

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

Changing to TRUE will disable optimizations but allow the assertion tests to run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant