Skip to content

Convert file-level rustfmt skip to fn level skips - #3809

Merged
joostjager merged 3 commits into
lightningdevkit:mainfrom
joostjager:rustfmt-skip-all
Jun 13, 2025
Merged

Convert file-level rustfmt skip to fn level skips#3809
joostjager merged 3 commits into
lightningdevkit:mainfrom
joostjager:rustfmt-skip-all

Conversation

@joostjager

@joostjagerjoostjager commented May 29, 2025

Copy link
Copy Markdown
Contributor

Extend the approach proposed in #3767 to the full repository. The change set is automatically generated using a script. The script omits skip directives when they would not impact formatting (code already rustfmt-compliant).

I've fixed various problems with the script, and it may be that there are a few edge cases left that should have had a skip directive. There could also be a few redundant ones. I think we can live with that.

Omitted are files that are formatted in in-flight rustfmt PRs: #3783, #3725, #3338 and #3337

@ldk-reviews-bot

ldk-reviews-bot commented May 29, 2025

Copy link
Copy Markdown

👋 Thanks for assigning @TheBlueMatt 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.

@joostjager
joostjagerforce-pushed the rustfmt-skip-all branch 2 times, most recently from a88062e to 16025f2CompareMay 29, 2025 14:26
@joostjager

Copy link
Copy Markdown
ContributorAuthor

As discussed in sync meet, I will try to extend the script to ignore rustfmt changes that only affect the function signature.

@joostjager

Copy link
Copy Markdown
ContributorAuthor

Pushed fix up commit to ignore sig changes. Modest reduction in skips, with a few edge cases.

@codecov

codecovBot commented Jun 2, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 99.01153% with 6 lines in your changes missing coverage. Please review.

Project coverage is 89.91%. Comparing base (e797180) to head (a38db49).

Files with missing linesPatch %Lines
lightning/src/chain/channelmonitor.rs91.17%6 Missing ⚠️
Additional details and impacted files
@@ Coverage Diff @@## main #3809 +/- ##
==========================================
+ Coverage 89.87% 89.91% +0.03% 
==========================================
Files 162 162 Lines 130214 130684 +470 Branches 130214 130684 +470 ==========================================
+ Hits 117034 117508 +474 + Misses 10486 10484 -2 + Partials 2694 2692 -2 

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

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

Why is this in draft? This needs a rebase by now, too.

@@ -1,48 +1,47 @@
#![cfg_attr(rustfmt, rustfmt_skip)]

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.

This was put here deliberately as we opted against running rustfmt on autogenerated files. We need to fix it either way, likely just revert it to include the skip.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Ah, didn't know it was auto-generated. Removed the commit that formats this file.

@joostjager

Copy link
Copy Markdown
ContributorAuthor

It's in draft because I want to see #3767 merged first. Don't want to spend time on rebase if we don't go this way.

@joostjager

Copy link
Copy Markdown
ContributorAuthor

#3767 seems a positive change. New code being added in PRs (for example async payments) is now automatically formatted and not creating more formatting debt. No bad rebase conflicts that I've heard of either.

Enough to go ahead and re-run the script on the latest main.

@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 from what I've seen so far.

Mind including the same changes for the remaining files in chain,ln, and routing, too?

@joostjager

Copy link
Copy Markdown
ContributorAuthor

LGTM from what I've seen so far.

Mind including the same changes for the remaining files in chain,ln, and routing, too?

Intentionally left these out because there are fmt prs in flight for those files. Links in pr desc

@tnull

Copy link
Copy Markdown
Contributor

Intentionally left these out because there are fmt prs in flight for those files. Links in pr desc

Ah, right. The remaining ones in routing never went far, so now closed them for now. Please include routing here.

@joostjager

Copy link
Copy Markdown
ContributorAuthor

Re-added routing files.

@joostjager
joostjager marked this pull request as ready for review June 11, 2025 12:53
@joostjager
joostjager requested a review from tnullJune 11, 2025 15:04
@TheBlueMatt

Copy link
Copy Markdown
Collaborator

