Skip to content

consensus: pin executed OP_VERIF and raw ECDSA hashtypes - #1065

Merged
reardencode merged 1 commit into
masterfrom
consensus/verif-sighash-corpus
Oct 18, 2026
Merged

reardencode merged 1 commit into
masterfrom
consensus/verif-sighash-corpus

Conversation

@rearden-grok

@rearden-grok rearden-grok Bot commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Pins OP_VERIF and OP_VERNOTIF in the taken IF branch, in every signature version. The untaken branch was already in the corpus.
  • Pins ECDSA hashtypes 0x00, 0x80, and 0x85: DERSIG accepts a signature over that raw byte, STRICTENC rejects it, and rewriting the byte to 0x01 or 0x81 rejects.
  • BIP66 is_valid_signature_encoding still does not range-check the hashtype byte. is_defined_hashtype remains the STRICTENC check.

Checked against our interpreter and Core v31.1 VerifyScript (script-oracle). No production change: Core already fails unexecuted OP_VERIF because 0x65/0x66 sit inside OP_IF..=OP_ENDIF and hit BAD_OPCODE, and IsValidSignatureEncoding does not check the hashtype range.

Test plan

  • cargo test -p rbitcoin-consensus --lib script_corpus_rows_match_our_interpreter
  • cargo test -p rbitcoin-consensus --lib bip66_encoding_edge_cases
  • cargo test --manifest-path script-oracle/Cargo.toml
  • fmt, clippy, deny, ast-grep, cargo test --workspace, ci-os-smoke.sh

OP_VERIF and OP_VERNOTIF already fail in an untaken branch. These rows
also fail them in the taken branch. DERSIG still accepts hashtype 0x00,
0x80, and 0x85, STRICTENC rejects them, and rewriting the type byte
makes the signature miss.
@reardencode
reardencode merged commit c70b341 into master Oct 18, 2026
18 checks passed
@rearden-grok
rearden-grok Bot deleted the consensus/verif-sighash-corpus branch October 18, 2026 15:29
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.

1 participant