Skip to content

Conversation

@TheBlueMatt
Copy link
Collaborator

No-export tags and copy the docs from async to sync traits and structs so that bindings users actually have real docs.

@TheBlueMatt TheBlueMatt added this to the 0.2 milestone Nov 3, 2025
@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Nov 3, 2025

I've assigned @joostjager 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.

The details of these errors aren't particularly relevant, and its
not worth the effort of exporting them, so we just mark them
no-export here.
As move semantics do not map to bindings, the BOLT 12 object
builders are marked no-export. In the new `OffersMesageFlow`, here,
we also mark the methods which return these builders as no-export.
Methods like `StaticInvoice::sign` have their own signing-function
traits, so there's no actual need to use `SignFn` directly, its
just a useful generic wrapper. Sadly, because it uses `AsRef`
bounds, which aren't really practical to map in bindings, we can't
really expose it directly in bindings. Because there's an
alternative and its tricky to expose, we simply mark it no-export
here.
We do not currently support async traits or methods in our
home-grown bindings logic, so here mark them no-export.
Rather than importing `ChannelTransactionParameters` via the `use`
in `lightning::sign`, import it via its real path in
`lightning::sign::ecdsa`. This makes reading the code (incredibly
marginally) simpler, but also makes the bindings generator happy.
In 0.2 we added new `LengthLimitedRead` and `LengthReadable`
traits, but forgot to copy the no-export tags from the existing
`Read` and `Readable` traits. Here we add the missing tags.
This avoids confusing the bindings generator.
When we added the async traits and wrapper structs for the
transaction-bumping logic, we didn't bother copying the
documentation to the sync wrappers as we figured the links
sufficed. Sadly, however, this means that our bindings logic will
have no docs but a broken link to an async object that doesn't
exist.

Instead, here, we copy the docs from the async objects to the sync
ones, at least leaving behind a comment noting that both need
updating whenever one gets updated.

We also fix one bogus link in `Wallet`'s docs.
When we added the async trait for `KVStore`, we didn't bother
copying the documentation to the sync wrappers as we figured the
links sufficed. Sadly, however, this means that our bindings logic
will have no docs but a broken link to an async object that doesn't
exist.

Instead, here, we copy the docs from the async objects to the sync
ones, at least leaving behind a comment noting that both need
updating whenever one gets updated.
When we added the async wrapper for `OutputSweeper`, we didn't
bother copying the documentation to the sync wrappers as we figured
the links sufficed. Sadly, however, this means that our bindings
logic will have no docs but a broken link to an async object that
doesn't exist.

Instead, here, we copy the docs from the async objects to the sync
ones, at least leaving behind a comment noting that both need
updating whenever one gets updated.
@TheBlueMatt TheBlueMatt force-pushed the 2025-11-0.2-doc-tweaks branch from 60a7713 to 4bc993c Compare November 3, 2025 21:32
@codecov
Copy link

codecov bot commented Nov 3, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.28%. Comparing base (5f8c54a) to head (4bc993c).
⚠️ Report is 16 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4203      +/-   ##
==========================================
+ Coverage   88.86%   89.28%   +0.41%     
==========================================
  Files         180      180              
  Lines      137913   137913              
  Branches   137913   137913              
==========================================
+ Hits       122560   123130     +570     
+ Misses      12540    12172     -368     
+ Partials     2813     2611     -202     
Flag Coverage Δ
fuzzing 32.67% <ø> (+11.24%) ⬆️
tests 88.69% <ø> (-0.03%) ⬇️

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

@joostjager joostjager left a comment

Choose a reason for hiding this comment

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

Mostly basic questions for my own understanding

#[cfg(not(feature = "std"))]
/// Marker trait to optionally implement `Sync` under std.
///
/// This is not exported to bindings users as async is only supported in Rust.
Copy link
Contributor

Choose a reason for hiding this comment

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

Out of scope: some of the Maybe* markers were needed for rust 1.63. With the MSRV bump, perhaps some clean up is possible.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Nice, yea, would be good to go back and remove what we can now.

Copy link
Contributor

@joostjager joostjager Nov 4, 2025

Choose a reason for hiding this comment

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

MIssing the hypothetical rust 'unnecessary bound' warning.


/// A synchronous version of the [`WalletSource`] trait.
/// An alternative to [`CoinSelectionSourceSync`] that can be implemented and used along
/// [`WalletSync`] to provide a default implementation to [`CoinSelectionSourceSync`].
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be an option to link in the reverse direction to not duplicate?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We could do that, but previously we wanted to avoid that because it it felt like it implied that sync was the "main" way of doing things in Rust, and that async was just a special mode, which isn't what we wanted. I don't feel super strongly, but it did seem simple enough to just copy.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, that was the intention indeed. Hopefully the duplication comment is sufficient.

@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

This is all doc changes so I'm gonna go ahead and land this.

@TheBlueMatt TheBlueMatt merged commit 2d6e017 into lightningdevkit:main Nov 4, 2025
22 of 25 checks passed
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.

3 participants