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

Prepare for custom channels (lnd v0.18.4-beta) #848

Draft
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

guggero
Copy link
Member

@guggero guggero commented Sep 19, 2024

This is the mother of all PRs for the custom channel saga. Merging this PR will be the final step for bringing custom channels to a non-experimental version of litd. There are many dependencies (see list/graph below), so it will remain in draft for a bit.
Most of the code in these PRs have already been reviewed on the 0-19-staging branch and have just been squashed down into easy-to-review pieces.

The following list is an ordered list of dependencies that need to be resolved before this PR can be merged (cc @dstadulis):

NOTE: This PR includes all recent changes to litd's 0-19-staging branch, including the new liquidity tests from #842. There haven't been any other in-flight PRs to the staging branch when writing this.

@guggero
Copy link
Member Author

guggero commented Oct 15, 2024

Similar to lightninglabs/loop#828, I bumped to lndclient v0.18.4-0 which references lightningnetwork/lnd#9183 (commit lightningnetwork/lnd@ca3bde9) which should remain stable, so we can start the main review work here.

We will want to wait with merging this until the full dependency chain above is resolved. But once lnd v0.18.4-beta is tagged, that should only entail bumping the versions in go.mod.

@guggero
Copy link
Member Author

guggero commented Oct 15, 2024

Need to add #861.

@guggero
Copy link
Member Author

guggero commented Oct 17, 2024

@jamaljsr I tagged you for review on this with the intention of asking you to run a full manual test run of this version within Polar (all the tests you've run previously).
Do you think you'll have time for that this or next week? Thank you!

@jamaljsr
Copy link
Member

@guggero Thanks for the clarification. I wasn't sure how I should test this or if it was ready. I will try it out in Polar by early next week at the latest, hopefully sooner. Excited to see this functionality getting mainlined 🙌

Copy link
Member

@ellemouton ellemouton left a comment

Choose a reason for hiding this comment

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

Looking good!

config.go Show resolved Hide resolved
subservers/taproot-assets.go Show resolved Hide resolved
subservers/faraday.go Show resolved Hide resolved
subservers/manager.go Outdated Show resolved Hide resolved
config.go Show resolved Hide resolved
terminal.go Show resolved Hide resolved
cmd/litcli/main.go Outdated Show resolved Hide resolved
cmd/litcli/main.go Show resolved Hide resolved
cmd/litcli/main.go Outdated Show resolved Hide resolved
.github/workflows/main.yml Outdated Show resolved Hide resolved
@guggero guggero force-pushed the update-to-lnd-18-4 branch 2 times, most recently from 23d6696 to 1335e4b Compare October 21, 2024 13:58
@guggero
Copy link
Member Author

guggero commented Oct 21, 2024

This PR now contains all the recently merged PRs of the 0-19-staging branch up to commit 2194f1e.

@guggero guggero force-pushed the update-to-lnd-18-4 branch 3 times, most recently from 3d30a93 to 9476c03 Compare October 22, 2024 12:29
Copy link
Member

@jamaljsr jamaljsr left a comment

Choose a reason for hiding this comment

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

tACK LGTM 🔥 🚀

I tested the following scenarios in Polar using this network structure with all litd nodes except for erin which is Core Lightning v24.08.1.

alice --[asset]-> bob --[sats]-> carol --[asset]-> dave
                                   |
                                 [sats]
                                   |
                                   v
                                  erin (core-ln)
  • fund asset channel using full asset balance after mint
  • fund asset channel using partial asset balance after mint
  • fund asset channel using full asset balance after mint + onchain send
  • fund asset channel using partial asset balance after mint + onchain send
  • fund asset channel using full asset balance from onchain receive
  • fund asset channel using partial asset balance from onchain receive
  • fund asset channel with push_sat=5000
  • create asset invoice on dave, pay with asset on alice (multi-hop)
  • create asset invoice on bob, pay with asset on alice (direct peer)
  • create asset invoice on alice, pay with asset on bob (direct peer, opposite direction)
  • create asset invoice on alice, pay with asset on dave (multi-hop, opposite direction)
  • create asset invoice on dave, pay with sats on bob (sats -> asset)
  • create sats invoice on bob, pay with asset on dave (asset -> sats)
  • create asset invoice on alice, pay with sats on erin (cln sats -> asset)
  • create sats invoice on erin, pay with asset on alice (asset -> cln sats)
  • create sats invoice on bob, pay with sats on alice (direct peer, sats -> sats)
  • create sats invoice on dave, pay with sats on alice (multi-hop, sats -> sats)
  • send asset keysend payment from alice to bob
  • send asset keysend payment from alice to carol

Note: I was using commit 35e6aea. I see there have been more pushes since I started testing. Let me know if you'd like another round of testing using the final commits before merging.

@jamaljsr
Copy link
Member

Thanks so much for the explanation. Now it totally makes sense.

I just have one follow-up question, for my own information, in the cases when sending smaller asset payments. If I only send 500 PUSD, how are the routing fees distributed? I assume the equivalent sats value is too small to be represented as an asset unit. Are the fees then added to the sats amount of the HTLC?

@guggero
Copy link
Member Author

guggero commented Oct 24, 2024

There is a certain amount of "underpayment" allowed when the conversion from asset to sats is off due to the precision. Currently 1 asset unit per HTLC (and up to 16 asset units per invoice, due to the MPP default max shard amount of 16) is allowed. That precision loss is basically paid by the edge node.
To avoid those precision losses to be significant amounts, the asset precision (decimal display) should be chosen correctly (a value of 6 for example, see the RFQ doc in the tapd repo).

@jamaljsr
Copy link
Member

Got it! Thanks again for the explanations. Very informative 🙏

guggero and others added 15 commits November 11, 2024 15:07
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.
Add the `priceoraclerpc`, `rfqrpc`, and the `tapchannelrpc` JSON
callbacks to the litclient's `Registrations` array. This allows the
litclient to use the rpc functions contained in these JSON callbacks.
Add testCustomChannelsMultiInput to verify multi-input channel funding.
In this test Charlie mints an asset, transfers it to Dave in two
separate txs. Dave then uses both asset UTXOs to fund a channel with
Charlie that is bigger than the value of either UTXO.
This commit adds a fully configurable RPC oracle that can serve asset
rates that differ for buy and sell.
We then add a test that shows and asserts proper asset conversion to
satoshis and back.
With this commit we sporadically assert in our itests that the outgoing
HTLCs for a payment and the incoming HTLCs of an invoice show the custom
channel data JSON with the actual asset amounts.
This commit removes the default value of 1 for `sat_per_vbyte` that's
being passed to `litd` rpc endpoint `fundchannel`. `litd` handles this
now perfectly on its own, and adding logic here only adds to the
confusion.
This commit adds an integration test for the MinRelayFee check. The test
ensures that transactions with fees below the minimum relay fee are
rejected.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 👀 In review
Development

Successfully merging this pull request may close these issues.

7 participants