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

itest: add new testCustomChannelsHtlcSuccess itest #901

Open
wants to merge 21 commits into
base: update-to-lnd-18-4
Choose a base branch
from

Conversation

Roasbeef
Copy link
Member

@Roasbeef Roasbeef commented Nov 9, 2024

No description provided.

@guggero
Copy link
Member

guggero commented Nov 11, 2024

Pushed up a rebase.

@Roasbeef
Copy link
Member Author

itests are racy right now due to sweeper/block timing, experimenting with either using BumpFee to trigger an immediate sweep or, be more lax w.r.t asserting which block mines the target txn.

@guggero
Copy link
Member

guggero commented Nov 15, 2024

Pushed up a rebase to reference the latest version of lightninglabs/taproot-assets#1154.

@Roasbeef
Copy link
Member Author

Updated to ref the latest tapd+lnd.

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.

Nice! Wasn't able to get the test to run on my machine even after many tries. So perhaps this isn't the latest version yet?

itest/assets_test.go Outdated Show resolved Hide resolved
itest/assets_test.go Show resolved Hide resolved
itest/litd_custom_channels_test.go Outdated Show resolved Hide resolved
itest/litd_custom_channels_test.go Outdated Show resolved Hide resolved
// Bob's balance should now reflect that he's gained the value of the HTLC,
// in addition to his settled balance.
//
// TODO(roasbeef): -1 as no decimal display on asset?
Copy link
Member

Choose a reason for hiding this comment

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

Yeah, that seems to be the likely cause.

// transaction.
mineBlocks(t, net, 1, 1)

// TODO(roasbeef): assert transfers
Copy link
Member

Choose a reason for hiding this comment

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

Asserting that the correct proofs can be found in the universe would also be a great check.

@@ -48,6 +48,10 @@ var allTestCases = []*testCase{
name: "test custom channels liquidity",
test: testCustomChannelsLiquidityEdgeCases,
},
{
name: "test custom channels htlc success",
Copy link
Member

Choose a reason for hiding this comment

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

I guess we'll also want to add a test case for timing out the HTLCs, instead of resolving them?

Copy link
Member Author

Choose a reason for hiding this comment

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

Bad test name here. We timeout out HTLCs at the very end of the itest when we mine enough blocks to timeout the HTLCs.

Copy link
Member Author

Choose a reason for hiding this comment

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

So this tests all 4 scenarios we about ( (local, remote) x (success, timeout) ), it does it all in one sweep with Alice's commitment that she force closed. I'll change the name of the test to better reflect what's covered.

@Roasbeef Roasbeef force-pushed the asset-htlc-itests branch 3 times, most recently from 048c654 to a8e4310 Compare November 21, 2024 03:24
@Roasbeef
Copy link
Member Author

Pushed up a new version!

Ran this for 30 minutes on my laptop and didn't get a flake. If it flakes on CI, I should be able to address it easily, given all the quality time spent with this test.

I also added a final assertion to make sure both Alice and Bob can send all the swept funds to a 3rd party.

guggero and others added 7 commits November 21, 2024 20:39
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.
guggero and others added 8 commits November 21, 2024 20:39
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.
This will report balance that we can 100% spend.
This is useful as sometimes we just want to return once the HTLC has
been accepted, like when we're paying hodl invoices.
In this commit, we add a new itest that tests the 4 sweeping cases for
HTLCs:
  * local success
  * remote success
  * local timeout
  * remote timeout

To test this, we have Alice load up her commitment transaction with 4
HTLCs (2 incoming, 2 outgoing) using hodl invoices. Then we force close
her commitment transaction. In this scenario, she needs to broadcast a
second level transaction to ultimately timeout, while Bob can sweep
directly from the commitment transaction.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🏗 In progress
Development

Successfully merging this pull request may close these issues.

6 participants