Skip to content

feat(forge test): add an option to continue fuzzing run on assertion failure #9727

Open
@forkforkdog

Description

@forkforkdog

Component

Forge

Describe the feature you would like

Description:
Currently, Foundry’s invariant tests stop execution upon encountering the first assertion failure, ending the entire fuzzing campaign.

Feature Request:
Add an option to allow the fuzzing campaign to continue running until all configured runs are completed, even if assertion failures are encountered.

Rationale:
This feature would enable continuous fuzzing in an "Echidna-style" manner, where failing assertions are collected throughout the run without interrupting the campaign. Certain assertion failures require long-running fuzzing campaigns (e.g., 4+ hours), and stopping on the first failure can hinder the discovery of additional issues.

Expected Behavior:
When the continuous_run option is enabled, the fuzzer should:

  1. Continue running despite encountering assertion failures.

  2. Log all failures encountered during the campaign.

  3. Upon manual cancellation (e.g., CTRL+C/CMD+C) or completion of the configured runs/timeout, present all call traces for reproducing the assertion failures.

Example Configuration:

[invariant]
continuous_run = true

Example Output:

test/fuzzing/FuzzPositions.sol:FuzzPositions                                     
    ↪ invariant_GLOB_01: [9/4294967295] Runs  
    ❌ Failures: 2

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions