Reduce CI fuzz iterations as we're now timing out - #3691

Merged
tnull merged 3 commits into
lightningdevkit:mainfrom
TheBlueMatt:2025-03-fuzz-less
Apr 11, 2025
Merged

Reduce CI fuzz iterations as we're now timing out#3691
tnull merged 3 commits into
lightningdevkit:mainfrom
TheBlueMatt:2025-03-fuzz-less

Conversation

@TheBlueMatt

Copy link
Copy Markdown
Collaborator

I think github has slowed down the runners so now our fuzz tests are timing out. Here we just reduce iteration count a bit.

@ldk-reviews-bot

ldk-reviews-bot commented Mar 29, 2025

Copy link
Copy Markdown

I've assigned @joostjager 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.

@tnulltnull left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ACK, seems we hit yet another failing case in the router target now: #3692

tnull
tnull previously approved these changes Mar 31, 2025
Comment threadfuzz/ci-fuzz.sh
HFUZZ_RUN_ARGS="$HFUZZ_RUN_ARGS -t0 -N100000"
else
HFUZZ_RUN_ARGS="$HFUZZ_RUN_ARGS -N1000000"
HFUZZ_RUN_ARGS="$HFUZZ_RUN_ARGS -N500000"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Any specific reasoning behind the 10x, 10x and 2x reductions?

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

No. I probably could have benchmarked, but in general there's not a lot of value in full_stack_target in CI because its just too dense to make any real progress, and similar for chanmon_consistency_target.

@joostjager

joostjager commented Apr 1, 2025

Copy link
Copy Markdown
Contributor

I checked out a fuzzer run on the attr failures PR and grepped the logs. Interestingly it seems like indeed chanmon_consistency_target takes nearly 3 hours. But the other one you mention, full_stack_target is only 18 seconds?

process_network_graph_target is also slow (2+ hours), and looking at the fuzz log in #3687, it doesn't seem to be resolved with that change.

Maybe I am not interpreting correctly though.

Also from this log, you'd say that all the fast tests (<30 sec) don't need their iteration count changed.

base32_target.rs
Summary iterations:1000002 time:198 speed:5050 crashes_count:0 timeout_count:0 new_units_added:449 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
bech32_parse_target.rs
Summary iterations:1000002 time:22 speed:45454 crashes_count:0 timeout_count:0 new_units_added:897 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
bolt11_deser_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:211 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
chanmon_consistency_target.rs
Summary iterations:100002 time:9769 speed:10 crashes_count:0 timeout_count:87 new_units_added:3435 slowest_unit_ms:1139 guard_nb:566357 branch_coverage_percent:2 peak_rss_mb:42
chanmon_deser_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:963 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
fromstr_to_netaddress_target.rs
Summary iterations:1000002 time:17 speed:58823 crashes_count:0 timeout_count:0 new_units_added:160 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
full_stack_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:797 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
indexedmap_target.rs
Summary iterations:1000002 time:648 speed:1543 crashes_count:0 timeout_count:0 new_units_added:698 slowest_unit_ms:19 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
invoice_deser_target.rs
Summary iterations:1000002 time:20 speed:50000 crashes_count:0 timeout_count:0 new_units_added:2955 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
invoice_request_deser_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:2244 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_accept_channel_target.rs
Summary iterations:1000002 time:23 speed:43478 crashes_count:0 timeout_count:0 new_units_added:1115 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_accept_channel_v2_target.rs
Summary iterations:1000002 time:246 speed:4065 crashes_count:0 timeout_count:0 new_units_added:1031 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_announcement_signatures_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:322 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_channel_announcement_target.rs
Summary iterations:1000002 time:20 speed:50000 crashes_count:0 timeout_count:0 new_units_added:413 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_channel_details_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:993 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_channel_ready_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:374 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_channel_reestablish_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:434 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_channel_update_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:210 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_closing_signed_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:380 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_commitment_signed_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:697 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_decoded_onion_error_packet_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:178 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_error_message_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:108 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_funding_created_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:342 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_funding_signed_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:304 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_gossip_timestamp_filter_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:294 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_init_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:1006 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_node_announcement_target.rs
Summary iterations:1000002 time:21 speed:47619 crashes_count:0 timeout_count:0 new_units_added:851 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_open_channel_target.rs
Summary iterations:1000002 time:35 speed:28571 crashes_count:0 timeout_count:0 new_units_added:1163 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_open_channel_v2_target.rs
Summary iterations:1000002 time:24 speed:41666 crashes_count:0 timeout_count:0 new_units_added:1289 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_ping_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:91 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_pong_target.rs
Summary iterations:1000002 time:20 speed:50000 crashes_count:0 timeout_count:0 new_units_added:83 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_query_channel_range_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:334 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_query_short_channel_ids_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:108 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_reply_channel_range_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:158 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_reply_short_channel_ids_end_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:337 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_revoke_and_ack_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:360 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_shutdown_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:333 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_splice_ack_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:387 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_splice_init_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:401 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_splice_locked_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:319 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_stfu_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:319 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_abort_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:403 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_ack_rbf_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:366 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_add_input_target.rs
Summary iterations:1000002 time:24 speed:41666 crashes_count:0 timeout_count:0 new_units_added:1270 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_add_output_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:390 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_complete_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:285 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_init_rbf_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:393 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_remove_input_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:297 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_remove_output_target.rs
Summary iterations:1000002 time:17 speed:58823 crashes_count:0 timeout_count:0 new_units_added:322 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_signatures_target.rs
Summary iterations:1000002 time:52 speed:19230 crashes_count:0 timeout_count:0 new_units_added:851 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_update_add_htlc_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:430 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_update_fail_htlc_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:480 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_update_fail_malformed_htlc_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:321 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_update_fee_target.rs
Summary iterations:1000002 time:17 speed:58823 crashes_count:0 timeout_count:0 new_units_added:308 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_update_fulfill_htlc_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:309 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
offer_deser_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:1333 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
onion_hop_data_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:981 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
onion_message_target.rs
Summary iterations:1000002 time:24 speed:41666 crashes_count:0 timeout_count:0 new_units_added:395 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
peer_crypt_target.rs
Summary iterations:1000002 time:27 speed:37037 crashes_count:0 timeout_count:0 new_units_added:315 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
process_network_graph_target.rs
Summary iterations:735922 time:8434 speed:87 crashes_count:0 timeout_count:0 new_units_added:30 slowest_unit_ms:40 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:161

@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

I checked out a fuzzer run on the attr failures PR and grepped the logs. Interestingly it seems like indeed chanmon_consistency_target takes nearly 3 hours. But the other one you mention, full_stack_target is only 18 seconds?

Ah, thanks for doing that. Yea, I was going on the results when I fuzz with real corpuses, where full_stack_target can get quite slow. But, given we currently don't initialize our CI fuzzers with a real corpus so it really doesn't get into it too much. I did go ahead and update the CI fuzzer to use the hard-coded full_stack_target seeds, but it still doesn't spend much time in complicated paths.

process_network_graph_target is also slow (2+ hours), and looking at the fuzz log in #3687, it doesn't seem to be resolved with that change.

Huh, interesting, I went ahead and slowed this one down though.

Also from this log, you'd say that all the fast tests (<30 sec) don't need their iteration count changed.

Yep!

@TheBlueMatt
TheBlueMattforce-pushed the 2025-03-fuzz-less branch 2 times, most recently from c87c3f3 to ad4fb1eCompareApril 1, 2025 18:33
@codecov

codecovBot commented Apr 1, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.92%. Comparing base (c4d23bc) to head (11dde05).
Report is 38 commits behind head on main.

Additional details and impacted files
@@ Coverage Diff @@## main #3691 +/- ##
==========================================
+ Coverage 89.05% 89.92% +0.86% 
==========================================
Files 155 156 +1 Lines 122019 129760 +7741 Branches 122019 129760 +7741 ==========================================
+ Hits 108666 116683 +8017 + Misses 10695 10441 -254 + Partials 2658 2636 -22 

☔ 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.

@TheBlueMatt
TheBlueMattforce-pushed the 2025-03-fuzz-less branch 6 times, most recently from b93b1d6 to 4b4bad8CompareApril 3, 2025 15:21
tnull
tnull previously approved these changes Apr 4, 2025

@tnulltnull left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

Fuzz failure is #3708

@joostjagerjoostjager left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great that fuzzing again found an issue. This is awesome.

Before merging this, I think we still want to see a successful fuzz run well within the timeout?

@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

Yea, happy to wait until we can at least run a fuzzing run and check that all the timings make sense.

@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

It passed, but taking five hours for CI is excessive, so I reduced it further.

@tnull

tnull commented Apr 8, 2025

Copy link
Copy Markdown
Contributor

It passed, but taking five hours for CI is excessive, so I reduced it further.

Now finished in 273min ~ 4.55 hours. Is this acceptable?

@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

Mmm, that's still pretty aggressive. Divided a few jobs by two so hopefully this time's the charm.

@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

Okay, its now "only" 2h, which I think is kinda reasonable, or at least its in line with what some of our other jobs take, so happy to land this now.

tnull
tnull previously approved these changes Apr 8, 2025
@joostjager

Copy link
Copy Markdown
Contributor

Distribution looks much better now:

testiterationstime
base32_target.rs2500002278
bech32_parse_target.rs250000258
bolt11_deser_target.rs250000245
chanmon_consistency_target.rs5002852
chanmon_deser_target.r250000255
fromstr_to_netaddress_target.r250000245
full_stack_target.rs50002554
indexedmap_target.rs500002394
invoice_deser_target.r250000251
invoice_request_deser_target.r250000250
msg_accept_channel_target.rs2500002181
msg_accept_channel_v2_target.r2500002258
msg_announcement_signatures_target.rs250000253
msg_channel_announcement_target.rs250000273
msg_channel_details_target.rs250000247
msg_channel_ready_target.r250000249
msg_channel_reestablish_target.rs250000252
msg_channel_update_target.rs250000254
msg_closing_signed_target.rs250000250
msg_commitment_signed_target.r250000255
msg_decoded_onion_error_packet_target.rs250000250
msg_error_message_target.r250000251
msg_funding_created_target.rs250000252
msg_funding_signed_target.rs250000250
msg_gossip_timestamp_filter_target.rs250000247
msg_init_target.rs250000248
msg_node_announcement_target.r250000260
msg_open_channel_target.rs250000271
msg_open_channel_v2_target.rs250000266
msg_ping_target.rs250000248
msg_pong_target.rs250000248
msg_query_channel_range_target.rs250000247
msg_query_short_channel_ids_target.rs250000252
msg_reply_channel_range_target.rs250000248
msg_reply_short_channel_ids_end_target.rs250000247
msg_revoke_and_ack_target.rs250000250
msg_shutdown_target.rs250000247
msg_splice_ack_target.rs250000250
msg_splice_init_target.rs250000250
msg_splice_locked_target.r250000248
msg_stfu_target.rs250000247
msg_tx_abort_target.rs250000248
msg_tx_ack_rbf_target.rs250000247
msg_tx_add_input_target.rs250000273
msg_tx_add_output_target.r250000248
msg_tx_complete_target.rs250000247
msg_tx_init_rbf_target.rs250000248
msg_tx_remove_input_target.rs250000247
msg_tx_remove_output_target.rs250000248
msg_tx_signatures_target.r2500002100
msg_update_add_htlc_target.rs250000299
msg_update_fail_htlc_target.rs250000252
msg_update_fail_malformed_htlc_target.rs250000249
msg_update_fee_target.rs250000248
msg_update_fulfill_htlc_target.rs250000249
offer_deser_target.rs250000248
onion_hop_data_target.rs250000249
onion_message_target.r250000264
peer_crypt_target.rs2500002108
process_network_graph_target.r50002568
process_onion_failure_target.r2500002165
refund_deser_target.rs250000249
router_target.rs50002606
zbase32_target.rs2500002119

Comment threadfuzz/src/full_stack.rs
Comment threadfuzz/ci-fuzz.sh
run: |
cd fuzz
RUSTFLAGS="--cfg=fuzzing --cfg=secp256k1_fuzz --cfg=hashes_fuzz" cargo test --verbose --color always
RUSTFLAGS="--cfg=fuzzing --cfg=secp256k1_fuzz --cfg=hashes_fuzz" cargo test --verbose --color always --lib --bins

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why these two additions?

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

Because RUSTFLAGS aren't applied to doctests, so we have to restrict tests to only run library and binary tests.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could add comments when making changes like this. Make life easier for future devs.

Comment threadfuzz/ci-fuzz.sh

mkdir -p hfuzz_workspace/full_stack_target/input
pushd write-seeds
RUSTFLAGS="$RUSTFLAGS --cfg=fuzzing" cargo run ../hfuzz_workspace/full_stack_target/input

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I wanted to verify that using the hardcoded seed indeed increases coverage, but it seems that hongfuzz reports in the log always

branch_coverage_percent:0

Not sure why that is? Otherwise it would be easy to compare with and without this hardcoded seed.

Or maybe there is another way to verify that it works indeed?

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

The fact that the full_stack_target got much slower is pretty good evidence :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Okay, indirect evidence. But why is hongfuzz reporting 0?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it not using coverage to direct fuzzing?

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

Yea, that I don't know, it certainly does locally and there's nothing different locally vs in CI. Also CI does turn up (fairly shallow) fuzz bugs as well, so I'd be surprised to learn it was able to do that with just general patterns and no instrumentation...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does it show you branch_coverage_percent as non-zero locally?

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

I'm not 100% sure about branch coverage specifically, but what I get from a running instance is: Coverage : edge: 16,485/568,547 [2%] pc: 738 cmp: 794,641. I assume "cmp" is the branch coverage.

joostjager
joostjager previously approved these changes Apr 10, 2025
When we made `test_node_counter_consistency` more aggressively
run, our `process_network_graph` fuzzer got materially slower,
resulting in consistent fuzz CI job timeouts.
Thus, here, we tweak the iteration count on all our fuzz jobs to
get them running in more consistent times.
Further, we further reduce `full_stack_target` iterations in
anticipation of a later commit which will start using our
hard-coded fuzz seeds, creating substantially more coverage and
slowing down fuzzing iterations.
In 3145168 we disabled
`test_node_counter_consistency` in debug builds since it can make
make things very slow, including `lightning-rapid-gossip-sync`
tests.
We should, however, have kept it when fuzzing, since that gives us
testing of potential coverage gaps in normal tests.
This should materially improve our fuzzing coverage in CI.
@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

Went ahead and squashed the addition of a comment in the fuzz script.

@joostjagerjoostjager left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great to have a more reasonable run time for the fuzzer!

Still interested to find out what's going on with that coverage indicator at zero in CI.

@tnull
tnull merged commit 83e9e80 into lightningdevkit:mainApr 11, 2025
Sign up for freeto 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.

4 participants

@TheBlueMatt@ldk-reviews-bot@joostjager@tnull
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Reduce CI fuzz iterations as we're now timing out - #3691

