-
Notifications
You must be signed in to change notification settings - Fork 493
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
commit_sig, revoke_and_ack ordering in channel reestablish flow #794
Comments
Can you clarify what part of the spec (if any) you disagree with here? I also don't see why Alice would send what you suggest. |
If on restart Alice sends add-sig-rev with 2 htlcs included in the sig,
then it is simply a protocol violation, there is no ambiguity there.
Le mer. 12 août 2020 à 12:32, Eugene <notifications@github.com> a écrit :
… Reopened #794
<#794>.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#794 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAPPFPWXDFJ24JUMJPLMVL3SAJVVFANCNFSM4P3PBJGA>
.
|
Yes, my point is that if one side owes two updates, they must be sent out in order on reconnect. That's what should be explicit |
If we have the following state transitions in a channel (starting from the beginning):
If these two messages do not reach Bob, then on reconnect:
Alice then owes Bob
However, what matters is that Alice send these updates in the correct order on startup. The order in which she sent them before going down. There are two ways that Alice could send these three messages that could cause confusion:
The wrong way:
If Alice sends the |
Hey is there anything I can help to move discussion on this? |
That sounds like a good candidate for discussion during the next spec meeting if you want more eyes on it. |
I can attend, I'm not sure about a best possible path to fix it. I think others may have had this issue come up perhaps in rust-lightning or c-lightning? |
I forgot when the meeting was, when is the next one? Sorry about that. |
@Crypt-iQ The meeting is every two weeks as you can infer from the dates of the minutes. |
There's also a tracking issue here with the meeting agenda. |
At first glance, I do agree with that statement. To be sure I understand, your whole point on this issue is that the spec should make the order of messages sent when reconnecting clearer, right? |
Yes since there is both a commit_sig and revoke_and_ack message that Alice must send, the spec should clarify that the order does matter. I believe the order should be the original order before reconnection. |
@Crypt-iQ What is your IRC nick, are you going to be at the meeting in a few hours? |
@ysangkok ill be able to join - I don't have an irc nick so it will probably be my gh handle with some numbers. |
Thanks for this! The problem is that we generally treat "receive sig, send revocation" as an atomic operation. By acknowledging that we've received the sig, but not immediately sending the revocation, we can break this and Badness Happens. The answer is indeed, to send the revocation first for this case. But this is not the only case c-lightning indeed remembers what it sent before:
|
I added a test in First of all, just to make sure we start on the right foot, I think the It should be:
I do agree with the conclusion though: There is already a section in Bolt 2 that mentions this:
It feels to me that we "simply" need to enrich this with an additional:
WDYT? |
Yes @rustyrussell I should have outlined the other case - I can't really parse the C code but it looks like what I'm describing. @t-bast there is another case to handle where the Another scenario (starting from the beginning):
Here Alice sends a
However, Alice cannot send the |
Great, that's a relief :)
I updated my test in ACINQ/eclair@77ff04b to repro this modified scenario. You are right, in that case Alice needs to re-transmit:
And in that case everything works fine. I think the right behaviour is to view your outgoing messages as a queue, that you persist on disk. |
@t-bast That sounds like the right behavior - if we owe any updates based on the interpretation of |
The existing requirements were not specifying the case where both a `commitment_signed` and `revoke_and_ack` need to be retransmitted. This is an important case to specify because if the relative order is not preserved, the channel will close. Fixes #794
The existing requirements were not specifying the case where both a `commitment_signed` and `revoke_and_ack` need to be retransmitted. This is an important case to specify because if the relative order is not preserved, the channel will close. Fixes #794
If we have the following state transitions:
In this scenario, Bob's node dies and the revocation and signature don't reach him.
Since Alice just revoked her last commitment, the next sig also covers the add that Bob sent, in addition to the one Alice sent. So the commit_sig has two htlc signatures.
If, on restart, Alice sends the wrong order:
then Bob will interpret the commit_sig that Alice sends as only having one sig, when it has two. Bob should then force close the channel.
Thus, the ordering of these two messages matters on startup. We can't hardcode a specific ordering as the "incorrect" ordering could always happen. This came up because in lnd, we always send the revocation first. This should be made explicit in the spec, but thought I'd open an issue up first.
The text was updated successfully, but these errors were encountered: