AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Low 29 Bitcoin

primitives: split RedeemScript and RedeemScriptBuf from script

Public commit record

What the developer wrote

Authored by Andrew Poelstra

83/100 · Strong
primitives: split RedeemScript and RedeemScriptBuf from script

There were multiple places in bitcoin/src/blockdata/script/tests.rs
where we were being sloppy and reinterpreting redeem scripts as
witness scripts and vice-versa. I am happy to say these no longer
compile :).

This completes the hard part of script tagging -- we still need to
add WitnessScript and TapScript, but these are part of "modern"
Bitcoin and therefore aren't randomly cast to/from other script types.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification
The short version

What changed, and why it matters

This commit is a code-quality and type-safety refactor in the rust-bitcoin library. It introduces a dedicated RedeemScript type so that P2SH redeem scripts can no longer be accidentally confused with other script types (such as witness scripts). The change makes several previously-allowed unsafe conversions fail at compile time, which helps prevent future bugs rather than fixing an active vulnerability.

Recommended action

No immediate action required. Users of the library should update code that passes ScriptBuf where RedeemScriptBuf is now expected, and review any custom conversions between redeem and witness scripts for correctness.

Security signals we found

01

Type-system hardening to prevent cross-casting of script types

02

Author acknowledges prior sloppy handling of redeem/witness scripts in tests

03

Compile-time prevention of invalid script type reinterpretation

04

PSBT redeem_script fields narrowed to RedeemScriptBuf

Risk score

Why this scored 29/100

Our methodology →
Potential impact 5/30
Exploitability 3/25
Stealth signal 4/15
Affected reach 6/15
Confidence 7/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.