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

Template generation #27

Merged
merged 32 commits into from
Mar 29, 2024
Merged

Template generation #27

merged 32 commits into from
Mar 29, 2024

Conversation

tuturu-tech
Copy link
Collaborator

@tuturu-tech tuturu-tech commented Mar 20, 2024

This PR adds the ability to automatically generate a fuzzing harness for a list of target contracts.

Fuzzing harness generation enables:

  • Automatic generation of a fuzzing harness for a list of contracts. Includes inheritance, deployment, and wrapper functions with random Actor selection.
  • Automatic generation of Actor contracts used as proxies for user actions. The Actor contracts contain wrapper functions to interact with the target contracts. The functions can be filtered so that only functions that have a certain modifier, are payable, or make a specific external call are included. This makes it easier to generate role based actors.
  • Automatic generation of Attack contracts from a list of premade attacks. The same function filtering as above can be applied.

Refactoring

  • Directory structure updated to make it easier to add new commands
  • Parser refactored
  • Foundry unit test generation moved to generate command
  • Move file operations to a utility function
  • HarnessGenerator and string templates refactored to reduce code duplication

Features

  • init command added to initialize a configuration file
  • template command added to generate a fuzzing harness. It includes the --name, --contracts, --output-dir, and --config flags. Added new string templates, classes, data classes.
  • Add --config flag to template and generate commands so that a configuration file can be used

Tests

  • Add tests for template command function filtering

Documentation

  • Updated README.md to reflect the changes

tuturu-tech and others added 30 commits March 5, 2024 11:43
Merge main and resolve conflicts, add notice on top of generated test files that they were auto-generated with fuzz-utils.
Add filtering tests for harness generation. Fix filtering cases and incorrect set comprehension
@tuturu-tech tuturu-tech marked this pull request as ready for review March 26, 2024 16:31
@tuturu-tech tuturu-tech mentioned this pull request Mar 28, 2024
@tuturu-tech tuturu-tech merged commit 14b770c into main Mar 29, 2024
11 checks passed
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.

2 participants