I admit I'm kinda meh oh doing this for everything. There's a handful of files left that are pretty small and can be easily formatted (at least once trampoline PRs land for chain and the router module PRs get picked back up), and for tests I understood the plan to be "move forward, get there soon" (I know, I know, I plan on finishing #3783 this week), so applying skips to everything in tests (which generally aren't regularly touched) just to format them soon seems kinda weird?

For large files that we want to format iteratively (channelmanager, channel, maybe some of chain though many of those files aren't that large, just very actively being edited), this approach makes a ton of sense, for every file I'm not sure that we want to always format iteratively?

@joostjager

Copy link
Copy Markdown
ContributorAuthor

I admit I'm kinda meh oh doing this for everything. There's a handful of files left that are pretty small and can be easily formatted (at least once trampoline PRs land for chain and the router module PRs get picked back up), and for tests I understood the plan to be "move forward, get there soon" (I know, I know, I plan on finishing #3783 this week), so applying skips to everything in tests (which generally aren't regularly touched) just to format them soon seems kinda weird?

I see what you mean. Applying skips now and removing them "soon" feels unnecessary. The way I see it though is that "soon" may be quite a bit further out than we'd like. Trampoline for example may take a while. Adding the skips doesn't hurt, they can easily be removed again if someone feels inclined to format a full file, and they add flexibility for devs to selectively format for whatever reason.

For large files that we want to format iteratively (channelmanager, channel, maybe some of chain though many of those files aren't that large, just very actively being edited), this approach makes a ton of sense, for every file I'm not sure that we want to always format iteratively?

I needed to rebase this PR anyway, and while I did I left out the test files. If you feel it is still too much, maybe you can list the exact files that are definitely good for the incremental approach?

@joostjager

joostjager commented Jun 12, 2025

Copy link
Copy Markdown
ContributorAuthor

Also not sure at all that doing the tests all in one with mass edits is ideal: #3783 (review)

@TheBlueMattTheBlueMatt left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think the file list here makes sense. I thought there were substantially more changes to onion_payment.rs for trampoline to come but @valentinewallace tells me they're more in outbound_payment.rs which has more active development and thus higher cost to delaying pushing the format skips down in it.

Comment threadlightning/src/ln/chan_utils.rs Outdated
secrets.push([0; 32]);
secrets.last_mut().unwrap()[0..32].clone_from_slice(&<Vec<u8>>::from_hex("c7518c8ae4660ed02894df8976fa1a3659c1a8b4b5bec0c4b872abeba4cb8964").unwrap());
secrets.last_mut().unwrap()[0..32].clone_from_slice(
&<Vec<u8>>::from_hex(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do you want to go ahead and break the hex constants out to give them names?

@joostjagerjoostjagerJun 12, 2025

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Done. All gave them the same hex name though...

@joostjager
joostjagerforce-pushed the rustfmt-skip-all branch 3 times, most recently from 7d69403 to 516fdb3CompareJune 12, 2025 18:42
Comment threadlightning/src/chain/onchaintx.rs Outdated
Comment threadlightning/src/chain/channelmonitor.rs Outdated
Comment threadlightning/src/chain/channelmonitor.rs Outdated
Comment threadlightning/src/chain/channelmonitor.rs Outdated
Comment threadlightning/src/chain/channelmonitor.rs Outdated
Comment threadlightning/src/ln/channel.rs Outdated
Comment threadlightning/src/ln/channel.rs Outdated
Comment threadlightning/src/ln/channel.rs Outdated
Comment threadlightning/src/ln/outbound_payment.rs Outdated
Comment threadlightning/src/ln/outbound_payment.rs Outdated
@joostjager

Copy link
Copy Markdown
ContributorAuthor

Removed redundant skips. Didn't do the optional improvements (format short fns), because it is probably easiest to keep this big PR "pure" and do the rest in follow ups.

@joostjager

Copy link
Copy Markdown
ContributorAuthor

Didn't squash the redundant skip removal commit, in case I need to re-run the script and re-apply the edge case fixes.

@TheBlueMattTheBlueMatt left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

11 files changed, 1984 insertions(+), 668 deletions(-)

Holy diff-size batman!

@joostjager
joostjager merged commit 3e9e6a3 into lightningdevkit:mainJun 13, 2025
@joostjagerjoostjager mentioned this pull request Jun 18, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@joostjager@ldk-reviews-bot@tnull@TheBlueMatt@valentinewallace
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
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;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Convert file-level rustfmt skip to fn level skips by joostjager · Pull Request #3809 · lightningdevkit/rust-lightning · GitHub
Skip to content

Convert file-level rustfmt skip to fn level skips - #3809

Merged
joostjager merged 3 commits into
lightningdevkit:mainfrom
joostjager:rustfmt-skip-all
Jun 13, 2025
Merged

Convert file-level rustfmt skip to fn level skips#3809
joostjager merged 3 commits into
lightningdevkit:mainfrom
joostjager:rustfmt-skip-all

Conversation

@joostjager

@joostjagerjoostjager commented May 29, 2025

Copy link
Copy Markdown
Contributor

Extend the approach proposed in #3767 to the full repository. The change set is automatically generated using a script. The script omits skip directives when they would not impact formatting (code already rustfmt-compliant).

I've fixed various problems with the script, and it may be that there are a few edge cases left that should have had a skip directive. There could also be a few redundant ones. I think we can live with that.

Omitted are files that are formatted in in-flight rustfmt PRs: #3783, #3725, #3338 and #3337

@ldk-reviews-bot

ldk-reviews-bot commented May 29, 2025

Copy link
Copy Markdown

👋 Thanks for assigning @TheBlueMatt 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.

@joostjager
joostjagerforce-pushed the rustfmt-skip-all branch 2 times, most recently from a88062e to 16025f2CompareMay 29, 2025 14:26
@joostjager

Copy link
Copy Markdown
ContributorAuthor

As discussed in sync meet, I will try to extend the script to ignore rustfmt changes that only affect the function signature.

@joostjager

Copy link
Copy Markdown
ContributorAuthor

Pushed fix up commit to ignore sig changes. Modest reduction in skips, with a few edge cases.

@codecov

codecovBot commented Jun 2, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 99.01153% with 6 lines in your changes missing coverage. Please review.

Project coverage is 89.91%. Comparing base (e797180) to head (a38db49).

Files with missing linesPatch %Lines
lightning/src/chain/channelmonitor.rs91.17%6 Missing ⚠️
Additional details and impacted files
@@ Coverage Diff @@## main #3809 +/- ##
==========================================
+ Coverage 89.87% 89.91% +0.03% 
==========================================
Files 162 162 Lines 130214 130684 +470 Branches 130214 130684 +470 ==========================================
+ Hits 117034 117508 +474 + Misses 10486 10484 -2 + Partials 2694 2692 -2 

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

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

Why is this in draft? This needs a rebase by now, too.

@@ -1,48 +1,47 @@
#![cfg_attr(rustfmt, rustfmt_skip)]

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.

This was put here deliberately as we opted against running rustfmt on autogenerated files. We need to fix it either way, likely just revert it to include the skip.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Ah, didn't know it was auto-generated. Removed the commit that formats this file.

@joostjager

Copy link
Copy Markdown
ContributorAuthor

It's in draft because I want to see #3767 merged first. Don't want to spend time on rebase if we don't go this way.

@joostjager

Copy link
Copy Markdown
ContributorAuthor

#3767 seems a positive change. New code being added in PRs (for example async payments) is now automatically formatted and not creating more formatting debt. No bad rebase conflicts that I've heard of either.

Enough to go ahead and re-run the script on the latest main.

@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 from what I've seen so far.

Mind including the same changes for the remaining files in chain,ln, and routing, too?

@joostjager

Copy link
Copy Markdown
ContributorAuthor

LGTM from what I've seen so far.

Mind including the same changes for the remaining files in chain,ln, and routing, too?

Intentionally left these out because there are fmt prs in flight for those files. Links in pr desc

@tnull

Copy link
Copy Markdown
Contributor

Intentionally left these out because there are fmt prs in flight for those files. Links in pr desc

Ah, right. The remaining ones in routing never went far, so now closed them for now. Please include routing here.

@joostjager

Copy link
Copy Markdown
ContributorAuthor

Re-added routing files.

@joostjager
joostjager marked this pull request as ready for review June 11, 2025 12:53
@joostjager
joostjager requested a review from tnullJune 11, 2025 15:04
@TheBlueMatt

Copy link
Copy Markdown
Collaborator

I admit I'm kinda meh oh doing this for everything. There's a handful of files left that are pretty small and can be easily formatted (at least once trampoline PRs land for chain and the router module PRs get picked back up), and for tests I understood the plan to be "move forward, get there soon" (I know, I know, I plan on finishing #3783 this week), so applying skips to everything in tests (which generally aren't regularly touched) just to format them soon seems kinda weird?

For large files that we want to format iteratively (channelmanager, channel, maybe some of chain though many of those files aren't that large, just very actively being edited), this approach makes a ton of sense, for every file I'm not sure that we want to always format iteratively?

@joostjager

Copy link
Copy Markdown
ContributorAuthor

I admit I'm kinda meh oh doing this for everything. There's a handful of files left that are pretty small and can be easily formatted (at least once trampoline PRs land for chain and the router module PRs get picked back up), and for tests I understood the plan to be "move forward, get there soon" (I know, I know, I plan on finishing #3783 this week), so applying skips to everything in tests (which generally aren't regularly touched) just to format them soon seems kinda weird?

I see what you mean. Applying skips now and removing them "soon" feels unnecessary. The way I see it though is that "soon" may be quite a bit further out than we'd like. Trampoline for example may take a while. Adding the skips doesn't hurt, they can easily be removed again if someone feels inclined to format a full file, and they add flexibility for devs to selectively format for whatever reason.

For large files that we want to format iteratively (channelmanager, channel, maybe some of chain though many of those files aren't that large, just very actively being edited), this approach makes a ton of sense, for every file I'm not sure that we want to always format iteratively?

I needed to rebase this PR anyway, and while I did I left out the test files. If you feel it is still too much, maybe you can list the exact files that are definitely good for the incremental approach?

@joostjager

joostjager commented Jun 12, 2025

Copy link
Copy Markdown
ContributorAuthor

Also not sure at all that doing the tests all in one with mass edits is ideal: #3783 (review)

@TheBlueMattTheBlueMatt left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think the file list here makes sense. I thought there were substantially more changes to onion_payment.rs for trampoline to come but @valentinewallace tells me they're more in outbound_payment.rs which has more active development and thus higher cost to delaying pushing the format skips down in it.

Comment threadlightning/src/ln/chan_utils.rs Outdated
secrets.push([0; 32]);
secrets.last_mut().unwrap()[0..32].clone_from_slice(&<Vec<u8>>::from_hex("c7518c8ae4660ed02894df8976fa1a3659c1a8b4b5bec0c4b872abeba4cb8964").unwrap());
secrets.last_mut().unwrap()[0..32].clone_from_slice(
&<Vec<u8>>::from_hex(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do you want to go ahead and break the hex constants out to give them names?

@joostjagerjoostjagerJun 12, 2025

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Done. All gave them the same hex name though...

@joostjager
joostjagerforce-pushed the rustfmt-skip-all branch 3 times, most recently from 7d69403 to 516fdb3CompareJune 12, 2025 18:42
Comment threadlightning/src/chain/onchaintx.rs Outdated
Comment threadlightning/src/chain/channelmonitor.rs Outdated
Comment threadlightning/src/chain/channelmonitor.rs Outdated
Comment threadlightning/src/chain/channelmonitor.rs Outdated
Comment threadlightning/src/chain/channelmonitor.rs Outdated
Comment threadlightning/src/ln/channel.rs Outdated
Comment threadlightning/src/ln/channel.rs Outdated
Comment threadlightning/src/ln/channel.rs Outdated
Comment threadlightning/src/ln/outbound_payment.rs Outdated
Comment threadlightning/src/ln/outbound_payment.rs Outdated
@joostjager

Copy link
Copy Markdown
ContributorAuthor

Removed redundant skips. Didn't do the optional improvements (format short fns), because it is probably easiest to keep this big PR "pure" and do the rest in follow ups.

@joostjager

Copy link
Copy Markdown
ContributorAuthor

Didn't squash the redundant skip removal commit, in case I need to re-run the script and re-apply the edge case fixes.

@TheBlueMattTheBlueMatt left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

11 files changed, 1984 insertions(+), 668 deletions(-)

Holy diff-size batman!

@joostjager
joostjager merged commit 3e9e6a3 into lightningdevkit:mainJun 13, 2025
@joostjagerjoostjager mentioned this pull request Jun 18, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

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

Convert file-level rustfmt skip to fn level skips - #3809

Merged
joostjager merged 3 commits into
lightningdevkit:mainfrom
joostjager:rustfmt-skip-all
Jun 13, 2025
Merged

Convert file-level rustfmt skip to fn level skips#3809
joostjager merged 3 commits into
lightningdevkit:mainfrom
joostjager:rustfmt-skip-all

Conversation

@joostjager

@joostjagerjoostjager commented May 29, 2025

Copy link
Copy Markdown
Contributor

Extend the approach proposed in #3767 to the full repository. The change set is automatically generated using a script. The script omits skip directives when they would not impact formatting (code already rustfmt-compliant).

I've fixed various problems with the script, and it may be that there are a few edge cases left that should have had a skip directive. There could also be a few redundant ones. I think we can live with that.

Omitted are files that are formatted in in-flight rustfmt PRs: #3783, #3725, #3338 and #3337

@ldk-reviews-bot

ldk-reviews-bot commented May 29, 2025

Copy link
Copy Markdown

👋 Thanks for assigning @TheBlueMatt 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.

@joostjager
joostjagerforce-pushed the rustfmt-skip-all branch 2 times, most recently from a88062e to 16025f2CompareMay 29, 2025 14:26
@joostjager

Copy link
Copy Markdown
ContributorAuthor

As discussed in sync meet, I will try to extend the script to ignore rustfmt changes that only affect the function signature.

@joostjager

Copy link
Copy Markdown
ContributorAuthor

Pushed fix up commit to ignore sig changes. Modest reduction in skips, with a few edge cases.

@codecov

codecovBot commented Jun 2, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 99.01153% with 6 lines in your changes missing coverage. Please review.

Project coverage is 89.91%. Comparing base (e797180) to head (a38db49).

Files with missing linesPatch %Lines
lightning/src/chain/channelmonitor.rs91.17%6 Missing ⚠️
Additional details and impacted files
@@ Coverage Diff @@## main #3809 +/- ##
==========================================
+ Coverage 89.87% 89.91% +0.03% 
==========================================
Files 162 162 Lines 130214 130684 +470 Branches 130214 130684 +470 ==========================================
+ Hits 117034 117508 +474 + Misses 10486 10484 -2 + Partials 2694 2692 -2 

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

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

Why is this in draft? This needs a rebase by now, too.

@@ -1,48 +1,47 @@
#![cfg_attr(rustfmt, rustfmt_skip)]

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.

This was put here deliberately as we opted against running rustfmt on autogenerated files. We need to fix it either way, likely just revert it to include the skip.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Ah, didn't know it was auto-generated. Removed the commit that formats this file.

@joostjager

Copy link
Copy Markdown
ContributorAuthor

It's in draft because I want to see #3767 merged first. Don't want to spend time on rebase if we don't go this way.

@joostjager

Copy link
Copy Markdown
ContributorAuthor

#3767 seems a positive change. New code being added in PRs (for example async payments) is now automatically formatted and not creating more formatting debt. No bad rebase conflicts that I've heard of either.

Enough to go ahead and re-run the script on the latest main.

@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 from what I've seen so far.

Mind including the same changes for the remaining files in chain,ln, and routing, too?

@joostjager

Copy link
Copy Markdown
ContributorAuthor

LGTM from what I've seen so far.

Mind including the same changes for the remaining files in chain,ln, and routing, too?

Intentionally left these out because there are fmt prs in flight for those files. Links in pr desc

@tnull

Copy link
Copy Markdown
Contributor

Intentionally left these out because there are fmt prs in flight for those files. Links in pr desc

Ah, right. The remaining ones in routing never went far, so now closed them for now. Please include routing here.

@joostjager

Copy link
Copy Markdown
ContributorAuthor

Re-added routing files.

@joostjager
joostjager marked this pull request as ready for review June 11, 2025 12:53
@joostjager
joostjager requested a review from tnullJune 11, 2025 15:04
@TheBlueMatt

Copy link
Copy Markdown
Collaborator

I admit I'm kinda meh oh doing this for everything. There's a handful of files left that are pretty small and can be easily formatted (at least once trampoline PRs land for chain and the router module PRs get picked back up), and for tests I understood the plan to be "move forward, get there soon" (I know, I know, I plan on finishing #3783 this week), so applying skips to everything in tests (which generally aren't regularly touched) just to format them soon seems kinda weird?

For large files that we want to format iteratively (channelmanager, channel, maybe some of chain though many of those files aren't that large, just very actively being edited), this approach makes a ton of sense, for every file I'm not sure that we want to always format iteratively?

@joostjager

Copy link
Copy Markdown
ContributorAuthor

I admit I'm kinda meh oh doing this for everything. There's a handful of files left that are pretty small and can be easily formatted (at least once trampoline PRs land for chain and the router module PRs get picked back up), and for tests I understood the plan to be "move forward, get there soon" (I know, I know, I plan on finishing #3783 this week), so applying skips to everything in tests (which generally aren't regularly touched) just to format them soon seems kinda weird?

I see what you mean. Applying skips now and removing them "soon" feels unnecessary. The way I see it though is that "soon" may be quite a bit further out than we'd like. Trampoline for example may take a while. Adding the skips doesn't hurt, they can easily be removed again if someone feels inclined to format a full file, and they add flexibility for devs to selectively format for whatever reason.

For large files that we want to format iteratively (channelmanager, channel, maybe some of chain though many of those files aren't that large, just very actively being edited), this approach makes a ton of sense, for every file I'm not sure that we want to always format iteratively?

I needed to rebase this PR anyway, and while I did I left out the test files. If you feel it is still too much, maybe you can list the exact files that are definitely good for the incremental approach?

@joostjager

joostjager commented Jun 12, 2025

Copy link
Copy Markdown
ContributorAuthor

Also not sure at all that doing the tests all in one with mass edits is ideal: #3783 (review)

@TheBlueMattTheBlueMatt left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think the file list here makes sense. I thought there were substantially more changes to onion_payment.rs for trampoline to come but @valentinewallace tells me they're more in outbound_payment.rs which has more active development and thus higher cost to delaying pushing the format skips down in it.

Comment threadlightning/src/ln/chan_utils.rs Outdated
secrets.push([0; 32]);
secrets.last_mut().unwrap()[0..32].clone_from_slice(&<Vec<u8>>::from_hex("c7518c8ae4660ed02894df8976fa1a3659c1a8b4b5bec0c4b872abeba4cb8964").unwrap());
secrets.last_mut().unwrap()[0..32].clone_from_slice(
&<Vec<u8>>::from_hex(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do you want to go ahead and break the hex constants out to give them names?

@joostjagerjoostjagerJun 12, 2025

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Done. All gave them the same hex name though...

@joostjager
joostjagerforce-pushed the rustfmt-skip-all branch 3 times, most recently from 7d69403 to 516fdb3CompareJune 12, 2025 18:42
Comment threadlightning/src/chain/onchaintx.rs Outdated
Comment threadlightning/src/chain/channelmonitor.rs Outdated
Comment threadlightning/src/chain/channelmonitor.rs Outdated
Comment threadlightning/src/chain/channelmonitor.rs Outdated
Comment threadlightning/src/chain/channelmonitor.rs Outdated
Comment threadlightning/src/ln/channel.rs Outdated
Comment threadlightning/src/ln/channel.rs Outdated
Comment threadlightning/src/ln/channel.rs Outdated
Comment threadlightning/src/ln/outbound_payment.rs Outdated
Comment threadlightning/src/ln/outbound_payment.rs Outdated
@joostjager

Copy link
Copy Markdown
ContributorAuthor

Removed redundant skips. Didn't do the optional improvements (format short fns), because it is probably easiest to keep this big PR "pure" and do the rest in follow ups.

@joostjager

Copy link
Copy Markdown
ContributorAuthor

Didn't squash the redundant skip removal commit, in case I need to re-run the script and re-apply the edge case fixes.

@TheBlueMattTheBlueMatt left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

11 files changed, 1984 insertions(+), 668 deletions(-)

Holy diff-size batman!

@joostjager
joostjager merged commit 3e9e6a3 into lightningdevkit:mainJun 13, 2025
@joostjagerjoostjager mentioned this pull request Jun 18, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

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

Convert file-level rustfmt skip to fn level skips - #3809

Merged
joostjager merged 3 commits into
lightningdevkit:mainfrom
joostjager:rustfmt-skip-all
Jun 13, 2025
Merged

Convert file-level rustfmt skip to fn level skips#3809
joostjager merged 3 commits into
lightningdevkit:mainfrom
joostjager:rustfmt-skip-all

Conversation

@joostjager

@joostjagerjoostjager commented May 29, 2025

Copy link
Copy Markdown
Contributor

Extend the approach proposed in #3767 to the full repository. The change set is automatically generated using a script. The script omits skip directives when they would not impact formatting (code already rustfmt-compliant).

I've fixed various problems with the script, and it may be that there are a few edge cases left that should have had a skip directive. There could also be a few redundant ones. I think we can live with that.

Omitted are files that are formatted in in-flight rustfmt PRs: #3783, #3725, #3338 and #3337

@ldk-reviews-bot

ldk-reviews-bot commented May 29, 2025

Copy link
Copy Markdown

👋 Thanks for assigning @TheBlueMatt 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.

@joostjager
joostjagerforce-pushed the rustfmt-skip-all branch 2 times, most recently from a88062e to 16025f2CompareMay 29, 2025 14:26
@joostjager

Copy link
Copy Markdown
ContributorAuthor

As discussed in sync meet, I will try to extend the script to ignore rustfmt changes that only affect the function signature.

@joostjager

Copy link
Copy Markdown
ContributorAuthor

Pushed fix up commit to ignore sig changes. Modest reduction in skips, with a few edge cases.

@codecov

codecovBot commented Jun 2, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 99.01153% with 6 lines in your changes missing coverage. Please review.

Project coverage is 89.91%. Comparing base (e797180) to head (a38db49).

Files with missing linesPatch %Lines
lightning/src/chain/channelmonitor.rs91.17%6 Missing ⚠️
Additional details and impacted files
@@ Coverage Diff @@## main #3809 +/- ##
==========================================
+ Coverage 89.87% 89.91% +0.03% 
==========================================
Files 162 162 Lines 130214 130684 +470 Branches 130214 130684 +470 ==========================================
+ Hits 117034 117508 +474 + Misses 10486 10484 -2 + Partials 2694 2692 -2 

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

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

Why is this in draft? This needs a rebase by now, too.

@@ -1,48 +1,47 @@
#![cfg_attr(rustfmt, rustfmt_skip)]

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.

This was put here deliberately as we opted against running rustfmt on autogenerated files. We need to fix it either way, likely just revert it to include the skip.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Ah, didn't know it was auto-generated. Removed the commit that formats this file.

@joostjager

Copy link
Copy Markdown
ContributorAuthor

It's in draft because I want to see #3767 merged first. Don't want to spend time on rebase if we don't go this way.

@joostjager

Copy link
Copy Markdown
ContributorAuthor

#3767 seems a positive change. New code being added in PRs (for example async payments) is now automatically formatted and not creating more formatting debt. No bad rebase conflicts that I've heard of either.

Enough to go ahead and re-run the script on the latest main.

@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 from what I've seen so far.

Mind including the same changes for the remaining files in chain,ln, and routing, too?

@joostjager

Copy link
Copy Markdown
ContributorAuthor

LGTM from what I've seen so far.

Mind including the same changes for the remaining files in chain,ln, and routing, too?

Intentionally left these out because there are fmt prs in flight for those files. Links in pr desc

@tnull

Copy link
Copy Markdown
Contributor

Intentionally left these out because there are fmt prs in flight for those files. Links in pr desc

Ah, right. The remaining ones in routing never went far, so now closed them for now. Please include routing here.

@joostjager

Copy link
Copy Markdown
ContributorAuthor

Re-added routing files.

@joostjager
joostjager marked this pull request as ready for review June 11, 2025 12:53
@joostjager
joostjager requested a review from tnullJune 11, 2025 15:04
@TheBlueMatt

Copy link
Copy Markdown
Collaborator

I admit I'm kinda meh oh doing this for everything. There's a handful of files left that are pretty small and can be easily formatted (at least once trampoline PRs land for chain and the router module PRs get picked back up), and for tests I understood the plan to be "move forward, get there soon" (I know, I know, I plan on finishing #3783 this week), so applying skips to everything in tests (which generally aren't regularly touched) just to format them soon seems kinda weird?

For large files that we want to format iteratively (channelmanager, channel, maybe some of chain though many of those files aren't that large, just very actively being edited), this approach makes a ton of sense, for every file I'm not sure that we want to always format iteratively?

@joostjager

Copy link
Copy Markdown
ContributorAuthor

I admit I'm kinda meh oh doing this for everything. There's a handful of files left that are pretty small and can be easily formatted (at least once trampoline PRs land for chain and the router module PRs get picked back up), and for tests I understood the plan to be "move forward, get there soon" (I know, I know, I plan on finishing #3783 this week), so applying skips to everything in tests (which generally aren't regularly touched) just to format them soon seems kinda weird?

I see what you mean. Applying skips now and removing them "soon" feels unnecessary. The way I see it though is that "soon" may be quite a bit further out than we'd like. Trampoline for example may take a while. Adding the skips doesn't hurt, they can easily be removed again if someone feels inclined to format a full file, and they add flexibility for devs to selectively format for whatever reason.

For large files that we want to format iteratively (channelmanager, channel, maybe some of chain though many of those files aren't that large, just very actively being edited), this approach makes a ton of sense, for every file I'm not sure that we want to always format iteratively?

I needed to rebase this PR anyway, and while I did I left out the test files. If you feel it is still too much, maybe you can list the exact files that are definitely good for the incremental approach?

@joostjager

joostjager commented Jun 12, 2025

Copy link
Copy Markdown
ContributorAuthor

Also not sure at all that doing the tests all in one with mass edits is ideal: #3783 (review)

@TheBlueMattTheBlueMatt left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think the file list here makes sense. I thought there were substantially more changes to onion_payment.rs for trampoline to come but @valentinewallace tells me they're more in outbound_payment.rs which has more active development and thus higher cost to delaying pushing the format skips down in it.

Comment threadlightning/src/ln/chan_utils.rs Outdated
secrets.push([0; 32]);
secrets.last_mut().unwrap()[0..32].clone_from_slice(&<Vec<u8>>::from_hex("c7518c8ae4660ed02894df8976fa1a3659c1a8b4b5bec0c4b872abeba4cb8964").unwrap());
secrets.last_mut().unwrap()[0..32].clone_from_slice(
&<Vec<u8>>::from_hex(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do you want to go ahead and break the hex constants out to give them names?

@joostjagerjoostjagerJun 12, 2025

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Done. All gave them the same hex name though...

@joostjager
joostjagerforce-pushed the rustfmt-skip-all branch 3 times, most recently from 7d69403 to 516fdb3CompareJune 12, 2025 18:42
Comment threadlightning/src/chain/onchaintx.rs Outdated
Comment threadlightning/src/chain/channelmonitor.rs Outdated
Comment threadlightning/src/chain/channelmonitor.rs Outdated
Comment threadlightning/src/chain/channelmonitor.rs Outdated
Comment threadlightning/src/chain/channelmonitor.rs Outdated
Comment threadlightning/src/ln/channel.rs Outdated
Comment threadlightning/src/ln/channel.rs Outdated
Comment threadlightning/src/ln/channel.rs Outdated
Comment threadlightning/src/ln/outbound_payment.rs Outdated
Comment threadlightning/src/ln/outbound_payment.rs Outdated
@joostjager

Copy link
Copy Markdown
ContributorAuthor

Removed redundant skips. Didn't do the optional improvements (format short fns), because it is probably easiest to keep this big PR "pure" and do the rest in follow ups.

@joostjager

Copy link
Copy Markdown
ContributorAuthor

Didn't squash the redundant skip removal commit, in case I need to re-run the script and re-apply the edge case fixes.

@TheBlueMattTheBlueMatt left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

11 files changed, 1984 insertions(+), 668 deletions(-)

Holy diff-size batman!

@joostjager
joostjager merged commit 3e9e6a3 into lightningdevkit:mainJun 13, 2025
@joostjagerjoostjager mentioned this pull request Jun 18, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

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

Convert file-level rustfmt skip to fn level skips - #3809

Merged
joostjager merged 3 commits into
lightningdevkit:mainfrom
joostjager:rustfmt-skip-all
Jun 13, 2025
Merged

Convert file-level rustfmt skip to fn level skips#3809
joostjager merged 3 commits into
lightningdevkit:mainfrom
joostjager:rustfmt-skip-all

Conversation

@joostjager

@joostjagerjoostjager commented May 29, 2025

Copy link
Copy Markdown
Contributor

Extend the approach proposed in #3767 to the full repository. The change set is automatically generated using a script. The script omits skip directives when they would not impact formatting (code already rustfmt-compliant).

I've fixed various problems with the script, and it may be that there are a few edge cases left that should have had a skip directive. There could also be a few redundant ones. I think we can live with that.

Omitted are files that are formatted in in-flight rustfmt PRs: #3783, #3725, #3338 and #3337

@ldk-reviews-bot

ldk-reviews-bot commented May 29, 2025

Copy link
Copy Markdown

👋 Thanks for assigning @TheBlueMatt 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.

@joostjager
joostjagerforce-pushed the rustfmt-skip-all branch 2 times, most recently from a88062e to 16025f2CompareMay 29, 2025 14:26
@joostjager

Copy link
Copy Markdown
ContributorAuthor

As discussed in sync meet, I will try to extend the script to ignore rustfmt changes that only affect the function signature.

@joostjager

Copy link
Copy Markdown
ContributorAuthor

Pushed fix up commit to ignore sig changes. Modest reduction in skips, with a few edge cases.

@codecov

codecovBot commented Jun 2, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 99.01153% with 6 lines in your changes missing coverage. Please review.

Project coverage is 89.91%. Comparing base (e797180) to head (a38db49).

Files with missing linesPatch %Lines
lightning/src/chain/channelmonitor.rs91.17%6 Missing ⚠️
Additional details and impacted files
@@ Coverage Diff @@## main #3809 +/- ##
==========================================
+ Coverage 89.87% 89.91% +0.03% 
==========================================
Files 162 162 Lines 130214 130684 +470 Branches 130214 130684 +470 ==========================================
+ Hits 117034 117508 +474 + Misses 10486 10484 -2 + Partials 2694 2692 -2 

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

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

Why is this in draft? This needs a rebase by now, too.

@@ -1,48 +1,47 @@
#![cfg_attr(rustfmt, rustfmt_skip)]

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.

This was put here deliberately as we opted against running rustfmt on autogenerated files. We need to fix it either way, likely just revert it to include the skip.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Ah, didn't know it was auto-generated. Removed the commit that formats this file.

@joostjager

Copy link
Copy Markdown
ContributorAuthor

It's in draft because I want to see #3767 merged first. Don't want to spend time on rebase if we don't go this way.

@joostjager

Copy link
Copy Markdown
ContributorAuthor

#3767 seems a positive change. New code being added in PRs (for example async payments) is now automatically formatted and not creating more formatting debt. No bad rebase conflicts that I've heard of either.

Enough to go ahead and re-run the script on the latest main.

@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 from what I've seen so far.

Mind including the same changes for the remaining files in chain,ln, and routing, too?

@joostjager

Copy link
Copy Markdown
ContributorAuthor

LGTM from what I've seen so far.

Mind including the same changes for the remaining files in chain,ln, and routing, too?

Intentionally left these out because there are fmt prs in flight for those files. Links in pr desc

@tnull

Copy link
Copy Markdown
Contributor

Intentionally left these out because there are fmt prs in flight for those files. Links in pr desc

Ah, right. The remaining ones in routing never went far, so now closed them for now. Please include routing here.

@joostjager

Copy link
Copy Markdown
ContributorAuthor

Re-added routing files.

@joostjager
joostjager marked this pull request as ready for review June 11, 2025 12:53
@joostjager
joostjager requested a review from tnullJune 11, 2025 15:04
@TheBlueMatt

Copy link
Copy Markdown
Collaborator

I admit I'm kinda meh oh doing this for everything. There's a handful of files left that are pretty small and can be easily formatted (at least once trampoline PRs land for chain and the router module PRs get picked back up), and for tests I understood the plan to be "move forward, get there soon" (I know, I know, I plan on finishing #3783 this week), so applying skips to everything in tests (which generally aren't regularly touched) just to format them soon seems kinda weird?

For large files that we want to format iteratively (channelmanager, channel, maybe some of chain though many of those files aren't that large, just very actively being edited), this approach makes a ton of sense, for every file I'm not sure that we want to always format iteratively?

@joostjager

Copy link
Copy Markdown
ContributorAuthor

I admit I'm kinda meh oh doing this for everything. There's a handful of files left that are pretty small and can be easily formatted (at least once trampoline PRs land for chain and the router module PRs get picked back up), and for tests I understood the plan to be "move forward, get there soon" (I know, I know, I plan on finishing #3783 this week), so applying skips to everything in tests (which generally aren't regularly touched) just to format them soon seems kinda weird?

I see what you mean. Applying skips now and removing them "soon" feels unnecessary. The way I see it though is that "soon" may be quite a bit further out than we'd like. Trampoline for example may take a while. Adding the skips doesn't hurt, they can easily be removed again if someone feels inclined to format a full file, and they add flexibility for devs to selectively format for whatever reason.

For large files that we want to format iteratively (channelmanager, channel, maybe some of chain though many of those files aren't that large, just very actively being edited), this approach makes a ton of sense, for every file I'm not sure that we want to always format iteratively?

I needed to rebase this PR anyway, and while I did I left out the test files. If you feel it is still too much, maybe you can list the exact files that are definitely good for the incremental approach?

@joostjager

joostjager commented Jun 12, 2025

Copy link
Copy Markdown
ContributorAuthor

Also not sure at all that doing the tests all in one with mass edits is ideal: #3783 (review)

@TheBlueMattTheBlueMatt left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think the file list here makes sense. I thought there were substantially more changes to onion_payment.rs for trampoline to come but @valentinewallace tells me they're more in outbound_payment.rs which has more active development and thus higher cost to delaying pushing the format skips down in it.

Comment threadlightning/src/ln/chan_utils.rs Outdated
secrets.push([0; 32]);
secrets.last_mut().unwrap()[0..32].clone_from_slice(&<Vec<u8>>::from_hex("c7518c8ae4660ed02894df8976fa1a3659c1a8b4b5bec0c4b872abeba4cb8964").unwrap());
secrets.last_mut().unwrap()[0..32].clone_from_slice(
&<Vec<u8>>::from_hex(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do you want to go ahead and break the hex constants out to give them names?

@joostjagerjoostjagerJun 12, 2025

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Done. All gave them the same hex name though...

@joostjager
joostjagerforce-pushed the rustfmt-skip-all branch 3 times, most recently from 7d69403 to 516fdb3CompareJune 12, 2025 18:42
Comment threadlightning/src/chain/onchaintx.rs Outdated
Comment threadlightning/src/chain/channelmonitor.rs Outdated
Comment threadlightning/src/chain/channelmonitor.rs Outdated
Comment threadlightning/src/chain/channelmonitor.rs Outdated
Comment threadlightning/src/chain/channelmonitor.rs Outdated
Comment threadlightning/src/ln/channel.rs Outdated
Comment threadlightning/src/ln/channel.rs Outdated
Comment threadlightning/src/ln/channel.rs Outdated
Comment threadlightning/src/ln/outbound_payment.rs Outdated
Comment threadlightning/src/ln/outbound_payment.rs Outdated
@joostjager

Copy link
Copy Markdown
ContributorAuthor

Removed redundant skips. Didn't do the optional improvements (format short fns), because it is probably easiest to keep this big PR "pure" and do the rest in follow ups.

@joostjager

Copy link
Copy Markdown
ContributorAuthor

Didn't squash the redundant skip removal commit, in case I need to re-run the script and re-apply the edge case fixes.

@TheBlueMattTheBlueMatt left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

11 files changed, 1984 insertions(+), 668 deletions(-)

Holy diff-size batman!

@joostjager
joostjager merged commit 3e9e6a3 into lightningdevkit:mainJun 13, 2025
@joostjagerjoostjager mentioned this pull request Jun 18, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

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

Convert file-level rustfmt skip to fn level skips - #3809

Merged
joostjager merged 3 commits into
lightningdevkit:mainfrom
joostjager:rustfmt-skip-all
Jun 13, 2025
Merged

Convert file-level rustfmt skip to fn level skips#3809
joostjager merged 3 commits into
lightningdevkit:mainfrom
joostjager:rustfmt-skip-all

Conversation

@joostjager

@joostjagerjoostjager commented May 29, 2025

Copy link
Copy Markdown
Contributor

Extend the approach proposed in #3767 to the full repository. The change set is automatically generated using a script. The script omits skip directives when they would not impact formatting (code already rustfmt-compliant).

I've fixed various problems with the script, and it may be that there are a few edge cases left that should have had a skip directive. There could also be a few redundant ones. I think we can live with that.

Omitted are files that are formatted in in-flight rustfmt PRs: #3783, #3725, #3338 and #3337

@ldk-reviews-bot

ldk-reviews-bot commented May 29, 2025

Copy link
Copy Markdown

👋 Thanks for assigning @TheBlueMatt 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.

@joostjager
joostjagerforce-pushed the rustfmt-skip-all branch 2 times, most recently from a88062e to 16025f2CompareMay 29, 2025 14:26
@joostjager

Copy link
Copy Markdown
ContributorAuthor

As discussed in sync meet, I will try to extend the script to ignore rustfmt changes that only affect the function signature.

@joostjager

Copy link
Copy Markdown
ContributorAuthor

Pushed fix up commit to ignore sig changes. Modest reduction in skips, with a few edge cases.

@codecov

codecovBot commented Jun 2, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 99.01153% with 6 lines in your changes missing coverage. Please review.

Project coverage is 89.91%. Comparing base (e797180) to head (a38db49).

Files with missing linesPatch %Lines
lightning/src/chain/channelmonitor.rs91.17%6 Missing ⚠️
Additional details and impacted files
@@ Coverage Diff @@## main #3809 +/- ##
==========================================
+ Coverage 89.87% 89.91% +0.03% 
==========================================
Files 162 162 Lines 130214 130684 +470 Branches 130214 130684 +470 ==========================================
+ Hits 117034 117508 +474 + Misses 10486 10484 -2 + Partials 2694 2692 -2 

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

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

Why is this in draft? This needs a rebase by now, too.

@@ -1,48 +1,47 @@
#![cfg_attr(rustfmt, rustfmt_skip)]

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.

This was put here deliberately as we opted against running rustfmt on autogenerated files. We need to fix it either way, likely just revert it to include the skip.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Ah, didn't know it was auto-generated. Removed the commit that formats this file.

@joostjager

Copy link
Copy Markdown
ContributorAuthor

It's in draft because I want to see #3767 merged first. Don't want to spend time on rebase if we don't go this way.

@joostjager

Copy link
Copy Markdown
ContributorAuthor

#3767 seems a positive change. New code being added in PRs (for example async payments) is now automatically formatted and not creating more formatting debt. No bad rebase conflicts that I've heard of either.

Enough to go ahead and re-run the script on the latest main.

@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 from what I've seen so far.

Mind including the same changes for the remaining files in chain,ln, and routing, too?

@joostjager

Copy link
Copy Markdown
ContributorAuthor

LGTM from what I've seen so far.

Mind including the same changes for the remaining files in chain,ln, and routing, too?

Intentionally left these out because there are fmt prs in flight for those files. Links in pr desc

@tnull

Copy link
Copy Markdown
Contributor

Intentionally left these out because there are fmt prs in flight for those files. Links in pr desc

Ah, right. The remaining ones in routing never went far, so now closed them for now. Please include routing here.

@joostjager

Copy link
Copy Markdown
ContributorAuthor

Re-added routing files.

@joostjager
joostjager marked this pull request as ready for review June 11, 2025 12:53
@joostjager
joostjager requested a review from tnullJune 11, 2025 15:04
@TheBlueMatt

Copy link
Copy Markdown
Collaborator

I admit I'm kinda meh oh doing this for everything. There's a handful of files left that are pretty small and can be easily formatted (at least once trampoline PRs land for chain and the router module PRs get picked back up), and for tests I understood the plan to be "move forward, get there soon" (I know, I know, I plan on finishing #3783 this week), so applying skips to everything in tests (which generally aren't regularly touched) just to format them soon seems kinda weird?

For large files that we want to format iteratively (channelmanager, channel, maybe some of chain though many of those files aren't that large, just very actively being edited), this approach makes a ton of sense, for every file I'm not sure that we want to always format iteratively?

@joostjager

Copy link
Copy Markdown
ContributorAuthor

I admit I'm kinda meh oh doing this for everything. There's a handful of files left that are pretty small and can be easily formatted (at least once trampoline PRs land for chain and the router module PRs get picked back up), and for tests I understood the plan to be "move forward, get there soon" (I know, I know, I plan on finishing #3783 this week), so applying skips to everything in tests (which generally aren't regularly touched) just to format them soon seems kinda weird?

I see what you mean. Applying skips now and removing them "soon" feels unnecessary. The way I see it though is that "soon" may be quite a bit further out than we'd like. Trampoline for example may take a while. Adding the skips doesn't hurt, they can easily be removed again if someone feels inclined to format a full file, and they add flexibility for devs to selectively format for whatever reason.

For large files that we want to format iteratively (channelmanager, channel, maybe some of chain though many of those files aren't that large, just very actively being edited), this approach makes a ton of sense, for every file I'm not sure that we want to always format iteratively?

I needed to rebase this PR anyway, and while I did I left out the test files. If you feel it is still too much, maybe you can list the exact files that are definitely good for the incremental approach?

@joostjager

joostjager commented Jun 12, 2025

Copy link
Copy Markdown
ContributorAuthor

Also not sure at all that doing the tests all in one with mass edits is ideal: #3783 (review)

@TheBlueMattTheBlueMatt left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think the file list here makes sense. I thought there were substantially more changes to onion_payment.rs for trampoline to come but @valentinewallace tells me they're more in outbound_payment.rs which has more active development and thus higher cost to delaying pushing the format skips down in it.

Comment threadlightning/src/ln/chan_utils.rs Outdated
secrets.push([0; 32]);
secrets.last_mut().unwrap()[0..32].clone_from_slice(&<Vec<u8>>::from_hex("c7518c8ae4660ed02894df8976fa1a3659c1a8b4b5bec0c4b872abeba4cb8964").unwrap());
secrets.last_mut().unwrap()[0..32].clone_from_slice(
&<Vec<u8>>::from_hex(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do you want to go ahead and break the hex constants out to give them names?

@joostjagerjoostjagerJun 12, 2025

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Done. All gave them the same hex name though...

@joostjager
joostjagerforce-pushed the rustfmt-skip-all branch 3 times, most recently from 7d69403 to 516fdb3CompareJune 12, 2025 18:42
Comment threadlightning/src/chain/onchaintx.rs Outdated
Comment threadlightning/src/chain/channelmonitor.rs Outdated
Comment threadlightning/src/chain/channelmonitor.rs Outdated
Comment threadlightning/src/chain/channelmonitor.rs Outdated
Comment threadlightning/src/chain/channelmonitor.rs Outdated
Comment threadlightning/src/ln/channel.rs Outdated
Comment threadlightning/src/ln/channel.rs Outdated
Comment threadlightning/src/ln/channel.rs Outdated
Comment threadlightning/src/ln/outbound_payment.rs Outdated
Comment threadlightning/src/ln/outbound_payment.rs Outdated
@joostjager

Copy link
Copy Markdown
ContributorAuthor

Removed redundant skips. Didn't do the optional improvements (format short fns), because it is probably easiest to keep this big PR "pure" and do the rest in follow ups.

@joostjager

Copy link
Copy Markdown
ContributorAuthor

Didn't squash the redundant skip removal commit, in case I need to re-run the script and re-apply the edge case fixes.

@TheBlueMattTheBlueMatt left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

11 files changed, 1984 insertions(+), 668 deletions(-)

Holy diff-size batman!

@joostjager
joostjager merged commit 3e9e6a3 into lightningdevkit:mainJun 13, 2025
@joostjagerjoostjager mentioned this pull request Jun 18, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@joostjager@ldk-reviews-bot@tnull@TheBlueMatt@valentinewallace
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); Convert file-level rustfmt skip to fn level skips by joostjager · Pull Request #3809 · lightningdevkit/rust-lightning · GitHub
Skip to content

Convert file-level rustfmt skip to fn level skips - #3809

Merged
joostjager merged 3 commits into
lightningdevkit:mainfrom
joostjager:rustfmt-skip-all
Jun 13, 2025
Merged

Convert file-level rustfmt skip to fn level skips#3809
joostjager merged 3 commits into
lightningdevkit:mainfrom
joostjager:rustfmt-skip-all

Conversation

@joostjager

@joostjagerjoostjager commented May 29, 2025

Copy link
Copy Markdown
Contributor

Extend the approach proposed in #3767 to the full repository. The change set is automatically generated using a script. The script omits skip directives when they would not impact formatting (code already rustfmt-compliant).

I've fixed various problems with the script, and it may be that there are a few edge cases left that should have had a skip directive. There could also be a few redundant ones. I think we can live with that.

Omitted are files that are formatted in in-flight rustfmt PRs: #3783, #3725, #3338 and #3337

@ldk-reviews-bot

ldk-reviews-bot commented May 29, 2025

Copy link
Copy Markdown

👋 Thanks for assigning @TheBlueMatt 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.

@joostjager
joostjagerforce-pushed the rustfmt-skip-all branch 2 times, most recently from a88062e to 16025f2CompareMay 29, 2025 14:26
@joostjager

Copy link
Copy Markdown
ContributorAuthor

As discussed in sync meet, I will try to extend the script to ignore rustfmt changes that only affect the function signature.

@joostjager

Copy link
Copy Markdown
ContributorAuthor

Pushed fix up commit to ignore sig changes. Modest reduction in skips, with a few edge cases.

@codecov

codecovBot commented Jun 2, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 99.01153% with 6 lines in your changes missing coverage. Please review.

Project coverage is 89.91%. Comparing base (e797180) to head (a38db49).

Files with missing linesPatch %Lines
lightning/src/chain/channelmonitor.rs91.17%6 Missing ⚠️
Additional details and impacted files
@@ Coverage Diff @@## main #3809 +/- ##
==========================================
+ Coverage 89.87% 89.91% +0.03% 
==========================================
Files 162 162 Lines 130214 130684 +470 Branches 130214 130684 +470 ==========================================
+ Hits 117034 117508 +474 + Misses 10486 10484 -2 + Partials 2694 2692 -2 

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

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

Why is this in draft? This needs a rebase by now, too.

@@ -1,48 +1,47 @@
#![cfg_attr(rustfmt, rustfmt_skip)]

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.

This was put here deliberately as we opted against running rustfmt on autogenerated files. We need to fix it either way, likely just revert it to include the skip.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Ah, didn't know it was auto-generated. Removed the commit that formats this file.

@joostjager

Copy link
Copy Markdown
ContributorAuthor

It's in draft because I want to see #3767 merged first. Don't want to spend time on rebase if we don't go this way.

@joostjager

Copy link
Copy Markdown
ContributorAuthor

#3767 seems a positive change. New code being added in PRs (for example async payments) is now automatically formatted and not creating more formatting debt. No bad rebase conflicts that I've heard of either.

Enough to go ahead and re-run the script on the latest main.

@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 from what I've seen so far.

Mind including the same changes for the remaining files in chain,ln, and routing, too?

@joostjager

Copy link
Copy Markdown
ContributorAuthor

LGTM from what I've seen so far.

Mind including the same changes for the remaining files in chain,ln, and routing, too?

Intentionally left these out because there are fmt prs in flight for those files. Links in pr desc

@tnull

Copy link
Copy Markdown
Contributor

Intentionally left these out because there are fmt prs in flight for those files. Links in pr desc

Ah, right. The remaining ones in routing never went far, so now closed them for now. Please include routing here.

@joostjager

Copy link
Copy Markdown
ContributorAuthor

Re-added routing files.

@joostjager
joostjager marked this pull request as ready for review June 11, 2025 12:53
@joostjager
joostjager requested a review from tnullJune 11, 2025 15:04
@TheBlueMatt

Copy link
Copy Markdown
Collaborator

I admit I'm kinda meh oh doing this for everything. There's a handful of files left that are pretty small and can be easily formatted (at least once trampoline PRs land for chain and the router module PRs get picked back up), and for tests I understood the plan to be "move forward, get there soon" (I know, I know, I plan on finishing #3783 this week), so applying skips to everything in tests (which generally aren't regularly touched) just to format them soon seems kinda weird?

For large files that we want to format iteratively (channelmanager, channel, maybe some of chain though many of those files aren't that large, just very actively being edited), this approach makes a ton of sense, for every file I'm not sure that we want to always format iteratively?

@joostjager

Copy link
Copy Markdown
ContributorAuthor

I admit I'm kinda meh oh doing this for everything. There's a handful of files left that are pretty small and can be easily formatted (at least once trampoline PRs land for chain and the router module PRs get picked back up), and for tests I understood the plan to be "move forward, get there soon" (I know, I know, I plan on finishing #3783 this week), so applying skips to everything in tests (which generally aren't regularly touched) just to format them soon seems kinda weird?

I see what you mean. Applying skips now and removing them "soon" feels unnecessary. The way I see it though is that "soon" may be quite a bit further out than we'd like. Trampoline for example may take a while. Adding the skips doesn't hurt, they can easily be removed again if someone feels inclined to format a full file, and they add flexibility for devs to selectively format for whatever reason.

For large files that we want to format iteratively (channelmanager, channel, maybe some of chain though many of those files aren't that large, just very actively being edited), this approach makes a ton of sense, for every file I'm not sure that we want to always format iteratively?

I needed to rebase this PR anyway, and while I did I left out the test files. If you feel it is still too much, maybe you can list the exact files that are definitely good for the incremental approach?

@joostjager

joostjager commented Jun 12, 2025

Copy link
Copy Markdown
ContributorAuthor

Also not sure at all that doing the tests all in one with mass edits is ideal: #3783 (review)

@TheBlueMattTheBlueMatt left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think the file list here makes sense. I thought there were substantially more changes to onion_payment.rs for trampoline to come but @valentinewallace tells me they're more in outbound_payment.rs which has more active development and thus higher cost to delaying pushing the format skips down in it.

Comment threadlightning/src/ln/chan_utils.rs Outdated
secrets.push([0; 32]);
secrets.last_mut().unwrap()[0..32].clone_from_slice(&<Vec<u8>>::from_hex("c7518c8ae4660ed02894df8976fa1a3659c1a8b4b5bec0c4b872abeba4cb8964").unwrap());
secrets.last_mut().unwrap()[0..32].clone_from_slice(
&<Vec<u8>>::from_hex(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do you want to go ahead and break the hex constants out to give them names?

@joostjagerjoostjagerJun 12, 2025

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Done. All gave them the same hex name though...

@joostjager
joostjagerforce-pushed the rustfmt-skip-all branch 3 times, most recently from 7d69403 to 516fdb3CompareJune 12, 2025 18:42
Comment threadlightning/src/chain/onchaintx.rs Outdated
Comment threadlightning/src/chain/channelmonitor.rs Outdated
Comment threadlightning/src/chain/channelmonitor.rs Outdated
Comment threadlightning/src/chain/channelmonitor.rs Outdated
Comment threadlightning/src/chain/channelmonitor.rs Outdated
Comment threadlightning/src/ln/channel.rs Outdated
Comment threadlightning/src/ln/channel.rs Outdated
Comment threadlightning/src/ln/channel.rs Outdated
Comment threadlightning/src/ln/outbound_payment.rs Outdated
Comment threadlightning/src/ln/outbound_payment.rs Outdated
@joostjager

Copy link
Copy Markdown
ContributorAuthor

Removed redundant skips. Didn't do the optional improvements (format short fns), because it is probably easiest to keep this big PR "pure" and do the rest in follow ups.

@joostjager

Copy link
Copy Markdown
ContributorAuthor

Didn't squash the redundant skip removal commit, in case I need to re-run the script and re-apply the edge case fixes.

@TheBlueMattTheBlueMatt left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

11 files changed, 1984 insertions(+), 668 deletions(-)

Holy diff-size batman!

@joostjager
joostjager merged commit 3e9e6a3 into lightningdevkit:mainJun 13, 2025
@joostjagerjoostjager mentioned this pull request Jun 18, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

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