Skip to content

fuzz: remove macros from chanmon_consistency#4571

Draft
joostjager wants to merge 3 commits intolightningdevkit:mainfrom
joostjager:fuzz-no-macros
Draft

fuzz: remove macros from chanmon_consistency#4571
joostjager wants to merge 3 commits intolightningdevkit:mainfrom
joostjager:fuzz-no-macros

Conversation

@joostjager
Copy link
Copy Markdown
Contributor

This PR removes the macro-heavy structure from chanmon_consistency.rs and rewrites it as explicit Rust code.

The main reason is compile time. The macros in this harness slow builds down enough that it becomes very noticeable during iteration. In follow-up force-close fuzzing work, the chanmon_consistency build time increased to around 5 minutes on my machine. That is too expensive for a fuzz target that needs frequent rebuilds.

The macros also make the file harder to read and reason about. Replacing them with normal types and methods should make the harness easier to maintain while also reducing the macro expansion cost.

Builds on #4565

Move shared fuzz logic into the root fuzz crate and generate
fake-hashes and real-hashes runner crates.

Keep `chanmon_consistency_target` on the real-hashes side, remove
the fuzz-local Cargo config, and update scripts, CI, coverage,
and docs to use explicit flags for each runner.

Generate the hash-mode compile checks in the wrapper bins
without a synthetic Cargo feature, while keeping the wrapper
template close to its original shape.

AI tools were used in preparing this commit.
Store real payment preimages in `chanmon_consistency` and use
them when claiming funds, so the real-hashes runner does not
treat `payment_hash` bytes as a stand-in preimage.

AI tools were used in preparing this commit.
Move chanmon_consistency.rs state and orchestration into
Harness, HarnessNode, EventQueues, PaymentTracker, and
PeerLink. This pushes reload, sync, monitor completion,
splice, queue handling, restart, and settle-all behavior
onto owned methods instead of local macros, closures, and
parameter-heavy helper plumbing.

Keep do_test focused on opcode dispatch while preserving
the existing harness behavior.
@ldk-reviews-bot
Copy link
Copy Markdown

👋 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!

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.

2 participants