rust-lightning icon indicating copy to clipboard operation
rust-lightning copied to clipboard

`rustfmt`: Run on `util/*` (2/2)

Open tnull opened this issue 1 year ago • 5 comments

This is PR 2/2, based on #3324.

The diff is a bit larger for this one, but AFAICT the changes look mostly reasonable (besides the oddity commented below).

FWIW, I had a look at currently open inflight PRs and the conflicts should be minimal if I'm not overlooking something.

tnull avatar Sep 18 '24 07:09 tnull

Codecov Report

Attention: Patch coverage is 82.03883% with 185 lines in your changes missing coverage. Please review.

Project coverage is 88.28%. Comparing base (42cc4e7) to head (7153e35).

Files with missing lines Patch % Lines
lightning/src/util/test_channel_signer.rs 50.64% 8 Missing and 69 partials :warning:
lightning/src/util/test_utils.rs 84.47% 66 Missing and 2 partials :warning:
lightning/src/util/ser.rs 74.24% 17 Missing :warning:
lightning/src/util/ser_macros.rs 90.19% 9 Missing and 1 partial :warning:
lightning/src/util/wakers.rs 93.00% 5 Missing and 2 partials :warning:
lightning/src/util/transaction_utils.rs 94.17% 3 Missing and 3 partials :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3323      +/-   ##
==========================================
- Coverage   88.31%   88.28%   -0.04%     
==========================================
  Files         149      149              
  Lines      112839   113376     +537     
  Branches   112839   113376     +537     
==========================================
+ Hits        99655   100089     +434     
- Misses      10700    10765      +65     
- Partials     2484     2522      +38     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Sep 18 '24 07:09 codecov[bot]

Ugh, can we split this? 42 commits in one PR is just a lot...

TheBlueMatt avatar Sep 18 '24 13:09 TheBlueMatt

Ugh, can we split this? 42 commits in one PR is just a lot...

Alright, happy to if you prefer (although at least half of these commits are one-line diffs). Now split out ~the first half of commits to #3324.

tnull avatar Sep 18 '24 13:09 tnull

Rebased after https://github.com/lightningdevkit/rust-lightning/pull/3327 landed.

tnull avatar Sep 19 '24 08:09 tnull

Rebased after #3324 landed.

tnull avatar Oct 01 '24 16:10 tnull

Rebased to resolve minor conflicts.

tnull avatar Oct 07 '24 08:10 tnull

Rebased once more to resolve minor conflicts.

Any additional comments here after we landed the split-out commits in #3324, @TheBlueMatt ?

tnull avatar Nov 05 '24 09:11 tnull

Rebased once more to resolve minor conflicts.

tnull avatar Nov 18 '24 17:11 tnull

Addressed all but one comment.

tnull avatar Dec 03 '24 12:12 tnull

Rebased once more to resolve minor conflict.

@TheBlueMatt any further comments here?

tnull avatar Dec 18 '24 08:12 tnull

Fixed the missing unwrap and rebased on main as this PR is ancient and I wanted to ensure there were no silent conflicts in the meantime:

> git range-diff 7153e3560...9b420e325 -- lightning/src/util

-:  --------- >  1:  0282b0d96 Drop spurious debug assertion in sweeping logic
 1:  4c70b5676 =  2:  2ca9a955e `rustfmt`: Run on `util/scid_utils.rs`
 2:  09d365b41 =  3:  be298f6df `rustfmt`: Run on `util/ser.rs`
 3:  a29868db1 =  4:  229a712d5 `rustfmt`: Prepare `util/ser_macros.rs`
 4:  60bf9eeaa =  5:  94c0e6aa5 `rustfmt`: Run on `util/ser_macros.rs`
 5:  d372bfdb5 !  6:  defe40494 `rustfmt`: Prepare `util/test_channel_signer.rs`
    @@ lightning/src/util/test_channel_signer.rs: impl EcdsaChannelSigner for TestChann
                        ).unwrap();
                }
     -          Ok(EcdsaChannelSigner::sign_holder_htlc_transaction(&self.inner, htlc_tx, input, htlc_descriptor, secp_ctx).unwrap())
    -+          self.inner.sign_holder_htlc_transaction(htlc_tx, input, htlc_descriptor, secp_ctx)
    ++          Ok(self.inner.sign_holder_htlc_transaction(htlc_tx, input, htlc_descriptor, secp_ctx).unwrap())
        }

        fn sign_counterparty_htlc_transaction(&self, htlc_tx: &Transaction, input: usize, amount: u64, per_commitment_point: &PublicKey, htlc: &HTLCOutputInCommitment, secp_ctx: &Secp256k1<secp256k1::All>) -> Result<Signature, ()> {
 6:  9142bf5f3 !  7:  251f22687 `rustfmt`: Run on `util/test_channel_signer.rs`
    @@ lightning/src/util/test_channel_signer.rs: impl EcdsaChannelSigner for TestChann
     +                          )
     +                          .unwrap();
                }
    -           self.inner.sign_holder_htlc_transaction(htlc_tx, input, htlc_descriptor, secp_ctx)
    +-          Ok(self.inner.sign_holder_htlc_transaction(htlc_tx, input, htlc_descriptor, secp_ctx).unwrap())
    ++          Ok(self
    ++                  .inner
    ++                  .sign_holder_htlc_transaction(htlc_tx, input, htlc_descriptor, secp_ctx)
    ++                  .unwrap())
        }

     -  fn sign_counterparty_htlc_transaction(&self, htlc_tx: &Transaction, input: usize, amount: u64, per_commitment_point: &PublicKey, htlc: &HTLCOutputInCommitment, secp_ctx: &Secp256k1<secp256k1::All>) -> Result<Signature, ()> {
 7:  58b455719 =  8:  95961f81d `rustfmt`: Prepare `util/test_utils.rs`
 8:  cc42fd606 =  9:  87f5694de `rustfmt`: Run on `util/test_utils.rs`
 9:  cd379a425 = 10:  709d89f3f `rustfmt`: Run on `util/time.rs`
10:  0a752b972 = 11:  0c230e1a9 `rustfmt`: Prepare `util/transaction_utils.rs`
11:  664ec5f66 = 12:  b7b882cc5 `rustfmt`: Run on `util/transaction_utils.rs`
12:  e14fafd41 = 13:  bbe6613bb `rustfmt`: Run on `util/wakers.rs`
13:  86a84adf6 = 14:  028fed479 `rustfmt`: Run on `util/mod.rs`

tnull avatar Jan 17 '25 09:01 tnull