Merge bitcoin/bitcoin#36054: test: add script_tests cases covering interpreter mutants
What changed, and why it matters
This commit only adds new test cases to Bitcoin Core's script test suite. It does not change any production code. The tests are designed to catch accidental code changes ('mutants') in the script interpreter that could affect consensus rules, but the commit itself is a defensive test addition with no active vulnerability being fixed.
No immediate action required. Treat as routine hardening of consensus test coverage. Reviewers may verify the new test vectors correctly fail against the described mutants.
Security signals we found
Adds consensus-relevant regression tests for script interpreter mutants
References externally discovered live mutants on bitcoincore.space
Targets DERSIG, opcode counting, OP_WITHIN, and OP_FROMALTSTACK behavior
No production code changes; purely test coverage
Evidence from the diff
The commit merges PR #36054, which adds four test vectors to src/test/data/script_tests.json. Each new test targets a specific mutation in src/script/interpreter.cpp that would alter consensus behavior: OP_FROMALTSTACK failing to pop the altstack, OP_WITHIN failing to pop all three inputs, OP_16 incorrectly counting toward the opcode limit, and DERSIG accepting a non-compound signature type. The actual interpreter source code is untouched; only regression tests are added.
Changed components
src/test/data/script_tests.jsonInspect captured patch +7 / −0
### src/test/data/script_tests.json
@@ -221,6 +221,7 @@
["11 -100 100", "WITHIN", "P2SH,STRICTENC", "OK"],
["-2147483647 -100 100", "WITHIN NOT", "P2SH,STRICTENC", "OK"],
["2147483647 -100 100", "WITHIN NOT", "P2SH,STRICTENC", "OK"],
+["0 0 1", "WITHIN DEPTH 1 EQUALVERIFY", "P2SH,STRICTENC", "OK", "WITHIN must pop all 3 elements"],
["2147483647 2147483647 SUB", "0 EQUAL", "P2SH,STRICTENC", "OK"],
["2147483647 DUP ADD", "4294967294 EQUAL", "P2SH,STRICTENC", "OK", ">32 bit EQUAL is valid"],
@@ -332,6 +333,10 @@
"0x616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161",
"P2SH,STRICTENC", "OK",
"201 opcodes executed. 0x61 is NOP"],
+["1",
+"0x60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060",
+"P2SH,STRICTENC", "OK",
+"202 OP_16 do not count towards the 201 opcode limit."],
["1 2 3 4 5 0x6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f",
"1 2 3 4 5 0x6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f",
"P2SH,STRICTENC", "OK",
@@ -1042,6 +1047,7 @@
["NOP", "TOALTSTACK 1", "P2SH,STRICTENC", "INVALID_STACK_OPERATION", "but, hey, more is always better, right?"],
["1", "FROMALTSTACK", "P2SH,STRICTENC", "INVALID_ALTSTACK_OPERATION"],
+["1", "2 TOALTSTACK FROMALTSTACK FROMALTSTACK", "P2SH,STRICTENC", "INVALID_ALTSTACK_OPERATION", "FROMALTSTACK must pop the altstack"],
["1", "2DROP 1", "P2SH,STRICTENC", "INVALID_STACK_OPERATION"],
["1", "2DUP", "P2SH,STRICTENC", "INVALID_STACK_OPERATION"],
["1 1", "3DUP", "P2SH,STRICTENC", "INVALID_STACK_OPERATION"],
@@ -1286,6 +1292,7 @@
["0x17 0x3014020002107777777777777777777777777777777701", "0 CHECKSIG NOT", "DERSIG", "SIG_DER", "Zero-length R is incorrectly encoded for DERSIG"],
["0x17 0x3014021077777777777777777777777777777777020001", "0 CHECKSIG NOT", "DERSIG", "SIG_DER", "Zero-length S is incorrectly encoded for DERSIG"],
["0x27 0x302402107777777777777777777777777777777702108777777777777777777777777777777701", "0 CHECKSIG NOT", "DERSIG", "SIG_DER", "Negative S is incorrectly encoded for DERSIG"],
+["0x27 0x312402107777777777777777777777777777777702107777777777777777777777777777777701", "0 CHECKSIG NOT", "DERSIG", "SIG_DER", "Non-compound type is incorrectly encoded for DERSIG"],
["Some basic segwit checks"],
[["00", 0.00000000 ], "", "0 0x206e340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d", "P2SH,WITNESS", "EVAL_FALSE", "Invalid witness script"],Why this scored 12/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.