#36458 Test: Add script vectors for interpreter edges

ReviewabilityReviewsAgreementSize
#36458 benthecarman Test: Add script vectors for interpreter edgesReady1Strong0 + 38 tests
  • Cover script interpreter and transaction validation edge cases in static test data files
  • Helps alternate implementations and downstream tools that rely on Core's static tests catch subtle bugs
  • Ready to review
  • Strong support with no open objections
  • Verified by running the new test vectors through btclib (fametrano)
  • Concept approval because covering gaps found by alternate implementations improves test suites (darosior)
  • 0 lines added or modified outside tests
  • 38 lines added or modified in tests
  • 1 lines removed in total
  • 2 files, 1 commits
Test infrastructure#32 of 54
P3 · test coverage
  • P3 because it expands static test coverage for subtle script interpreter and policy validation edge cases
  • Mainly helps downstream consumers and alternate implementations rather than catching bugs in Core itself
Reviewability: ReadyStalePaused
Agreement: StrongPositivePositive w/ caveatsNeutralMildDisputedBlockedCrickets
Reviews: current code-review ACKs, then (+stale ACKs) and -NACKs; greener = more ACKs.
Size: lines added or modified outside tests, then in tests; greener = smaller.

Goal

Adds test vectors to script_tests.json and tx_invalid.json for script interpreter and transaction validation edge cases. The additions cover OP_CHECKSEQUENCEVERIFY with negative operand -2, OP_IFDUP on negative zero and non-minimal zero, OP_ROLL with identical values on stack, Taproot output keys with invalid curve x-coordinates, and single-flag execution for STRICTENC, LOW_S, and NULLFAIL.

Problem: Downstream and alternate implementations that rely on Bitcoin Core's static test suite can miss subtle consensus and policy interpreter edge cases. Additionally, certain policy behaviors were previously only exercised when Bitcoin Core's test harness dynamically augmented validation flags, leaving static JSON consumers without direct test coverage.

Evidence of importance:

  • Author note in description: 'These were discovered by finding gaps in an alternate implementation (bitcoin-s)'
  • Author note in commit message: 'Some policy cases were only caught by the tx_valid harness adding flags back, which implementations copying the JSON don't replicate.'

Scope: Test data file updates only.

Risk of a mistake: low (tests). Only modifies static JSON test data files and does not change any production or validation code.

Reviewability

Ready

Nothing known that would invalidate a review now.

Waiting on (from the thread read):

  • nothing: PR is reviewed and approved with all questions answered

Agreement

Strong

substantive support, no open objection (fametrano, darosior)

Thread notes: Added darosior to participants with Concept ACK and full ACK. Recorded question on redundancy in tx_invalid.json which author answered.

Objections, suggestions, and questions:

ReviewerTypeHarm, request, or questionStatusMust beAuthor repliedQuote
darosior (member)question, scopewhether the tx_invalid.json vector is redundant with the script_tests.json vectoranswered · author replied agreeing it is redundant but that redundancy does not hurt hereansweredyes2026-10-22: 'Isn't this one redundant with the script_tests.json one you added above?'
Status from: 2026-10-22: benthecarman: 'yeah i guess, being redundant doesn't really hurt here though'

Support:

  • fametrano (contributor) (2026-10-09) [tested: script_tests.json, tx_invalid.json]: ran the new vectors through btclib; all script_tests.json rows give expected results and error codes, and the 4 tx_invalid.json rows fail under listed flags and pass with no flags
  • darosior (member) (Concept ACK, 2026-10-22) [read]: It's useful to know what re-implementations got wrong, as it's often non-obvious stuff we can better cover in our automated testing.
  • darosior (member) (ACK, 2026-10-22): (no reason given) [not substantive]

Participants:

  • fametrano (contributor, support, 1 statements 2026-10-09 to 2026-10-09): tested vectors against btclib and verified expected results
  • fanquake (member, neutral, 1 statements 2026-10-16 to 2026-10-16): pinged instagibbs
  • darosior (member, support, 5 statements 2026-10-22 to 2026-10-22): Concept ACK and approved; asked about test vector redundancy

Files

39 lines under test/bench/ci.

  • src/test/data/script_tests.json +22/-1
  • src/test/data/tx_invalid.json +16/-0

Card

The short text the ranking pass compares across PRs.

Adds test vectors to script_tests.json and tx_invalid.json covering interpreter edge cases including OP_CHECKSEQUENCEVERIFY with -2, OP_IFDUP on negative zero, invalid Taproot public key x-coordinates, and isolated policy flags. Alternate implementations consuming Bitcoin Core's static test vectors miss these corner cases, particularly where Bitcoin Core's test harness previously relied on dynamic flag injection. The edge cases were identified by finding gaps in bitcoin-s.

Data

dossier JSON · extract JSON · model ledger, generated 2026-10-23T01:17, confidence high, input hash 6588154a411766a9
thread read through 2026-10-22 (8 statements), head 5d2fb8d309
labels: Tests

Categories

Test infrastructure

P3 · test coverage

Adds test coverage for script interpreter edge cases discovered through alternate implementations. While it does not catch a regression in Bitcoin Core itself, expanding static test vectors provides worthwhile coverage for subtle consensus and policy edge cases.

Membership: Carries the Tests label and updates static test data files (src/test/data/script_tests.json and tx_invalid.json) to expand unit test coverage.

Factors: security/stability 1, bug 0, performance 0, user value 0, leverage 0