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

Add support for optimization mode #71

Closed
anishnaik opened this issue Dec 19, 2022 · 0 comments · Fixed by #75
Closed

Add support for optimization mode #71

anishnaik opened this issue Dec 19, 2022 · 0 comments · Fixed by #75
Assignees
Labels
good first issue Good for newcomers

Comments

@anishnaik
Copy link
Collaborator

anishnaik commented Dec 19, 2022

Optimization mode can be treated as another test case provider, similar to property or assertion mode. This is a great issue for someone who is starting to work with medusa because it touches on medusa's most critical packages, how medusa uses the subscribe/publish model to handle fuzz testing, and how easy it is to create a new testing strategy in medusa.

I would recommend understanding how Echidna's optimization mode works first. At a high level, the optimization mode in Echidna tries to maximize some value x. It probably does this by storing the latest maximum, max, and upon the running of a new call sequence will check whether the new max is greater than max. If so, it overwrites max with the new maximum. Realistically, it doesn't matter what x is, what you care about is the return value of the echidna_opt (medusa_opt) function.

This can be done in medusa as well, please refer to test_case.go, test_case_assertion.go, test_case_assertion_provider.go, test_case_property.go, and test_case_property_provider.go. Similarly, you will probably create a test_case_optimization.go and a test_case_optimization_provider.go.

Here are some key considerations:

  1. Support for optimization mode in the config and CLI. Should be disabled by default.
  2. Use the property and assertion test case providers as examples on how to build out optimization mode.
  3. Create a unit test or two that runs medusa in optimization mode.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants