Skip to content
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

Handle splice with local/remote index mismatch #2757

Merged
merged 2 commits into from
Sep 28, 2023

Conversation

t-bast
Copy link
Member

@t-bast t-bast commented Sep 28, 2023

We assumed that once quiescent, the local and remote commitment index would be the same, but that's not true. Those two indices may diverge because of concurrent updates. We need to keep using the right index for each commitment during and after a splice, otherwise it leads to "invalid commit sig" errors.

We assumed that once quiescent, the local and remote commitment index
would be the same, but that's not true. Those two indices may diverge
because of concurrent updates. We need to keep using the right index for
each commitment during and after a splice, otherwise it leads to "invalid
commit sig" errors.
@t-bast t-bast requested review from remyers and pm47 September 28, 2023 09:36
@codecov-commenter
Copy link

Codecov Report

Merging #2757 (8bb9fa6) into master (0e4985c) will increase coverage by 0.06%.
The diff coverage is 100.00%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

@@            Coverage Diff             @@
##           master    #2757      +/-   ##
==========================================
+ Coverage   85.81%   85.87%   +0.06%     
==========================================
  Files         216      216              
  Lines       18070    18070              
  Branches      732      751      +19     
==========================================
+ Hits        15506    15517      +11     
+ Misses       2564     2553      -11     
Files Coverage Δ
...c/main/scala/fr/acinq/eclair/channel/Helpers.scala 94.33% <100.00%> (ø)
...inq/eclair/channel/fund/InteractiveTxBuilder.scala 91.47% <100.00%> (ø)

... and 4 files with indirect coverage changes

Copy link
Contributor

@remyers remyers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix and new test look good. I also confirmed the test fails without the fix.

@remyers
Copy link
Contributor

remyers commented Sep 28, 2023

In the process of testing I discovered a small bug in the crossSign helper which I fixed in ab4e7ec. Would it make sense to wrap that fix into this PR, or create a new one?

@remyers
Copy link
Contributor

remyers commented Sep 28, 2023

Do you think testing with mismatched commit indexes would be useful for all of the quiescence splice tests?

After some false starts, I modified setupHtlcs to test with mismatched commit indexes in 927e114.

Both changes are in branch https://github.com/remyers/eclair/tree/splice-remote-commit-index

@t-bast
Copy link
Member Author

t-bast commented Sep 28, 2023

In the process of testing I discovered a small bug in the crossSign helper which I fixed in ab4e7ec.

Very good catch, thanks! There was another bug as well (related to having mutiple commit_sig), which I patched in ad5e84d

Do you think testing with mismatched commit indexes would be useful for all of the quiescence splice tests?

No, that would be overkill. That's a specific edge case we want to test once, it doesn't need to be the code path we use in all tests (especially since it's way less readable).

@t-bast t-bast requested a review from remyers September 28, 2023 15:21
Copy link
Contributor

@remyers remyers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@t-bast t-bast merged commit a3b1f9f into master Sep 28, 2023
1 check passed
@t-bast t-bast deleted the splice-remote-commit-index branch September 28, 2023 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants