test: add script_tests cases covering more interpreter mutants #36128

pull ViniciusCestarii wants to merge 3 commits into bitcoin:master from ViniciusCestarii:kill-more-interpreter-mutants changing 2 files +34 −0
  1. ViniciusCestarii commented at 1:21 PM on August 31, 2026: contributor

    Kills some live mutants on interpreter.cpp that affect consensus found with https://github.com/ViniciusCestarii/mutant-harness. They are:

    <details> <summary>interpreter.cpp (killed by 4e7de2ac4cc6c08ff27620de01ccd9d66c568459): <code>OP_IF</code>/<code>OP_NOTIF</code> tapscript minimal-IF: <code>vch[0] != 1</code> -> <code>vch[0] > 1</code> </summary>

    diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp
    index 98b16ec..f9b08fe 100644
    --- a/src/script/interpreter.cpp
    +++ b/src/script/interpreter.cpp
    @@ -624,7 +624,7 @@ bool EvalScript(std::vector<std::vector<unsigned char> >& stack, const CScript&
                             if (sigversion == SigVersion::TAPSCRIPT) {
                                 // The input argument to the OP_IF and OP_NOTIF opcodes must be either
                                 // exactly 0 (the empty vector) or exactly 1 (the one-byte vector with value 1).
    -                            if (vch.size() > 1 || (vch.size() == 1 && vch[0] != 1)) {
    +                            if (vch.size() > 1 || (vch.size() == 1 && vch[0] > 1)) {
                                     return set_error(serror, SCRIPT_ERR_TAPSCRIPT_MINIMALIF);
                                 }
                             }
    

    </details>

    <details> <summary>interpreter.cpp (killed by f1380123b6f8912e2ca599f30f2d89c0af9b9c5f): P2WSH: <code>memcmp(hash_exec_script.begin(), program.data(), 32)</code> -> <code>31</code></summary>

    diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp
    index 98b16ec..73a1bb5 100644
    --- a/src/script/interpreter.cpp
    +++ b/src/script/interpreter.cpp
    @@ -1940,7 +1940,7 @@ static bool VerifyWitnessProgram(const CScriptWitness& witness, int witversion,
                 exec_script = CScript(script_bytes.begin(), script_bytes.end());
                 uint256 hash_exec_script;
                 CSHA256().Write(exec_script.data(), exec_script.size()).Finalize(hash_exec_script.begin());
    -            if (memcmp(hash_exec_script.begin(), program.data(), 32)) {
    +            if (memcmp(hash_exec_script.begin(), program.data(), 31)) {
                     return set_error(serror, SCRIPT_ERR_WITNESS_PROGRAM_MISMATCH);
                 }
                 return ExecuteWitnessScript(stack, exec_script, flags, SigVersion::WITNESS_V0, checker, execdata, serror);
    

    </details>

    <details> <summary>interpreter.cpp (killed by 44a7083d43604b3d5c923ffc9011d8043a27d052): opcode limit: <code>sigversion == BASE || sigversion == WITNESS_V0</code> -> <code>sigversion == BASE</code></summary>

    diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp
    index 98b16ec..b117045 100644
    --- a/src/script/interpreter.cpp
    +++ b/src/script/interpreter.cpp
    @@ -457,7 +457,7 @@ bool EvalScript(std::vector<std::vector<unsigned char> >& stack, const CScript&
                 if (vchPushValue.size() > MAX_SCRIPT_ELEMENT_SIZE)
                     return set_error(serror, SCRIPT_ERR_PUSH_SIZE);
     
    -            if (sigversion == SigVersion::BASE || sigversion == SigVersion::WITNESS_V0) {
    +            if (sigversion == SigVersion::BASE) {
                     // Note how OP_RESERVED does not count towards the opcode limit.
                     if (opcode > OP_16 && ++nOpCount > MAX_OPS_PER_SCRIPT) {
                         return set_error(serror, SCRIPT_ERR_OP_COUNT);
    

    </details>

    Recommend reviewing per commit.

  2. test: cover TAPSCRIPT_MINIMALIF for OP_IF and OP_NOTIF with 1-byte vector 0x00 4e7de2ac4c
  3. test: cover P2WSH trailing byte mismatch f1380123b6
  4. test: cover MAX_OPS_PER_SCRIPT in P2WSH witness scripts 44a7083d43
  5. DrahtBot added the label Tests on Aug 31, 2026
  6. DrahtBot commented at 1:21 PM on August 31, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/36128.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process. A summary of reviews will appear here.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

Labels

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-08-31 17:51 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me