Skip to content

Test the two sig_ops boundaries no case reached (closes #2775) - #2776

Merged
fametrano merged 1 commit into
btclib-org:mainfrom
dodoshell:sig-ops-boundary-tests
Oct 23, 2026
Merged

fametrano merged 1 commit into
btclib-org:mainfrom
dodoshell:sig-ops-boundary-tests

Conversation

@dodoshell

Copy link
Copy Markdown
Contributor

What this changes

Closes #2775

Adds the two cases the issue names to tests/script/sig_ops_test.py:

  • test_p2sh_sig_op_count[op-16-is-push-only-too]: OP_16 before the
    push of _S2, so _last_push has to treat OP_16 as push only;
  • test_accurate_sig_op_count[op-1-is-one]: a 1-of-1 multisig, legacy
    20 and accurate 1, so OP_1 has to be inside the accurate range.

No source change.

How it was verified

On e5b6e09a with this commit, uv run pytest tests/script/sig_ops_test.py:

  • as committed: 49 passed;
  • with if op_code >= _OP_16 in _last_push: only
    test_p2sh_sig_op_count[op-16-is-push-only-too] fails;
  • with _OP_1 < last_op_code in _sig_op_count: only
    test_accurate_sig_op_count[op-1-is-one] fails.

Checks

  • uv run pre-commit run --all-files is clean (ruff, mypy strict,
    markdownlint, the copyright notice, uv.lock)
  • uv run pytest passes

Anything the reviewer should know

I ran both commands on Windows with Python 3.13. uv run pytest: 19942
passed, 100 skipped. In the hooks run, mixed-line-ending flagged only
the CRLF checkout that core.autocrlf makes here, and check-changelog
could not start because there is no python3 on the PATH. Running its
script directly with the venv's interpreter
(.github/scripts/check_changelog.py --grandfathered 23) passes.

_last_push could read OP_16 as a non-push and _sig_op_count could leave
OP_1 out of the accurate range with sig_ops_test.py still passing. An
OP_16 before the redeem-script push now covers the first, and a 1-of-1
multisig the second; each case fails under its mutant with only this
file run.

Signed-off-by: dodoshell <326978213+dodoshell@users.noreply.github.com>

@fametrano fametrano left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approves f8c5223, as the human decided.

A fresh local reviewer CLEARED f8c5223, with no rebase since. Every check passed or was skipped but Claude review, which is the bot's weekly quota (429, resets 2026-10-24T11:00 UTC), so there is no bot ACK: run. Not checked here: the mutants beyond the two the commit names.

@fametrano
fametrano merged commit 3897e4f into btclib-org:main Oct 23, 2026
19 checks passed
@fametrano

Copy link
Copy Markdown
Member

Landed as 3897e4f. Thank you, @dodoshell: both boundaries now have a case that fails under its mutant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sig_ops: two boundary comparisons have no test in sig_ops_test.py

2 participants