Skip to content

Commit

Permalink
Update fuzz and invariant configs (#1402)
Browse files Browse the repository at this point in the history
  • Loading branch information
grandizzy authored Jan 28, 2025
1 parent 3825c9e commit 9393ec7
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 0 deletions.
56 changes: 56 additions & 0 deletions src/reference/config/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,30 @@ The flag indicating whether to include values from storage.

The flag indicating whether to include push bytes values.

##### `gas_report_samples`

- Type: integer
- Default: 256
- Environment: `FOUNDRY_FUZZ_GAS_REPORT_SAMPLES`

Number of runs to use for generating gas report.

##### `failure_persist_dir`

- Type: string (path)
- Default: `./cache/fuzz`
- Environment: `FOUNDRY_FUZZ_FAILURE_PERIST_DIR`

Path where fuzz failures are recorded and replayed.

##### `failure_persist_file`

- Type: string
- Default: `failures`
- Environment: `FOUNDRY_FUZZ_FAILURE_PERIST_FILE`

Name of the file to record fuzz failures.

##### `show_logs`

- Type: boolean
Expand Down Expand Up @@ -473,3 +497,35 @@ The flag indicating whether to include push bytes values. See also [fuzz.include
- Environment: `FOUNDRY_INVARIANT_SHRINK_RUN_LIMIT`

The maximum number of attempts to shrink a failed the sequence. Shrink process is disabled if set to 0.

##### `max_assume_rejects`

- Type: integer
- Default: 65536
- Environment: `FOUNDRY_INVARIANT_MAX_ASSUME_REJECTS`

The maximum number of rejects via `vm.assume` which can be encountered during a single invariant run.

##### `gas_report_samples`

- Type: integer
- Default: 256
- Environment: `FOUNDRY_INVARIANT_GAS_REPORT_SAMPLES`

Number of runs to use for generating gas report.

##### `failure_persist_dir`

- Type: string (path)
- Default: `./cache/invariant`
- Environment: `FOUNDRY_INVARIANT_FAILURE_PERIST_DIR`

Path where invariant failures are recorded and replayed.

##### `show_metrics`

- Type: boolean
- Default: false
- Environment: `FOUNDRY_INVARIANT_SHOW_METRICS`

The flag indicating whether to collect and display fuzzed selectors metrics in test report.
19 changes: 19 additions & 0 deletions src/static/config.default.toml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,14 @@ dictionary_weight = 40
include_storage = true
# The flag indicating whether to include push bytes values
include_push_bytes = true
# Number of runs to include in the gas report.
gas_report_samples = 256
# Path where fuzz failures are recorded and replayed.
# failure_persist_dir = /path/to/persist/dir
# Name of the file to record fuzz failures, defaults to `failures`.
# failure_persist_file = "failures"
# Show `console.log` in fuzz test.
show_logs = false

[invariant]
# The number of runs that must execute for each invariant test group
Expand All @@ -186,3 +194,14 @@ dictionary_weight = 80
include_storage = true
# The flag indicating whether to include push bytes values
include_push_bytes = true
# The maximum number of attempts to shrink the sequence.
shrink_run_limit = 5000
# The maximum number of rejects via `vm.assume` which can be encountered during a single
# invariant run.
max_assume_rejects = 65536
# Number of runs to include in the gas report.
gas_report_samples = 256
# Path where invariant failures are recorded and replayed.
# failure_persist_dir = /path/to/persist/dir
# Whether to collect and display fuzzed selectors metrics.
show_metrics = false

0 comments on commit 9393ec7

Please sign in to comment.