Skip to content

Use SignedAmount::unsigned_abs to avoid overflow#4383

Merged
TheBlueMatt merged 1 commit intolightningdevkit:mainfrom
jkczyz:2026-02-unsigned-abs
Feb 4, 2026
Merged

Use SignedAmount::unsigned_abs to avoid overflow#4383
TheBlueMatt merged 1 commit intolightningdevkit:mainfrom
jkczyz:2026-02-unsigned-abs

Conversation

@jkczyz
Copy link
Contributor

@jkczyz jkczyz commented Feb 4, 2026

In debug mode, using SignedAmount::abs can lead to an integer overflow when used with SignedAmount::MIN. Use SignedAmount::unsigned_abs to avoid this.

In debug mode, using SignedAmount::abs can lead to an integer overflow
when used with SignedAmount::MIN. Use SignedAmount::unsigned_abs to
avoid this.
@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Feb 4, 2026

👋 Thanks for assigning @TheBlueMatt as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@jkczyz jkczyz requested a review from TheBlueMatt February 4, 2026 15:57
Copy link
Contributor

@wpaulino wpaulino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth adding a test?

Copy link
Collaborator

@TheBlueMatt TheBlueMatt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Meh, not sure its worth bothering to test a bug that isn't even a bug in prod. The appropriate test would be a CI check that bans the abs method in our code, anyway.

@TheBlueMatt TheBlueMatt merged commit 7fcfb39 into lightningdevkit:main Feb 4, 2026
18 of 19 checks passed
@codecov
Copy link

codecov bot commented Feb 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.01%. Comparing base (817ab5e) to head (2d948fd).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4383      +/-   ##
==========================================
- Coverage   86.01%   86.01%   -0.01%     
==========================================
  Files         156      156              
  Lines      102857   102857              
  Branches   102857   102857              
==========================================
- Hits        88476    88473       -3     
- Misses      11871    11875       +4     
+ Partials     2510     2509       -1     
Flag Coverage Δ
tests 86.01% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants