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

[custom channels 3/3]: add FundingController to manage channel asset funding #882

Merged
merged 7 commits into from
May 28, 2024

Conversation

Roasbeef
Copy link
Member

@Roasbeef Roasbeef commented Apr 16, 2024

In this PR, we add a new sub-system, that FundingController which is tasked with managing the asset channel funding process from start to finish. The new funding sub-system will communicate directly with an lnd node (in-process or via RPC) to drive the funding process with an externally funded PSBT template. We'll interact with the local AssetWallet to funding+sign the PSBT on all levels, then ask lnd to validate what we've created, before finally broadcasting the final transaction. Before we kick off the funding process, we'll send a series of input validation proofs to the remote party. They'll validate these proofs (sent as custom messages) to ensure that we can actually sign for the assets sent.

Link to all PRs in the saga:

TODO

  • The PSBT returned from lnd will have the funding output append to it. As is, we're able to construct the funding output entirely ourselves, but the internal key isn't yet known, so the default anchoring process will arrive at the wrong output. We may need also have lnd return the musig2 internal key for this process to work properly.
  • The default anchor txn logic will make a series of dummy outputs (1k sats). However, the channel may be funded with an output larger than that to be able to pay for co-op close fees. We'll need to be able to pass a custom amount. This is related to the above TODO
  • Add a concrete implementation of PsbtChannelFunder

Copy link
Member

@guggero guggero left a comment

Choose a reason for hiding this comment

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

Awesome, looks very good! Left some suggestions and clarifications to make sure we have the same flow in mind.

tapchannel/aux_funding.go Outdated Show resolved Hide resolved
tapchannel/aux_funding.go Outdated Show resolved Hide resolved
tapchannel/aux_funding.go Outdated Show resolved Hide resolved
tapchannel/aux_funding.go Outdated Show resolved Hide resolved
tapchannel/aux_funding.go Outdated Show resolved Hide resolved
tapchannel/aux_funding.go Outdated Show resolved Hide resolved
tapchannel/records.go Outdated Show resolved Hide resolved
@guggero guggero force-pushed the custom-channels-integration branch 4 times, most recently from e437f07 to 33067d0 Compare April 17, 2024 19:46
@guggero guggero force-pushed the custom-channels-integration-funding branch 2 times, most recently from 486831a to d8f3190 Compare April 18, 2024 18:39
Copy link
Member

@guggero guggero left a comment

Choose a reason for hiding this comment

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

Super exciting!

tapchannel/allocation.go Outdated Show resolved Hide resolved
tapchannel/aux_funding.go Outdated Show resolved Hide resolved
@guggero guggero force-pushed the custom-channels-integration branch from 33067d0 to d7b3b87 Compare April 23, 2024 08:55
@dstadulis dstadulis modified the milestones: v0.4, ⚡️PoC⚡️ Apr 23, 2024
@guggero guggero force-pushed the custom-channels-integration branch from d7b3b87 to f7b587a Compare April 25, 2024 15:51
@guggero guggero force-pushed the custom-channels-integration branch 3 times, most recently from dd47bfd to c7135e7 Compare May 14, 2024 11:58
@dstadulis dstadulis assigned guggero and unassigned Roasbeef May 15, 2024
@guggero guggero force-pushed the custom-channels-integration-funding branch from d50cee9 to f616b28 Compare May 17, 2024 14:44
@guggero guggero changed the title tapchannel: add FundingController to manage channel asset funding [custom channels 2/3]: add FundingController to manage channel asset funding May 17, 2024
@guggero guggero force-pushed the custom-channels-integration branch from c7135e7 to bbcd2fb Compare May 17, 2024 14:48
@guggero guggero changed the base branch from custom-channels-integration to custom-channels-integration-signing May 17, 2024 14:48
@guggero guggero changed the title [custom channels 2/3]: add FundingController to manage channel asset funding [custom channels 3/3]: add FundingController to manage channel asset funding May 17, 2024
@guggero guggero force-pushed the custom-channels-integration-funding branch from f616b28 to 908b6f3 Compare May 20, 2024 16:31
@guggero guggero force-pushed the custom-channels-integration-signing branch from 80b004a to eb7bb32 Compare May 20, 2024 16:31
@dstadulis dstadulis removed this from the ⚡️PoC⚡️ milestone May 20, 2024
@guggero
Copy link
Member

guggero commented May 21, 2024

Ready for full review.

@guggero guggero force-pushed the custom-channels-integration-signing branch from 2fc91ba to 516c4d4 Compare May 21, 2024 19:40
@guggero guggero force-pushed the custom-channels-integration-funding branch 2 times, most recently from 733b8b6 to 2a4ea41 Compare May 23, 2024 05:06
@guggero guggero force-pushed the custom-channels-integration-signing branch from 516c4d4 to 370a717 Compare May 23, 2024 05:06
@guggero guggero force-pushed the custom-channels-integration-funding branch from 2a4ea41 to 9133857 Compare May 23, 2024 12:18
proof/verifier.go Outdated Show resolved Hide resolved
tapchannelmsg/wire_msgs.go Show resolved Hide resolved
tapchannelmsg/wire_msgs.go Outdated Show resolved Hide resolved
@ffranr ffranr self-requested a review May 23, 2024 16:08
tapchannelmsg/wire_msgs.go Outdated Show resolved Hide resolved
server.go Show resolved Hide resolved
server.go Show resolved Hide resolved
rpcserver.go Outdated Show resolved Hide resolved
taprpc/taprootassets.proto Outdated Show resolved Hide resolved
@guggero guggero force-pushed the custom-channels-integration-signing branch from 370a717 to feea448 Compare May 24, 2024 06:51
Base automatically changed from custom-channels-integration-signing to main May 24, 2024 07:19
@guggero guggero force-pushed the custom-channels-integration-funding branch from 9133857 to 4cbfbc7 Compare May 24, 2024 16:24
@guggero guggero force-pushed the custom-channels-integration-funding branch from 4cbfbc7 to fc79c5b Compare May 27, 2024 14:58
@guggero guggero requested a review from ffranr May 27, 2024 14:58
perms/perms.go Outdated Show resolved Hide resolved
Copy link
Contributor

@ffranr ffranr left a comment

Choose a reason for hiding this comment

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

Just one comment here to consider: #882 (comment)

@guggero guggero force-pushed the custom-channels-integration-funding branch from fc79c5b to c7cdf47 Compare May 27, 2024 15:15
Copy link
Member

@GeorgeTsagk GeorgeTsagk left a comment

Choose a reason for hiding this comment

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

✔️

@guggero guggero added this pull request to the merge queue May 28, 2024
Merged via the queue into main with commit 75a9f66 May 28, 2024
14 checks passed
@guggero guggero deleted the custom-channels-integration-funding branch May 28, 2024 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

5 participants