Skip to content

Small bindings tweaks for 0.0.118 #2679

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 23, 2023

Conversation

TheBlueMatt
Copy link
Collaborator

Okay, actually the last PR, I promise.

Bindings aren't currently able to handle a struct with a generic
which is actually exposed - we map all structs concretely to a
single type, whereas having fluctuating types on a struct requires
mapping the inner field to a trait first.

Since this isn't super practical, we make `PendingOnionMessage` a
tuple in bindings, rather than a struct.
rustc doesn't allow `--features` with `-p`, so we simply skip the
steps that rely on it.
@TheBlueMatt TheBlueMatt added this to the 0.0.118 milestone Oct 23, 2023
@TheBlueMatt TheBlueMatt changed the title Small bindings tweaks for 0.0.116 Small bindings tweaks for 0.0.118 Oct 23, 2023
@codecov-commenter
Copy link

codecov-commenter commented Oct 23, 2023

Codecov Report

Attention: 34 lines in your changes are missing coverage. Please review.

Comparison is base (3f416bc) 88.76% compared to head (c40fc0f) 88.75%.

❗ Current head c40fc0f differs from pull request most recent head 35eb38d. Consider uploading reports for the commit 35eb38d to get more accurate results

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2679      +/-   ##
==========================================
- Coverage   88.76%   88.75%   -0.02%     
==========================================
  Files         112      112              
  Lines       88460    88474      +14     
  Branches    88460    88474      +14     
==========================================
  Hits        78525    78525              
- Misses       7698     7707       +9     
- Partials     2237     2242       +5     
Files Coverage Δ
lightning/src/onion_message/offers.rs 11.11% <ø> (ø)
lightning/src/onion_message/messenger.rs 76.05% <0.00%> (-2.76%) ⬇️
lightning/src/ln/channelmanager.rs 78.82% <0.00%> (+0.01%) ⬆️

... and 8 files with indirect coverage changes

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

/// Typically, this is used for messages initiating a message flow rather than in response to
/// another message. The latter should use the return value of [`Self::handle_custom_message`].
#[cfg(c_bindings)]
fn release_pending_custom_messages(&self) -> Vec<(Self::CustomMessage, Destination, Option<BlindedPath>)>;
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this need to change if PendingOnionMessage is a type alias for a tuple in bindings? If it does, then it doesn't seem like PendingOnionMessage needs to be pub for bindings.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Right, that is the first thing I tried and it didn't really work. Type aliases in bindings are handled a bit specifically for cases we rely on (eg the scorer), so it didn't quite work here. I will drop it to not be pub.

Copy link
Collaborator Author

@TheBlueMatt TheBlueMatt Oct 23, 2023

Choose a reason for hiding this comment

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

Actually, reverted this. onion_messages/mod.rs re-exports it as pub so it doesnt compile as pub-crate, and I'd rather not have any more diff than is required. There's no reason not to export it, the bindings won't include it anyway.

@TheBlueMatt TheBlueMatt force-pushed the 2023-10-116-bindings-1 branch from 35eb38d to c40fc0f Compare October 23, 2023 21:10
@TheBlueMatt
Copy link
Collaborator Author

$ git diff-tree -U1 35eb38df c40fc0fb
diff --git a/lightning/src/onion_message/messenger.rs b/lightning/src/onion_message/messenger.rs
index cf0f9e086..10991e037 100644
--- a/lightning/src/onion_message/messenger.rs
+++ b/lightning/src/onion_message/messenger.rs
@@ -178,3 +178,3 @@ pub struct PendingOnionMessage<T: OnionMessageContents> {
 /// enqueued for sending.
-pub type PendingOnionMessage<T: OnionMessageContents> = (T, Destination, Option<BlindedPath>);
+pub(crate) type PendingOnionMessage<T: OnionMessageContents> = (T, Destination, Option<BlindedPath>);
$ 

jkczyz
jkczyz previously approved these changes Oct 23, 2023
wpaulino
wpaulino previously approved these changes Oct 23, 2023
@TheBlueMatt TheBlueMatt dismissed stale reviews from wpaulino and jkczyz via 35eb38d October 23, 2023 21:24
@TheBlueMatt TheBlueMatt force-pushed the 2023-10-116-bindings-1 branch from c40fc0f to 35eb38d Compare October 23, 2023 21:24
@TheBlueMatt TheBlueMatt merged commit d0795d8 into lightningdevkit:main Oct 23, 2023
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