Skip to content

Conversation

@joostjager
Copy link
Contributor

@joostjager joostjager commented Feb 2, 2026

This PR is aiming to increase fuzz coverage generally, and for async persistence of channel monitors specifically. Helpful for increasing confidence that #4345 (which makes use of async persistence) is stable to use.

Changes

  • Expand chanmon_consistency fuzz test from 2 to 6 channels (3 per peer pair)
  • Add MPP payment fuzzing commands that split payments across multiple channels

New fuzz commands

  • 0x70: Direct MPP A→B using all 3 channels
  • 0x71-0x73: MPP via intermediate node with multi-channel variants on first hop, both hops, or second hop

Follow-up

Force-closing one of the channels

@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Feb 2, 2026

👋 Thanks for assigning @TheBlueMatt as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@codecov
Copy link

codecov bot commented Feb 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.00%. Comparing base (f9ad345) to head (e0ba40e).
⚠️ Report is 49 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4367      +/-   ##
==========================================
- Coverage   86.09%   86.00%   -0.10%     
==========================================
  Files         156      156              
  Lines      102804   102781      -23     
  Branches   102804   102781      -23     
==========================================
- Hits        88508    88394     -114     
- Misses      11788    11878      +90     
- Partials     2508     2509       +1     
Flag Coverage Δ
tests 86.00% <ø> (-0.10%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@joostjager
Copy link
Contributor Author

joostjager commented Feb 2, 2026

@TheBlueMatt we keep expanding the fuzz space. If we want to stick to byte commands to not make it unnecessarily difficult for the fuzzer, it seems we have to accept less variation. In particular when there are multiple channels, fuzzing operations on each of them individually is quickly using up all byte values.

For the same reason, I selected only four variations of mpp.

Do you think the trade-off is still right, or should we consider something like 1 byte command + 1 byte parameter?

joostjager and others added 2 commits February 3, 2026 16:18
This expands the channel monitor consistency fuzz test from 2 channels
to 6 channels (3 between A-B and 3 between B-C), enabling future MPP
payment testing.

Changes:
- Extract `connect_peers!` macro from `make_channel!` to avoid duplicate
  peer connections
- Create channel arrays `chan_ab_ids[3]` and `chan_bc_ids[3]`
- Store SCIDs in `chan_ab_scids[3]` and `chan_bc_scids[3]`
- Use funding transaction versions 1-6 to avoid txid collisions under
  fuzz hashing (which XORs all bytes to a single byte, causing versions
  0-5 to collide between A-B and B-C channel pairs)
- Update `test_return!` assertions to expect 3/6/3 channels

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add multi-path payment (MPP) fuzzing commands that split payments across
multiple channels:

- send_mpp_payment: direct MPP from source to dest using multiple channels
- send_mpp_hop_payment: MPP via intermediate node with multiple channels
  on either or both hops

New fuzz commands:
- 0x70: direct MPP 0->1 (uses all 3 A-B channels)
- 0x71: MPP 0->1->2, multi channels on first hop (A-B)
- 0x72: MPP 0->1->2, multi channels on both hops (A-B and B-C)
- 0x73: MPP 0->1->2, multi channels on second hop (B-C)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@joostjager joostjager marked this pull request as ready for review February 3, 2026 15:20
@joostjager joostjager requested review from TheBlueMatt and valentinewallace and removed request for valentinewallace February 3, 2026 15:20
@joostjager joostjager changed the title Fuzz mpp payments Fuzz multi-part payments Feb 3, 2026
Copy link
Collaborator

@TheBlueMatt TheBlueMatt left a comment

Choose a reason for hiding this comment

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

IMO one of the biggest coverage gaps that we can fix here is what happens to payments when a channel was closed. Its obviously not trivial (we have to handle clearing HTLCs via the monitor path) but I'm not actually sure the changes here would have found the bulk of the issues we've run into on 0.1, whereas closing some of the channels would.

@ldk-reviews-bot
Copy link

👋 The first review has been submitted!

Do you think this PR is ready for a second reviewer? If so, click here to assign a second reviewer.

@joostjager
Copy link
Contributor Author

IMO one of the biggest coverage gaps that we can fix here is what happens to payments when a channel was closed. Its obviously not trivial (we have to handle clearing HTLCs via the monitor path) but I'm not actually sure the changes here would have found the bulk of the issues we've run into on 0.1, whereas closing some of the channels would.

Yes I can definitely see that. My idea was to first add multiple channels and mpp in this PR, and then continue with force closing in the next. Do you think doing it the other way around is better?

@TheBlueMatt
Copy link
Collaborator

Oh, no, this is definitely fine, i just wanted to check if that was the next step/intended as a separate PR or if it wasn't planned. Happy to land this as-is first.

@joostjager
Copy link
Contributor Author

Intended next step. I had added it to the PR description to avoid the question :)

@TheBlueMatt
Copy link
Collaborator

Maybe that'll teach me to read (it won't).

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.

3 participants