-
Notifications
You must be signed in to change notification settings - Fork 103
custom channels: use tapd
as the aux component implementation for lnd
in integrated mode
#761
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
Conversation
407c675
to
b9bbaca
Compare
b9bbaca
to
776813b
Compare
776813b
to
31d4fee
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had a quick look to gain familiarity - looks good and mostly plumbing 👍 main question is around why the cli commands belong here
config.go
Outdated
@@ -379,6 +380,7 @@ func loadAndValidateConfig(interceptor signal.Interceptor) (*Config, error) { | |||
cfg.Remote.LitDebugLevel, cfg.Lnd.LogWriter, | |||
) | |||
} else { | |||
SetupLoggers(cfg.Lnd.LogWriter, interceptor) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this not covered by SetupLoggers(preCfg.Lnd.LogWriter, interceptor)
above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you're right. I was debugging something logging related and forgot to remove this again. Confirmed it's not needed.
terminal.go
Outdated
tapdWrapper, available := g.subServerMgr.GetServer(subservers.TAP) | ||
if !available { | ||
return nil, fmt.Errorf("tapd is not available, must be " + | ||
"started in integrated mode for Taproot Assets " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
started in integrated mode
-> do you mean that tapd must be integrated? cause 'integrated mode' to me means that lnd is integrated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, both. I'll update the error message.
|
||
var lnCommands = []cli.Command{ | ||
{ | ||
Name: "ln", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would tap
be better? ln
to me is general lightning network
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I agree. Though I think this is temporary and we'll remove them in a future release anyway (see comment below). But for now I think Polar already uses the commands in some demos, so I don't want to rename them just for renaming sake.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose since it's inducing ln functionality but pairing with tapd it's a bit of both
"github.com/lightningnetwork/lnd/lnwire" | ||
"github.com/lightningnetwork/lnd/record" | ||
"github.com/urfave/cli" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just skimmed this commit really quickly but it isnt yet immediately obvious to me why this is here and not in the taproot assets cmd
directory? ie what makes this different from loopcli
or equivalent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do eventually want the logic that's done in this file be RPCs in tapd
, then it will make sense to move them to tapcli
. But for now we need access to both lnd
's and tapd
's RPCs from within a single command, which is done most conveniently in tapcli
(see the way we bake a macaroon just to connect to tapd
).
31d4fee
to
2fa4b07
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really exciting to see how everything fits together 🎉🚀. Left some comments in this first (quick) pass.
terminal.go
Outdated
return nil, fmt.Errorf("tapd is not available, must be " + | ||
"started in integrated mode for Taproot Assets " + | ||
"Channels to be available") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error messages could be more distinguished between running remotely and being available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the error message according to @ellemouton's review. Hope it makes more sense now.
msatPerUnit := acceptedQuote.BidPrice | ||
numUnits := uint64(decodeResp.NumMsat) / msatPerUnit | ||
|
||
fmt.Printf("Got quote for %v asset units at %v msat/unit from peer "+ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to have user consent here, because sending is blocked by SendPaymentRequest
where a user has time to read this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, this message isn't really about consent, more of an information (and I guess initially mainly added for debugging purposes 😅 ).
The actual validation of the exchange rate is done by the RFQ and price oracle logic of tapd
. The end user will be able to plug in their exchange API of choice to validate prices against, and then define a maximum percentage (PPM actually) of deviation due to spread.
cmd/litcli/ln.go
Outdated
ValueMsat: int64(numMSats), | ||
DescriptionHash: descHash, | ||
FallbackAddr: ctx.String("fallback_addr"), | ||
Expiry: ctx.Int64("expiry"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this may need to use the default expiry above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, good point. Fixed!
itest/litd_custom_channels_test.go
Outdated
fabiaAssetBalance += fabiaInvoiceAssetAmount1 | ||
|
||
// ------------ | ||
// Test case 4: Create an asset invoice on Fabian and pay it with just |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why those are multipart payments isn't quite obvious to me, probably also need the assertions to check for the individual htlc attempts (early stage I guess 🙂).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a bit hidden, we hard code the max shard size to 80k in the payInvoiceWithXXX()
helper. So choosing a large enough asset amount will guarantee at least two shards. Updated the comment to make it a bit more obvious.
And yes, we don't currently track the number of attempts. There are a lot of assertions still missing here, mainly due to the fact that the itest library isn't fully compatible with the refactored version in lnd
, so we can't just re-use a lot of those assertions.
067d09c
to
ee468ba
Compare
Thanks for the reviews! I addressed all comments and fixed the failing CI steps (hopefully). |
ee468ba
to
57bf3a0
Compare
This commit represents the main integration between lnd running in integrated mode and tapd providing auxiliary components for custom channels.
This change will speed up integration tests by not waiting a full 5 seconds before re-trying the connection to lnd if it fails the first time.
57bf3a0
to
0b2b3eb
Compare
No description provided.