-
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
DynComms [1/n]: Implement Quiescence Protocol #8270
Conversation
d1aa5e5
to
9a6d107
Compare
bc147f4
to
7a78e3d
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.
Pretty straight forward diff! Missing some context from the other PR, and also still need to catch up w/ the latest state of the spec.
The main thing I think we need to zoom in on re unit tests is: the assumption that if we don't ACK a new settle/fail from the mailbox, then upon reconnection, all those items are retransmitted once again. If this is the case, then we can just force a disconnection after the stfu
cycle is complete (see comment there about needing to send a special internal error to make that happen).
One other question I have is: is it the expected flow that a disconnect restores the channel lifecycle back to "active"? Or do we really want another protocol level message here so we can go back to normal w/o needing to re-create the peer connection?
7a78e3d
to
6da6398
Compare
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 WalkthroughThe implementation of the Quiescence ( Changes
Assessment against linked issues
Possibly related issues
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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
5e41a47
to
408ba29
Compare
70613b5
to
29e5c42
Compare
f808f5f
to
b0cc975
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.
lgtm 🏅
last few comments from me - none blocking merge!
@@ -398,6 +426,10 @@ func (q *QuiescerLive) sendOwedStfu(numPendingLocalUpdates uint64) error { | |||
// state. If so, we will try to resolve any outstanding | |||
// StfuReqs. | |||
q.tryResolveStfuReq() | |||
|
|||
if q.isQuiescent() { |
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.
non-blocking / can be done in a followup if we feel strongly: we're doubling up on q.isQuiescent
checks here and in tryResolveStfuReq
- could be combined into one function that handles all our tasks once we're quiescent.
); err != nil { | ||
l.stfuFailf("%s", err.Error()) | ||
qReq.Resolve(fn.Err[lntypes.ChannelParty](err)) | ||
if l.noDanglingUpdates(lntypes.Local) { |
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.
Is this commit going to be squashed before merge?
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'll squash it.
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.
Nvm the conflicts are ridiculous if I try and squash it.
b0cc975
to
0a76aaf
Compare
htlcswitch: add sendOwedStfu method to quiescer
htlcswitch: use quiescer SendOwedStfu method in link stfu implementation
In this commit we defer processRemoteAdds using a new mechanism on the quiescer where we capture a closure that needs to be run. We do this because we need to avoid the scenario where we send back immediate resolutions to the newly added HTLCs when quiescent as it is a protocol violation. It is not enough for us to simply defer sending the messages since the purpose of quiescence itself is to have well-defined and agreed upon channel state. If, for whatever reason, the node (or connection) is restarted between when these hooks are captured and when they are ultimately run, they will be resolved by the resolveFwdPkgs logic when the link comes back up. In a future commit we will explicitly call the quiescer's resume method when it is OK for htlc traffic to commence.
In this commit we implement a noop quiescer that we will use when the feature hasn't been negotiated. This will make it far easier to manage quiescence operations without having a number of if statements in the link logic.
0a76aaf
to
a31167b
Compare
Here we add a flag where we can disable quiescence. This will be used in the case where the feature is not negotiated with our peer.
This change simplifies some of the quiescer responsibilities in favor of making the link check whether or not it has a clean state to be able to send or receive an stfu. This change was made on the basis that the only use the quiescer makes of this information is to assess that it is or is not zero. Further the difficulty of checking this condition in the link is barely more burdensome than selecting the proper information to pass to the quiescer anyway.
a31167b
to
debc43d
Compare
Ran the failed "check commits" and "cross compile" locally since they fail on GitHub due to not enough space being available. Everything checks out, merging. |
Rebased on #9097 now.
NOTE: This PR is part of a series implementing Dynamic Commitments. This PR does not directly implement any Dynamic Commitments specific logic but quiescence is a protocol gadget that is a prerequisite for Dynamic Commitments.
Change Description
This change implements the behavior described in the Quiescence Specification. It allows us to respond to our peer's request to quiesce the channel as well as implementing some
ChannelUpdateHandler
operations that allow us to initiate the process ourselves.Some commits towards the end of the series have been included to allow us to initiate quiescence via RPC for the purposes of integration and interop testing. These commits should be removed before this PR is considered ready to merge. They will ultimately be replaced by RPCs that initiate the Dynamic Commitments protocol itself which will implicitly initiate quiescence as part of its process.
NOTE: This PR does NOT include a mechanism for timing out a quiescence session. This means that if we have an intentionally or unintentionally uncooperative peer, the channel will remain quiesced indefinitely. This is not desirable and will either be addressed in later commits in this PR or into a subsequent PR. However, this PR is submitted without it as it is "complete" in its own right.
Steps to Test
Steps for reviewers to follow to test the change.
Pull Request Checklist
Testing
Code Style and Documentation
[skip ci]
in the commit message for small changes.📝 Please see our Contribution Guidelines for further guidance.