Skip to content

Minimise need to depend on rust-dlc in leaf crates#214

Closed
luckysori wants to merge 4 commits intomainfrom
chore/dlc-manager-internal-dep
Closed

Minimise need to depend on rust-dlc in leaf crates#214
luckysori wants to merge 4 commits intomainfrom
chore/dlc-manager-internal-dep

Conversation

@luckysori
Copy link
Copy Markdown
Contributor

This dependency should ideally only be known by core crates such as ln-dlc-node.

We define a method get_new_address on Node so that we can control how we call the underlying on-chain wallet, rather than letting consumers call the wallet through a trait that is designed for a completely different purpose.

We also turn the generic get_dlcs API into the more specific get_confirmed_dlcs, as this is the only thing that is currently needed. This way we can avoid consumers needing to understand types defined by rust-dlc. The get_confirmed_dlcs API and the matching Dlc type should evolve (and perhaps even disappear) as we meet new requirements.

We cannot remove the dlc-manager dependency from the coordinator just yet because we haven't yet defined our own type for the ContractInput. Once we do so, we should remove this dependency and finally ensure that rust-dlc is an implementation detail from the perspective of our leaf crates.

Most notably:

- We now depend on the `split-tx-experiment` branch of
`p2pderivatives/rust-lightning` fork. It appears that the changes we
had in our fork are no longer needed and we need to update the
dependency to be able to use the new branch of `rust-dlc`.

- We've had to add our own `CustomSigner` and `CustomKeysManager`
since `rust-dlc` no longer exports them. For now we have just inlined
the implementations used in the `rust-dlc` tests.
We no longer need to patch the dependency after version 2.0 has been
published.
This dependency should ideally only be known by core crates such as
`ln-dlc-node`.

We define a method `get_new_address` on `Node` so that we can control
how we call the underlying on-chain wallet, rather than letting
consumers call the wallet through a trait that is designed for a
completely different purpose.

We also turn the generic `get_dlcs` API into the more specific
`get_confirmed_dlcs`, as this is the only thing that is currently
needed. This way we can avoid consumers needing to understand types
defined by `rust-dlc`. The `get_confirmed_dlcs` API and the matching
`Dlc` type should evolve (and perhaps even disappear) as we meet new
requirements.

We cannot remove the `dlc-manager` dependency from the `coordinator`
just yet because we haven't yet defined our own type for the
`ContractInput`. Once we do so, we should remove this dependency and
finally ensure that `rust-dlc` is an implementation detail from the
perspective of our leaf crates.
@luckysori luckysori requested review from bonomat, da-kami and holzeis March 7, 2023 02:59
@luckysori luckysori self-assigned this Mar 7, 2023
Copy link
Copy Markdown
Contributor

@da-kami da-kami left a comment

Choose a reason for hiding this comment

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

LGTM

@da-kami
Copy link
Copy Markdown
Contributor

da-kami commented Mar 7, 2023

We cannot remove the dlc-manager dependency from the coordinator just yet because we haven't yet defined our own type for the ContractInput. Once we do so, we should remove this dependency and finally ensure that rust-dlc is an implementation detail from the perspective of our leaf crates.

I thought about doing so, but it is quite cumbersome because it's a quite complex type with a lot of nested other types inside. Nonetheless, it would be cleaner to create our own and map.

@luckysori luckysori force-pushed the chore/ln-dlc-node-deps-upgrade branch from 2701cb6 to 09d9710 Compare March 7, 2023 03:49
Base automatically changed from chore/ln-dlc-node-deps-upgrade to main March 7, 2023 04:06
@luckysori
Copy link
Copy Markdown
Contributor Author

Merged with #213.

@luckysori luckysori closed this Mar 7, 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.

2 participants