Skip to content
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

[0.0.125-bindings] 0.0.125 Bindings Changes #3364

Merged

Conversation

TheBlueMatt
Copy link
Collaborator

Sames as 0.0.124 bindings changes.

TheBlueMatt and others added 21 commits October 14, 2024 19:15
...as the bindings generation does not currently have the ability
to map a reference to a `NodeId` inside a tuple.
Bindings can't handle references in return types, so reduce the
visibility to pub(crate).
The bindings currently get confused by the implicit `Sign` type, so
we temporarily remove it on the `impl` here.
Re-exports in Rust make `use` statements a little shorter, but for
otherwise don't materially change a crate's API. Sadly, the C
bindings generator currently can't figure out re-exports, but it
also exports everything into one global namespace, so it doesn't
matter much anyway.
Having struct fields with references to other structs is tough in
our bindings logic, but even worse if the fields are in an enum.
Its simplest to just take the clone penalty here.
The scorer currently relies on an associated type for the fee
parameters. This isn't supportable at all in bindings, and for
lack of a better option we simply hard-code the parameter for all
scorers  to `ProbabilisticScoringFeeParameters`.
These are not expressible in C/most languages, and thus must be
hidden.
Rather than `ChannelMonitor` only being clonable when the signer is
clonable, we require all signers to be clonable and then make all
`ChannelMonitor`s clonable.
As we cannot express slices without inner references in bindings
wrappers.
Bindings don't accept dyn traits, but instead map any traits to a
single dynamic struct. Thus, we can always take a specific trait
to accept any implementation, which we do here.
Mapping an `Hmac<Sha256>` would require somewhat custom logic as
we'd have to behave differently based on generic parameters, so its
simplest to just swap it to a `[u8; 32]` instead.
The bindings really should support this, but currently they don't
and its late enough in the release cycle I don't want to try to fix
that.
@TheBlueMatt TheBlueMatt added this to the 0.0.125 milestone Oct 14, 2024
@TheBlueMatt
Copy link
Collaborator Author

Landing as its identical to 0.0.124/just rebased:

$ git range-diff v0.0.124..upstream/0.0.124-bindings v0.0.125...c85a315866ed0282993544e127ed7c61193332ae
 1:  12411d1a2 <  -:  --------- Specify imports manually in `types::features::sealed`
 2:  492b9c266 =  1:  dec090902 Make `as_directed_to` non-public
 3:  d5ef56830 =  2:  292900fa0 Restrict ChannelInfo::as_directed_from visibility
 4:  0f1e81926 =  3:  c4de4c337 Use an explicit `Sign` type on the `ChannelMonitor` read tuple
 5:  212e4a5ab =  4:  74030c913 Export `outbound_payment` structs in their respective modules
 6:  4ae9bcf49 =  5:  f40aa37ca Avoid enums containing references with lifetimes
 7:  0b978a1f4 =  6:  18f1e34fb Mark a few offers fields no-export as we have no mapping for them
 8:  ec446c986 =  7:  810e88c5c Use `[u8; 3]` not `CurrencyCode` to skip type aliases to primitives
 9:  d8ec8877e =  8:  bda3c4636 Hard-code scorer parameters to `ProbabilisticScoringFeeParameters`
10:  f24cef0fa =  9:  1ac1fe820 Mark several types no-export which should be exported eventually
11:  c029a654b = 10:  e55b8e4d5 `crate`-only several BOLT12 methods that require unbounded generics
12:  67fb2f4f8 = 11:  5f526f820 Make ChannelMonitor always clonable
13:  e9b7acb8a = 12:  2459a77de Make the custom message traits cloneable as they're deep in nested structs
14:  c6cfe8871 = 13:  2dac3f832 Avoid slices without inner references
15:  6c8e19a36 = 14:  a7a2860cd Avoid options holding references in the public API
16:  8f6819d40 = 15:  5ba0359b1 Hide `Direction::select_node_id` due to lifetimes
17:  fa674ef58 = 16:  8c05cdabe Drop `SerialId` type as bindings don't support primitive aliasing
18:  9301a0d75 = 17:  640d4421d Minimal updates to `lightning-transaction-sync` for bindings
19:  3ffb48d3f = 18:  28aca7d1b Require an OM in BP as this should generally be true and its easier to map
20:  020b479da = 19:  3f1a9b1c9 Avoid returning references in `NodeAnnouncementInfo` accessors
21:  03d4eb52e = 20:  d23d57d9b Use `[u8; 32]` rather than `Hmac<Sha256>` for simplicity
22:  31b6b712e = 21:  c85a31586 Use inline bounds for secp contexts, rather than `where` clauses
$ 

@TheBlueMatt TheBlueMatt merged commit f0ac360 into lightningdevkit:0.0.125-bindings Oct 14, 2024
2 of 19 checks passed
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.

2 participants