Merged
tnull merged 3 commits into
lightningdevkit:mainfrom
TheBlueMatt:2025-03-fuzz-less
Apr 11, 2025
Merged

Reduce CI fuzz iterations as we're now timing out#3691
tnull merged 3 commits into
lightningdevkit:mainfrom
TheBlueMatt:2025-03-fuzz-less

Conversation

@TheBlueMatt

Copy link
Copy Markdown
Collaborator

I think github has slowed down the runners so now our fuzz tests are timing out. Here we just reduce iteration count a bit.

@ldk-reviews-bot

ldk-reviews-bot commented Mar 29, 2025

Copy link
Copy Markdown

I've assigned @joostjager 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.

@tnulltnull left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ACK, seems we hit yet another failing case in the router target now: #3692

tnull
tnull previously approved these changes Mar 31, 2025
Comment threadfuzz/ci-fuzz.sh
HFUZZ_RUN_ARGS="$HFUZZ_RUN_ARGS -t0 -N100000"
else
HFUZZ_RUN_ARGS="$HFUZZ_RUN_ARGS -N1000000"
HFUZZ_RUN_ARGS="$HFUZZ_RUN_ARGS -N500000"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Any specific reasoning behind the 10x, 10x and 2x reductions?

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

No. I probably could have benchmarked, but in general there's not a lot of value in full_stack_target in CI because its just too dense to make any real progress, and similar for chanmon_consistency_target.

@joostjager

joostjager commented Apr 1, 2025

Copy link
Copy Markdown
Contributor

I checked out a fuzzer run on the attr failures PR and grepped the logs. Interestingly it seems like indeed chanmon_consistency_target takes nearly 3 hours. But the other one you mention, full_stack_target is only 18 seconds?

process_network_graph_target is also slow (2+ hours), and looking at the fuzz log in #3687, it doesn't seem to be resolved with that change.

Maybe I am not interpreting correctly though.

Also from this log, you'd say that all the fast tests (<30 sec) don't need their iteration count changed.

base32_target.rs
Summary iterations:1000002 time:198 speed:5050 crashes_count:0 timeout_count:0 new_units_added:449 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
bech32_parse_target.rs
Summary iterations:1000002 time:22 speed:45454 crashes_count:0 timeout_count:0 new_units_added:897 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
bolt11_deser_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:211 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
chanmon_consistency_target.rs
Summary iterations:100002 time:9769 speed:10 crashes_count:0 timeout_count:87 new_units_added:3435 slowest_unit_ms:1139 guard_nb:566357 branch_coverage_percent:2 peak_rss_mb:42
chanmon_deser_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:963 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
fromstr_to_netaddress_target.rs
Summary iterations:1000002 time:17 speed:58823 crashes_count:0 timeout_count:0 new_units_added:160 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
full_stack_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:797 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
indexedmap_target.rs
Summary iterations:1000002 time:648 speed:1543 crashes_count:0 timeout_count:0 new_units_added:698 slowest_unit_ms:19 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
invoice_deser_target.rs
Summary iterations:1000002 time:20 speed:50000 crashes_count:0 timeout_count:0 new_units_added:2955 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
invoice_request_deser_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:2244 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_accept_channel_target.rs
Summary iterations:1000002 time:23 speed:43478 crashes_count:0 timeout_count:0 new_units_added:1115 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_accept_channel_v2_target.rs
Summary iterations:1000002 time:246 speed:4065 crashes_count:0 timeout_count:0 new_units_added:1031 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_announcement_signatures_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:322 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_channel_announcement_target.rs
Summary iterations:1000002 time:20 speed:50000 crashes_count:0 timeout_count:0 new_units_added:413 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_channel_details_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:993 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_channel_ready_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:374 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_channel_reestablish_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:434 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_channel_update_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:210 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_closing_signed_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:380 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_commitment_signed_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:697 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_decoded_onion_error_packet_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:178 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_error_message_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:108 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_funding_created_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:342 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_funding_signed_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:304 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_gossip_timestamp_filter_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:294 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_init_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:1006 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_node_announcement_target.rs
Summary iterations:1000002 time:21 speed:47619 crashes_count:0 timeout_count:0 new_units_added:851 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_open_channel_target.rs
Summary iterations:1000002 time:35 speed:28571 crashes_count:0 timeout_count:0 new_units_added:1163 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_open_channel_v2_target.rs
Summary iterations:1000002 time:24 speed:41666 crashes_count:0 timeout_count:0 new_units_added:1289 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_ping_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:91 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_pong_target.rs
Summary iterations:1000002 time:20 speed:50000 crashes_count:0 timeout_count:0 new_units_added:83 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_query_channel_range_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:334 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_query_short_channel_ids_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:108 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_reply_channel_range_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:158 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_reply_short_channel_ids_end_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:337 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_revoke_and_ack_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:360 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_shutdown_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:333 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_splice_ack_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:387 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_splice_init_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:401 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_splice_locked_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:319 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_stfu_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:319 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_abort_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:403 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_ack_rbf_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:366 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_add_input_target.rs
Summary iterations:1000002 time:24 speed:41666 crashes_count:0 timeout_count:0 new_units_added:1270 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_add_output_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:390 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_complete_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:285 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_init_rbf_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:393 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_remove_input_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:297 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_remove_output_target.rs
Summary iterations:1000002 time:17 speed:58823 crashes_count:0 timeout_count:0 new_units_added:322 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_signatures_target.rs
Summary iterations:1000002 time:52 speed:19230 crashes_count:0 timeout_count:0 new_units_added:851 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_update_add_htlc_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:430 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_update_fail_htlc_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:480 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_update_fail_malformed_htlc_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:321 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_update_fee_target.rs
Summary iterations:1000002 time:17 speed:58823 crashes_count:0 timeout_count:0 new_units_added:308 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_update_fulfill_htlc_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:309 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
offer_deser_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:1333 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
onion_hop_data_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:981 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
onion_message_target.rs
Summary iterations:1000002 time:24 speed:41666 crashes_count:0 timeout_count:0 new_units_added:395 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
peer_crypt_target.rs
Summary iterations:1000002 time:27 speed:37037 crashes_count:0 timeout_count:0 new_units_added:315 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
process_network_graph_target.rs
Summary iterations:735922 time:8434 speed:87 crashes_count:0 timeout_count:0 new_units_added:30 slowest_unit_ms:40 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:161

@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

I checked out a fuzzer run on the attr failures PR and grepped the logs. Interestingly it seems like indeed chanmon_consistency_target takes nearly 3 hours. But the other one you mention, full_stack_target is only 18 seconds?

Ah, thanks for doing that. Yea, I was going on the results when I fuzz with real corpuses, where full_stack_target can get quite slow. But, given we currently don't initialize our CI fuzzers with a real corpus so it really doesn't get into it too much. I did go ahead and update the CI fuzzer to use the hard-coded full_stack_target seeds, but it still doesn't spend much time in complicated paths.

process_network_graph_target is also slow (2+ hours), and looking at the fuzz log in #3687, it doesn't seem to be resolved with that change.

Huh, interesting, I went ahead and slowed this one down though.

Also from this log, you'd say that all the fast tests (<30 sec) don't need their iteration count changed.

Yep!

@TheBlueMatt
TheBlueMattforce-pushed the 2025-03-fuzz-less branch 2 times, most recently from c87c3f3 to ad4fb1eCompareApril 1, 2025 18:33
@codecov

codecovBot commented Apr 1, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.92%. Comparing base (c4d23bc) to head (11dde05).
Report is 38 commits behind head on main.

Additional details and impacted files
@@ Coverage Diff @@## main #3691 +/- ##
==========================================
+ Coverage 89.05% 89.92% +0.86% 
==========================================
Files 155 156 +1 Lines 122019 129760 +7741 Branches 122019 129760 +7741 ==========================================
+ Hits 108666 116683 +8017 + Misses 10695 10441 -254 + Partials 2658 2636 -22 

☔ 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.

@TheBlueMatt
TheBlueMattforce-pushed the 2025-03-fuzz-less branch 6 times, most recently from b93b1d6 to 4b4bad8CompareApril 3, 2025 15:21
tnull
tnull previously approved these changes Apr 4, 2025

@tnulltnull left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

Fuzz failure is #3708

@joostjagerjoostjager left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great that fuzzing again found an issue. This is awesome.

Before merging this, I think we still want to see a successful fuzz run well within the timeout?

@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

Yea, happy to wait until we can at least run a fuzzing run and check that all the timings make sense.

@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

It passed, but taking five hours for CI is excessive, so I reduced it further.

@tnull

tnull commented Apr 8, 2025

Copy link
Copy Markdown
Contributor

It passed, but taking five hours for CI is excessive, so I reduced it further.

Now finished in 273min ~ 4.55 hours. Is this acceptable?

@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

Mmm, that's still pretty aggressive. Divided a few jobs by two so hopefully this time's the charm.

@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

Okay, its now "only" 2h, which I think is kinda reasonable, or at least its in line with what some of our other jobs take, so happy to land this now.

tnull
tnull previously approved these changes Apr 8, 2025
@joostjager

Copy link
Copy Markdown
Contributor

Distribution looks much better now:

testiterationstime
base32_target.rs2500002278
bech32_parse_target.rs250000258
bolt11_deser_target.rs250000245
chanmon_consistency_target.rs5002852
chanmon_deser_target.r250000255
fromstr_to_netaddress_target.r250000245
full_stack_target.rs50002554
indexedmap_target.rs500002394
invoice_deser_target.r250000251
invoice_request_deser_target.r250000250
msg_accept_channel_target.rs2500002181
msg_accept_channel_v2_target.r2500002258
msg_announcement_signatures_target.rs250000253
msg_channel_announcement_target.rs250000273
msg_channel_details_target.rs250000247
msg_channel_ready_target.r250000249
msg_channel_reestablish_target.rs250000252
msg_channel_update_target.rs250000254
msg_closing_signed_target.rs250000250
msg_commitment_signed_target.r250000255
msg_decoded_onion_error_packet_target.rs250000250
msg_error_message_target.r250000251
msg_funding_created_target.rs250000252
msg_funding_signed_target.rs250000250
msg_gossip_timestamp_filter_target.rs250000247
msg_init_target.rs250000248
msg_node_announcement_target.r250000260
msg_open_channel_target.rs250000271
msg_open_channel_v2_target.rs250000266
msg_ping_target.rs250000248
msg_pong_target.rs250000248
msg_query_channel_range_target.rs250000247
msg_query_short_channel_ids_target.rs250000252
msg_reply_channel_range_target.rs250000248
msg_reply_short_channel_ids_end_target.rs250000247
msg_revoke_and_ack_target.rs250000250
msg_shutdown_target.rs250000247
msg_splice_ack_target.rs250000250
msg_splice_init_target.rs250000250
msg_splice_locked_target.r250000248
msg_stfu_target.rs250000247
msg_tx_abort_target.rs250000248
msg_tx_ack_rbf_target.rs250000247
msg_tx_add_input_target.rs250000273
msg_tx_add_output_target.r250000248
msg_tx_complete_target.rs250000247
msg_tx_init_rbf_target.rs250000248
msg_tx_remove_input_target.rs250000247
msg_tx_remove_output_target.rs250000248
msg_tx_signatures_target.r2500002100
msg_update_add_htlc_target.rs250000299
msg_update_fail_htlc_target.rs250000252
msg_update_fail_malformed_htlc_target.rs250000249
msg_update_fee_target.rs250000248
msg_update_fulfill_htlc_target.rs250000249
offer_deser_target.rs250000248
onion_hop_data_target.rs250000249
onion_message_target.r250000264
peer_crypt_target.rs2500002108
process_network_graph_target.r50002568
process_onion_failure_target.r2500002165
refund_deser_target.rs250000249
router_target.rs50002606
zbase32_target.rs2500002119

Comment threadfuzz/src/full_stack.rs
Comment threadfuzz/ci-fuzz.sh
run: |
cd fuzz
RUSTFLAGS="--cfg=fuzzing --cfg=secp256k1_fuzz --cfg=hashes_fuzz" cargo test --verbose --color always
RUSTFLAGS="--cfg=fuzzing --cfg=secp256k1_fuzz --cfg=hashes_fuzz" cargo test --verbose --color always --lib --bins

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why these two additions?

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

Because RUSTFLAGS aren't applied to doctests, so we have to restrict tests to only run library and binary tests.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could add comments when making changes like this. Make life easier for future devs.

Comment threadfuzz/ci-fuzz.sh

mkdir -p hfuzz_workspace/full_stack_target/input
pushd write-seeds
RUSTFLAGS="$RUSTFLAGS --cfg=fuzzing" cargo run ../hfuzz_workspace/full_stack_target/input

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I wanted to verify that using the hardcoded seed indeed increases coverage, but it seems that hongfuzz reports in the log always

branch_coverage_percent:0

Not sure why that is? Otherwise it would be easy to compare with and without this hardcoded seed.

Or maybe there is another way to verify that it works indeed?

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

The fact that the full_stack_target got much slower is pretty good evidence :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Okay, indirect evidence. But why is hongfuzz reporting 0?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it not using coverage to direct fuzzing?

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

Yea, that I don't know, it certainly does locally and there's nothing different locally vs in CI. Also CI does turn up (fairly shallow) fuzz bugs as well, so I'd be surprised to learn it was able to do that with just general patterns and no instrumentation...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does it show you branch_coverage_percent as non-zero locally?

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

I'm not 100% sure about branch coverage specifically, but what I get from a running instance is: Coverage : edge: 16,485/568,547 [2%] pc: 738 cmp: 794,641. I assume "cmp" is the branch coverage.

joostjager
joostjager previously approved these changes Apr 10, 2025
When we made `test_node_counter_consistency` more aggressively
run, our `process_network_graph` fuzzer got materially slower,
resulting in consistent fuzz CI job timeouts.
Thus, here, we tweak the iteration count on all our fuzz jobs to
get them running in more consistent times.
Further, we further reduce `full_stack_target` iterations in
anticipation of a later commit which will start using our
hard-coded fuzz seeds, creating substantially more coverage and
slowing down fuzzing iterations.
In 3145168 we disabled
`test_node_counter_consistency` in debug builds since it can make
make things very slow, including `lightning-rapid-gossip-sync`
tests.
We should, however, have kept it when fuzzing, since that gives us
testing of potential coverage gaps in normal tests.
This should materially improve our fuzzing coverage in CI.
@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

Went ahead and squashed the addition of a comment in the fuzz script.

@joostjagerjoostjager left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great to have a more reasonable run time for the fuzzer!

Still interested to find out what's going on with that coverage indicator at zero in CI.

@tnull
tnull merged commit 83e9e80 into lightningdevkit:mainApr 11, 2025
Sign up for freeto 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.

4 participants

@TheBlueMatt@ldk-reviews-bot@joostjager@tnull
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Reduce CI fuzz iterations as we're now timing out - #3691

