According to corecheck, the following mutant is not caught by any test (https://corecheck.dev/mutation/src/script/interpreter.cpp).
0diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp
1index 61ea7f4503..4f6fa34836 100644
2--- a/src/script/interpreter.cpp
3+++ b/src/script/interpreter.cpp
4@@ -746,7 +746,6 @@ bool EvalScript(std::vector<std::vector<unsigned char> >& stack, const CScript&
5 return set_error(serror, SCRIPT_ERR_INVALID_STACK_OPERATION);
6 valtype vch1 = stacktop(-6);
7 valtype vch2 = stacktop(-5);
8- stack.erase(stack.end()-6, stack.end()-4);
9 stack.push_back(vch1);
10 stack.push_back(vch2);
11 }
It means we’re not testing the behavior of the OP_2ROT opcode properly. The normal behavior is: [1, 2, 3, 4, 5, 6] → OP_2ROT → [3, 4, 5, 6, 1, 2]
(6 elements). However, by deleting the erase
, it becomes: [1, 2, 3, 4, 5, 6] → OP_2ROT → [1, 2, 3, 4, 5, 6, 1, 2] (8 elements)
which is obviously wrong. In script_tests.json
, we have some test cases that includes the OP_2ROT which correctly tests the move part of 2ROT but not the erase one. See:
0["25 24 23 22 21 20", "2ROT 24 EQUAL", "P2SH,STRICTENC", "OK"],
1["25 24 23 22 21 20", "2ROT DROP 25 EQUAL", "P2SH,STRICTENC", "OK"],
2["25 24 23 22 21 20", "2ROT 2DROP 20 EQUAL", "P2SH,STRICTENC", "OK"],
3["25 24 23 22 21 20", "2ROT 2DROP DROP 21 EQUAL", "P2SH,STRICTENC", "OK"],
4["25 24 23 22 21 20", "2ROT 2DROP 2DROP 22 EQUAL", "P2SH,STRICTENC", "OK"],
5["25 24 23 22 21 20", "2ROT 2DROP 2DROP DROP 23 EQUAL", "P2SH,STRICTENC", "OK"],
6["25 24 23 22 21 20", "2ROT 2ROT 22 EQUAL", "P2SH,STRICTENC", "OK"],
7["25 24 23 22 21 20", "2ROT 2ROT 2ROT 20 EQUAL", "P2SH,STRICTENC", "OK"],
That said, this PR adds one more test case to the case mentioned.