-
Notifications
You must be signed in to change notification settings - Fork 407
Correct Channel outbound HTLC serialization and expand fuzzing coverage #892
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
Correct Channel outbound HTLC serialization and expand fuzzing coverage #892
Conversation
caaba21
to
055f0b3
Compare
Codecov Report
@@ Coverage Diff @@
## main #892 +/- ##
==========================================
+ Coverage 90.42% 92.36% +1.93%
==========================================
Files 59 61 +2
Lines 30173 41340 +11167
==========================================
+ Hits 27285 38184 +10899
- Misses 2888 3156 +268
Continue to review full report at Codecov.
|
055f0b3
to
50e9525
Compare
Rebased after #851 merge. |
50e9525
to
46697b9
Compare
46697b9
to
1c818cd
Compare
Added some additional documentation. |
While trying to debug the issue ultimately tracked down to a `PeerHandler` locking bug in lightningdevkit#891, the ability to deliver only individual messages at a time in chanmon_consistency looked important. Specifically, it initially appeared there may be a race when an update_add_htlc was delivered, then a node sent a payment, and only after that, the corresponding commitment-signed was delivered. This commit adds such an ability, greatly expanding the potential for chanmon_consistency to identify channel state machine bugs.
Channel serialization should happen "as if remove_uncommitted_htlcs_and_mark_paused had just been called". This is true for the most part, but outbound RemoteRemoved HTLCs were being serialized as normal, even though `remote_uncommitted_htlcs_and_mark_paused` resets them to `Committed`. This led to a bug identified by the `chanmon_consistency_target` fuzzer wherein, if we receive a update_*_htlc message bug not the corresponding commitment_signed prior to a serialization roundtrip, we'd force-close the channel due to the peer "attempting to fail/claim an HTLC which was already failed/claimed".
1c818cd
to
25dbd0d
Compare
Squashed fixups with no changes. Will merge after CI:
|
This is based on #851 as it is required to get chanmon_consistency_target to run clean anyway.
This fixes a few trivial bugs in full_stack_target, then expands the coverage of chanmon_consistency_target significantly, fixing one bug that that expansion found (so far).