Merged
tnull merged 3 commits into
lightningdevkit:mainfrom
TheBlueMatt:2025-03-fuzz-less
Apr 11, 2025
Merged

Reduce CI fuzz iterations as we're now timing out#3691
tnull merged 3 commits into
lightningdevkit:mainfrom
TheBlueMatt:2025-03-fuzz-less

Conversation

@TheBlueMatt

Copy link
Copy Markdown
Collaborator

I think github has slowed down the runners so now our fuzz tests are timing out. Here we just reduce iteration count a bit.

@ldk-reviews-bot

ldk-reviews-bot commented Mar 29, 2025

Copy link
Copy Markdown

I've assigned @joostjager 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.

@tnulltnull left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ACK, seems we hit yet another failing case in the router target now: #3692

tnull
tnull previously approved these changes Mar 31, 2025
Comment threadfuzz/ci-fuzz.sh
HFUZZ_RUN_ARGS="$HFUZZ_RUN_ARGS -t0 -N100000"
else
HFUZZ_RUN_ARGS="$HFUZZ_RUN_ARGS -N1000000"
HFUZZ_RUN_ARGS="$HFUZZ_RUN_ARGS -N500000"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Any specific reasoning behind the 10x, 10x and 2x reductions?

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

No. I probably could have benchmarked, but in general there's not a lot of value in full_stack_target in CI because its just too dense to make any real progress, and similar for chanmon_consistency_target.

@joostjager

joostjager commented Apr 1, 2025

Copy link
Copy Markdown
Contributor

I checked out a fuzzer run on the attr failures PR and grepped the logs. Interestingly it seems like indeed chanmon_consistency_target takes nearly 3 hours. But the other one you mention, full_stack_target is only 18 seconds?

process_network_graph_target is also slow (2+ hours), and looking at the fuzz log in #3687, it doesn't seem to be resolved with that change.

Maybe I am not interpreting correctly though.

Also from this log, you'd say that all the fast tests (<30 sec) don't need their iteration count changed.

base32_target.rs
Summary iterations:1000002 time:198 speed:5050 crashes_count:0 timeout_count:0 new_units_added:449 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
bech32_parse_target.rs
Summary iterations:1000002 time:22 speed:45454 crashes_count:0 timeout_count:0 new_units_added:897 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
bolt11_deser_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:211 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
chanmon_consistency_target.rs
Summary iterations:100002 time:9769 speed:10 crashes_count:0 timeout_count:87 new_units_added:3435 slowest_unit_ms:1139 guard_nb:566357 branch_coverage_percent:2 peak_rss_mb:42
chanmon_deser_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:963 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
fromstr_to_netaddress_target.rs
Summary iterations:1000002 time:17 speed:58823 crashes_count:0 timeout_count:0 new_units_added:160 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
full_stack_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:797 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
indexedmap_target.rs
Summary iterations:1000002 time:648 speed:1543 crashes_count:0 timeout_count:0 new_units_added:698 slowest_unit_ms:19 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
invoice_deser_target.rs
Summary iterations:1000002 time:20 speed:50000 crashes_count:0 timeout_count:0 new_units_added:2955 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
invoice_request_deser_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:2244 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_accept_channel_target.rs
Summary iterations:1000002 time:23 speed:43478 crashes_count:0 timeout_count:0 new_units_added:1115 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_accept_channel_v2_target.rs
Summary iterations:1000002 time:246 speed:4065 crashes_count:0 timeout_count:0 new_units_added:1031 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_announcement_signatures_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:322 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_channel_announcement_target.rs
Summary iterations:1000002 time:20 speed:50000 crashes_count:0 timeout_count:0 new_units_added:413 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_channel_details_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:993 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_channel_ready_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:374 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_channel_reestablish_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:434 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_channel_update_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:210 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_closing_signed_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:380 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_commitment_signed_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:697 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_decoded_onion_error_packet_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:178 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_error_message_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:108 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_funding_created_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:342 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_funding_signed_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:304 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_gossip_timestamp_filter_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:294 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_init_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:1006 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_node_announcement_target.rs
Summary iterations:1000002 time:21 speed:47619 crashes_count:0 timeout_count:0 new_units_added:851 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_open_channel_target.rs
Summary iterations:1000002 time:35 speed:28571 crashes_count:0 timeout_count:0 new_units_added:1163 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_open_channel_v2_target.rs
Summary iterations:1000002 time:24 speed:41666 crashes_count:0 timeout_count:0 new_units_added:1289 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_ping_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:91 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_pong_target.rs
Summary iterations:1000002 time:20 speed:50000 crashes_count:0 timeout_count:0 new_units_added:83 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_query_channel_range_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:334 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_query_short_channel_ids_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:108 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_reply_channel_range_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:158 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_reply_short_channel_ids_end_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:337 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_revoke_and_ack_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:360 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_shutdown_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:333 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_splice_ack_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:387 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_splice_init_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:401 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_splice_locked_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:319 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_stfu_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:319 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_abort_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:403 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_ack_rbf_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:366 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_add_input_target.rs
Summary iterations:1000002 time:24 speed:41666 crashes_count:0 timeout_count:0 new_units_added:1270 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_add_output_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:390 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_complete_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:285 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_init_rbf_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:393 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_remove_input_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:297 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_remove_output_target.rs
Summary iterations:1000002 time:17 speed:58823 crashes_count:0 timeout_count:0 new_units_added:322 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_signatures_target.rs
Summary iterations:1000002 time:52 speed:19230 crashes_count:0 timeout_count:0 new_units_added:851 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_update_add_htlc_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:430 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_update_fail_htlc_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:480 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_update_fail_malformed_htlc_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:321 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_update_fee_target.rs
Summary iterations:1000002 time:17 speed:58823 crashes_count:0 timeout_count:0 new_units_added:308 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_update_fulfill_htlc_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:309 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
offer_deser_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:1333 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
onion_hop_data_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:981 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
onion_message_target.rs
Summary iterations:1000002 time:24 speed:41666 crashes_count:0 timeout_count:0 new_units_added:395 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
peer_crypt_target.rs
Summary iterations:1000002 time:27 speed:37037 crashes_count:0 timeout_count:0 new_units_added:315 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
process_network_graph_target.rs
Summary iterations:735922 time:8434 speed:87 crashes_count:0 timeout_count:0 new_units_added:30 slowest_unit_ms:40 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:161

@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

I checked out a fuzzer run on the attr failures PR and grepped the logs. Interestingly it seems like indeed chanmon_consistency_target takes nearly 3 hours. But the other one you mention, full_stack_target is only 18 seconds?

Ah, thanks for doing that. Yea, I was going on the results when I fuzz with real corpuses, where full_stack_target can get quite slow. But, given we currently don't initialize our CI fuzzers with a real corpus so it really doesn't get into it too much. I did go ahead and update the CI fuzzer to use the hard-coded full_stack_target seeds, but it still doesn't spend much time in complicated paths.

process_network_graph_target is also slow (2+ hours), and looking at the fuzz log in #3687, it doesn't seem to be resolved with that change.

Huh, interesting, I went ahead and slowed this one down though.

Also from this log, you'd say that all the fast tests (<30 sec) don't need their iteration count changed.

Yep!

@TheBlueMatt
TheBlueMattforce-pushed the 2025-03-fuzz-less branch 2 times, most recently from c87c3f3 to ad4fb1eCompareApril 1, 2025 18:33
@codecov

codecovBot commented Apr 1, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.92%. Comparing base (c4d23bc) to head (11dde05).
Report is 38 commits behind head on main.

Additional details and impacted files
@@ Coverage Diff @@## main #3691 +/- ##
==========================================
+ Coverage 89.05% 89.92% +0.86% 
==========================================
Files 155 156 +1 Lines 122019 129760 +7741 Branches 122019 129760 +7741 ==========================================
+ Hits 108666 116683 +8017 + Misses 10695 10441 -254 + Partials 2658 2636 -22 

☔ 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.

@TheBlueMatt
TheBlueMattforce-pushed the 2025-03-fuzz-less branch 6 times, most recently from b93b1d6 to 4b4bad8CompareApril 3, 2025 15:21
tnull
tnull previously approved these changes Apr 4, 2025

@tnulltnull left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

Fuzz failure is #3708

@joostjagerjoostjager left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great that fuzzing again found an issue. This is awesome.

Before merging this, I think we still want to see a successful fuzz run well within the timeout?

@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

Yea, happy to wait until we can at least run a fuzzing run and check that all the timings make sense.

@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

It passed, but taking five hours for CI is excessive, so I reduced it further.

@tnull

tnull commented Apr 8, 2025

Copy link
Copy Markdown
Contributor

It passed, but taking five hours for CI is excessive, so I reduced it further.

Now finished in 273min ~ 4.55 hours. Is this acceptable?

@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

Mmm, that's still pretty aggressive. Divided a few jobs by two so hopefully this time's the charm.

@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

Okay, its now "only" 2h, which I think is kinda reasonable, or at least its in line with what some of our other jobs take, so happy to land this now.

tnull
tnull previously approved these changes Apr 8, 2025
@joostjager

Copy link
Copy Markdown
Contributor

Distribution looks much better now:

testiterationstime
base32_target.rs2500002278
bech32_parse_target.rs250000258
bolt11_deser_target.rs250000245
chanmon_consistency_target.rs5002852
chanmon_deser_target.r250000255
fromstr_to_netaddress_target.r250000245
full_stack_target.rs50002554
indexedmap_target.rs500002394
invoice_deser_target.r250000251
invoice_request_deser_target.r250000250
msg_accept_channel_target.rs2500002181
msg_accept_channel_v2_target.r2500002258
msg_announcement_signatures_target.rs250000253
msg_channel_announcement_target.rs250000273
msg_channel_details_target.rs250000247
msg_channel_ready_target.r250000249
msg_channel_reestablish_target.rs250000252
msg_channel_update_target.rs250000254
msg_closing_signed_target.rs250000250
msg_commitment_signed_target.r250000255
msg_decoded_onion_error_packet_target.rs250000250
msg_error_message_target.r250000251
msg_funding_created_target.rs250000252
msg_funding_signed_target.rs250000250
msg_gossip_timestamp_filter_target.rs250000247
msg_init_target.rs250000248
msg_node_announcement_target.r250000260
msg_open_channel_target.rs250000271
msg_open_channel_v2_target.rs250000266
msg_ping_target.rs250000248
msg_pong_target.rs250000248
msg_query_channel_range_target.rs250000247
msg_query_short_channel_ids_target.rs250000252
msg_reply_channel_range_target.rs250000248
msg_reply_short_channel_ids_end_target.rs250000247
msg_revoke_and_ack_target.rs250000250
msg_shutdown_target.rs250000247
msg_splice_ack_target.rs250000250
msg_splice_init_target.rs250000250
msg_splice_locked_target.r250000248
msg_stfu_target.rs250000247
msg_tx_abort_target.rs250000248
msg_tx_ack_rbf_target.rs250000247
msg_tx_add_input_target.rs250000273
msg_tx_add_output_target.r250000248
msg_tx_complete_target.rs250000247
msg_tx_init_rbf_target.rs250000248
msg_tx_remove_input_target.rs250000247
msg_tx_remove_output_target.rs250000248
msg_tx_signatures_target.r2500002100
msg_update_add_htlc_target.rs250000299
msg_update_fail_htlc_target.rs250000252
msg_update_fail_malformed_htlc_target.rs250000249
msg_update_fee_target.rs250000248
msg_update_fulfill_htlc_target.rs250000249
offer_deser_target.rs250000248
onion_hop_data_target.rs250000249
onion_message_target.r250000264
peer_crypt_target.rs2500002108
process_network_graph_target.r50002568
process_onion_failure_target.r2500002165
refund_deser_target.rs250000249
router_target.rs50002606
zbase32_target.rs2500002119

Comment threadfuzz/src/full_stack.rs
Comment threadfuzz/ci-fuzz.sh
run: |
cd fuzz
RUSTFLAGS="--cfg=fuzzing --cfg=secp256k1_fuzz --cfg=hashes_fuzz" cargo test --verbose --color always
RUSTFLAGS="--cfg=fuzzing --cfg=secp256k1_fuzz --cfg=hashes_fuzz" cargo test --verbose --color always --lib --bins

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why these two additions?

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

Because RUSTFLAGS aren't applied to doctests, so we have to restrict tests to only run library and binary tests.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could add comments when making changes like this. Make life easier for future devs.

Comment threadfuzz/ci-fuzz.sh

mkdir -p hfuzz_workspace/full_stack_target/input
pushd write-seeds
RUSTFLAGS="$RUSTFLAGS --cfg=fuzzing" cargo run ../hfuzz_workspace/full_stack_target/input

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I wanted to verify that using the hardcoded seed indeed increases coverage, but it seems that hongfuzz reports in the log always

branch_coverage_percent:0

Not sure why that is? Otherwise it would be easy to compare with and without this hardcoded seed.

Or maybe there is another way to verify that it works indeed?

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

The fact that the full_stack_target got much slower is pretty good evidence :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Okay, indirect evidence. But why is hongfuzz reporting 0?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it not using coverage to direct fuzzing?

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

Yea, that I don't know, it certainly does locally and there's nothing different locally vs in CI. Also CI does turn up (fairly shallow) fuzz bugs as well, so I'd be surprised to learn it was able to do that with just general patterns and no instrumentation...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does it show you branch_coverage_percent as non-zero locally?

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

I'm not 100% sure about branch coverage specifically, but what I get from a running instance is: Coverage : edge: 16,485/568,547 [2%] pc: 738 cmp: 794,641. I assume "cmp" is the branch coverage.

joostjager
joostjager previously approved these changes Apr 10, 2025
When we made `test_node_counter_consistency` more aggressively
run, our `process_network_graph` fuzzer got materially slower,
resulting in consistent fuzz CI job timeouts.
Thus, here, we tweak the iteration count on all our fuzz jobs to
get them running in more consistent times.
Further, we further reduce `full_stack_target` iterations in
anticipation of a later commit which will start using our
hard-coded fuzz seeds, creating substantially more coverage and
slowing down fuzzing iterations.
In 3145168 we disabled
`test_node_counter_consistency` in debug builds since it can make
make things very slow, including `lightning-rapid-gossip-sync`
tests.
We should, however, have kept it when fuzzing, since that gives us
testing of potential coverage gaps in normal tests.
This should materially improve our fuzzing coverage in CI.
@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

Went ahead and squashed the addition of a comment in the fuzz script.

@joostjagerjoostjager left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great to have a more reasonable run time for the fuzzer!

Still interested to find out what's going on with that coverage indicator at zero in CI.

@tnull
tnull merged commit 83e9e80 into lightningdevkit:mainApr 11, 2025
Sign up for freeto 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.

4 participants

@TheBlueMatt@ldk-reviews-bot@joostjager@tnull
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Reduce CI fuzz iterations as we're now timing out - #3691

