lightninglabs / taproot-assets

A layer 1 daemon, for the Taproot Assets Protocol specification, written in Go (golang)
MIT License
457 stars 110 forks source link

[tracking]: Ensure AuxFundingController functionality meets tap deliverables / needs #872

Closed dstadulis closed 3 months ago

dstadulis commented 5 months ago

https://github.com/lightningnetwork/lnd/pull/8622 Adds AuxFundingController functionality to lnd and relies on a new MsgRouter to intercept messages passed over the wire for use in processing/arbitrating tap channel state.

Editable deliverable list tapd would need

Design implementation commentary:

idea is we pass in AuxFundingController at the top level, it implements MsgEndpoint, so it can handle processing the tx_asset_proof messages so given an external pending chan ID (kinda like the FundingStateStep stuff), it'll process all that and arrive at the top level commitment needed then once open+accept chan come, we use that pending chan ID to map to the blobs and stuff we need so that's now passed all the way down into the db, and the funding+commitment txn construction in that PR now I'll circle back to look at signing, rn no new sigs are sent, but if you set these values properly, both sides will now arrive at the "correct" funding output + commitment txn that'll hold the asset

ffranr commented 5 months ago

To address this issue, I think it's sufficient to concentrate on this type introduced in PR https://github.com/lightningnetwork/lnd/pull/8622 :

// AuxFundingDesc stores a series of attributes that may be used to modify the
// way the channel funding occurs
type AuxFundingDesc struct {
    // CustomFundingBlob is a custom blob that'll be stored in the database
    // within the OpenChannel struct. This should represent information
    // static to the channel lifetime.
    CustomFundingBlob tlv.Blob

    // TapscriptRoot is the root of the tapscript tree that will be used to
    // create the funding output.
    TapscriptRoot chainhash.Hash

    // CustomLocalCommitBlob is a custom blob that'll be stored in the
    // first commitment entry for the local party.
    CustomLocalCommitBlob tlv.Blob

    // CustomRemoteCommitBlob is a custom blob that'll be stored in the
    // first commitment entry for the remote party.
    //
    // TODO(roasbeef): have this just use the leaf fetcher?
    CustomRemoteCommitBlob tlv.Blob

    // InitAuxLeaves is the set of aux leaves that'll be used for the very
    // first commitment state.
    InitAuxLeaves CommitAuxLeaves
}

And then the question becomes: are those fields sufficient to setup a tap payment channel? I think the answer is yes. Do you agree @guggero ? Is there anything else we need to consider here?

guggero commented 5 months ago

And then the question becomes: are those fields sufficient to setup a tap payment channel? I think the answer is yes. Do you agree @guggero ?

Yes, I think answering that question by implementing the MsgRouter and AuxFundingController is the main task of this issue.

ffranr commented 5 months ago

And then the question becomes: are those fields sufficient to setup a tap payment channel? I think the answer is yes. Do you agree @guggero ?

Yes, I think answering that question by implementing the MsgRouter and AuxFundingController is the main task of this issue.

Oh I thought this issue was about checking that the AuxFundingController setup was flexible enough for tap. Rather than the actually implementing for tap. Ah I think you want to check by implementing.

ffranr commented 5 months ago

I've unassigned myself. There is nothing for me to do here. Oli is writing the code for this issue.

guggero commented 3 months ago

Fixed by https://github.com/lightningnetwork/lnd/pull/8622 and https://github.com/lightningnetwork/lnd/pull/8632.