Skip to content

[bug]: trouble inceasing the size of asset channels in itest #1432

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

Open
ZZiigguurraatt opened this issue Mar 10, 2025 · 7 comments · May be fixed by lightninglabs/lightning-terminal#1015
Open
Labels
bug Something isn't working needs triage

Comments

@ZZiigguurraatt
Copy link

If in litd_custom_channels_test.go I make the following change

$ git diff
diff --git a/itest/litd_custom_channels_test.go b/itest/litd_custom_channels_test.go
index e6d3801..2e7eb30 100644
--- a/itest/litd_custom_channels_test.go
+++ b/itest/litd_custom_channels_test.go
@@ -46,7 +46,7 @@ var (
                AssetType: taprpc.AssetType_NORMAL,
                Name:      "itest-asset-cents",
                AssetMeta: dummyMetaData,
-               Amount:    1_000_000,
+               Amount:    2_000_000,
        }
 
        shortTimeout = time.Second * 5
@@ -1874,7 +1874,7 @@ func testCustomChannelsLiquidityEdgeCases(ctx context.Context,
        t.Logf("Universes synced between all nodes, distributing assets...")
 
        const (
-               daveFundingAmount = uint64(400_000)
+               daveFundingAmount = uint64(800_000)
                erinFundingAmount = uint64(200_000)
        )
        charlieFundingAmount := cents.Amount - uint64(2*400_000)
$

and then run

make itest icase=test_custom_channels_liquidity

I get the error

    test_harness.go:107: Opening asset channels...
    test_harness.go:107: Funded channel between Charlie and Dave: txid:"4cb5b6d8cb390870186cb4c5fc05505996addf52c385bbb45b71e1a93037cb30"
    assets_test.go:168: 
        	Error Trace:	/zziigguurraatt/git/lightning-terminal-projects/mint_asset_test/itest/assets_test.go:168
        	            				/zziigguurraatt/git/lightning-terminal-projects/mint_asset_test/itest/litd_custom_channels_test.go:1882
        	            				/zziigguurraatt/git/lightning-terminal-projects/mint_asset_test/itest/test_harness.go:103
        	            				/zziigguurraatt/git/lightning-terminal-projects/mint_asset_test/itest/litd_test.go:102
        	Error:      	Received unexpected error:
        	            	rpc error: code = Unknown desc = error funding channel: unable to fund vPacket: unable to select coins: failed to find coin(s) that satisfy given constraints; if previous transfers are un-confirmed, wait for them to confirm before trying again
        	Test:       	TestLightningTerminal/test_custom_channels_liquidity
    test_harness.go:172: 
        	Error Trace:	/zziigguurraatt/git/lightning-terminal-projects/mint_asset_test/itest/test_harness.go:193
        	            				/zziigguurraatt/git/lightning-terminal-projects/mint_asset_test/itest/test_harness.go:172
        	            				/zziigguurraatt/git/lightning-terminal-projects/mint_asset_test/itest/assertions.go:177
        	            				/zziigguurraatt/git/lightning-terminal-projects/mint_asset_test/itest/assertions.go:123
        	            				/usr/lib/go-1.23/src/runtime/panic.go:629
        	            				/usr/lib/go-1.23/src/testing/testing.go:1006
        	            				/zziigguurraatt/git/lightning-terminal-projects/mint_asset_test/itest/assets_test.go:168
        	            				/zziigguurraatt/git/lightning-terminal-projects/mint_asset_test/itest/litd_custom_channels_test.go:1882
        	            				/zziigguurraatt/git/lightning-terminal-projects/mint_asset_test/itest/test_harness.go:103
        	            				/zziigguurraatt/git/lightning-terminal-projects/mint_asset_test/itest/litd_test.go:102
        	Error:      	Received unexpected error:
        	            	wanted 1, found 2 txs in mempool: [4cb5b6d8cb390870186cb4c5fc05505996addf52c385bbb45b71e1a93037cb30 faba8adff40711093c2035586223f0cda71f7fef67d3314818a7724173f77d27]
        	Test:       	TestLightningTerminal/test_custom_channels_liquidity
        	Messages:   	unable to find txns in mempool
itest error from [node:Bob]: receive topology client stream got err:graph subscription err: rpc error: code = Unknown desc = malformed header: missing HTTP content-type
    harness.go:444: finished test: , start height=438, end height=488, mined blocks=50
    harness.go:450: test failed, skipped cleanup
=== NAME  TestLightningTerminal
    litd_test.go:116: Failure time: 2025-03-10 10:48:16.400
--- FAIL: TestLightningTerminal (96.15s)
    --- FAIL: TestLightningTerminal/test_custom_channels_liquidity (96.15s)
FAIL
make: *** [Makefile:226: itest-only] Error 255

I think maybe the proper amount of coins isn't be distributed to the nodes before trying to open channels or maybe it is just not waiting for transactions to propagate to the mempool and confirm before attempting to proceed, but I'm not sure how itest sets up its test network. It should be smart enough to make sure each node has the right amount of assets before trying to open up channels though.

I've randomly get this issue in https://github.com/lightninglabs/tapdvalidation when I do have enough coins in the wallet of each node (I know this because it is random and works 90% of the time), but now I've been able to make it reproducible in the itest framework. I'm not sure if it is the same problem or a different one with the same error message, but it would be good to fix it in itest since it is at least a reproducible error there.

@ZZiigguurraatt ZZiigguurraatt added bug Something isn't working needs triage labels Mar 10, 2025
@Roasbeef
Copy link
Member

I think maybe the proper amount of coins isn't be distributed to the nodes before trying to open channels or maybe it is just not waiting for transactions to propagate to the mempool and confirm before attempting to proceed, but I'm not sure how itest sets up its test network. It should be smart enough to make sure each node has the right amount of assets before trying to open up channels though.

If you're increasing the amount of asset needed to fund a channel, then you also need to ensure that each node has enough asset in its wallet. This is a low level test framework, if the framework makes assumptions about how many assets each node should have, then it may reduce our ability to test certain scenarios.

@ZZiigguurraatt
Copy link
Author

I think maybe the proper amount of coins isn't be distributed to the nodes before trying to open channels or maybe it is just not waiting for transactions to propagate to the mempool and confirm before attempting to proceed, but I'm not sure how itest sets up its test network. It should be smart enough to make sure each node has the right amount of assets before trying to open up channels though.

If you're increasing the amount of asset needed to fund a channel, then you also need to ensure that each node has enough asset in its wallet. This is a low level test framework, if the framework makes assumptions about how many assets each node should have, then it may reduce our ability to test certain scenarios.

So you are saying that it is not adjustable by design?

@guggero
Copy link
Member

guggero commented Mar 24, 2025

The tests are currently set up in quite a rigid way. We definitely need to improve the test code to make it more flexible. There will be a big refactor coming soon.

ZZiigguurraatt pushed a commit to ZZiigguurraatt/lightning-terminal that referenced this issue Mar 25, 2025
This fixes lightninglabs/taproot-assets#1432
by defining the on chain asset amounts sent to each node and the sizes
of channels opened by each node relative to each other without hard
coding the values. This then allows the channel sizes to be adjusted
more easily as needed.
@ZZiigguurraatt
Copy link
Author

I've randomly get this issue in https://github.com/lightninglabs/tapdvalidation when I do have enough coins in the wallet of each node (I know this because it is random and works 90% of the time), but now I've been able to make it reproducible in the itest framework. I'm not sure if it is the same problem or a different one with the same error message, but it would be good to fix it in itest since it is at least a reproducible error there.

This issue was different than the random one I encountered in https://github.com/lightninglabs/tapdvalidation .

@ZZiigguurraatt
Copy link
Author

I think maybe the proper amount of coins isn't be distributed to the nodes before trying to open channels or maybe it is just not waiting for transactions to propagate to the mempool and confirm before attempting to proceed, but I'm not sure how itest sets up its test network. It should be smart enough to make sure each node has the right amount of assets before trying to open up channels though.

The fix in lightninglabs/lightning-terminal#1015 makes it smart enough to send the right amount of assets to each node before trying to open up channels.

@Roasbeef
Copy link
Member

Roasbeef commented Mar 26, 2025

So you are saying that it is not adjustable by design?

No, see this fragment:

If you're increasing the amount of asset needed to fund a channel, then you also need to ensure that each node has enough asset in its wallet.

The funding amounts are hard coded, if you increase the channel size then you also need to modify that value.

@ZZiigguurraatt
Copy link
Author

The funding amounts are hard coded, if you increase the channel size then you also need to modify that value.

Yes, they were hard coded in a confusing/weird way, so in lightninglabs/lightning-terminal#1015 I've changed it so that they are no longer hard coded, but relative toe each other.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants