Skip to content

Conversation

@valentinewallace
Copy link
Contributor

@valentinewallace valentinewallace commented Jan 13, 2026

Reduces generics and verbosity across the codebase, should provide equivalent behavior.

Inspired by #4309 (comment). Basically, instead of Deref indirection we instead impl<T: Trait, D: Deref<Target = Trait>> Trait for D for all our traits.

@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Jan 13, 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.

@valentinewallace
Copy link
Contributor Author

If this looks good and works for language bindings, I/claude can do it for all the other traits. I feel like this is a solid improvement.

@valentinewallace
Copy link
Contributor Author

@TheBlueMatt would appreciate conceptual review to make sure this works for the language bindings.

@valentinewallace
Copy link
Contributor Author

Actually, it looks like this might not work for 1.75 (associated type bounds are unstable). Not sure if we plan on bumping that anytime soon?

@TheBlueMatt
Copy link
Collaborator

@TheBlueMatt would appreciate conceptual review to make sure this works for the language bindings.

It means updating the generation logic to support it, but it certainly isn't directly problematic.

Actually, it looks like this might not work for 1.75 (associated type bounds are unstable). Not sure if we plan on bumping that anytime soon?

You can write it as impl<T: BroadcasterInterface, B: Deref<Target = T>> BroadcasterInterface for B { instead of impl<B: Deref<Target: BroadcasterInterface>> BroadcasterInterface for B {.

@TheBlueMatt
Copy link
Collaborator

Conceptually tho yea imo we should do this. Its "the right way" to do it in rust.

@codecov
Copy link

codecov bot commented Jan 13, 2026

Codecov Report

❌ Patch coverage is 93.20388% with 28 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.57%. Comparing base (b4fb555) to head (ad7aaa5).

Files with missing lines Patch % Lines
lightning/src/ln/channel.rs 92.10% 6 Missing ⚠️
lightning/src/chain/channelmonitor.rs 85.29% 5 Missing ⚠️
lightning/src/chain/chainmonitor.rs 75.00% 4 Missing ⚠️
lightning-background-processor/src/lib.rs 62.50% 3 Missing ⚠️
lightning/src/util/anchor_channel_reserves.rs 0.00% 3 Missing ⚠️
lightning/src/blinded_path/payment.rs 75.00% 2 Missing ⚠️
lightning/src/ln/chan_utils.rs 66.66% 2 Missing ⚠️
lightning/src/onion_message/messenger.rs 90.90% 2 Missing ⚠️
lightning/src/ln/channelmanager.rs 93.75% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4311      +/-   ##
==========================================
- Coverage   86.58%   86.57%   -0.02%     
==========================================
  Files         158      158              
  Lines      102367   102194     -173     
  Branches   102367   102194     -173     
==========================================
- Hits        88636    88475     -161     
+ Misses      11316    11303      -13     
- Partials     2415     2416       +1     
Flag Coverage Δ
fuzzing 36.90% <42.82%> (-0.03%) ⬇️
tests 85.86% <93.20%> (-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.

Copy link
Contributor

@tnull tnull left a comment

Choose a reason for hiding this comment

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

Note that you'll need to bump lightning-liquidity's version to 0.3.0+git to get the SemVer checks to pass, as it's an API-breaking change.

Useful for upcoming commits where we otherwise break SemVer checks by changing
the ALiquidityManager associated types.
Reduces generics and verbosity across the codebase, should
provide equivalent behavior.
Reduces generics and verbosity across the codebase, should provide equivalent
behavior.
Reduces generics and verbosity across the codebase, should provide equivalent
behavior.
Reduces generics and verbosity across the codebase, should provide equivalent
behavior.
Reduces generics and verbosity across the codebase, should provide equivalent
behavior.
Reduces generics and verbosity across the codebase, should provide equivalent
behavior.
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.

4 participants