-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Beat [0/4]: improve itest miner #8892
Conversation
Important Review skippedAuto reviews are limited to specific labels. Labels to auto review (1)
Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
2be0eb1
to
0339928
Compare
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.
Very nice refactor 💯
Would be nice to get a green run for Neutrino, since we change some of the behavior of that backend in this PR.
0339928
to
263006e
Compare
|
263006e
to
4630d4f
Compare
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.
Really great work! 🔥
Pretty much LGTM - agreed with Oli re trying to catch the rest of the neutrino Mempool errors here though
lntest/harness_miner.go
Outdated
// NOTE: this differs from miner's `MineBlocks` as it requires the nodes to be | ||
// synced. | ||
func (h *HarnessTest) MineBlocks(num uint32) []*wire.MsgBlock { | ||
require.Less(h, num, uint32(maxBlocksAllowed), | ||
"too many blocks to mine") | ||
// NOTE: Use `MineBlocksAndAssertNumTxes` if you expect txns in the blocks. Use | ||
// `MineEmptyBlocks` if you want to keep the txns stay unconfirmed. |
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.
nice 🙏
wow yeah "this differs from miner's `MineBlocks" is very confusing 😂
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: s/"if you want to keep the txns stay unconfirmed"/"if you want to make sure that txns stay unconfirmed".
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.
unaddressed :)
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.
updated!
lntest/harness_miner.go
Outdated
|
||
desc += "Consider using `MineBlocksAndAssertNumTxes` if you " + | ||
"expect txns, or `MineEmptyBlocks` if you want to " + | ||
"keep the txns stay unconfirmed." |
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: "if you want to keep the txns unconfirmed" or "if you want to ensure that the txns stay unconfirmed"
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.
fixed!
|
||
// CurrentHeight returns the current block height. | ||
func (h *HarnessTest) CurrentHeight() uint32 { | ||
return h.currentHeight |
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.
should we guard this or do we expect the Mine*
methods to always be called synchronously with other calls?
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 it should always be called in the same goroutine.
388981d
to
adca500
Compare
0d6d233
to
aa7013c
Compare
1e898e2
to
4548971
Compare
We now are seeing two failed tests, The first happens in
Will check the logs and create an issue page to track it. The second is in
|
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 🧹 🔥
one unaddressed tiny nit :)
For the postgres one, seems like Bob isn't starting up anymore because it's crashing:
|
4548971
to
e0ec893
Compare
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.
Nice, the Neutrino test is now green 🟢
Although I have one question about a skipped test... Other than that, LGTM 🎉
itest/lnd_funding_test.go
Outdated
@@ -278,6 +278,10 @@ func basicChannelFundingTest(ht *lntest.HarnessTest, | |||
// testUnconfirmedChannelFunding tests that our unconfirmed change outputs can | |||
// be used to fund channels. | |||
func testUnconfirmedChannelFunding(ht *lntest.HarnessTest) { | |||
if ht.IsNeutrinoBackend() { |
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.
Are we planning on resurrecting this test after some of the other changes in the PR series?
I understand that it's a bit harder to set up for Neutrino since we don't see any unconfirmed balance.
But couldn't we send some coins to the wallet, confirm those, then do a self-transfer that is unconfirmed (that way even Neutrino nodes will see the TX as they've created it themselves), then open a channel from that?
I think it might be good to keep the test if possible since this scenario is one that seems to happen some times in the wild.
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 like it! Updated as suggested!
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 don't see a push of new commits since your comment?
This commit moves the `HarnessMiner` into a new package to avoid confusion about incoming changes.
This commit adds more assertion to `MineBlocks` so the caller won't misuse it.
in harness Prepare to make `HarnessTest.Miner` a private instance to sync height.
`MineBlocksAndAssertNumTxes`
The nodes are already shut down in the `Cleanup` in `ht.Subtest` so there's no need to shutdown them again.
This commit makes sure `missionControlStore` catches the shutdown signal when draining the ticker. A few debug logs are added to aid the process.
This commit makes sure the sweep requests are received before mining blocks to trigger the actual sweeping. In addition, `testFundingExpiryBlocksOnPending` is updated to deal with the old `channel link not found` issue.
This test was previously working because we'd mine an extra block to confirm the coins inside `FundCoinsUnconfirmed` when it's a neutrino backend, as shown in https://github.com/lightningnetwork/lnd/blob/fdd28c8d888792ea8fde3c557ba9f2594e0a6ec8/lntest/harness.go#L1431 Since neutrino has trouble seeing unconfirmed balance, we now send some coins to the wallet, confirm those, then do a self-transfer so the node will have unconfirmed outputs to perform the test.
e0ec893
to
9180762
Compare
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.
Very nice, LGTM 🎉
Will merge once CI run is complete.
Moooar green CI ❤️ |
This PR refactors the mining methods to make them easier to use. In specific,
MineBlocks
,MineEmptyBlocks
andMineBlocksAndAssertNumTxes
methods, and instructions on how to use them are now shown in the returned error message.HarnessMiner
to be a private instance, as previously we've seen a mixed usage ofht.MineBlocksAndAssertNumTxes(1, 1)
andht.Miner.MineBlocksAndAssertNumTxes(1, 1)
, causing confusion for devs. All the miner-related methods are now moved into a single file, and can only be accessed viaht
.ht
and it can be accessed viaht.CurrentHeight()
, which is helpful in tests that heavily rely on the block height, e.g., the multi-hop tests.