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

Merged
merged 7 commits into from
Nov 26, 2024

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?

// 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.

@Roasbeef Roasbeef force-pushed the asset-htlc-itests branch 3 times, most recently from a374019 to d7775e0 Compare November 21, 2024 23:44
@guggero
Copy link
Member

guggero commented Nov 25, 2024

Pushed up a rebase.

proof.UniverseRpcCourierType, zane.Cfg.LitAddr(),
))

// Next, we'll make Alice and Bob, who will be the main nodes under test.
Copy link
Member

Choose a reason for hiding this comment

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

this and other lines violate the lll

Copy link
Member Author

Choose a reason for hiding this comment

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

Old diff? Looks fine to me

Copy link
Member

Choose a reason for hiding this comment

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

maybe, I think there was a fix-up between comment & clicking the "finish review" button

// entire balances to Zane, our 3rd party.
//
// We'll make two addrs for Zane, one for Alice, and one for bob.
zaneTap := newTapClient(t.t, zane)
Copy link
Member

Choose a reason for hiding this comment

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

if we keep this we can remove the commented out zane tap init on top of the test

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure what you mean. Zane is the universe server that information is posted to, then we use it at the very end to ensure that we can send the funds we've swept.

Roasbeef and others added 7 commits November 25, 2024 21:23
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.
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.

Gonna merge then absorb the commits into the update-to-lnd-18-4 branch, fixing any nits along the way.

@guggero guggero merged commit e76f04d into update-to-lnd-18-4 Nov 26, 2024
12 of 13 checks passed
@guggero guggero deleted the asset-htlc-itests branch November 26, 2024 10:14
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.

post-merge ack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

4 participants