Skip to content

rustfmt: Reformat the fuzz dir – the easy part #3111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

tnull
Copy link
Contributor

@tnull tnull commented Jun 7, 2024

As suggested here, we split out the easy part from #3102 to have it land fast and reduce the risk of potential rebases becoming necessary.

@codecov-commenter
Copy link

codecov-commenter commented Jun 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.85%. Comparing base (88124a9) to head (99409fb).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3111      +/-   ##
==========================================
+ Coverage   89.84%   89.85%   +0.01%     
==========================================
  Files         119      119              
  Lines       97843    97843              
  Branches    97843    97843              
==========================================
+ Hits        87906    87921      +15     
+ Misses       7368     7352      -16     
- Partials     2569     2570       +1     

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

@valentinewallace valentinewallace self-requested a review June 7, 2024 16:28
@tnull
Copy link
Contributor Author

tnull commented Jun 7, 2024

Fixed.

Copy link
Collaborator

@TheBlueMatt TheBlueMatt left a comment

Choose a reason for hiding this comment

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

Otherwise LGTM.

@tnull tnull force-pushed the 2024-06-rustfmt-fuzz-the-easy-part branch 2 times, most recently from f891099 to a8622c9 Compare June 7, 2024 17:33
@tnull
Copy link
Contributor Author

tnull commented Jun 7, 2024

Force pushed with the following changes:

> git diff-tree -U2 b5dd23920 a8622c98b
diff --git a/fuzz/src/router.rs b/fuzz/src/router.rs
index f62461df4..a40026821 100644
--- a/fuzz/src/router.rs
+++ b/fuzz/src/router.rs
@@ -208,12 +208,7 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
                                        for _ in 0..count {
                                                scid += 1;
-                                               let (rnid, _) = node_pks
-                                                       .iter()
-                                                       .skip(
-                                                               u16::from_be_bytes(get_slice!(2).try_into().unwrap()) as usize
-                                                                       % node_pks.len(),
-                                                       )
-                                                       .next()
-                                                       .unwrap();
+                                               let skip = u16::from_be_bytes(get_slice!(2).try_into().unwrap()) as usize
+                                                       % node_pks.len();
+                                               let (rnid, _) = node_pks.iter().skip(skip).next().unwrap();
                                                let capacity = u64::from_be_bytes(get_slice!(8).try_into().unwrap());
                                                $first_hops_vec.push(ChannelDetails {
@@ -272,9 +267,6 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
                        for _ in 0..count {
                                scid += 1;
-                               let (rnid, _) = node_pks
-                                       .iter()
-                                       .skip(slice_to_be16(get_slice!(2)) as usize % node_pks.len())
-                                       .next()
-                                       .unwrap();
+                               let skip = slice_to_be16(get_slice!(2)) as usize % node_pks.len();
+                               let (rnid, _) = node_pks.iter().skip(skip).next().unwrap();
                                $last_hops.push(RouteHint(vec![RouteHintHop {
                                        src_node_id: *rnid,

@TheBlueMatt
Copy link
Collaborator

#3080 should go first, i think.

@tnull
Copy link
Contributor Author

tnull commented Jun 7, 2024

#3080 should go first, i think.

Fine by me, although IIUC there should barely be any conflicts as this doesn't interfere with the full_stack/chanmon_consistency changes.

@tnull tnull force-pushed the 2024-06-rustfmt-fuzz-the-easy-part branch from a8622c9 to b4a906d Compare June 7, 2024 18:39
@tnull tnull force-pushed the 2024-06-rustfmt-fuzz-the-easy-part branch from b4a906d to 99409fb Compare June 7, 2024 18:42
@tnull
Copy link
Contributor Author

tnull commented Jun 7, 2024

Rebased to resolve minor conflicts after #3080 landed.

@TheBlueMatt TheBlueMatt merged commit c166c21 into lightningdevkit:main Jun 7, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants