fuzz: Add upgrade/downgrade simulation to chanmon_consistency and fix chacha20 build#4499
fuzz: Add upgrade/downgrade simulation to chanmon_consistency and fix chacha20 build#4499Atishyy27 wants to merge 1 commit intolightningdevkit:mainfrom
Conversation
|
👋 I see @joostjager was un-assigned. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4499 +/- ##
==========================================
+ Coverage 86.18% 86.21% +0.03%
==========================================
Files 160 160
Lines 107441 107441
Branches 107441 107441
==========================================
+ Hits 92593 92634 +41
+ Misses 12229 12189 -40
+ Partials 2619 2618 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
TheBlueMatt
left a comment
There was a problem hiding this comment.
Huh? In order to do an upgrade/downgrade we'll need to actually depend on a previous version of LDK.
|
Ah, I see! I was initially aiming for forward-compatibility coverage by simulating unknown odd TLVs. If the goal is actual cross-version testing, should I add a previous version (e.g., |
|
See the upgrade tests in |
|
Got it. I checked Before I go too deep into the implementation for the fuzzer: since Shall I go ahead and duplicate those test harness implementations for the 0.2 dependency, or is there a lighter-weight serialization round-trip pattern you had in mind for the fuzzer? |
Closes #4452
This PR introduces upgrade/downgrade serialization coverage to the
chanmon_consistencyfuzzer as discussed.Changes:
reload_nodeclosure inchanmon_consistency.rs. Based on a fuzzer input byte, it randomly appends a dummy/unknown odd-type TLV record (0xBADF00D1) to the serializedChannelManagerbyte stream before reloading. This simulates loading data written by a newer version, ensuring we don't drop channels on unknown odd TLVs.seek_to_blockdummy method to the#[cfg(fuzzing)]block ofChaCha20inlightning/src/crypto/chacha20.rs. Without this, the fuzzer binaries currently fail to compile onmain(Exit Code 1).