Merged
tnull merged 3 commits into
lightningdevkit:mainfrom
TheBlueMatt:2025-03-fuzz-less
Apr 11, 2025
Merged

Reduce CI fuzz iterations as we're now timing out#3691
tnull merged 3 commits into
lightningdevkit:mainfrom
TheBlueMatt:2025-03-fuzz-less

Conversation

@TheBlueMatt

Copy link
Copy Markdown
Collaborator

I think github has slowed down the runners so now our fuzz tests are timing out. Here we just reduce iteration count a bit.

@ldk-reviews-bot

ldk-reviews-bot commented Mar 29, 2025

Copy link
Copy Markdown

I've assigned @joostjager 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.

@tnulltnull left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ACK, seems we hit yet another failing case in the router target now: #3692

tnull
tnull previously approved these changes Mar 31, 2025
Comment threadfuzz/ci-fuzz.sh
HFUZZ_RUN_ARGS="$HFUZZ_RUN_ARGS -t0 -N100000"
else
HFUZZ_RUN_ARGS="$HFUZZ_RUN_ARGS -N1000000"
HFUZZ_RUN_ARGS="$HFUZZ_RUN_ARGS -N500000"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Any specific reasoning behind the 10x, 10x and 2x reductions?

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

No. I probably could have benchmarked, but in general there's not a lot of value in full_stack_target in CI because its just too dense to make any real progress, and similar for chanmon_consistency_target.

@joostjager

joostjager commented Apr 1, 2025

Copy link
Copy Markdown
Contributor

I checked out a fuzzer run on the attr failures PR and grepped the logs. Interestingly it seems like indeed chanmon_consistency_target takes nearly 3 hours. But the other one you mention, full_stack_target is only 18 seconds?

process_network_graph_target is also slow (2+ hours), and looking at the fuzz log in #3687, it doesn't seem to be resolved with that change.

Maybe I am not interpreting correctly though.

Also from this log, you'd say that all the fast tests (<30 sec) don't need their iteration count changed.

base32_target.rs
Summary iterations:1000002 time:198 speed:5050 crashes_count:0 timeout_count:0 new_units_added:449 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
bech32_parse_target.rs
Summary iterations:1000002 time:22 speed:45454 crashes_count:0 timeout_count:0 new_units_added:897 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
bolt11_deser_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:211 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
chanmon_consistency_target.rs
Summary iterations:100002 time:9769 speed:10 crashes_count:0 timeout_count:87 new_units_added:3435 slowest_unit_ms:1139 guard_nb:566357 branch_coverage_percent:2 peak_rss_mb:42
chanmon_deser_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:963 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
fromstr_to_netaddress_target.rs
Summary iterations:1000002 time:17 speed:58823 crashes_count:0 timeout_count:0 new_units_added:160 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
full_stack_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:797 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
indexedmap_target.rs
Summary iterations:1000002 time:648 speed:1543 crashes_count:0 timeout_count:0 new_units_added:698 slowest_unit_ms:19 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
invoice_deser_target.rs
Summary iterations:1000002 time:20 speed:50000 crashes_count:0 timeout_count:0 new_units_added:2955 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
invoice_request_deser_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:2244 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_accept_channel_target.rs
Summary iterations:1000002 time:23 speed:43478 crashes_count:0 timeout_count:0 new_units_added:1115 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_accept_channel_v2_target.rs
Summary iterations:1000002 time:246 speed:4065 crashes_count:0 timeout_count:0 new_units_added:1031 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_announcement_signatures_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:322 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_channel_announcement_target.rs
Summary iterations:1000002 time:20 speed:50000 crashes_count:0 timeout_count:0 new_units_added:413 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_channel_details_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:993 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_channel_ready_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:374 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_channel_reestablish_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:434 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_channel_update_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:210 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_closing_signed_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:380 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_commitment_signed_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:697 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_decoded_onion_error_packet_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:178 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_error_message_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:108 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_funding_created_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:342 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_funding_signed_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:304 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_gossip_timestamp_filter_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:294 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_init_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:1006 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_node_announcement_target.rs
Summary iterations:1000002 time:21 speed:47619 crashes_count:0 timeout_count:0 new_units_added:851 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_open_channel_target.rs
Summary iterations:1000002 time:35 speed:28571 crashes_count:0 timeout_count:0 new_units_added:1163 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_open_channel_v2_target.rs
Summary iterations:1000002 time:24 speed:41666 crashes_count:0 timeout_count:0 new_units_added:1289 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_ping_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:91 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_pong_target.rs
Summary iterations:1000002 time:20 speed:50000 crashes_count:0 timeout_count:0 new_units_added:83 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_query_channel_range_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:334 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_query_short_channel_ids_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:108 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_reply_channel_range_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:158 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_reply_short_channel_ids_end_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:337 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_revoke_and_ack_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:360 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_shutdown_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:333 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_splice_ack_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:387 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_splice_init_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:401 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_splice_locked_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:319 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_stfu_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:319 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_abort_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:403 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_ack_rbf_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:366 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_add_input_target.rs
Summary iterations:1000002 time:24 speed:41666 crashes_count:0 timeout_count:0 new_units_added:1270 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_add_output_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:390 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_complete_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:285 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_init_rbf_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:393 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_remove_input_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:297 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_remove_output_target.rs
Summary iterations:1000002 time:17 speed:58823 crashes_count:0 timeout_count:0 new_units_added:322 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_signatures_target.rs
Summary iterations:1000002 time:52 speed:19230 crashes_count:0 timeout_count:0 new_units_added:851 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_update_add_htlc_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:430 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_update_fail_htlc_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:480 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_update_fail_malformed_htlc_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:321 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_update_fee_target.rs
Summary iterations:1000002 time:17 speed:58823 crashes_count:0 timeout_count:0 new_units_added:308 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_update_fulfill_htlc_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:309 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
offer_deser_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:1333 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
onion_hop_data_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:981 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
onion_message_target.rs
Summary iterations:1000002 time:24 speed:41666 crashes_count:0 timeout_count:0 new_units_added:395 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
peer_crypt_target.rs
Summary iterations:1000002 time:27 speed:37037 crashes_count:0 timeout_count:0 new_units_added:315 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
process_network_graph_target.rs
Summary iterations:735922 time:8434 speed:87 crashes_count:0 timeout_count:0 new_units_added:30 slowest_unit_ms:40 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:161

@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

I checked out a fuzzer run on the attr failures PR and grepped the logs. Interestingly it seems like indeed chanmon_consistency_target takes nearly 3 hours. But the other one you mention, full_stack_target is only 18 seconds?

Ah, thanks for doing that. Yea, I was going on the results when I fuzz with real corpuses, where full_stack_target can get quite slow. But, given we currently don't initialize our CI fuzzers with a real corpus so it really doesn't get into it too much. I did go ahead and update the CI fuzzer to use the hard-coded full_stack_target seeds, but it still doesn't spend much time in complicated paths.

process_network_graph_target is also slow (2+ hours), and looking at the fuzz log in #3687, it doesn't seem to be resolved with that change.

Huh, interesting, I went ahead and slowed this one down though.

Also from this log, you'd say that all the fast tests (<30 sec) don't need their iteration count changed.

Yep!

@TheBlueMatt
TheBlueMattforce-pushed the 2025-03-fuzz-less branch 2 times, most recently from c87c3f3 to ad4fb1eCompareApril 1, 2025 18:33
@codecov

codecovBot commented Apr 1, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.92%. Comparing base (c4d23bc) to head (11dde05).
Report is 38 commits behind head on main.

Additional details and impacted files
@@ Coverage Diff @@## main #3691 +/- ##
==========================================
+ Coverage 89.05% 89.92% +0.86% 
==========================================
Files 155 156 +1 Lines 122019 129760 +7741 Branches 122019 129760 +7741 ==========================================
+ Hits 108666 116683 +8017 + Misses 10695 10441 -254 + Partials 2658 2636 -22 

☔ 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.

@TheBlueMatt
TheBlueMattforce-pushed the 2025-03-fuzz-less branch 6 times, most recently from b93b1d6 to 4b4bad8CompareApril 3, 2025 15:21
tnull
tnull previously approved these changes Apr 4, 2025

@tnulltnull left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

Fuzz failure is #3708

@joostjagerjoostjager left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great that fuzzing again found an issue. This is awesome.

Before merging this, I think we still want to see a successful fuzz run well within the timeout?

@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

Yea, happy to wait until we can at least run a fuzzing run and check that all the timings make sense.

@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

It passed, but taking five hours for CI is excessive, so I reduced it further.

@tnull

tnull commented Apr 8, 2025

Copy link
Copy Markdown
Contributor

It passed, but taking five hours for CI is excessive, so I reduced it further.

Now finished in 273min ~ 4.55 hours. Is this acceptable?

@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

Mmm, that's still pretty aggressive. Divided a few jobs by two so hopefully this time's the charm.

@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

Okay, its now "only" 2h, which I think is kinda reasonable, or at least its in line with what some of our other jobs take, so happy to land this now.

tnull
tnull previously approved these changes Apr 8, 2025
@joostjager

Copy link
Copy Markdown
Contributor

Distribution looks much better now:

testiterationstime
base32_target.rs2500002278
bech32_parse_target.rs250000258
bolt11_deser_target.rs250000245
chanmon_consistency_target.rs5002852
chanmon_deser_target.r250000255
fromstr_to_netaddress_target.r250000245
full_stack_target.rs50002554
indexedmap_target.rs500002394
invoice_deser_target.r250000251
invoice_request_deser_target.r250000250
msg_accept_channel_target.rs2500002181
msg_accept_channel_v2_target.r2500002258
msg_announcement_signatures_target.rs250000253
msg_channel_announcement_target.rs250000273
msg_channel_details_target.rs250000247
msg_channel_ready_target.r250000249
msg_channel_reestablish_target.rs250000252
msg_channel_update_target.rs250000254
msg_closing_signed_target.rs250000250
msg_commitment_signed_target.r250000255
msg_decoded_onion_error_packet_target.rs250000250
msg_error_message_target.r250000251
msg_funding_created_target.rs250000252
msg_funding_signed_target.rs250000250
msg_gossip_timestamp_filter_target.rs250000247
msg_init_target.rs250000248
msg_node_announcement_target.r250000260
msg_open_channel_target.rs250000271
msg_open_channel_v2_target.rs250000266
msg_ping_target.rs250000248
msg_pong_target.rs250000248
msg_query_channel_range_target.rs250000247
msg_query_short_channel_ids_target.rs250000252
msg_reply_channel_range_target.rs250000248
msg_reply_short_channel_ids_end_target.rs250000247
msg_revoke_and_ack_target.rs250000250
msg_shutdown_target.rs250000247
msg_splice_ack_target.rs250000250
msg_splice_init_target.rs250000250
msg_splice_locked_target.r250000248
msg_stfu_target.rs250000247
msg_tx_abort_target.rs250000248
msg_tx_ack_rbf_target.rs250000247
msg_tx_add_input_target.rs250000273
msg_tx_add_output_target.r250000248
msg_tx_complete_target.rs250000247
msg_tx_init_rbf_target.rs250000248
msg_tx_remove_input_target.rs250000247
msg_tx_remove_output_target.rs250000248
msg_tx_signatures_target.r2500002100
msg_update_add_htlc_target.rs250000299
msg_update_fail_htlc_target.rs250000252
msg_update_fail_malformed_htlc_target.rs250000249
msg_update_fee_target.rs250000248
msg_update_fulfill_htlc_target.rs250000249
offer_deser_target.rs250000248
onion_hop_data_target.rs250000249
onion_message_target.r250000264
peer_crypt_target.rs2500002108
process_network_graph_target.r50002568
process_onion_failure_target.r2500002165
refund_deser_target.rs250000249
router_target.rs50002606
zbase32_target.rs2500002119

Comment threadfuzz/src/full_stack.rs
Comment threadfuzz/ci-fuzz.sh
run: |
cd fuzz
RUSTFLAGS="--cfg=fuzzing --cfg=secp256k1_fuzz --cfg=hashes_fuzz" cargo test --verbose --color always
RUSTFLAGS="--cfg=fuzzing --cfg=secp256k1_fuzz --cfg=hashes_fuzz" cargo test --verbose --color always --lib --bins

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why these two additions?

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

Because RUSTFLAGS aren't applied to doctests, so we have to restrict tests to only run library and binary tests.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could add comments when making changes like this. Make life easier for future devs.

Comment threadfuzz/ci-fuzz.sh

mkdir -p hfuzz_workspace/full_stack_target/input
pushd write-seeds
RUSTFLAGS="$RUSTFLAGS --cfg=fuzzing" cargo run ../hfuzz_workspace/full_stack_target/input

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I wanted to verify that using the hardcoded seed indeed increases coverage, but it seems that hongfuzz reports in the log always

branch_coverage_percent:0

Not sure why that is? Otherwise it would be easy to compare with and without this hardcoded seed.

Or maybe there is another way to verify that it works indeed?

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

The fact that the full_stack_target got much slower is pretty good evidence :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Okay, indirect evidence. But why is hongfuzz reporting 0?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it not using coverage to direct fuzzing?

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

Yea, that I don't know, it certainly does locally and there's nothing different locally vs in CI. Also CI does turn up (fairly shallow) fuzz bugs as well, so I'd be surprised to learn it was able to do that with just general patterns and no instrumentation...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does it show you branch_coverage_percent as non-zero locally?

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

I'm not 100% sure about branch coverage specifically, but what I get from a running instance is: Coverage : edge: 16,485/568,547 [2%] pc: 738 cmp: 794,641. I assume "cmp" is the branch coverage.

joostjager
joostjager previously approved these changes Apr 10, 2025
When we made `test_node_counter_consistency` more aggressively
run, our `process_network_graph` fuzzer got materially slower,
resulting in consistent fuzz CI job timeouts.
Thus, here, we tweak the iteration count on all our fuzz jobs to
get them running in more consistent times.
Further, we further reduce `full_stack_target` iterations in
anticipation of a later commit which will start using our
hard-coded fuzz seeds, creating substantially more coverage and
slowing down fuzzing iterations.
In 3145168 we disabled
`test_node_counter_consistency` in debug builds since it can make
make things very slow, including `lightning-rapid-gossip-sync`
tests.
We should, however, have kept it when fuzzing, since that gives us
testing of potential coverage gaps in normal tests.
This should materially improve our fuzzing coverage in CI.
@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

Went ahead and squashed the addition of a comment in the fuzz script.

@joostjagerjoostjager left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great to have a more reasonable run time for the fuzzer!

Still interested to find out what's going on with that coverage indicator at zero in CI.

@tnull
tnull merged commit 83e9e80 into lightningdevkit:mainApr 11, 2025
Sign up for freeto 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.

4 participants

@TheBlueMatt@ldk-reviews-bot@joostjager@tnull
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Reduce CI fuzz iterations as we're now timing out - #3691

Merged
tnull merged 3 commits into
lightningdevkit:mainfrom
TheBlueMatt:2025-03-fuzz-less
Apr 11, 2025
Merged

