Draft
Conversation
In a bid to create a uniffi wrapper for PaymentPreimage, we also create bindings-specific variants for the ffg types: LightningBalance, PaymentKind, and Event, all of which have fields that hold object/interface instances - PaymentPreimage, ConfirmationStatus and ClosureReason. We implement type conversion for the types created. Unfortunately the build does not compile. According to the uniffi docs: "When you want to ... store object instances as fields in records, the underlying Rust code will need to work with Arc<T> directly, to ensure that the code behaves in the way that UniFFI expects." Arc-ing the fields that hold PaymentPreimage, ConfirmationStatus, & ClosureReason is not sufficient to circumvent the error associated with objects not being supported in enum variants.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does
In a bid to create a uniffi wrapper for
PaymentPreimageas aninterface object, we also create bindings-specific variants for the
following types:
LightningBalance,PaymentKind, andEvent,All of which have fields that hold object/interface instances -
PaymentPreimage,ConfirmationStatusandClosureReason.This is not currently supported in uniffi 0.27.3
To workaround this limitation, we
Arcthese types and implement type conversionfor the new FFI types created.
Unfortunately this also does not build. Even though, according to the uniffi docs:
this
Arc-ing the fields that holdPaymentPreimage,ConfirmationStatus,&
ClosureReasonin the related enums is not sufficient to circumventthe error associated with objects not being supported in enum variants.
Update
We discover that support for interface in enum variant fields have been added to uniffi 0.30.0
but this upgrade will bring in a significant amount of changes to the entire library, discounting
the boilerplate required to support exposing
PaymentPreimageto FFI as an interface object.Following conversations with maintainer, we agree to pause this feature work so that blocked
PRs can move forward. See some related conversation here.