Skip to content

Add independent coverage directory configuration option#1428

Merged
gustavo-grieco merged 5 commits intocrytic:masterfrom
BowTiedRadone:feat/independent-coverage-dir
Aug 28, 2025
Merged

Add independent coverage directory configuration option#1428
gustavo-grieco merged 5 commits intocrytic:masterfrom
BowTiedRadone:feat/independent-coverage-dir

Conversation

@BowTiedRadone
Copy link
Copy Markdown
Contributor

@BowTiedRadone BowTiedRadone commented Aug 20, 2025

This PR adds a new coverageDir configuration option that allows users to specify a separate directory for saving coverage reports, independent from the corpus directory.

Previously, coverage reports were saved to the corpus directory, which mixed different types of output files. This PR introduces a dedicated configuration option with automatic fallback to maintain backward compatibility.

Usage Example

corpusDir: "corpus-xyz"
coverageDir: "coverage-xyz"

- Add coverageDir field to CampaignConf type
- Add coverageDir parsing in config YAML files
- Add --coverage-dir CLI option with fallback to --corpus-dir
- Update Main.hs to use coverageDir with corpus fallback logic
- Remove unused filepath dependency from test suite
- Add config parsing tests for corpusDir and coverageDir
- Add test helpers for coverage directory validation
- Add integration tests for coverage fallback behavior
- Add test configuration files for coverage scenarios
@BowTiedRadone BowTiedRadone requested a review from arcz as a code owner August 20, 2025 16:41
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Aug 20, 2025

CLA assistant check
All committers have signed the CLA.

@BowTiedRadone
Copy link
Copy Markdown
Contributor Author

@arcz Could you please take a look at this when you have a chance? Let me know if any further action is needed.

@gustavo-grieco
Copy link
Copy Markdown
Collaborator

I think the code looks fine in general but I'm wondering about the use case. Why exactly you need the fuzzer to write the reports elsewhere?

@BowTiedRadone
Copy link
Copy Markdown
Contributor Author

First of all, this PR addresses the TODO in the codebase:

echidna/src/Main.hs

Lines 104 to 106 in 9870b1a

-- TODO: We use the corpus dir to save coverage reports which is confusing.
-- Add config option to pass dir for saving coverage report and decouple it
-- from corpusDir.

It separates coverage reports from the corpus directory, which makes things clearer since they serve different purposes. It also gives users more flexibility—for example, someone tracking coverage over time in version control can now keep those reports cleanly organized by choosing a dedicated path.

Copy link
Copy Markdown
Member

@elopez elopez left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

-- This tests the actual fallback logic: coverageDir <|> corpusDir.
checkEffectiveCoverageDir :: FilePath -> (Env, WorkerState) -> IO Bool
checkEffectiveCoverageDir expectedDir (env, _) = do
let effectiveDir = env.cfg.campaignConf.coverageDir <|> env.cfg.campaignConf.corpusDir
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This kind of duplicates the same logic you're trying to test, I don't think it adds much value. I think asserting the expected state is enough 👍

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in 7b37d96.

Co-authored-by: Emilio López <[email protected]>
BowTiedRadone added a commit to BowTiedRadone/echidna that referenced this pull request Aug 27, 2025
@BowTiedRadone BowTiedRadone force-pushed the feat/independent-coverage-dir branch from 8fa5c0e to 7b37d96 Compare August 27, 2025 20:17
@BowTiedRadone BowTiedRadone requested a review from elopez August 27, 2025 20:33
@gustavo-grieco
Copy link
Copy Markdown
Collaborator

Oh, btw, I noted that you are first time contributor. Would you like some suggestions on other small issues to address so you can get more exposure to the code?

@BowTiedRadone
Copy link
Copy Markdown
Contributor Author

@gustavo-grieco Thanks, I’d be glad to help when time permits. I’m very interested in fuzzing tools.

In fact, together with @moodmosaic, I built a similar tool for the Stacks blockchain called Rendezvous. In its Foreword, we made sure to credit Echidna 🙂

@gustavo-grieco gustavo-grieco merged commit 98b0d3f into crytic:master Aug 28, 2025
15 checks passed
@gustavo-grieco
Copy link
Copy Markdown
Collaborator

Merged! It is great to see people inspired by our code! BTW, if you want to discuss some next steps or potential collaboration hit me on Telegram

@BowTiedRadone BowTiedRadone deleted the feat/independent-coverage-dir branch August 28, 2025 19:12
datradito pushed a commit to datradito/echidna-mcp that referenced this pull request Dec 29, 2025
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.

4 participants