Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .github/workflows/mutants.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: mutants
on:
schedule:
- cron: "0 3 * * 0"
workflow_dispatch:
pull_request:
paths:
- "Cargo.toml"
- "Cargo.lock"
- "crates/**"
- ".github/workflows/mutants.yml"

permissions:
contents: read

jobs:
mutants-pr:
if: github.event_name == 'pull_request'
concurrency:
group: mutants-pr-${{ github.ref }}
cancel-in-progress: true
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false
submodules: false
fetch-depth: 0
- uses: dtolnay/rust-toolchain@a5f673d0ba8626c3977bb416a1612774bc82181b
- uses: taiki-e/install-action@9534c84618278caac52cb373bb164ed464dbd8af
with:
tool: cargo-mutants@27.1.0
- run: git diff origin/${{ github.base_ref }}.. --unified=0 > git.diff
- run: cargo mutants --workspace --in-diff git.diff -j 2
continue-on-error: true

mutants-weekly:
if: github.event_name != 'pull_request'
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
runs-on: ubuntu-latest
timeout-minutes: 360
strategy:
fail-fast: false
matrix:
shard: [0, 1, 2, 3, 4, 5, 6, 7]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false
submodules: false
- uses: dtolnay/rust-toolchain@a5f673d0ba8626c3977bb416a1612774bc82181b
- uses: taiki-e/install-action@9534c84618278caac52cb373bb164ed464dbd8af
with:
tool: cargo-mutants@27.1.0
- run: cargo mutants --workspace --shard ${{ matrix.shard }}/8 -j 2
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
if: always()
with:
name: mutants-${{ matrix.shard }}
path: mutants.out
16 changes: 16 additions & 0 deletions crates/rbitcoin-primitives/src/script_sigops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,22 @@ pub fn script_sigop_count(script: &[u8], accurate: bool) -> u64 {

#[cfg(test)]
mod tests {

#[test]
fn sigop_count_covers_pushdata_and_truncation() {
// 21 -= : [4c,2,ac] original 0, mutant i-=1 => 1
assert_eq!(script_sigop_count(&[0x4c, 2, 0xac], true), 0);
// 21 *= : [4c,1,ac] original 0, mutant i*=1 => 1
assert_eq!(script_sigop_count(&[0x4c, 1, 0xac], true), 0);
// 28 *= : [4d,1,0,ac] original 0, mutant i*=2 => 1
assert_eq!(script_sigop_count(&[0x4d, 1, 0, 0xac], true), 0);
// 41 > vs >= vs == : truncated must be 0
assert_eq!(script_sigop_count(&[0x02, 0x00], true), 0);
assert_eq!(script_sigop_count(&[0x4c, 2, 0xac, 0xac], true), 0);
// extra long killer for 21 -= if guard changes
assert_eq!(script_sigop_count(&[0x4c, 2, 0xac, 0xac, 0xac], true), 1); // PUSHDATA1 2 [ac,ac] + ac => 1
}

use super::*;

#[test]
Expand Down
11 changes: 11 additions & 0 deletions docs/mutants/missed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Mutants Baseline

> Generated: 2026-09-20 16:14 ET · Runner: M4 mini · consensus 2026-09-19 night → 2026-09-20 morning (9h, 2518 tested) · primitives 2026-09-20 ~15:00 ET (16m, 292 tested)

| Crate | Tested | Missed | Timeout | Details |
| :--- | ---: | ---: | ---: | :--- |
| `rbitcoin-primitives` | 292 | 4 | 8 | [./rbitcoin-primitives.md](./rbitcoin-primitives.md) |
| `rbitcoin-consensus` | 2518 | 304 | 38 | [./rbitcoin-consensus.md](./rbitcoin-consensus.md) |

### Top files - consensus
- `block/mod.rs` 65 · `script/interpreter.rs` 57 · `silent_payments.rs` 50 · `confirm_run/write.rs` 23 · `confirm_run/pin.rs` 22
Loading
Loading