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

Save corpus continuously while fuzzing #1047

Closed
wants to merge 1 commit into from
Closed

Conversation

samalws-tob
Copy link
Collaborator

This PR adds a process which continuously saves corpus as new coverage/reproducers are discovered (#1045). This makes echidna crashes less inconvenient, and shortens the corpus saving time at the end.
It also makes the NewCoverage event include the list of transactions as part of the event, since this is needed when saving corpus info.


-- save to corpus in the background while tests are running
-- returns a channel that gets sent () when the process is done
runCorpusSaver :: Env -> IO (Chan ())
Copy link
Member

Choose a reason for hiding this comment

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

can we use MVar instead of Chan here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Is there a way to wait for MVar to be written to without doing an infinite loop? I used a Chan because you can wait for it using readChan instead of getting locked in a while (thead is not finished) loop

Copy link
Member

Choose a reason for hiding this comment

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

yeah, it should be possible

nworkers :: Int
nworkers = fromIntegral $ fromMaybe 1 env.cfg.campaignConf.workers

loop !dir !chan !workersAlive = when (workersAlive > 0) $ do
Copy link
Member

Choose a reason for hiding this comment

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

we have some logic duplication here but we can refactor this with the subscribe system we talked about

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Separate PR for that subscribe system? I could add it to this PR if you want

Copy link
Member

Choose a reason for hiding this comment

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

let's do it in this PR then

@samalws-tob
Copy link
Collaborator Author

#1048

@arcz arcz deleted the saveCoverageEarly2 branch January 25, 2024 16:07
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