Skip to content

Conversation

@TheBlueMatt
Copy link
Collaborator

A handful of cleanups now that we bumped the MSRV and can use impl Trait in trait methods.

@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Oct 25, 2025

👋 Thanks for assigning @tnull 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.

@TheBlueMatt
Copy link
Collaborator Author

There's still a few Box::pins in lightning-background-processor that we really should be able to get rid of, but its not entirely trivial so I didn't do it here.

@TheBlueMatt TheBlueMatt force-pushed the 2025-10-msrv-less-box branch 13 times, most recently from 4edab1f to e8fa417 Compare October 25, 2025 20:54
Now that it has the same MSRV as everything else in the workspace,
it doesn't need to live on its own.
Now that our MSRV is above 1.68 we can use the `pin!` macro to
avoid having to `Box` various futures, avoiding some allocations,
especially in `lightning-net-tokio`, which happens in a tight loop.
Now that our MSRV is 1.75, we can return `impl Trait` from trait
methods. Here we use this to clean up `KVStore` methods, dropping
the `Pin<Box<dyn ...>>` we had to use to have trait methods return
a concrete type. Sadly, there's two places where we can't drop a
`Box::pin` until we switch to edition 2024.
@TheBlueMatt TheBlueMatt force-pushed the 2025-10-msrv-less-box branch from e8fa417 to d54050d Compare October 25, 2025 20:55
@codecov
Copy link

codecov bot commented Oct 25, 2025

Codecov Report

❌ Patch coverage is 73.74517% with 68 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.79%. Comparing base (be24841) to head (724caa8).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
lightning-background-processor/src/lib.rs 0.00% 20 Missing ⚠️
lightning-block-sync/src/rest.rs 27.77% 13 Missing ⚠️
lightning-block-sync/src/rpc.rs 27.77% 13 Missing ⚠️
lightning-block-sync/src/gossip.rs 0.00% 9 Missing ⚠️
lightning/src/util/test_utils.rs 25.00% 6 Missing ⚠️
lightning-persister/src/fs_store.rs 90.90% 4 Missing ⚠️
lightning-net-tokio/src/lib.rs 60.00% 2 Missing ⚠️
lightning-liquidity/src/lsps2/service.rs 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4175      +/-   ##
==========================================
- Coverage   88.81%   88.79%   -0.02%     
==========================================
  Files         180      180              
  Lines      137105   137120      +15     
  Branches   137105   137120      +15     
==========================================
- Hits       121765   121761       -4     
- Misses      12529    12539      +10     
- Partials     2811     2820       +9     
Flag Coverage Δ
fuzzing 21.60% <1.98%> (+<0.01%) ⬆️
tests 88.64% <73.74%> (-0.02%) ⬇️

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.

Now that our MSRV is 1.75, we can return `impl Trait` from trait
methods. Here we use this to clean up `lightning-block-sync` trait
methods, dropping the `Pin<Box<dyn ...>>` we had to use to have
trait methods return a concrete type.
Now that our MSRV is 1.75, we can return `impl Trait` from trait
methods. Here we use this to clean up `lightning` crate trait
methods, dropping the `Pin<Box<dyn ...>>`/`AsyncResult` we had to
use to have trait methods return a concrete type.
Now that we have an MSRV that supports returning `impl Trait` in
trait methods, we can use it to avoid the `Box<dyn ...>` we had
spewed all over our BOLT 11 invoice serialization.
@TheBlueMatt TheBlueMatt force-pushed the 2025-10-msrv-less-box branch from d54050d to 004c76a Compare October 25, 2025 21:08
@TheBlueMatt TheBlueMatt force-pushed the 2025-10-msrv-less-box branch from 9d5a3e2 to 724caa8 Compare October 26, 2025 11:50
@tnull tnull requested review from tnull and removed request for wpaulino October 27, 2025 06:56
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.

Given how much this cleans up the new async traits, I do wonder if we want to ship this for 0.2 afterall?

"lightning-macros",
"lightning-dns-resolver",
"lightning-liquidity",
"lightning-transaction-sync",
Copy link
Contributor

@tnull tnull Oct 27, 2025

Choose a reason for hiding this comment

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

As BDK is about to bump their MSRV to 1.85, let's not bother with this if we need to move it out again shortly.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I thought they agreed to keep the utility crates to 1.75?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Actually, I thought they were gonna walk it back to 1.75...

@ldk-reviews-bot
Copy link

👋 The first review has been submitted!

Do you think this PR is ready for a second reviewer? If so, click here to assign a second reviewer.

@TheBlueMatt
Copy link
Collaborator Author

Given how much this cleans up the new async traits, I do wonder if we want to ship this for 0.2 afterall?

Meh, I don't think they clean them up that much, they just remove a Box::pin, and actually they become a bit more annoying to work with (see the few places we have to keep the Box::pin cause of rustc mess). It becomes a bit easier to work with in edition 2024, which luckily a downstream crate could choose to use if they want.

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.

3 participants