Reduce CI fuzz iterations as we're now timing out#3691
tnull merged 3 commits into
lightningdevkit:mainfrom
TheBlueMatt:2025-03-fuzz-less

Conversation

@TheBlueMatt

Copy link
Copy Markdown
Collaborator

I think github has slowed down the runners so now our fuzz tests are timing out. Here we just reduce iteration count a bit.

@ldk-reviews-bot

ldk-reviews-bot commented Mar 29, 2025

Copy link
Copy Markdown

I've assigned @joostjager 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.

@tnulltnull left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ACK, seems we hit yet another failing case in the router target now: #3692

tnull
tnull previously approved these changes Mar 31, 2025
Comment threadfuzz/ci-fuzz.sh
HFUZZ_RUN_ARGS="$HFUZZ_RUN_ARGS -t0 -N100000"
else
HFUZZ_RUN_ARGS="$HFUZZ_RUN_ARGS -N1000000"
HFUZZ_RUN_ARGS="$HFUZZ_RUN_ARGS -N500000"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Any specific reasoning behind the 10x, 10x and 2x reductions?

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

No. I probably could have benchmarked, but in general there's not a lot of value in full_stack_target in CI because its just too dense to make any real progress, and similar for chanmon_consistency_target.

@joostjager

joostjager commented Apr 1, 2025

Copy link
Copy Markdown
Contributor

I checked out a fuzzer run on the attr failures PR and grepped the logs. Interestingly it seems like indeed chanmon_consistency_target takes nearly 3 hours. But the other one you mention, full_stack_target is only 18 seconds?

process_network_graph_target is also slow (2+ hours), and looking at the fuzz log in #3687, it doesn't seem to be resolved with that change.

Maybe I am not interpreting correctly though.

Also from this log, you'd say that all the fast tests (<30 sec) don't need their iteration count changed.

base32_target.rs
Summary iterations:1000002 time:198 speed:5050 crashes_count:0 timeout_count:0 new_units_added:449 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
bech32_parse_target.rs
Summary iterations:1000002 time:22 speed:45454 crashes_count:0 timeout_count:0 new_units_added:897 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
bolt11_deser_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:211 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
chanmon_consistency_target.rs
Summary iterations:100002 time:9769 speed:10 crashes_count:0 timeout_count:87 new_units_added:3435 slowest_unit_ms:1139 guard_nb:566357 branch_coverage_percent:2 peak_rss_mb:42
chanmon_deser_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:963 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
fromstr_to_netaddress_target.rs
Summary iterations:1000002 time:17 speed:58823 crashes_count:0 timeout_count:0 new_units_added:160 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
full_stack_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:797 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
indexedmap_target.rs
Summary iterations:1000002 time:648 speed:1543 crashes_count:0 timeout_count:0 new_units_added:698 slowest_unit_ms:19 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
invoice_deser_target.rs
Summary iterations:1000002 time:20 speed:50000 crashes_count:0 timeout_count:0 new_units_added:2955 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
invoice_request_deser_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:2244 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_accept_channel_target.rs
Summary iterations:1000002 time:23 speed:43478 crashes_count:0 timeout_count:0 new_units_added:1115 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_accept_channel_v2_target.rs
Summary iterations:1000002 time:246 speed:4065 crashes_count:0 timeout_count:0 new_units_added:1031 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_announcement_signatures_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:322 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_channel_announcement_target.rs
Summary iterations:1000002 time:20 speed:50000 crashes_count:0 timeout_count:0 new_units_added:413 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_channel_details_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:993 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_channel_ready_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:374 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_channel_reestablish_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:434 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_channel_update_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:210 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_closing_signed_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:380 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_commitment_signed_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:697 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_decoded_onion_error_packet_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:178 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_error_message_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:108 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_funding_created_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:342 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_funding_signed_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:304 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_gossip_timestamp_filter_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:294 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_init_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:1006 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_node_announcement_target.rs
Summary iterations:1000002 time:21 speed:47619 crashes_count:0 timeout_count:0 new_units_added:851 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_open_channel_target.rs
Summary iterations:1000002 time:35 speed:28571 crashes_count:0 timeout_count:0 new_units_added:1163 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_open_channel_v2_target.rs
Summary iterations:1000002 time:24 speed:41666 crashes_count:0 timeout_count:0 new_units_added:1289 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_ping_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:91 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_pong_target.rs
Summary iterations:1000002 time:20 speed:50000 crashes_count:0 timeout_count:0 new_units_added:83 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_query_channel_range_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:334 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_query_short_channel_ids_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:108 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_reply_channel_range_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:158 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_reply_short_channel_ids_end_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:337 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_revoke_and_ack_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:360 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_shutdown_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:333 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_splice_ack_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:387 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_splice_init_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:401 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_splice_locked_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:319 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_stfu_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:319 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_abort_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:403 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_ack_rbf_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:366 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_add_input_target.rs
Summary iterations:1000002 time:24 speed:41666 crashes_count:0 timeout_count:0 new_units_added:1270 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_add_output_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:390 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_complete_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:285 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_init_rbf_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:393 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_remove_input_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:297 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_remove_output_target.rs
Summary iterations:1000002 time:17 speed:58823 crashes_count:0 timeout_count:0 new_units_added:322 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_signatures_target.rs
Summary iterations:1000002 time:52 speed:19230 crashes_count:0 timeout_count:0 new_units_added:851 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_update_add_htlc_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:430 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_update_fail_htlc_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:480 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_update_fail_malformed_htlc_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:321 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_update_fee_target.rs
Summary iterations:1000002 time:17 speed:58823 crashes_count:0 timeout_count:0 new_units_added:308 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_update_fulfill_htlc_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:309 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
offer_deser_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:1333 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
onion_hop_data_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:981 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
onion_message_target.rs
Summary iterations:1000002 time:24 speed:41666 crashes_count:0 timeout_count:0 new_units_added:395 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
peer_crypt_target.rs
Summary iterations:1000002 time:27 speed:37037 crashes_count:0 timeout_count:0 new_units_added:315 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
process_network_graph_target.rs
Summary iterations:735922 time:8434 speed:87 crashes_count:0 timeout_count:0 new_units_added:30 slowest_unit_ms:40 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:161

@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

I checked out a fuzzer run on the attr failures PR and grepped the logs. Interestingly it seems like indeed chanmon_consistency_target takes nearly 3 hours. But the other one you mention, full_stack_target is only 18 seconds?

Ah, thanks for doing that. Yea, I was going on the results when I fuzz with real corpuses, where full_stack_target can get quite slow. But, given we currently don't initialize our CI fuzzers with a real corpus so it really doesn't get into it too much. I did go ahead and update the CI fuzzer to use the hard-coded full_stack_target seeds, but it still doesn't spend much time in complicated paths.

process_network_graph_target is also slow (2+ hours), and looking at the fuzz log in #3687, it doesn't seem to be resolved with that change.

Huh, interesting, I went ahead and slowed this one down though.

Also from this log, you'd say that all the fast tests (<30 sec) don't need their iteration count changed.

Yep!

@TheBlueMatt
TheBlueMattforce-pushed the 2025-03-fuzz-less branch 2 times, most recently from c87c3f3 to ad4fb1eCompareApril 1, 2025 18:33
@codecov

codecovBot commented Apr 1, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.92%. Comparing base (c4d23bc) to head (11dde05).
Report is 38 commits behind head on main.

Additional details and impacted files
@@ Coverage Diff @@## main #3691 +/- ##
==========================================
+ Coverage 89.05% 89.92% +0.86% 
==========================================
Files 155 156 +1 Lines 122019 129760 +7741 Branches 122019 129760 +7741 ==========================================
+ Hits 108666 116683 +8017 + Misses 10695 10441 -254 + Partials 2658 2636 -22 

☔ 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.

@TheBlueMatt
TheBlueMattforce-pushed the 2025-03-fuzz-less branch 6 times, most recently from b93b1d6 to 4b4bad8CompareApril 3, 2025 15:21
tnull
tnull previously approved these changes Apr 4, 2025

@tnulltnull left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

Fuzz failure is #3708

@joostjagerjoostjager left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great that fuzzing again found an issue. This is awesome.

Before merging this, I think we still want to see a successful fuzz run well within the timeout?

@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

Yea, happy to wait until we can at least run a fuzzing run and check that all the timings make sense.

@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

It passed, but taking five hours for CI is excessive, so I reduced it further.

@tnull

tnull commented Apr 8, 2025

Copy link
Copy Markdown
Contributor

It passed, but taking five hours for CI is excessive, so I reduced it further.

Now finished in 273min ~ 4.55 hours. Is this acceptable?

@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

Mmm, that's still pretty aggressive. Divided a few jobs by two so hopefully this time's the charm.

@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

Okay, its now "only" 2h, which I think is kinda reasonable, or at least its in line with what some of our other jobs take, so happy to land this now.

tnull
tnull previously approved these changes Apr 8, 2025
@joostjager

Copy link
Copy Markdown
Contributor

Distribution looks much better now:

testiterationstime
base32_target.rs2500002278
bech32_parse_target.rs250000258
bolt11_deser_target.rs250000245
chanmon_consistency_target.rs5002852
chanmon_deser_target.r250000255
fromstr_to_netaddress_target.r250000245
full_stack_target.rs50002554
indexedmap_target.rs500002394
invoice_deser_target.r250000251
invoice_request_deser_target.r250000250
msg_accept_channel_target.rs2500002181
msg_accept_channel_v2_target.r2500002258
msg_announcement_signatures_target.rs250000253
msg_channel_announcement_target.rs250000273
msg_channel_details_target.rs250000247
msg_channel_ready_target.r250000249
msg_channel_reestablish_target.rs250000252
msg_channel_update_target.rs250000254
msg_closing_signed_target.rs250000250
msg_commitment_signed_target.r250000255
msg_decoded_onion_error_packet_target.rs250000250
msg_error_message_target.r250000251
msg_funding_created_target.rs250000252
msg_funding_signed_target.rs250000250
msg_gossip_timestamp_filter_target.rs250000247
msg_init_target.rs250000248
msg_node_announcement_target.r250000260
msg_open_channel_target.rs250000271
msg_open_channel_v2_target.rs250000266
msg_ping_target.rs250000248
msg_pong_target.rs250000248
msg_query_channel_range_target.rs250000247
msg_query_short_channel_ids_target.rs250000252
msg_reply_channel_range_target.rs250000248
msg_reply_short_channel_ids_end_target.rs250000247
msg_revoke_and_ack_target.rs250000250
msg_shutdown_target.rs250000247
msg_splice_ack_target.rs250000250
msg_splice_init_target.rs250000250
msg_splice_locked_target.r250000248
msg_stfu_target.rs250000247
msg_tx_abort_target.rs250000248
msg_tx_ack_rbf_target.rs250000247
msg_tx_add_input_target.rs250000273
msg_tx_add_output_target.r250000248
msg_tx_complete_target.rs250000247
msg_tx_init_rbf_target.rs250000248
msg_tx_remove_input_target.rs250000247
msg_tx_remove_output_target.rs250000248
msg_tx_signatures_target.r2500002100
msg_update_add_htlc_target.rs250000299
msg_update_fail_htlc_target.rs250000252
msg_update_fail_malformed_htlc_target.rs250000249
msg_update_fee_target.rs250000248
msg_update_fulfill_htlc_target.rs250000249
offer_deser_target.rs250000248
onion_hop_data_target.rs250000249
onion_message_target.r250000264
peer_crypt_target.rs2500002108
process_network_graph_target.r50002568
process_onion_failure_target.r2500002165
refund_deser_target.rs250000249
router_target.rs50002606
zbase32_target.rs2500002119

Comment threadfuzz/src/full_stack.rs
Comment threadfuzz/ci-fuzz.sh
run: |
cd fuzz
RUSTFLAGS="--cfg=fuzzing --cfg=secp256k1_fuzz --cfg=hashes_fuzz" cargo test --verbose --color always
RUSTFLAGS="--cfg=fuzzing --cfg=secp256k1_fuzz --cfg=hashes_fuzz" cargo test --verbose --color always --lib --bins

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why these two additions?

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

Because RUSTFLAGS aren't applied to doctests, so we have to restrict tests to only run library and binary tests.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could add comments when making changes like this. Make life easier for future devs.

Comment threadfuzz/ci-fuzz.sh

mkdir -p hfuzz_workspace/full_stack_target/input
pushd write-seeds
RUSTFLAGS="$RUSTFLAGS --cfg=fuzzing" cargo run ../hfuzz_workspace/full_stack_target/input

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I wanted to verify that using the hardcoded seed indeed increases coverage, but it seems that hongfuzz reports in the log always

branch_coverage_percent:0

Not sure why that is? Otherwise it would be easy to compare with and without this hardcoded seed.

Or maybe there is another way to verify that it works indeed?

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

The fact that the full_stack_target got much slower is pretty good evidence :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Okay, indirect evidence. But why is hongfuzz reporting 0?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it not using coverage to direct fuzzing?

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

Yea, that I don't know, it certainly does locally and there's nothing different locally vs in CI. Also CI does turn up (fairly shallow) fuzz bugs as well, so I'd be surprised to learn it was able to do that with just general patterns and no instrumentation...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does it show you branch_coverage_percent as non-zero locally?

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

I'm not 100% sure about branch coverage specifically, but what I get from a running instance is: Coverage : edge: 16,485/568,547 [2%] pc: 738 cmp: 794,641. I assume "cmp" is the branch coverage.

joostjager
joostjager previously approved these changes Apr 10, 2025
When we made `test_node_counter_consistency` more aggressively
run, our `process_network_graph` fuzzer got materially slower,
resulting in consistent fuzz CI job timeouts.
Thus, here, we tweak the iteration count on all our fuzz jobs to
get them running in more consistent times.
Further, we further reduce `full_stack_target` iterations in
anticipation of a later commit which will start using our
hard-coded fuzz seeds, creating substantially more coverage and
slowing down fuzzing iterations.
In 3145168 we disabled
`test_node_counter_consistency` in debug builds since it can make
make things very slow, including `lightning-rapid-gossip-sync`
tests.
We should, however, have kept it when fuzzing, since that gives us
testing of potential coverage gaps in normal tests.
This should materially improve our fuzzing coverage in CI.
@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

Went ahead and squashed the addition of a comment in the fuzz script.

@joostjagerjoostjager left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great to have a more reasonable run time for the fuzzer!

Still interested to find out what's going on with that coverage indicator at zero in CI.

@tnull
tnull merged commit 83e9e80 into lightningdevkit:mainApr 11, 2025
Sign up for freeto 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.

4 participants

@TheBlueMatt@ldk-reviews-bot@joostjager@tnull
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Reduce CI fuzz iterations as we're now timing out - #3691

Merged
tnull merged 3 commits into
lightningdevkit:mainfrom
TheBlueMatt:2025-03-fuzz-less
Apr 11, 2025
Merged

