Uh oh!
There was an error while loading. Please reload this page.
Drop Deref indirection for most trait parameters - #4311
Conversation
👋 Thanks for assigning @jkczyz as a reviewer! |
valentinewallace
commented
Jan 13, 2026
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
commented
Jan 13, 2026
@TheBlueMatt would appreciate conceptual review to make sure this works for the language bindings. |
valentinewallace
commented
Jan 13, 2026
Actually, it looks like this might not work for 1.75 ( |
TheBlueMatt
commented
Jan 13, 2026
It means updating the generation logic to support it, but it certainly isn't directly problematic.
You can write it as |
TheBlueMatt
commented
Jan 13, 2026
Conceptually tho yea imo we should do this. Its "the right way" to do it in rust. |
1c6cf54 to
584fec7CompareUh oh!
There was an error while loading. Please reload this page.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@## main #4311 +/- ##
==========================================
- Coverage 86.09% 85.98% -0.12%
==========================================
Files 156 156 Lines 102804 102609 -195 Branches 102804 102609 -195 ==========================================
- Hits 88508 88225 -283 - Misses 11788 11873 +85 - Partials 2508 2511 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
tnull
left a comment
There was a problem hiding this comment.
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.
584fec7 to
ad7aaa5Comparejoostjager
commented
Jan 15, 2026
Is the |
valentinewallace
commented
Jan 15, 2026
Yes, I will un-draft the PR once all the traits are complete :) |
ldk-reviews-bot
commented
Jan 15, 2026
🔔 1st Reminder Hey @TheBlueMatt! This PR has been waiting for your review. |
ad7aaa5 to
028f1fbCompare| fn message_received(&self); | ||
| } | ||
| impl<T: ChannelMessageHandler + ?Sized, C: Deref<Target = T>> ChannelMessageHandler for C { |
There was a problem hiding this comment.
Is this really better than using Arc instead of Deref, and accepting that for no-std the API might look slightly different?
There aren't that many no-std projects.
There was a problem hiding this comment.
Yeah maybe we should resolve this here #4309 (comment) before moving forward with this direction? Is it still difficult to add new trait params now that we have Claude?
There was a problem hiding this comment.
Ask Claude to add a logger to ChannelMonitor, and then report back 😂
028f1fb to
3630b91CompareDeref indirection for ChannelManager, etcDeref indirection for most trait parameters3630b91 to
2ceb510Comparevalentinewallace
commented
Jan 20, 2026
@tnull do you have any idea if the LDK Node API CI failure is easy to fix on the LDK Node end? Otherwise I can drop the |
2ceb510 to
db87b32CompareTheBlueMatt
commented
Jan 20, 2026
It is now the responsibility of |
valentinewallace
commented
Jan 20, 2026
I'm aware, but I'm not sure if it's something that should be fixed or whether the new |
TheBlueMatt
commented
Jan 20, 2026
Fair enough. It does look like its just a conflict cause there's a deref-bounded auto-impl, which shouldn't be crazy to fix. Would have to go actually try to be sure though. |
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. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Reduces generics and verbosity across the codebase, should provide equivalent behavior. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Reduces generics and verbosity across the codebase, should provide equivalent behavior. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Reduces generics and verbosity across the codebase, should provide equivalent behavior. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Reduces generics and verbosity across the codebase, should provide equivalent behavior. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Reduces generics and verbosity across the codebase, should provide equivalent behavior. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Reduces generics and verbosity across the codebase, should provide equivalent behavior. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Reduces generics and verbosity across the codebase, should provide equivalent behavior. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Reduces generics and verbosity across the codebase, should provide equivalent behavior. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Reduces generics and verbosity across the codebase, should provide equivalent behavior. Unfortunately the same improvement can't be made for KVStoreSync and Persist, due to the blanket implementation where all KVStoreSync traits implement Persist resulting in conflicting implementations. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Reduces generics and verbosity across the codebase, should provide equivalent behavior. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Reduces generics and verbosity across the codebase, should provide equivalent behavior. This could be split into multiple commits (e.g. one for OnionMessenger message handler types, one for PeerManager message handler types) but it would require adding a new IgnoringOnionMessageHandler type for the messenger handlers, due to the IgnoringMessageHandler's Deref implementation conflicting otherwise. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Reduces generics and verbosity across the codebase, should provide equivalent behavior. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Reduces generics and verbosity across the codebase, should provide equivalent behavior. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Reduces generics and verbosity across the codebase, should provide equivalent behavior. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
4c0875a to
101d206Comparevalentinewallace
commented
Jan 30, 2026
Rebased |
valentinewallace
commented
Jan 30, 2026
Only change since @tnull's last ACK was a rebase, landing |
Reduces generics and verbosity across the codebase, should provide equivalent behavior.
Inspired by #4309 (comment). Basically, instead of
Derefindirection we insteadimpl<T: Trait, D: Deref<Target = Trait>> Trait for Dfor all our traits.The majority of the codebase's traits are done in this PR, but we do skip a good amount still. In a lot of cases traits are skipped because of compiler complaints about (potential-) conflicting trait implementations, but also ran into some lifetime issues and some
c_bindingsissues.