Skip to main content

solidity-mutate

Mutation testing framework for Solidity contracts.

Version: v0.1.1

Install

If you are using the published package from PyPI:

pip install solidity-mutate==0.1.1

If you want to work on the repository locally:

git clone https://github.com/sidarth16/solidity-mutate.git
cd solidity-mutate
pip install -e .

Run

Run the tool from the repo root against the bundled Foundry example:

solidity-mutate examples/test_contract --safe

You can also run it as a module:

python3 -m solidity_mutate examples/test_contract --safe

To inspect the available mutators:

solidity-mutate --list-mutators

CLI Arguments

  • target
    • Path to the Solidity project root.
    • Default: ..
  • --file
    • Mutate only one Solidity file relative to the project root.
    • Example: contracts/token.sol
  • --test-cmd
    • Command used to run tests for each mutant.
    • Default: forge test
  • --mutators
    • Comma-separated mutators to run.
    • Default: all
  • --timeout
    • Timeout in seconds for each test command run.
    • Default: 30
  • --safe
    • Run a preflight test before mutation and a postflight test after mutation.
  • -v
    • Increase verbosity.
    • Use -v for summaries and -vv for full mutant logs.
  • --list-mutators
    • Print the available mutators and exit.

Repository Layout

  • src/solidity_mutate/: installable Python package
  • examples/test_contract/: Foundry sample project used by the mutator
  • pyproject.toml: package metadata and console script entrypoint

Sample Project

Run the bundled Foundry example directly:

cd examples/test_contract
forge test

Sample Results

The bundled example project currently reaches:

  • 100% line coverage
  • 100% statement coverage
  • 55.56% mutation score

Coverage Report

Coverage report

Mutation Report

Mutation report

-vv Sample Output

Verbose mutation output

Full Output

Full mutation output

Metadata

Release files for solidity-mutate 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for solidity-mutate 0.1.1
File Size Uploaded Provenance
solidity_mutate-0.1.1.tar.gz 10.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for solidity-mutate 0.1.1
File Interpreter ABI Platform
solidity_mutate-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 24.4 kB

Release files / solidity_mutate-0.1.1.tar.gz

Download URL solidity_mutate-0.1.1.tar.gz
Size 10.5 kB
Tags Source
SHA-256 checksum
How to use checksums
616c87e3fc0d8a2dfadf5f3dc95c06a6add3acdd4dd0dd4750986fc3117572f5
BLAKE2b-256 checksum
How to use checksums
4a76b99356763074b18be38b70fb917b09009f32e43b9eb46bc7d7b07bd89bdc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.10

Release files / solidity_mutate-0.1.1-py3-none-any.whl

Download URL solidity_mutate-0.1.1-py3-none-any.whl
Size 13.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
913d0d173d4d735270368a475b69089c8ba4c2ccd1aabcfd912394aadbabb817
BLAKE2b-256 checksum
How to use checksums
8b3686ca2d56f5a06a1ac445188f96423ab5f95ce52d89bcefe129abc3b80853
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.10

Security for solidity-mutate 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page