Skip to content

Audit (Mutation Testing) #34

Audit (Mutation Testing)

Audit (Mutation Testing) #34

Workflow file for this run

# Nightly and manual mutation testing scoped to Ark consensus (sighash, timelocks, taproot).
name: Audit (Mutation Testing)
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
jobs:
mutation_test:
name: cargo-mutants (consensus)
runs-on: ubuntu-latest
env:
# Pre-built asset: cargo-mutants-x86_64-unknown-linux-gnu.tar.gz — update SHA256 when bumping.
CARGO_MUTANTS_VERSION: "27.0.0"
CARGO_MUTANTS_SHA256: "5083ce59bf9195ce9bb218278b609bbd183be897ca53671bad4df588fc7a9d7d"
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo-mutants binary
id: cache-cargo-mutants
uses: actions/cache@v4
with:
path: ~/.cargo/bin/cargo-mutants
key: cargo-mutants-v${{ env.CARGO_MUTANTS_VERSION }}-${{ runner.os }}-${{ runner.arch }}
- name: Install cargo-mutants (pre-built)
if: steps.cache-cargo-mutants.outputs.cache-hit != 'true'
run: |
set -euo pipefail
url="https://github.com/sourcefrog/cargo-mutants/releases/download/v${CARGO_MUTANTS_VERSION}/cargo-mutants-x86_64-unknown-linux-gnu.tar.gz"
tmp="$(mktemp)"
curl --fail --silent --show-error --location --output "$tmp" "$url"
echo "${CARGO_MUTANTS_SHA256} $tmp" | sha256sum -c -
mkdir -p "${HOME}/.cargo/bin"
tar xzf "$tmp" -C "${HOME}/.cargo/bin"
chmod +x "${HOME}/.cargo/bin/cargo-mutants"
rm -f "$tmp"
- name: Run mutation tests (consensus only)
run: |
set -euo pipefail
# Sovereignty boundary: mutate only validate_*, verify_*, compute_vtxo_id, reconstruct_*, audit_*.
# cargo-mutants matches this via -F/--re against `cargo mutants --list` lines (not a separate --function flag).
cargo mutants --package vpack --all-features --file "src/consensus/*" \
-F "validate_.*|verify_.*|compute_vtxo_id|reconstruct_.*|audit_.*" \
--baseline skip \
--jobs 4