Skip to content

fuzz: cover deferred writing in chanmon_consistency#4465

Draft
joostjager wants to merge 1 commit intolightningdevkit:mainfrom
joostjager:chain-mon-internal-deferred-writes-with-fuzz
Draft

fuzz: cover deferred writing in chanmon_consistency#4465
joostjager wants to merge 1 commit intolightningdevkit:mainfrom
joostjager:chain-mon-internal-deferred-writes-with-fuzz

Conversation

@joostjager
Copy link
Contributor

@joostjager joostjager commented Mar 6, 2026

Adds fuzz coverage for #4351

@ldk-reviews-bot
Copy link

👋 Hi! I see this is a draft PR.
I'll wait to assign reviewers until you mark it as ready for review.
Just convert it out of draft status when you're ready for review!

@codecov
Copy link

codecov bot commented Mar 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@d830f10). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4465   +/-   ##
=======================================
  Coverage        ?   86.19%           
=======================================
  Files           ?      160           
  Lines           ?   107536           
  Branches        ?   107536           
=======================================
  Hits            ?    92686           
  Misses          ?    12224           
  Partials        ?     2626           
Flag Coverage Δ
tests 86.19% <ø> (?)

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 joostjager force-pushed the chain-mon-internal-deferred-writes-with-fuzz branch from 51afc25 to 0aebb10 Compare March 19, 2026 07:51
@joostjager
Copy link
Contributor Author

Rebased

@joostjager
Copy link
Contributor Author

Will hold off on this until pre-existing fuzz failures #4496 and #4472 are in

Add a `deferred` flag to `TestChainMonitor` that controls whether the
underlying `ChainMonitor` queues operations instead of executing them
immediately. The flag is derived from the fuzz input alongside the
existing monitor style bits, so each of the three nodes can
independently run in deferred or immediate mode.

In deferred mode, `watch_channel` and `update_channel` always return
`InProgress`. A new `flush_and_update_latest_monitors` method drains
the queued operations and, when the persister reports `Completed`,
promotes the pending shadow monitor snapshots to persisted state.
This method is called before `release_pending_monitor_events` and
at each point where the fuzzer completes pending monitor updates.

On node reload, deferred monitors are flushed immediately after
`watch_channel` so the node starts with a consistent state.

AI tools were used in preparing this commit.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@joostjager joostjager force-pushed the chain-mon-internal-deferred-writes-with-fuzz branch from 0aebb10 to 6274ba0 Compare March 20, 2026 17:52
@joostjager
Copy link
Contributor Author

Prerequisites are in, rebased.

@TheBlueMatt
Copy link
Collaborator

This LGTM, why is it draft?

@joostjager
Copy link
Contributor Author

I first wanted to do a serious local run, but then it turned out there are so many pre-existing fuzz failures that it is hard to see what's new. I've bisected the failures to the various PRs that introduced them.

@joostjager
Copy link
Contributor Author

joostjager commented Mar 22, 2026

Although for this PR I could just see if anything pops up that doesnt repro on main. Will do that.

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