Skip to content

Commit

Permalink
Merge pull request #2391 from crytic/mutator/fit-and-finish
Browse files Browse the repository at this point in the history
update slither-mutate readme with quickstart
  • Loading branch information
0xalpharush authored Mar 29, 2024
2 parents 28402ae + 640d675 commit 3e8a643
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions slither/tools/mutator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,24 @@

`slither-mutate` is a mutation testing tool for solidity based smart contracts.

## Usage
## Quick Start

`slither-mutate <codebase> --test-cmd <test-command> <options>`
In a foundry project with **passing** tests that are run with `forge test`, you can mutate all solidity files in the `src` folder by running the following:

To view the list of mutators available `slither-mutate --list-mutators`
`slither-mutate src --test-cmd='forge test'`

You can provide flags to `forge` as part of the `--test-cmd` parameter or target a single file path instead of the whole `src` directory, for example:

`slither-mutate src/core/MyContract.sol --test-cmd='forge test --match-contract="MyContract"'`

### CLI Interface

```shell
$ slither-mutate --help
usage: slither-mutate <codebase> --test-cmd <test command> <options>

Experimental smart contract mutator. Based on https://arxiv.org/abs/2006.11597

positional arguments:
codebase Codebase to analyze (.sol file, project directory, ...)

Expand All @@ -24,10 +33,11 @@ options:
--timeout TIMEOUT Set timeout for test command (by default 30 seconds)
--output-dir OUTPUT_DIR
Name of output directory (by default 'mutation_campaign')
--verbose output all mutants generated
-v, --verbose log mutants that are caught as well as those that are uncaught
-vv, --very-verbose log mutants that are caught, uncaught, and fail to compile. And more!
--mutators-to-run MUTATORS_TO_RUN
mutant generators to run
--contract-names CONTRACT_NAMES
list of contract names you want to mutate
--quick to stop full mutation if revert mutator passes
--comprehensive continue testing minor mutations if severe mutants are uncaught
```

0 comments on commit 3e8a643

Please sign in to comment.