-
Notifications
You must be signed in to change notification settings - Fork 101
Custom channels itest: Use group keys on some payments & invoices #995
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
base: master
Are you sure you want to change the base?
Conversation
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 is a good start as a sanity check for some of the new logic. I think we'll want to more or less run each test w/ both asset ID and group key, but that might eventually be a bit unwieldy when it comes to execution time.
Ultimately, we do expect most of the primary use cases to use group keys, so pehrhaps it's fine to lean towards coverage there?
itest/assets_test.go
Outdated
|
||
case len(groupID) > 0: | ||
groupHash := sha256.Sum256(groupID) | ||
targetID = hex.EncodeToString(groupHash[:]) |
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, do we need to modify what we return as JsonHtlc
to start to include a distinct group key field? IIRC, it's all TLV within the db/lnd, so shouldn't be a big lift there, and should be backwards compat.
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, good idea. We can definitely add that to make certain things easier. Even if it's just informative to the user and useful in itests (but not explicitly expected in the RFQ logic).
I agree with you here, ideally we'd want to even focus more on group key usage compared to single asset IDs. I'll think of an approach that lets us run everything in assetID / groupkey mode, and see if it's worth the trouble. Otherwise, we could just add groupkey explicit itests, and support the hybrid mode on the more extensive edge-case itests |
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.
Concept ACK
itest/assets_test.go
Outdated
|
||
case len(groupID) > 0: | ||
groupHash := sha256.Sum256(groupID) | ||
targetID = hex.EncodeToString(groupHash[:]) |
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, good idea. We can definitely add that to make certain things easier. Even if it's just informative to the user and useful in itests (but not explicitly expected in the RFQ logic).
2d7defe
to
072cc37
Compare
Added an extra commit which lets us run the liquidity edge cases in assetID & groupKey mode This way the edge case coverage is repeated for group keys without re-writing the whole test We could take a similar approach for all other tests, so please take a look and LMK if you agree with that approach. It would ofcs lead to running everything twice, so double total itest time. |
072cc37
to
e75169c
Compare
e75169c
to
673009d
Compare
rebased on |
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.
Looks pretty good! Have some ideas to reduce the size of the diff though.
itest/assets_test.go
Outdated
targetID = hex.EncodeToString(assetID) | ||
|
||
case len(groupID) > 0: | ||
groupHash := sha256.Sum256(groupID) |
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.
Same here, re x-coordinate. I wonder why this didn't cause things to fail? Or did this still point to the old commit in tapd
?
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 you started the review a bit before I rebased & used latest ref to tapd, which also changed these lines in the LiT side
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.
ok so it was the wrong commit (other comment)
itest/litd_custom_channels_test.go
Outdated
@@ -1896,10 +1918,13 @@ func testCustomChannelsLiquidityEdgeCases(ctx context.Context, | |||
|
|||
logBalance(t.t, nodes, assetID, "10k sats") | |||
|
|||
opts = []payOpt{} |
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.
nit: var opts []payOpt
to match empty initialization style 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.
can't redeclare it, i'm just setting it again
|
||
// Run liquidity edge cases and only use group keys for invoices and | ||
// payments. | ||
testCustomChannelsLiquidtyEdgeCasesCore(ctx, net, t, true) |
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.
Can't we run this directly in testCustomChannelsLiquidityEdgeCases
? Meaning to call the same sub test function there once with true once with false.
Each new test has quite a bit of overhead, so the more we can combine, the better.
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 thought of that. We can't really do that as it will crash due to re-creating all the nodes again in the same network.
Ideally, we would want to have a helper function that resets the state to a "clean slate" as far as liquidity goes, so that we can re-run the same suite and have the same liquidity footprint across multiple runs.
Maybe can make an issue/todo for this and introduce it in a later PR.
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've actually come full circle now and started taking apart the HTLC force close test in #1017 and making two out of them. That helps with starting with a clean slate.
And the performance optimizations I have in #987 should make it so that there is no additional overhead for running things in the same test vs. in separate ones.
So this is okay the way it is now.
673009d
to
da3cca1
Compare
unified the helpers / itests commit to make things simpler |
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.
LGTM pending nits and update to the actual merged commit of tapd
.
|
||
// Run liquidity edge cases and only use group keys for invoices and | ||
// payments. | ||
testCustomChannelsLiquidtyEdgeCasesCore(ctx, net, t, true) |
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've actually come full circle now and started taking apart the HTLC force close test in #1017 and making two out of them. That helps with starting with a clean slate.
And the performance optimizations I have in #987 should make it so that there is no additional overhead for running things in the same test vs. in separate ones.
So this is okay the way it is now.
We add support for group keys on payments and invoices across the itests. This includes all the required helpers and optional arguments to make adding invoices and sending payments group-key enabled. In order to run the liquidity edge cases twice, once using only asset IDs and once using only group keys, we need to extract the main logic into a re-usable function that has the group key option on the top level. If the group key flag is set, then we append the respective group key opt to the payment & invoice related calls.
da3cca1
to
9f885cc
Compare
@Roasbeef: review reminder |
Description
We sprinkle around some group keys across the grouped asset custom channels test. Some of the invoices and payments in that test now use a group key instead of a specific asset ID.
Related tapd PR: https://github.com/lightninglabs/taproot-assets/pull/1423/commits
For the liquidity edge cases itest, we now support running it in assetID & groupKey mode, meaning we can go through the full suite of edge cases by using either a single assetID or a groupKey.