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

Merge rust-bitcoin/rust-bitcoin#7012: units: add track_caller to panic ops

Public commit record

What the developer wrote

Authored by Andrew Poelstra

100/100 · Strong
Merge rust-bitcoin/rust-bitcoin#7012: units: add track_caller to panic ops

48fac6da7f6d4186083496cec217eee17ac06124 units: add track_caller to panic ops (satsfy (Renato Britto))
9a6cbd9a33b16726e482931fbe4bbf7a603aebd6 units: propagate fn attrs in op macro (satsfy (Renato Britto))

Pull request description:

Part of https://github.com/rust-bitcoin/rust-bitcoin/issues/5518

Policy is to use `#[track_caller]` on functions that panic on invalid arguments. In units, there is arithmetic on block heights, weights, fee rates, etc. A panic links code inside units instead of at the caller mistake. The macro now copies fn attributes onto the impls it generates, so that `&a - &b` also links properly.


ACKs for top commit:
apoelstra:
ACK 48fac6da7f6d4186083496cec217eee17ac06124; successfully ran local tests


Tree-SHA512: 122db363e288809bd3f2c2b721d2278318facea1f9136ff30756f3359d61f5fb895b920621726aadd5f887585cf1eb1819017f0f6160f4e1556ba1d49c100c27
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This change adds Rust's #[track_caller] annotation to arithmetic operations in the rust-bitcoin 'units' crate that can panic on invalid input (for example, subtracting a larger number from a smaller one). This annotation does not change whether or when panics happen; it only improves the quality of panic error messages by pointing to the caller's code instead of deep inside the library. It is a debugging/diagnostics improvement, not a security fix.

Recommended action

No security action required. Treat as a normal quality/debugging improvement. If reviewing, verify that #[track_caller] was applied consistently to all panicking operator impls and that the macro attribute propagation does not accidentally copy attributes that should remain on the primary impl only.

Security signals we found

01

No security-relevant behavioral change: only panic location metadata is affected

02

No new unsafe code or cryptographic operations

03

No changes to bounds checks, overflow handling, or arithmetic semantics

04

Change is explicitly described by the vendor as a policy/diagnostics improvement, not a vulnerability fix

Risk score

Why this scored 19/100

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