Reduce CI fuzz iterations as we're now timing out#3691
tnull merged 3 commits into
lightningdevkit:mainfrom
TheBlueMatt:2025-03-fuzz-less

Conversation

@TheBlueMatt

Copy link
Copy Markdown
Collaborator

I think github has slowed down the runners so now our fuzz tests are timing out. Here we just reduce iteration count a bit.

@ldk-reviews-bot

ldk-reviews-bot commented Mar 29, 2025

Copy link
Copy Markdown

I've assigned @joostjager 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.

@tnulltnull left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ACK, seems we hit yet another failing case in the router target now: #3692

tnull
tnull previously approved these changes Mar 31, 2025
Comment threadfuzz/ci-fuzz.sh
HFUZZ_RUN_ARGS="$HFUZZ_RUN_ARGS -t0 -N100000"
else
HFUZZ_RUN_ARGS="$HFUZZ_RUN_ARGS -N1000000"
HFUZZ_RUN_ARGS="$HFUZZ_RUN_ARGS -N500000"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Any specific reasoning behind the 10x, 10x and 2x reductions?

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

No. I probably could have benchmarked, but in general there's not a lot of value in full_stack_target in CI because its just too dense to make any real progress, and similar for chanmon_consistency_target.

@joostjager

joostjager commented Apr 1, 2025

Copy link
Copy Markdown
Contributor

I checked out a fuzzer run on the attr failures PR and grepped the logs. Interestingly it seems like indeed chanmon_consistency_target takes nearly 3 hours. But the other one you mention, full_stack_target is only 18 seconds?

process_network_graph_target is also slow (2+ hours), and looking at the fuzz log in #3687, it doesn't seem to be resolved with that change.

Maybe I am not interpreting correctly though.

Also from this log, you'd say that all the fast tests (<30 sec) don't need their iteration count changed.

base32_target.rs
Summary iterations:1000002 time:198 speed:5050 crashes_count:0 timeout_count:0 new_units_added:449 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
bech32_parse_target.rs
Summary iterations:1000002 time:22 speed:45454 crashes_count:0 timeout_count:0 new_units_added:897 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
bolt11_deser_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:211 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
chanmon_consistency_target.rs
Summary iterations:100002 time:9769 speed:10 crashes_count:0 timeout_count:87 new_units_added:3435 slowest_unit_ms:1139 guard_nb:566357 branch_coverage_percent:2 peak_rss_mb:42
chanmon_deser_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:963 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
fromstr_to_netaddress_target.rs
Summary iterations:1000002 time:17 speed:58823 crashes_count:0 timeout_count:0 new_units_added:160 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
full_stack_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:797 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
indexedmap_target.rs
Summary iterations:1000002 time:648 speed:1543 crashes_count:0 timeout_count:0 new_units_added:698 slowest_unit_ms:19 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
invoice_deser_target.rs
Summary iterations:1000002 time:20 speed:50000 crashes_count:0 timeout_count:0 new_units_added:2955 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
invoice_request_deser_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:2244 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_accept_channel_target.rs
Summary iterations:1000002 time:23 speed:43478 crashes_count:0 timeout_count:0 new_units_added:1115 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_accept_channel_v2_target.rs
Summary iterations:1000002 time:246 speed:4065 crashes_count:0 timeout_count:0 new_units_added:1031 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_announcement_signatures_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:322 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_channel_announcement_target.rs
Summary iterations:1000002 time:20 speed:50000 crashes_count:0 timeout_count:0 new_units_added:413 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_channel_details_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:993 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_channel_ready_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:374 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_channel_reestablish_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:434 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_channel_update_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:210 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_closing_signed_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:380 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_commitment_signed_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:697 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_decoded_onion_error_packet_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:178 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_error_message_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:108 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_funding_created_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:342 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_funding_signed_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:304 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_gossip_timestamp_filter_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:294 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_init_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:1006 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_node_announcement_target.rs
Summary iterations:1000002 time:21 speed:47619 crashes_count:0 timeout_count:0 new_units_added:851 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_open_channel_target.rs
Summary iterations:1000002 time:35 speed:28571 crashes_count:0 timeout_count:0 new_units_added:1163 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_open_channel_v2_target.rs
Summary iterations:1000002 time:24 speed:41666 crashes_count:0 timeout_count:0 new_units_added:1289 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_ping_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:91 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_pong_target.rs
Summary iterations:1000002 time:20 speed:50000 crashes_count:0 timeout_count:0 new_units_added:83 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_query_channel_range_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:334 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_query_short_channel_ids_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:108 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_reply_channel_range_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:158 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_reply_short_channel_ids_end_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:337 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_revoke_and_ack_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:360 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_shutdown_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:333 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_splice_ack_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:387 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_splice_init_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:401 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_splice_locked_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:319 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_stfu_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:319 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_abort_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:403 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_ack_rbf_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:366 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_add_input_target.rs
Summary iterations:1000002 time:24 speed:41666 crashes_count:0 timeout_count:0 new_units_added:1270 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_add_output_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:390 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_complete_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:285 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_init_rbf_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:393 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_remove_input_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:297 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_remove_output_target.rs
Summary iterations:1000002 time:17 speed:58823 crashes_count:0 timeout_count:0 new_units_added:322 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_signatures_target.rs
Summary iterations:1000002 time:52 speed:19230 crashes_count:0 timeout_count:0 new_units_added:851 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_update_add_htlc_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:430 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_update_fail_htlc_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:480 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_update_fail_malformed_htlc_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:321 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_update_fee_target.rs
Summary iterations:1000002 time:17 speed:58823 crashes_count:0 timeout_count:0 new_units_added:308 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_update_fulfill_htlc_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:309 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
offer_deser_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:1333 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
onion_hop_data_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:981 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
onion_message_target.rs
Summary iterations:1000002 time:24 speed:41666 crashes_count:0 timeout_count:0 new_units_added:395 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
peer_crypt_target.rs
Summary iterations:1000002 time:27 speed:37037 crashes_count:0 timeout_count:0 new_units_added:315 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
process_network_graph_target.rs
Summary iterations:735922 time:8434 speed:87 crashes_count:0 timeout_count:0 new_units_added:30 slowest_unit_ms:40 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:161

@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

I checked out a fuzzer run on the attr failures PR and grepped the logs. Interestingly it seems like indeed chanmon_consistency_target takes nearly 3 hours. But the other one you mention, full_stack_target is only 18 seconds?

Ah, thanks for doing that. Yea, I was going on the results when I fuzz with real corpuses, where full_stack_target can get quite slow. But, given we currently don't initialize our CI fuzzers with a real corpus so it really doesn't get into it too much. I did go ahead and update the CI fuzzer to use the hard-coded full_stack_target seeds, but it still doesn't spend much time in complicated paths.

process_network_graph_target is also slow (2+ hours), and looking at the fuzz log in #3687, it doesn't seem to be resolved with that change.

Huh, interesting, I went ahead and slowed this one down though.

Also from this log, you'd say that all the fast tests (<30 sec) don't need their iteration count changed.

Yep!

@TheBlueMatt
TheBlueMattforce-pushed the 2025-03-fuzz-less branch 2 times, most recently from c87c3f3 to ad4fb1eCompareApril 1, 2025 18:33
@codecov

codecovBot commented Apr 1, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.92%. Comparing base (c4d23bc) to head (11dde05).
Report is 38 commits behind head on main.

Additional details and impacted files
@@ Coverage Diff @@## main #3691 +/- ##
==========================================
+ Coverage 89.05% 89.92% +0.86% 
==========================================
Files 155 156 +1 Lines 122019 129760 +7741 Branches 122019 129760 +7741 ==========================================
+ Hits 108666 116683 +8017 + Misses 10695 10441 -254 + Partials 2658 2636 -22 

☔ 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.

@TheBlueMatt
TheBlueMattforce-pushed the 2025-03-fuzz-less branch 6 times, most recently from b93b1d6 to 4b4bad8CompareApril 3, 2025 15:21
tnull
tnull previously approved these changes Apr 4, 2025

@tnulltnull left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

Fuzz failure is #3708

@joostjagerjoostjager left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great that fuzzing again found an issue. This is awesome.

Before merging this, I think we still want to see a successful fuzz run well within the timeout?

@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

Yea, happy to wait until we can at least run a fuzzing run and check that all the timings make sense.

@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

It passed, but taking five hours for CI is excessive, so I reduced it further.

@tnull

tnull commented Apr 8, 2025

Copy link
Copy Markdown
Contributor

It passed, but taking five hours for CI is excessive, so I reduced it further.

Now finished in 273min ~ 4.55 hours. Is this acceptable?

@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

Mmm, that's still pretty aggressive. Divided a few jobs by two so hopefully this time's the charm.

@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

Okay, its now "only" 2h, which I think is kinda reasonable, or at least its in line with what some of our other jobs take, so happy to land this now.

tnull
tnull previously approved these changes Apr 8, 2025
@joostjager

Copy link
Copy Markdown
Contributor

Distribution looks much better now:

testiterationstime
base32_target.rs2500002278
bech32_parse_target.rs250000258
bolt11_deser_target.rs250000245
chanmon_consistency_target.rs5002852
chanmon_deser_target.r250000255
fromstr_to_netaddress_target.r250000245
full_stack_target.rs50002554
indexedmap_target.rs500002394
invoice_deser_target.r250000251
invoice_request_deser_target.r250000250
msg_accept_channel_target.rs2500002181
msg_accept_channel_v2_target.r2500002258
msg_announcement_signatures_target.rs250000253
msg_channel_announcement_target.rs250000273
msg_channel_details_target.rs250000247
msg_channel_ready_target.r250000249
msg_channel_reestablish_target.rs250000252
msg_channel_update_target.rs250000254
msg_closing_signed_target.rs250000250
msg_commitment_signed_target.r250000255
msg_decoded_onion_error_packet_target.rs250000250
msg_error_message_target.r250000251
msg_funding_created_target.rs250000252
msg_funding_signed_target.rs250000250
msg_gossip_timestamp_filter_target.rs250000247
msg_init_target.rs250000248
msg_node_announcement_target.r250000260
msg_open_channel_target.rs250000271
msg_open_channel_v2_target.rs250000266
msg_ping_target.rs250000248
msg_pong_target.rs250000248
msg_query_channel_range_target.rs250000247
msg_query_short_channel_ids_target.rs250000252
msg_reply_channel_range_target.rs250000248
msg_reply_short_channel_ids_end_target.rs250000247
msg_revoke_and_ack_target.rs250000250
msg_shutdown_target.rs250000247
msg_splice_ack_target.rs250000250
msg_splice_init_target.rs250000250
msg_splice_locked_target.r250000248
msg_stfu_target.rs250000247
msg_tx_abort_target.rs250000248
msg_tx_ack_rbf_target.rs250000247
msg_tx_add_input_target.rs250000273
msg_tx_add_output_target.r250000248
msg_tx_complete_target.rs250000247
msg_tx_init_rbf_target.rs250000248
msg_tx_remove_input_target.rs250000247
msg_tx_remove_output_target.rs250000248
msg_tx_signatures_target.r2500002100
msg_update_add_htlc_target.rs250000299
msg_update_fail_htlc_target.rs250000252
msg_update_fail_malformed_htlc_target.rs250000249
msg_update_fee_target.rs250000248
msg_update_fulfill_htlc_target.rs250000249
offer_deser_target.rs250000248
onion_hop_data_target.rs250000249
onion_message_target.r250000264
peer_crypt_target.rs2500002108
process_network_graph_target.r50002568
process_onion_failure_target.r2500002165
refund_deser_target.rs250000249
router_target.rs50002606
zbase32_target.rs2500002119

Comment threadfuzz/src/full_stack.rs
Comment threadfuzz/ci-fuzz.sh
run: |
cd fuzz
RUSTFLAGS="--cfg=fuzzing --cfg=secp256k1_fuzz --cfg=hashes_fuzz" cargo test --verbose --color always
RUSTFLAGS="--cfg=fuzzing --cfg=secp256k1_fuzz --cfg=hashes_fuzz" cargo test --verbose --color always --lib --bins

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why these two additions?

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

Because RUSTFLAGS aren't applied to doctests, so we have to restrict tests to only run library and binary tests.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could add comments when making changes like this. Make life easier for future devs.

Comment threadfuzz/ci-fuzz.sh

mkdir -p hfuzz_workspace/full_stack_target/input
pushd write-seeds
RUSTFLAGS="$RUSTFLAGS --cfg=fuzzing" cargo run ../hfuzz_workspace/full_stack_target/input

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I wanted to verify that using the hardcoded seed indeed increases coverage, but it seems that hongfuzz reports in the log always

branch_coverage_percent:0

Not sure why that is? Otherwise it would be easy to compare with and without this hardcoded seed.

Or maybe there is another way to verify that it works indeed?

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

The fact that the full_stack_target got much slower is pretty good evidence :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Okay, indirect evidence. But why is hongfuzz reporting 0?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it not using coverage to direct fuzzing?

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

Yea, that I don't know, it certainly does locally and there's nothing different locally vs in CI. Also CI does turn up (fairly shallow) fuzz bugs as well, so I'd be surprised to learn it was able to do that with just general patterns and no instrumentation...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does it show you branch_coverage_percent as non-zero locally?

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

I'm not 100% sure about branch coverage specifically, but what I get from a running instance is: Coverage : edge: 16,485/568,547 [2%] pc: 738 cmp: 794,641. I assume "cmp" is the branch coverage.

joostjager
joostjager previously approved these changes Apr 10, 2025
When we made `test_node_counter_consistency` more aggressively
run, our `process_network_graph` fuzzer got materially slower,
resulting in consistent fuzz CI job timeouts.
Thus, here, we tweak the iteration count on all our fuzz jobs to
get them running in more consistent times.
Further, we further reduce `full_stack_target` iterations in
anticipation of a later commit which will start using our
hard-coded fuzz seeds, creating substantially more coverage and
slowing down fuzzing iterations.
In 3145168 we disabled
`test_node_counter_consistency` in debug builds since it can make
make things very slow, including `lightning-rapid-gossip-sync`
tests.
We should, however, have kept it when fuzzing, since that gives us
testing of potential coverage gaps in normal tests.
This should materially improve our fuzzing coverage in CI.
@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

Went ahead and squashed the addition of a comment in the fuzz script.

@joostjagerjoostjager left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great to have a more reasonable run time for the fuzzer!

Still interested to find out what's going on with that coverage indicator at zero in CI.

@tnull
tnull merged commit 83e9e80 into lightningdevkit:mainApr 11, 2025
Sign up for freeto 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.

4 participants

@TheBlueMatt@ldk-reviews-bot@joostjager@tnull
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Reduce CI fuzz iterations as we're now timing out - #3691

Merged
tnull merged 3 commits into
lightningdevkit:mainfrom
TheBlueMatt:2025-03-fuzz-less
Apr 11, 2025
Merged

