-
Notifications
You must be signed in to change notification settings - Fork 2.2k
lnwallet/chancloser: fix flake in TestRbfCloseClosingNegotiationLocal #9652
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?
lnwallet/chancloser: fix flake in TestRbfCloseClosingNegotiationLocal #9652
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 Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Pull Request Overview
This PR addresses a test flake in the RBF loop for the TestRbfCloseClosingNegotiationLocal by introducing an iteration flag to better track state transitions during iterations.
- Adds an iteration boolean parameter to the functions expectHalfSignerIteration and assertSingleRbfIteration.
- Updates test calls to pass the correct iteration flag.
lnwallet/chancloser/rbf_coop_test.go
Outdated
// If we're in the middle of an iteration, then we expect a transition | ||
// from ClosePending -> LocalCloseStart. | ||
if iteration { | ||
expectedStates = append(expectedStates, &ClosingNegotiation{}) |
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.
The comment indicates that during an iteration the state should transition from ClosePending to LocalCloseStart, but the code appends a ClosingNegotiation state. Verify if the intended behavior should append a LocalCloseStart state instead.
expectedStates = append(expectedStates, &ClosingNegotiation{}) | |
expectedStates = append(expectedStates, &LocalCloseStart{}) |
Copilot uses AI. Check for mistakes.
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.
You're right, but that's the inner state (which lives in ClosingNegotiation
). If we wanted to make the assertion clearer, we could add something like assertInnerStateTransitions
.
Looks like this revealed another flake:
Will look into it. |
In this commit, we fix a flake in the rbf loop sub-test for the TestRbfCloseClosingNegotiationLocal test case. The fix here is that when we go from ClosePending for an RBF iteration loop, we first transition to LocalCloseStart. However we only do this extra transition if we're doing an iteration (starting from ClosePending). To fix this, we add a new bool that tracks if this is an iteration or not. We can then also eliminate the extra assertion at the end, as we'll terminate in `ClosePending` which is checked by `assertLocalClosePending()` in `assertSingleRbfIteration`. Fixes lightningnetwork#9526.
67e9826
to
40f58da
Compare
I think that was a flake that was fixed in my other PR. Pushed up a rebased version. |
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.
Thanks for the fix! Looks like we have one more flake tho,
--- FAIL: TestRbfCloseClosingNegotiationLocal (0.04s)
--- FAIL: TestRbfCloseClosingNegotiationLocal/send_offer_rbf_wrong_local_script (0.00s)
rbf_coop_test.go:1565: FAIL: ReportError(mock.argumentMatcher)
at: [/home/runner/work/lnd/lnd/lnwallet/chancloser/rbf_coop_test.go:398 /home/runner/work/lnd/lnd/lnwallet/chancloser/rbf_coop_test.go:1548]
rbf_coop_test.go:1565: FAIL: 0 out of 1 expectation(s) were met.
The code you are testing needs to make 1 more call(s).
at: [/home/runner/work/lnd/lnd/lnwallet/chancloser/rbf_coop_test.go:238 /home/runner/work/lnd/lnd/lnwallet/chancloser/rbf_coop_test.go:248 /home/runner/work/lnd/lnd/lnwallet/chancloser/rbf_coop_test.go:1565]
FAIL
FAIL github.com/lightningnetwork/lnd/lnwallet/chancloser 0.505s
FAIL
Hmm yeah I think this fix exposed some other ones. I think the issue is mainly with the way the test framework does the assertions. I'll do a pass to try to make the state assertions more precise. |
@Roasbeef, remember to re-request review from reviewers when ready |
In this commit, we fix a flake in the rbf loop sub-test for the TestRbfCloseClosingNegotiationLocal test case.
The fix here is that when we go from ClosePending for an RBF iteration loop, we first transition to LocalCloseStart. However we only do this extra transition if we're doing an iteration (starting from ClosePending).
To fix this, we add a new bool that tracks if this is an iteration or not. We can then also eliminate the extra assertion at the end, as we'll terminate in
ClosePending
which is checked byassertLocalClosePending()
inassertSingleRbfIteration
.Fixes #9526.