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

Add `impl Clone for Box<{custom DST}>`

Public commit record

What the developer wrote

Authored by Martin Habovstiak

78/100 · Adequate
Add `impl Clone for Box<{custom DST}>`

`Script<T>` and `PushBytes` are unsized types wrapping `[u8]`. The standard
library only provides `Clone for Box<T>` where `T: Clone + Sized`, so
`Box<Script<T>>` and `Box<PushBytes>` were missing `Clone` implementations.

Add manual `impl<T> Clone for Box<Script<T>>` and `impl Clone for
Box<PushBytes>` that clone the underlying bytes and wrap them in new boxed
values via `from_boxed_bytes` / `from_boxed_slice_unchecked`.

Also add the corresponding `Box<{Script variant}>` and `Box<PushBytes>` fields
to the API test's `Clone` struct (guarded by `#[cfg(feature = "alloc")]`) so
that these impls are covered by the compile-time API surface tests.
✓ 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 adds the ability to clone boxed versions of two custom unsized byte-wrapping types used in Bitcoin scripts. Before this change, code that tried to clone a Box<Script> or Box<PushBytes> would fail to compile. The change is a normal API completeness fix and does not appear to fix any memory-safety bug or security vulnerability.

Recommended action

No security action required. Treat as a routine API enhancement. Reviewers may verify that the unchecked constructors preserve invariants (length < 2^32), which the commit message and code comment assert is maintained by cloning from a valid value.

Security signals we found

01

No security-relevant keywords in commit title or message

02

No unsafe code introduced in the diff

03

No bounds-checking or validation logic changed

04

No incident, CVE, or disclosure references present

05

Change is purely additive API surface expansion

Risk score

Why this scored 18/100

Our methodology →
Potential impact 0/30
Exploitability 0/25
Stealth signal 0/15
Affected reach 5/15
Confidence 9/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.