Reduce CI fuzz iterations as we're now timing out#3691
tnull merged 3 commits into
lightningdevkit:mainfrom
TheBlueMatt:2025-03-fuzz-less

Conversation

@TheBlueMatt

Copy link
Copy Markdown
Collaborator

I think github has slowed down the runners so now our fuzz tests are timing out. Here we just reduce iteration count a bit.

@ldk-reviews-bot

ldk-reviews-bot commented Mar 29, 2025

Copy link
Copy Markdown

I've assigned @joostjager 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.

@tnulltnull left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ACK, seems we hit yet another failing case in the router target now: #3692

tnull
tnull previously approved these changes Mar 31, 2025
Comment threadfuzz/ci-fuzz.sh
HFUZZ_RUN_ARGS="$HFUZZ_RUN_ARGS -t0 -N100000"
else
HFUZZ_RUN_ARGS="$HFUZZ_RUN_ARGS -N1000000"
HFUZZ_RUN_ARGS="$HFUZZ_RUN_ARGS -N500000"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Any specific reasoning behind the 10x, 10x and 2x reductions?

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

No. I probably could have benchmarked, but in general there's not a lot of value in full_stack_target in CI because its just too dense to make any real progress, and similar for chanmon_consistency_target.

@joostjager

joostjager commented Apr 1, 2025

Copy link
Copy Markdown
Contributor

I checked out a fuzzer run on the attr failures PR and grepped the logs. Interestingly it seems like indeed chanmon_consistency_target takes nearly 3 hours. But the other one you mention, full_stack_target is only 18 seconds?

process_network_graph_target is also slow (2+ hours), and looking at the fuzz log in #3687, it doesn't seem to be resolved with that change.

Maybe I am not interpreting correctly though.

Also from this log, you'd say that all the fast tests (<30 sec) don't need their iteration count changed.

base32_target.rs
Summary iterations:1000002 time:198 speed:5050 crashes_count:0 timeout_count:0 new_units_added:449 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
bech32_parse_target.rs
Summary iterations:1000002 time:22 speed:45454 crashes_count:0 timeout_count:0 new_units_added:897 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
bolt11_deser_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:211 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
chanmon_consistency_target.rs
Summary iterations:100002 time:9769 speed:10 crashes_count:0 timeout_count:87 new_units_added:3435 slowest_unit_ms:1139 guard_nb:566357 branch_coverage_percent:2 peak_rss_mb:42
chanmon_deser_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:963 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
fromstr_to_netaddress_target.rs
Summary iterations:1000002 time:17 speed:58823 crashes_count:0 timeout_count:0 new_units_added:160 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
full_stack_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:797 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
indexedmap_target.rs
Summary iterations:1000002 time:648 speed:1543 crashes_count:0 timeout_count:0 new_units_added:698 slowest_unit_ms:19 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
invoice_deser_target.rs
Summary iterations:1000002 time:20 speed:50000 crashes_count:0 timeout_count:0 new_units_added:2955 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
invoice_request_deser_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:2244 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_accept_channel_target.rs
Summary iterations:1000002 time:23 speed:43478 crashes_count:0 timeout_count:0 new_units_added:1115 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_accept_channel_v2_target.rs
Summary iterations:1000002 time:246 speed:4065 crashes_count:0 timeout_count:0 new_units_added:1031 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_announcement_signatures_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:322 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_channel_announcement_target.rs
Summary iterations:1000002 time:20 speed:50000 crashes_count:0 timeout_count:0 new_units_added:413 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_channel_details_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:993 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_channel_ready_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:374 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_channel_reestablish_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:434 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_channel_update_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:210 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_closing_signed_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:380 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_commitment_signed_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:697 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_decoded_onion_error_packet_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:178 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_error_message_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:108 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_funding_created_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:342 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_funding_signed_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:304 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_gossip_timestamp_filter_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:294 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_init_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:1006 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_node_announcement_target.rs
Summary iterations:1000002 time:21 speed:47619 crashes_count:0 timeout_count:0 new_units_added:851 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_open_channel_target.rs
Summary iterations:1000002 time:35 speed:28571 crashes_count:0 timeout_count:0 new_units_added:1163 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_open_channel_v2_target.rs
Summary iterations:1000002 time:24 speed:41666 crashes_count:0 timeout_count:0 new_units_added:1289 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_ping_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:91 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_pong_target.rs
Summary iterations:1000002 time:20 speed:50000 crashes_count:0 timeout_count:0 new_units_added:83 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_query_channel_range_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:334 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_query_short_channel_ids_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:108 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_reply_channel_range_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:158 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_reply_short_channel_ids_end_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:337 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_revoke_and_ack_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:360 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_shutdown_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:333 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_splice_ack_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:387 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_splice_init_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:401 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_splice_locked_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:319 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_stfu_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:319 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_abort_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:403 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_ack_rbf_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:366 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_add_input_target.rs
Summary iterations:1000002 time:24 speed:41666 crashes_count:0 timeout_count:0 new_units_added:1270 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_add_output_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:390 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_complete_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:285 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_init_rbf_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:393 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_remove_input_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:297 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_remove_output_target.rs
Summary iterations:1000002 time:17 speed:58823 crashes_count:0 timeout_count:0 new_units_added:322 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_signatures_target.rs
Summary iterations:1000002 time:52 speed:19230 crashes_count:0 timeout_count:0 new_units_added:851 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_update_add_htlc_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:430 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_update_fail_htlc_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:480 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_update_fail_malformed_htlc_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:321 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_update_fee_target.rs
Summary iterations:1000002 time:17 speed:58823 crashes_count:0 timeout_count:0 new_units_added:308 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_update_fulfill_htlc_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:309 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
offer_deser_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:1333 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
onion_hop_data_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:981 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
onion_message_target.rs
Summary iterations:1000002 time:24 speed:41666 crashes_count:0 timeout_count:0 new_units_added:395 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
peer_crypt_target.rs
Summary iterations:1000002 time:27 speed:37037 crashes_count:0 timeout_count:0 new_units_added:315 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
process_network_graph_target.rs
Summary iterations:735922 time:8434 speed:87 crashes_count:0 timeout_count:0 new_units_added:30 slowest_unit_ms:40 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:161

@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

I checked out a fuzzer run on the attr failures PR and grepped the logs. Interestingly it seems like indeed chanmon_consistency_target takes nearly 3 hours. But the other one you mention, full_stack_target is only 18 seconds?

Ah, thanks for doing that. Yea, I was going on the results when I fuzz with real corpuses, where full_stack_target can get quite slow. But, given we currently don't initialize our CI fuzzers with a real corpus so it really doesn't get into it too much. I did go ahead and update the CI fuzzer to use the hard-coded full_stack_target seeds, but it still doesn't spend much time in complicated paths.

process_network_graph_target is also slow (2+ hours), and looking at the fuzz log in #3687, it doesn't seem to be resolved with that change.

Huh, interesting, I went ahead and slowed this one down though.

Also from this log, you'd say that all the fast tests (<30 sec) don't need their iteration count changed.

Yep!

@TheBlueMatt
TheBlueMattforce-pushed the 2025-03-fuzz-less branch 2 times, most recently from c87c3f3 to ad4fb1eCompareApril 1, 2025 18:33
@codecov

codecovBot commented Apr 1, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.92%. Comparing base (c4d23bc) to head (11dde05).
Report is 38 commits behind head on main.

Additional details and impacted files
@@ Coverage Diff @@## main #3691 +/- ##
==========================================
+ Coverage 89.05% 89.92% +0.86% 
==========================================
Files 155 156 +1 Lines 122019 129760 +7741 Branches 122019 129760 +7741 ==========================================
+ Hits 108666 116683 +8017 + Misses 10695 10441 -254 + Partials 2658 2636 -22 

☔ 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.

@TheBlueMatt
TheBlueMattforce-pushed the 2025-03-fuzz-less branch 6 times, most recently from b93b1d6 to 4b4bad8CompareApril 3, 2025 15:21
tnull
tnull previously approved these changes Apr 4, 2025

@tnulltnull left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

Fuzz failure is #3708

@joostjagerjoostjager left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great that fuzzing again found an issue. This is awesome.

Before merging this, I think we still want to see a successful fuzz run well within the timeout?

@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

Yea, happy to wait until we can at least run a fuzzing run and check that all the timings make sense.

@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

It passed, but taking five hours for CI is excessive, so I reduced it further.

@tnull

tnull commented Apr 8, 2025

Copy link
Copy Markdown
Contributor

It passed, but taking five hours for CI is excessive, so I reduced it further.

Now finished in 273min ~ 4.55 hours. Is this acceptable?

@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

Mmm, that's still pretty aggressive. Divided a few jobs by two so hopefully this time's the charm.

@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

Okay, its now "only" 2h, which I think is kinda reasonable, or at least its in line with what some of our other jobs take, so happy to land this now.

tnull
tnull previously approved these changes Apr 8, 2025
@joostjager

Copy link
Copy Markdown
Contributor

Distribution looks much better now:

testiterationstime
base32_target.rs2500002278
bech32_parse_target.rs250000258
bolt11_deser_target.rs250000245
chanmon_consistency_target.rs5002852
chanmon_deser_target.r250000255
fromstr_to_netaddress_target.r250000245
full_stack_target.rs50002554
indexedmap_target.rs500002394
invoice_deser_target.r250000251
invoice_request_deser_target.r250000250
msg_accept_channel_target.rs2500002181
msg_accept_channel_v2_target.r2500002258
msg_announcement_signatures_target.rs250000253
msg_channel_announcement_target.rs250000273
msg_channel_details_target.rs250000247
msg_channel_ready_target.r250000249
msg_channel_reestablish_target.rs250000252
msg_channel_update_target.rs250000254
msg_closing_signed_target.rs250000250
msg_commitment_signed_target.r250000255
msg_decoded_onion_error_packet_target.rs250000250
msg_error_message_target.r250000251
msg_funding_created_target.rs250000252
msg_funding_signed_target.rs250000250
msg_gossip_timestamp_filter_target.rs250000247
msg_init_target.rs250000248
msg_node_announcement_target.r250000260
msg_open_channel_target.rs250000271
msg_open_channel_v2_target.rs250000266
msg_ping_target.rs250000248
msg_pong_target.rs250000248
msg_query_channel_range_target.rs250000247
msg_query_short_channel_ids_target.rs250000252
msg_reply_channel_range_target.rs250000248
msg_reply_short_channel_ids_end_target.rs250000247
msg_revoke_and_ack_target.rs250000250
msg_shutdown_target.rs250000247
msg_splice_ack_target.rs250000250
msg_splice_init_target.rs250000250
msg_splice_locked_target.r250000248
msg_stfu_target.rs250000247
msg_tx_abort_target.rs250000248
msg_tx_ack_rbf_target.rs250000247
msg_tx_add_input_target.rs250000273
msg_tx_add_output_target.r250000248
msg_tx_complete_target.rs250000247
msg_tx_init_rbf_target.rs250000248
msg_tx_remove_input_target.rs250000247
msg_tx_remove_output_target.rs250000248
msg_tx_signatures_target.r2500002100
msg_update_add_htlc_target.rs250000299
msg_update_fail_htlc_target.rs250000252
msg_update_fail_malformed_htlc_target.rs250000249
msg_update_fee_target.rs250000248
msg_update_fulfill_htlc_target.rs250000249
offer_deser_target.rs250000248
onion_hop_data_target.rs250000249
onion_message_target.r250000264
peer_crypt_target.rs2500002108
process_network_graph_target.r50002568
process_onion_failure_target.r2500002165
refund_deser_target.rs250000249
router_target.rs50002606
zbase32_target.rs2500002119

Comment threadfuzz/src/full_stack.rs
Comment threadfuzz/ci-fuzz.sh
run: |
cd fuzz
RUSTFLAGS="--cfg=fuzzing --cfg=secp256k1_fuzz --cfg=hashes_fuzz" cargo test --verbose --color always
RUSTFLAGS="--cfg=fuzzing --cfg=secp256k1_fuzz --cfg=hashes_fuzz" cargo test --verbose --color always --lib --bins

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why these two additions?

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

Because RUSTFLAGS aren't applied to doctests, so we have to restrict tests to only run library and binary tests.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could add comments when making changes like this. Make life easier for future devs.

Comment threadfuzz/ci-fuzz.sh

mkdir -p hfuzz_workspace/full_stack_target/input
pushd write-seeds
RUSTFLAGS="$RUSTFLAGS --cfg=fuzzing" cargo run ../hfuzz_workspace/full_stack_target/input

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I wanted to verify that using the hardcoded seed indeed increases coverage, but it seems that hongfuzz reports in the log always

branch_coverage_percent:0

Not sure why that is? Otherwise it would be easy to compare with and without this hardcoded seed.

Or maybe there is another way to verify that it works indeed?

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

The fact that the full_stack_target got much slower is pretty good evidence :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Okay, indirect evidence. But why is hongfuzz reporting 0?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it not using coverage to direct fuzzing?

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

Yea, that I don't know, it certainly does locally and there's nothing different locally vs in CI. Also CI does turn up (fairly shallow) fuzz bugs as well, so I'd be surprised to learn it was able to do that with just general patterns and no instrumentation...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does it show you branch_coverage_percent as non-zero locally?

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

I'm not 100% sure about branch coverage specifically, but what I get from a running instance is: Coverage : edge: 16,485/568,547 [2%] pc: 738 cmp: 794,641. I assume "cmp" is the branch coverage.

joostjager
joostjager previously approved these changes Apr 10, 2025
When we made `test_node_counter_consistency` more aggressively
run, our `process_network_graph` fuzzer got materially slower,
resulting in consistent fuzz CI job timeouts.
Thus, here, we tweak the iteration count on all our fuzz jobs to
get them running in more consistent times.
Further, we further reduce `full_stack_target` iterations in
anticipation of a later commit which will start using our
hard-coded fuzz seeds, creating substantially more coverage and
slowing down fuzzing iterations.
In 3145168 we disabled
`test_node_counter_consistency` in debug builds since it can make
make things very slow, including `lightning-rapid-gossip-sync`
tests.
We should, however, have kept it when fuzzing, since that gives us
testing of potential coverage gaps in normal tests.
This should materially improve our fuzzing coverage in CI.
@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

Went ahead and squashed the addition of a comment in the fuzz script.

@joostjagerjoostjager left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great to have a more reasonable run time for the fuzzer!

Still interested to find out what's going on with that coverage indicator at zero in CI.

@tnull
tnull merged commit 83e9e80 into lightningdevkit:mainApr 11, 2025
Sign up for freeto 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.

4 participants

@TheBlueMatt@ldk-reviews-bot@joostjager@tnull
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Reduce CI fuzz iterations as we're now timing out - #3691

Merged
tnull merged 3 commits into
lightningdevkit:mainfrom
TheBlueMatt:2025-03-fuzz-less
Apr 11, 2025
Merged

Reduce CI fuzz iterations as we're now timing out#3691
tnull merged 3 commits into
lightningdevkit:mainfrom
TheBlueMatt:2025-03-fuzz-less

Conversation

@TheBlueMatt

Copy link
Copy Markdown
Collaborator

I think github has slowed down the runners so now our fuzz tests are timing out. Here we just reduce iteration count a bit.

@ldk-reviews-bot

ldk-reviews-bot commented Mar 29, 2025

Copy link
Copy Markdown

I've assigned @joostjager 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.

@tnulltnull left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ACK, seems we hit yet another failing case in the router target now: #3692

tnull
tnull previously approved these changes Mar 31, 2025
Comment threadfuzz/ci-fuzz.sh
HFUZZ_RUN_ARGS="$HFUZZ_RUN_ARGS -t0 -N100000"
else
HFUZZ_RUN_ARGS="$HFUZZ_RUN_ARGS -N1000000"
HFUZZ_RUN_ARGS="$HFUZZ_RUN_ARGS -N500000"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Any specific reasoning behind the 10x, 10x and 2x reductions?

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

No. I probably could have benchmarked, but in general there's not a lot of value in full_stack_target in CI because its just too dense to make any real progress, and similar for chanmon_consistency_target.

@joostjager

joostjager commented Apr 1, 2025

Copy link
Copy Markdown
Contributor

I checked out a fuzzer run on the attr failures PR and grepped the logs. Interestingly it seems like indeed chanmon_consistency_target takes nearly 3 hours. But the other one you mention, full_stack_target is only 18 seconds?

process_network_graph_target is also slow (2+ hours), and looking at the fuzz log in #3687, it doesn't seem to be resolved with that change.

Maybe I am not interpreting correctly though.

Also from this log, you'd say that all the fast tests (<30 sec) don't need their iteration count changed.

base32_target.rs
Summary iterations:1000002 time:198 speed:5050 crashes_count:0 timeout_count:0 new_units_added:449 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
bech32_parse_target.rs
Summary iterations:1000002 time:22 speed:45454 crashes_count:0 timeout_count:0 new_units_added:897 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
bolt11_deser_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:211 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
chanmon_consistency_target.rs
Summary iterations:100002 time:9769 speed:10 crashes_count:0 timeout_count:87 new_units_added:3435 slowest_unit_ms:1139 guard_nb:566357 branch_coverage_percent:2 peak_rss_mb:42
chanmon_deser_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:963 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
fromstr_to_netaddress_target.rs
Summary iterations:1000002 time:17 speed:58823 crashes_count:0 timeout_count:0 new_units_added:160 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
full_stack_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:797 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
indexedmap_target.rs
Summary iterations:1000002 time:648 speed:1543 crashes_count:0 timeout_count:0 new_units_added:698 slowest_unit_ms:19 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
invoice_deser_target.rs
Summary iterations:1000002 time:20 speed:50000 crashes_count:0 timeout_count:0 new_units_added:2955 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
invoice_request_deser_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:2244 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_accept_channel_target.rs
Summary iterations:1000002 time:23 speed:43478 crashes_count:0 timeout_count:0 new_units_added:1115 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_accept_channel_v2_target.rs
Summary iterations:1000002 time:246 speed:4065 crashes_count:0 timeout_count:0 new_units_added:1031 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_announcement_signatures_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:322 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_channel_announcement_target.rs
Summary iterations:1000002 time:20 speed:50000 crashes_count:0 timeout_count:0 new_units_added:413 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_channel_details_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:993 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_channel_ready_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:374 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_channel_reestablish_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:434 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_channel_update_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:210 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_closing_signed_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:380 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_commitment_signed_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:697 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_decoded_onion_error_packet_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:178 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_error_message_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:108 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_funding_created_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:342 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_funding_signed_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:304 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_gossip_timestamp_filter_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:294 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_init_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:1006 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_node_announcement_target.rs
Summary iterations:1000002 time:21 speed:47619 crashes_count:0 timeout_count:0 new_units_added:851 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_open_channel_target.rs
Summary iterations:1000002 time:35 speed:28571 crashes_count:0 timeout_count:0 new_units_added:1163 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_open_channel_v2_target.rs
Summary iterations:1000002 time:24 speed:41666 crashes_count:0 timeout_count:0 new_units_added:1289 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_ping_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:91 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_pong_target.rs
Summary iterations:1000002 time:20 speed:50000 crashes_count:0 timeout_count:0 new_units_added:83 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_query_channel_range_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:334 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_query_short_channel_ids_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:108 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_reply_channel_range_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:158 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_reply_short_channel_ids_end_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:337 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_revoke_and_ack_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:360 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_shutdown_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:333 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_splice_ack_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:387 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_splice_init_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:401 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_splice_locked_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:319 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_stfu_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:319 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_abort_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:403 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_ack_rbf_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:366 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_add_input_target.rs
Summary iterations:1000002 time:24 speed:41666 crashes_count:0 timeout_count:0 new_units_added:1270 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_add_output_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:390 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_complete_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:285 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_init_rbf_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:393 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_remove_input_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:297 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_remove_output_target.rs
Summary iterations:1000002 time:17 speed:58823 crashes_count:0 timeout_count:0 new_units_added:322 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_tx_signatures_target.rs
Summary iterations:1000002 time:52 speed:19230 crashes_count:0 timeout_count:0 new_units_added:851 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_update_add_htlc_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:430 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_update_fail_htlc_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:480 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_update_fail_malformed_htlc_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:321 slowest_unit_ms:17 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_update_fee_target.rs
Summary iterations:1000002 time:17 speed:58823 crashes_count:0 timeout_count:0 new_units_added:308 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
msg_update_fulfill_htlc_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:309 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
offer_deser_target.rs
Summary iterations:1000002 time:19 speed:52631 crashes_count:0 timeout_count:0 new_units_added:1333 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
onion_hop_data_target.rs
Summary iterations:1000002 time:18 speed:55555 crashes_count:0 timeout_count:0 new_units_added:981 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
onion_message_target.rs
Summary iterations:1000002 time:24 speed:41666 crashes_count:0 timeout_count:0 new_units_added:395 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
peer_crypt_target.rs
Summary iterations:1000002 time:27 speed:37037 crashes_count:0 timeout_count:0 new_units_added:315 slowest_unit_ms:16 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:42
process_network_graph_target.rs
Summary iterations:735922 time:8434 speed:87 crashes_count:0 timeout_count:0 new_units_added:30 slowest_unit_ms:40 guard_nb:566357 branch_coverage_percent:0 peak_rss_mb:161

@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

I checked out a fuzzer run on the attr failures PR and grepped the logs. Interestingly it seems like indeed chanmon_consistency_target takes nearly 3 hours. But the other one you mention, full_stack_target is only 18 seconds?

Ah, thanks for doing that. Yea, I was going on the results when I fuzz with real corpuses, where full_stack_target can get quite slow. But, given we currently don't initialize our CI fuzzers with a real corpus so it really doesn't get into it too much. I did go ahead and update the CI fuzzer to use the hard-coded full_stack_target seeds, but it still doesn't spend much time in complicated paths.

process_network_graph_target is also slow (2+ hours), and looking at the fuzz log in #3687, it doesn't seem to be resolved with that change.

Huh, interesting, I went ahead and slowed this one down though.

Also from this log, you'd say that all the fast tests (<30 sec) don't need their iteration count changed.

Yep!

@TheBlueMatt
TheBlueMattforce-pushed the 2025-03-fuzz-less branch 2 times, most recently from c87c3f3 to ad4fb1eCompareApril 1, 2025 18:33
@codecov

codecovBot commented Apr 1, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.92%. Comparing base (c4d23bc) to head (11dde05).
Report is 38 commits behind head on main.

Additional details and impacted files
@@ Coverage Diff @@## main #3691 +/- ##
==========================================
+ Coverage 89.05% 89.92% +0.86% 
==========================================
Files 155 156 +1 Lines 122019 129760 +7741 Branches 122019 129760 +7741 ==========================================
+ Hits 108666 116683 +8017 + Misses 10695 10441 -254 + Partials 2658 2636 -22 

☔ 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.

@TheBlueMatt
TheBlueMattforce-pushed the 2025-03-fuzz-less branch 6 times, most recently from b93b1d6 to 4b4bad8CompareApril 3, 2025 15:21
tnull
tnull previously approved these changes Apr 4, 2025

@tnulltnull left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

Fuzz failure is #3708

@joostjagerjoostjager left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great that fuzzing again found an issue. This is awesome.

Before merging this, I think we still want to see a successful fuzz run well within the timeout?

@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

Yea, happy to wait until we can at least run a fuzzing run and check that all the timings make sense.

@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

It passed, but taking five hours for CI is excessive, so I reduced it further.

@tnull

tnull commented Apr 8, 2025

Copy link
Copy Markdown
Contributor

It passed, but taking five hours for CI is excessive, so I reduced it further.

Now finished in 273min ~ 4.55 hours. Is this acceptable?

@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

Mmm, that's still pretty aggressive. Divided a few jobs by two so hopefully this time's the charm.

@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

Okay, its now "only" 2h, which I think is kinda reasonable, or at least its in line with what some of our other jobs take, so happy to land this now.

tnull
tnull previously approved these changes Apr 8, 2025
@joostjager

Copy link
Copy Markdown
Contributor

Distribution looks much better now:

testiterationstime
base32_target.rs2500002278
bech32_parse_target.rs250000258
bolt11_deser_target.rs250000245
chanmon_consistency_target.rs5002852
chanmon_deser_target.r250000255
fromstr_to_netaddress_target.r250000245
full_stack_target.rs50002554
indexedmap_target.rs500002394
invoice_deser_target.r250000251
invoice_request_deser_target.r250000250
msg_accept_channel_target.rs2500002181
msg_accept_channel_v2_target.r2500002258
msg_announcement_signatures_target.rs250000253
msg_channel_announcement_target.rs250000273
msg_channel_details_target.rs250000247
msg_channel_ready_target.r250000249
msg_channel_reestablish_target.rs250000252
msg_channel_update_target.rs250000254
msg_closing_signed_target.rs250000250
msg_commitment_signed_target.r250000255
msg_decoded_onion_error_packet_target.rs250000250
msg_error_message_target.r250000251
msg_funding_created_target.rs250000252
msg_funding_signed_target.rs250000250
msg_gossip_timestamp_filter_target.rs250000247
msg_init_target.rs250000248
msg_node_announcement_target.r250000260
msg_open_channel_target.rs250000271
msg_open_channel_v2_target.rs250000266
msg_ping_target.rs250000248
msg_pong_target.rs250000248
msg_query_channel_range_target.rs250000247
msg_query_short_channel_ids_target.rs250000252
msg_reply_channel_range_target.rs250000248
msg_reply_short_channel_ids_end_target.rs250000247
msg_revoke_and_ack_target.rs250000250
msg_shutdown_target.rs250000247
msg_splice_ack_target.rs250000250
msg_splice_init_target.rs250000250
msg_splice_locked_target.r250000248
msg_stfu_target.rs250000247
msg_tx_abort_target.rs250000248
msg_tx_ack_rbf_target.rs250000247
msg_tx_add_input_target.rs250000273
msg_tx_add_output_target.r250000248
msg_tx_complete_target.rs250000247
msg_tx_init_rbf_target.rs250000248
msg_tx_remove_input_target.rs250000247
msg_tx_remove_output_target.rs250000248
msg_tx_signatures_target.r2500002100
msg_update_add_htlc_target.rs250000299
msg_update_fail_htlc_target.rs250000252
msg_update_fail_malformed_htlc_target.rs250000249
msg_update_fee_target.rs250000248
msg_update_fulfill_htlc_target.rs250000249
offer_deser_target.rs250000248
onion_hop_data_target.rs250000249
onion_message_target.r250000264
peer_crypt_target.rs2500002108
process_network_graph_target.r50002568
process_onion_failure_target.r2500002165
refund_deser_target.rs250000249
router_target.rs50002606
zbase32_target.rs2500002119

Comment threadfuzz/src/full_stack.rs
Comment threadfuzz/ci-fuzz.sh
run: |
cd fuzz
RUSTFLAGS="--cfg=fuzzing --cfg=secp256k1_fuzz --cfg=hashes_fuzz" cargo test --verbose --color always
RUSTFLAGS="--cfg=fuzzing --cfg=secp256k1_fuzz --cfg=hashes_fuzz" cargo test --verbose --color always --lib --bins

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why these two additions?

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

Because RUSTFLAGS aren't applied to doctests, so we have to restrict tests to only run library and binary tests.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could add comments when making changes like this. Make life easier for future devs.

Comment threadfuzz/ci-fuzz.sh

mkdir -p hfuzz_workspace/full_stack_target/input
pushd write-seeds
RUSTFLAGS="$RUSTFLAGS --cfg=fuzzing" cargo run ../hfuzz_workspace/full_stack_target/input

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I wanted to verify that using the hardcoded seed indeed increases coverage, but it seems that hongfuzz reports in the log always

branch_coverage_percent:0

Not sure why that is? Otherwise it would be easy to compare with and without this hardcoded seed.

Or maybe there is another way to verify that it works indeed?

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

The fact that the full_stack_target got much slower is pretty good evidence :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Okay, indirect evidence. But why is hongfuzz reporting 0?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it not using coverage to direct fuzzing?

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

Yea, that I don't know, it certainly does locally and there's nothing different locally vs in CI. Also CI does turn up (fairly shallow) fuzz bugs as well, so I'd be surprised to learn it was able to do that with just general patterns and no instrumentation...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does it show you branch_coverage_percent as non-zero locally?

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

I'm not 100% sure about branch coverage specifically, but what I get from a running instance is: Coverage : edge: 16,485/568,547 [2%] pc: 738 cmp: 794,641. I assume "cmp" is the branch coverage.

joostjager
joostjager previously approved these changes Apr 10, 2025
When we made `test_node_counter_consistency` more aggressively
run, our `process_network_graph` fuzzer got materially slower,
resulting in consistent fuzz CI job timeouts.
Thus, here, we tweak the iteration count on all our fuzz jobs to
get them running in more consistent times.
Further, we further reduce `full_stack_target` iterations in
anticipation of a later commit which will start using our
hard-coded fuzz seeds, creating substantially more coverage and
slowing down fuzzing iterations.
In 3145168 we disabled
`test_node_counter_consistency` in debug builds since it can make
make things very slow, including `lightning-rapid-gossip-sync`
tests.
We should, however, have kept it when fuzzing, since that gives us
testing of potential coverage gaps in normal tests.
This should materially improve our fuzzing coverage in CI.
@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

Went ahead and squashed the addition of a comment in the fuzz script.

@joostjagerjoostjager left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great to have a more reasonable run time for the fuzzer!

Still interested to find out what's going on with that coverage indicator at zero in CI.

@tnull
tnull merged commit 83e9e80 into lightningdevkit:mainApr 11, 2025
Sign up for freeto 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.

4 participants

@TheBlueMatt@ldk-reviews-bot@joostjager@tnull